# Error msg when running a small dataset

**URL:** <https://nextstrain.discourse.group/t/error-msg-when-running-a-small-dataset/48>\
**Category:** Help and Getting Started\
**Created:** [June 26, 2020, 3:17am UTC](https://nextstrain.discourse.group/t/error-msg-when-running-a-small-dataset/48 "2020-06-26T03:17:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jxl175](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jxl175](https://nextstrain.discourse.group/u/jxl175)\
**Post date:** [June 26, 2020, 3:17am UTC](https://nextstrain.discourse.group/t/error-msg-when-running-a-small-dataset/48/1 "2020-06-26T03:17:06Z")

</div>

Hello,

I installed nextStrain by following the tutorial (container installation). I was able to successfully run the zika-tutorial. When I run a small example with 10 sequences downloaded from NCBI Virus website step by step, I could successfully build the alignments and create the raw tree. However, when I run the refine step (using the same format as the zika-tutorial, it reports the following error:

nextstrain:/nextstrain/build $ augur refine \

> –tree results/tree\_raw.nwk   
> –alignment results/aligned.fasta   
> –metadata data/metadata2.tsv   
> –output-tree results/tree.nwk   
> –output-node-data results/branch\_lengths.json   
> –timetree   
> –coalescent opt   
> –date-confidence   
> –date-inference marginal   
> –clock-filter-iqd 4

augur refine is using TreeTime version 0.7.4  
Traceback (most recent call last):  
File “/usr/bin/augur”, line 11, in   
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/refine.py”, line 209, in run  
covariance=args.covariance, resolve\_polytomies=(not args.keep\_polytomies))  
File “/nextstrain/augur/augur/refine.py”, line 37, in refine  
verbose=verbosity, gtr=‘JC69’, precision=precision)  
File “/usr/lib/python3.6/site-packages/treetime/treetime.py”, line 34, in **init**  
super(TreeTime, self). **init** (\*args, \*\*kwargs)  
File “/usr/lib/python3.6/site-packages/treetime/clock\_tree.py”, line 83, in **init**  
self.\_assign\_dates()  
File “/usr/lib/python3.6/site-packages/treetime/clock\_tree.py”, line 130, in \_assign\_dates  
raise MissingDataError(“ERROR: ALMOST NO VALID DATE CONSTRAINTS”)  
treetime.MissingDataError: ERROR: ALMOST NO VALID DATE CONSTRAINTS

Can you please help?

Thanks,

Jim

---

<div class="post-metadata">

**Author:** ![rneher](https://yyz1.discourse-cdn.com/flex031/user_avatar/nextstrain.discourse.group/rneher/32/20_2.png) [@rneher](https://nextstrain.discourse.group/u/rneher)\
**Post date:** [June 26, 2020, 8:24am UTC](https://nextstrain.discourse.group/t/error-msg-when-running-a-small-dataset/48/2 "2020-06-26T08:24:38Z")

</div>

This is likely do to a mismatch between the names of your sequences in the tree and the metadata, Otherwise it could be due to mal-formated dates (augur expects ISO format YYYY-MM-DD).

please check that there are valid date entries for the exact taxon names of your tree in the meta data. Furthermore, these names should be in a column `strain` or `name` in the metadata.

---

<div class="post-metadata">

**Author:** ![jxl175](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jxl175](https://nextstrain.discourse.group/u/jxl175)\
**Post date:** [June 26, 2020, 1:24pm UTC](https://nextstrain.discourse.group/t/error-msg-when-running-a-small-dataset/48/3 "2020-06-26T13:24:53Z")

</div>

Thanks, I checked and correct names and date format. It worked once, then when I add more fields to the metadata, move to the next step " Annotate the Phylogeny", it does not work any more. Then I back to the refine step, it does not work anymore. Here is the commend and error msg.

augur refine \

> –tree results/tree\_raw.nwk   
> –alignment results/aligned.fasta   
> –metadata data/metadata3.txt   
> –output-tree results/tree.nwk   
> –output-node-data results/branch\_lengths.json   
> –timetree   
> –coalescent opt   
> –date-confidence   
> –date-inference marginal   
> –clock-filter-iqd 4  
> augur refine is using TreeTime version 0.7.4  
> Traceback (most recent call last):  
> File “/usr/bin/augur”, line 11, in   
> 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/refine.py”, line 194, in run  
> min\_max\_year=args.year\_bounds)  
> File “/nextstrain/augur/augur/utils.py”, line 143, in get\_numerical\_dates  
> v = m[date\_col]  
> KeyError: ‘date’

Here is the metadata:

| strain | virus | date | country |
| --- | --- | --- | --- |
| NC\_045512 | Severe acute respiratory syndrome-related coronavirus | 2019-12-31 | China |
| MT653094 | Severe acute respiratory syndrome-related coronavirus | 2020-01-11 | USA |
| MT653095 | Severe acute respiratory syndrome-related coronavirus | 2020-02-12 | USA |
| MT653096 | Severe acute respiratory syndrome-related coronavirus | 2020-03-11 | USA |
| MT653097 | Severe acute respiratory syndrome-related coronavirus | 2020-04-11 | USA |
| MT653098 | Severe acute respiratory syndrome-related coronavirus | 2020-05-11 | USA |
| MT653099 | Severe acute respiratory syndrome-related coronavirus | 2020-06-12 | USA |
| MT653100 | Severe acute respiratory syndrome-related coronavirus | 2020-01-12 | USA |
| MT653101 | Severe acute respiratory syndrome-related coronavirus | 2020-02-12 | USA |
| MT653102 | Severe acute respiratory syndrome-related coronavirus | 2020-03-12 | USA |

Here is the raw tree:

(NC\_045512:0.00013455,(MT653097:0.00003324,(((MT653095:0.00000100,MT653101:0.00003593):0.00003610,MT653096:0.00018008):0.00000189,(MT653100:0.00003627,MT653102:0.00000201):0.00003527):0.00006826):0.00000296,((MT653094:0.00000100,MT653098:0.00000100):0.00003319,MT653099:0.00016813):0.00006691):0.00000000;

Any possible reasons?

---

<div class="post-metadata">

**Author:** ![rneher](https://yyz1.discourse-cdn.com/flex031/user_avatar/nextstrain.discourse.group/rneher/32/20_2.png) [@rneher](https://nextstrain.discourse.group/u/rneher)\
**Post date:** [June 26, 2020, 3:04pm UTC](https://nextstrain.discourse.group/t/error-msg-when-running-a-small-dataset/48/4 "2020-06-26T15:04:17Z")

</div>

your metadata should be a tab-delimited file. your file extension is `.txt` which makes me think this is where the problem might be.

---

<div class="post-metadata">

**Author:** ![jxl175](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jxl175](https://nextstrain.discourse.group/u/jxl175)\
**Post date:** [June 26, 2020, 3:26pm UTC](https://nextstrain.discourse.group/t/error-msg-when-running-a-small-dataset/48/5 "2020-06-26T15:26:52Z")

</div>

Thanks, but it is tab delimited, even though I use .txt extension.

---

<div class="post-metadata">

**Author:** ![jlhudd](https://yyz1.discourse-cdn.com/flex031/user_avatar/nextstrain.discourse.group/jlhudd/32/583_2.png) [@jlhudd](https://nextstrain.discourse.group/u/jlhudd)\
**Post date:** [June 26, 2020, 6:10pm UTC](https://nextstrain.discourse.group/t/error-msg-when-running-a-small-dataset/48/6 "2020-06-26T18:10:35Z")

</div>

Hi @jxl175! Augur currently only reads metadata as tab-delimited if the metadata file has a `.tsv` extension. Can you try renaming your metadata file to something like `metadata.tsv` and running the analysis again?

I’ve created [an issue on GitHub for this behavior with some suggestions for how to make the interface more user-friendly](https://github.com/nextstrain/augur/issues/574). We will discuss possible solutions and hopefully get a fix into an upcoming augur release.

---

<div class="post-metadata">

**Author:** ![jxl175](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jxl175](https://nextstrain.discourse.group/u/jxl175)\
**Post date:** [June 26, 2020, 7:50pm UTC](https://nextstrain.discourse.group/t/error-msg-when-running-a-small-dataset/48/7 "2020-06-26T19:50:37Z")

</div>

Thanks. That is the reason. I really appreciate your help. Now I can run it on a small example. I notice the following you may consider to improve:

1. in your Zika tutorial ([https://nextstrain.org/docs/tutorials/zika](https://nextstrain.org/docs/tutorials/zika)), the commend “augur ancestral” session, one actually has to specify what kind of output (e.g., output-node-data). The one in the tutorial using just “output” will not work.

2. I cannot find how to specify/construct users’ “auspice\_config.json”. Can you please help on that? Or we have to edit the .json file directly?

3. Tutorial or the document does not tell how to create the snakefile. Can you help?

Thanks again.

---

<div class="post-metadata">

**Author:** ![emmahodcroft](https://yyz1.discourse-cdn.com/flex031/user_avatar/nextstrain.discourse.group/emmahodcroft/32/14_2.png) [@emmahodcroft](https://nextstrain.discourse.group/u/emmahodcroft)\
**Post date:** [June 27, 2020, 7:59am UTC](https://nextstrain.discourse.group/t/error-msg-when-running-a-small-dataset/48/8 "2020-06-27T07:59:20Z")

</div>

Thanks for your feedback! We’re working on correcting number 1 right now.

For number 2, yes - you have to modify the .json file directly, there’s no way to correct it. However, you can use the ones given in the tutorials or other repositories as a great starting point - copy these and edit!

The snakefile also needs to be created yourself - or again, I recommend taking one from the tutorial and editing it. Snakefiles will be personal to what different people want to do in an analysis, so they may be different from project to project/group to group. Some people use different ‘workflow’ programs, like nextflow. Augur will work with any of these - we just tend to use Snakemake.
