How to combine multiple .json files in a single auspice view?

Hi,
I am trying to make a combined Nextstrain instance of flu A (H1 and H3) and B (Vic and Yam). And I have four individual .json files and every time I have to view them separately. How do I combine these .json and view it via auspice at once? Any help regarding this is greatly appreciated!

Our augur tooling doesn’t yet support this, but if you are comfortable writing small scripts this is entirely possible!

Each of your 4 JSONs will have a tree defined like so:

"tree": {"name": "...":, "children": [...]}

Auspice can accept an array of trees such as:

"tree": [
   {"name": "H1_root_name":, "children": [...]},
   {"name": "H3_root_name":, "children": [...]},
   {"name": "vic_root_name":, "children": [...]},
   {"name": "yam_root_name":, "children": [...]}
]

There are a few things to consider:

  • The metadata (the “meta” key in the JSON) from the four datasets will have to be combined into a single unified metadata section
  • The co-ordinate system for genotypes won’t be right as this assumes all trees use the same alignment/coordinate system. There’s no way around this at the moment. Mutations on individual branches will still be correct relative to their reference, but if (e.g.) you colour by “nuc 352” then all four trees will show their diversity at that nuc position, but those positions will probably not be in alignment across the 4 datasets.

If you want to pursue this I’m happy to help debug issues you run into

Thank you for your prompt response, James! I will try to work it out.

Hi @james,

Thank you for your suggestions on the question I posted earlier. I encountered some technical issues on my side and I have to redo everything. However, before I could follow your advice in writing a script, I realized I could view it all at once by putting all .json file in auspice/ folder (see below the dropdown of ‘Dataset’). I was wondering why is it so? is this due to some recent updates? Thank you!

Hi @james,

Sorry for more questions. Another issue that I had is all the available datasets shown here can be viewed, except for h3n2. I tried to troubleshoot like rerun everything, but no luck, I still got the error. I am clueless where the error could come from.

Thank you in advance for your help. Much appreciated!!

-Swan

Oh - I misunderstood your original question. Yes – any datasets (JSONs) in the provided --datasetsDir will be available via the Auspice starting page, and the dropdowns will show all the datasets at the same “level” (if you don’t have any _ characters in your filenames then every dataset will be the same (top) level). This outcome is much simpler than trying to visualize them all simultaneously.

Another issue that I had is all the available datasets shown here can be viewed, except for h3n2.

Could you open the browser console (how to do this varies for each browser, so googling is the best way) and see if there are any errors printed? Alternately if the data is not sensitive you could attach it here and I can take a look.

Hi @james , thank you so much for your prompt response! I really appreciate!

Here are the error messages from the console:

The sequence data that I used are publicly available from FluDB and GISAID. Do you want the sequence data attached here or the JSON file?

Also, is h3n2_root-sequence.json necessary for auspice view?

Thank you!!

Just the JSON file please! In your original screenshot this file would be “h3n2.json” but in a subsequent screenshot you’ve changed your filenames to things like “a_h3n2.json”.

is h3n2_root-sequence.json necessary for auspice view?

No, it’s optional. This file is used to be able to show genotypes for positions without any variation.

Got it. Attached herein is the compressed JSON file. I am still struggling to identify which step could potentially caused the errors. I am grateful for your help on this.

a_h3n2.json.zip (6.8 MB)

That file (once unzipped) renders fine for me when viewing in Auspice 2.51.0 or when dragging-and-dropping onto https://auspice.us/: