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

feat: make clade_membership node attribute optional #1457

Merged
merged 2 commits into from
May 24, 2024

Conversation

ivan-aksamentov
Copy link
Member

@ivan-aksamentov ivan-aksamentov commented May 23, 2024

Not all Auspice trees have clade_membership attribute on the nodes. Here I make this attribute optional in Nextclade.

With this change, if clade_membership is not present:

  • output JSON/NDJSON result entries will not contain clade field

  • clade column in output CSV/TSV will be empty

  • clade column in Nextclade Web will be empty

It does not affect any other parts of the application. Notably, clade-like attributes (from .meta.extensions.nextclade.clade_node_attrs are still assigned and being written to the output).

Tested on sars-cov-2 dataset with clade_membership node attribute removed using jq:

jq 'walk(if (type == "object" and .clade_membership) then del(.clade_membership) else . end )' tree.original.json > tree.json

(in real trees you might also need to change metadata, such as colorings)

Further work:

  • We might remove empty clade column from CSV/TSV and from Web. Though it might be a bit involved - the results are streamed one at a time and we don't know whether there will be any clades or not until very end. But at that point it is too late - everything has been already written. And a disappearance of a column is a potential for breakage in users' code.

Not all trees have `clade_membership` attribute on the nodes. Here I made this attribute optional in Nextclade.

If `clade_membership` is not present:

 - output JSON/NDJSON result entries will not contain `clade` field

 - `clade` column in output CSV/TSV will be empty

 - `clade` column in Nextclade Web will be empty


it does not affect any other parts of the application. Notably clade-like attributes (from `.meta.extensions.nextclade.clade_node_attrs` are still assigned and being written to the output).

Tested on `sars-cov-2` dataset and `clade_membership` node attribute removed using `jq`:

```bash
jq 'walk(if (type == "object" and .clade_membership) then del(.clade_membership) else . end )' tree.original.json > tree.json
```

(in real trees you might also need to change metadata, such as colorings)


### Further work:

 - We might remove empty `clade` column from CSV/TSV and from Web. Thought it might be a bit involved - the results are streamed one at a time and we don't know whether there will be any clades or not until very end. But at that point it is too late - everything has been already written.
Copy link

vercel bot commented May 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nextclade ✅ Ready (Inspect) Visit Preview May 24, 2024 6:29am

@ivan-aksamentov ivan-aksamentov merged commit 7963ac4 into master May 24, 2024
20 checks passed
@ivan-aksamentov ivan-aksamentov deleted the feat/clade-optional branch May 24, 2024 06:30
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 this pull request may close these issues.

1 participant