Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"set_metadata" parameter #302

Open
hyanwong opened this issue Jul 22, 2023 · 1 comment · May be fixed by #449
Open

"set_metadata" parameter #302

hyanwong opened this issue Jul 22, 2023 · 1 comment · May be fixed by #449

Comments

@hyanwong
Copy link
Member

hyanwong commented Jul 22, 2023

Linked to #203 and #237 (comment). At the moment, tsdate, as well as changing node times, also changes node metadata to add (unconstrained) means and variances. It would be useful to have the ability to (a) not add to metadata and (b) specify whether or not node metadata should be stomped on, if it exists.

Since this is the only metdata that tsdate touches, I suggest that as a first step, we could have a parameter set_metadata, save_metadata, store_metadata or even force_metadata with the following values:

  • False: do not touch any metadata columns in any tables
  • True: always add metadata to the node column, changing the schema and overwriting any existing node metadata
  • None (default): try to append the existing node metadata, overwriting the tsdate-specific fields if they exist. A minor wrinkle is if there is binary node metadata (i.e. without a schema) and the metadata column is not empty (see Set node metadata schema #203 (comment)). In this case we won't know how to adjust the node metadata properly, so we should either raise an error or emit a warning. I suggest we should raise a warning, but it would be a pain to have run tsdate all the way through only to raise an error at the end, so we could check before running the main tsdate routine, and raise the error early?
@hyanwong hyanwong changed the title "omit_metadata" parameter "save_metadata" parameter Jul 22, 2023
@hyanwong hyanwong changed the title "save_metadata" parameter "set_metadata" parameter Jul 22, 2023
hyanwong added a commit to hyanwong/tsdate that referenced this issue Jul 23, 2023
Defaults to a "struct" type unless a schema already exists (or if there is a null schema that can be interpreted as JSON). Fixes tskit-dev#302
hyanwong added a commit to hyanwong/tsdate that referenced this issue Jul 23, 2023
Defaults to a "struct" type unless a schema already exists (or if there is a null schema that can be interpreted as JSON). Fixes tskit-dev#302
@hyanwong
Copy link
Member Author

For backwards compatibility #303 is slightly more sophisticated and if the null schema is set, tries to interpret it as JSON (and if it succeeds, sets the schema to a permissive JSON type).

hyanwong added a commit to hyanwong/tsdate that referenced this issue Jul 24, 2023
Defaults to a "struct" type unless a schema already exists (or if there is a null schema that can be interpreted as JSON). Fixes tskit-dev#302
hyanwong added a commit to hyanwong/tsdate that referenced this issue Jul 24, 2023
Defaults to a "struct" type unless a schema already exists (or if there is a null schema that can be interpreted as JSON). Fixes tskit-dev#302
hyanwong added a commit to hyanwong/tsdate that referenced this issue Jul 24, 2023
Defaults to a "struct" type unless a schema already exists (or if there is a null schema that can be interpreted as JSON). Fixes tskit-dev#302
@hyanwong hyanwong linked a pull request Dec 14, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant