Adding Frequencies Panel

I got a little lost on the documentation.

I really like the “frequencies” panel in the nextstrain builds, but I am not sure how to add it into my local build. I have a local build has sequences that are not in GISAID and are not even always SARS-CoV-2.

Just changing the auspice config file to include

"
“panels”: [
“tree”,
“map”,
“entropy”,
“frequencies”
],
"

didn’t magically make it appear, so there’s a rule that I’m missing somewhere.

What rule adds the information needed for the “frequencies” panel to appear?

If it helps, I used the zika tutorial snakefile as a template for my local builds.

Hey Erin – there are two things needed for this to work:

  1. add “frequencies” to the panels in the JSON. It looks like you’ve done this correctly.

  2. Make sure a “tip-frequencies” JSON is available for auspice to fetch. The filename here should be the same as the main dataset JSON, but with _tip-frequencies added. For instance, these are the files behind nextstrain.org/flu/seasonal/yam/na/2y: https://data.nextstrain.org/flu_seasonal_yam_na_2y.json and http://data.nextstrain.org/flu_seasonal_yam_na_2y_tip-frequencies.json.

The creation of the tip-frequencies JSON is typically via augur frequencies (docs here). For an example, here’s the snakemake rule we use to create this for our SARS-CoV-2 builds.

1 Like

Thank you for your answer!

I’ve run into a problem with augur frequencies that I am hoping you can help me get around:

If I add the following to a rule :

augur frequencies \
            --method kde \
            --metadata {input.metadata} \
            --tree {input.tree} \
            --output {output.frequencies}

I get a key error :

Traceback (most recent call last):
  File "/usr/bin/augur", line 11, in <module>
    load_entry_point('nextstrain-augur', 'console_scripts', 'augur')()
  File "/nextstrain/augur/augur/__main__.py", line 10, in main
    return augur.run( argv[1:] )
  File "/nextstrain/augur/augur/__init__.py", line 74, in run
    return args.__command__.run(args)
  File "/nextstrain/augur/augur/frequencies.py", line 97, in run
    tip.attr = {"num_date": np.mean(dates[tip.name])}
KeyError: 'MN908947.3'

I think this is due to the ‘.’ in MN908947.3. How do I get around this?

Hey Erin – looking at that error I suspect that either MN908947.3 (Wuhan/Hu-1/2019, often included to root the tree) is not in the metadata file you provided to augur frequencies or that it’s in the metadata but missing a date.

I forgot to respond.

Yes, I needed to put my reference in my metadata table.

Also, I realized that the frequencies file is a separate file. My frequencies panel is working fine, now.

1 Like