nextstrain / nextclade

Viral genome alignment, mutation calling, clade assignment, quality checks and phylogenetic placement
https://clades.nextstrain.org
MIT License
214 stars 58 forks source link

nextclade run with optional dataset tag input #1521

Open jrotieno opened 1 week ago

jrotieno commented 1 week ago

The nextclade run --dataset-name xx is great and uses by default the latest dataset tag. However, as mentioned in the documentation, "If a new version of the dataset is released between two runs, they will use different versions of the dataset and may produce different results."

It would be nice to have an optional --dataset-tag input where one can specify the specific tag for a dataset name when they don't want to use the default latest.

ivan-aksamentov commented 1 week ago

Hi @jrotieno,

Makes sense! I cannot give any promises that this will be implemented though, due to lack of time. (Contributions are always welcome!)

For the time being, if you need to use the same version repeatedly - you could use the 2-stage flow with nextclade dataset get followed by one or more nextclade run with --input-dataset.

jrotieno commented 1 week ago

Many thanks @ivan-aksamentov for the swift response!

We have been using the 2-stage flow. However, I wanted to also have the option of running nextclade sort that would predict the dataset name, and do nextclade run with the predicted dataset name and an optional dataset tag.

But thinking about it again, it may not be the most sensible to predict a name and use a fixed tag as the tags are not universal across all datasets.

Nonetheless, will be nice to see the run and tag option in the future!

jrotieno commented 1 week ago

While here, is there a way to output the dataset tag used from a nextclade run command with an input dataset name?

ivan-aksamentov commented 1 week ago

Hmm... I don't think so. Not currently.

The name you already know when downloading or running - you'd have to write it down somewhere, e.g. in a txt or json file.

If you've downloaded the dataset, then the tag you can find in the dataset directory in pathogen.json file at the property .version.tag (example). Or if you downloaded a particuar tag, you can also write it down.

There were previously feature requests to add dataset name, tag and other things (like time of the run) to the outputs, however it's bit tricky, because you can also run nextclade without any dataset or with a third-party dataset, and in this case there might be no name or tag at all. Names and tags are really only ensured for our official datasets and our official dataset server where we enforce this particular versioning scheme.

I agree that it might be useful, and we need to contemplate about these things a little more sometimes.

jrotieno commented 1 week ago

For anyone following, my tentative solution is nextclade dataset list --name $dataset_name --json for the predicted dataset name, then parsing the output for the default version under the "version" block. Note however, the manual says

--json Print output in JSON format.

      This is useful for automated processing. However, at this time, we cannot guarantee stability of the format. Use at own risk.