# Adding Frequencies Panel

**URL:** <https://nextstrain.discourse.group/t/adding-frequencies-panel/222>\
**Category:** Help and Getting Started\
**Created:** [December 9, 2020, 11:03pm UTC](https://nextstrain.discourse.group/t/adding-frequencies-panel/222 "2020-12-09T23:03:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ErinYoung](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@ErinYoung](https://nextstrain.discourse.group/u/ErinYoung)\
**Post date:** [December 9, 2020, 11:03pm UTC](https://nextstrain.discourse.group/t/adding-frequencies-panel/222/1 "2020-12-09T23:03:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![james](https://yyz1.discourse-cdn.com/flex031/user_avatar/nextstrain.discourse.group/james/32/11_2.png) [@james](https://nextstrain.discourse.group/u/james)\
**Post date:** [December 10, 2020, 2:23am UTC](https://nextstrain.discourse.group/t/adding-frequencies-panel/222/2 "2020-12-10T02:23:39Z")

</div>

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:](http://nextstrain.org/flu/seasonal/yam/na/2y:) [https://data.nextstrain.org/flu\_seasonal\_yam\_na\_2y.json](https://data.nextstrain.org/flu_seasonal_yam_na_2y.json) and [http://data.nextstrain.org/flu\_seasonal\_yam\_na\_2y\_tip-frequencies.json](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](https://docs.nextstrain.org/projects/augur/en/stable/usage/cli/frequencies.html)). For an example, [here’s](https://github.com/nextstrain/ncov/blob/master/workflow/snakemake_rules/main_workflow.smk#L826-L852) the snakemake rule we use to create this for our SARS-CoV-2 builds.

---

<div class="post-metadata">

**Author:** ![ErinYoung](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@ErinYoung](https://nextstrain.discourse.group/u/ErinYoung)\
**Post date:** [February 23, 2021, 11:51pm UTC](https://nextstrain.discourse.group/t/adding-frequencies-panel/222/3 "2021-02-23T23:51:08Z")

</div>

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 :

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

```

I get a key error :

```auto
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?

---

<div class="post-metadata">

**Author:** ![james](https://yyz1.discourse-cdn.com/flex031/user_avatar/nextstrain.discourse.group/james/32/11_2.png) [@james](https://nextstrain.discourse.group/u/james)\
**Post date:** [February 25, 2021, 3:06am UTC](https://nextstrain.discourse.group/t/adding-frequencies-panel/222/4 "2021-02-25T03:06:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ErinYoung](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@ErinYoung](https://nextstrain.discourse.group/u/ErinYoung)\
**Post date:** [July 8, 2021, 4:39pm UTC](https://nextstrain.discourse.group/t/adding-frequencies-panel/222/5 "2021-07-08T16:39:12Z")

</div>

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.
