An "AttributeError: 'NoneType' object has no attribute 'shape'" when building phylogenetic tree using Augur

Hello all,
I am getting started with the Augur and currently building a phylogenetic tree on ncov. According to tutorial web Augur: A bioinformatics toolkit for phylogenetic analysis — Augur documentation, I have built a tree newick file and am going to refine it and acquire the time tree file. However, many times as I tried there is an Error always accured that is " AttributeError: ‘NoneType’ object has no attribute ‘shape’ ".

The following lines are the augur command line be input and the specific of the error:

$ augur refine -a gisaid_hcov-19_2021_02_26_02_rename_edit_filted_align.fasta
-t gisaid_hcov-19_2021_02_26_02_rename_edit_filted_align.tree
–metadata gisaid_hcov-19_2021_02_26_02_matadata_sorted.tsv
–output-tree gisaid_hcov-19_2021_02_26_02_rename_edit_filted_align_refine.tree
–output-node-data gisaid_hcov-19_2021_02_26_02_rename_edit_filted_align_nodedata
–timetree
–coalescent float
–date-confidence
–vcf-reference EPI_ISL_402125.fasta

augur refine is using TreeTime version 0.8.1

13.20 ***WARNING: TreeAnc._attach_sequences_to_nodes: NO SEQUENCE FOR LEAF:
hCoV-19/Lu_an/101/2020

15.32 ***WARNING: TreeAnc._attach_sequences_to_nodes: NO SEQUENCE FOR LEAF:
hCoV-19/Lu_an/339/2020

15.33 ***WARNING: TreeAnc._attach_sequences_to_nodes: NO SEQUENCE FOR LEAF:
hCoV-19/Lu_an/226/2020

15.34 ***WARNING: TreeAnc._attach_sequences_to_nodes: NO SEQUENCE FOR LEAF:
hCoV-19/Lu_an/98/2020

15.36 ***WARNING: TreeAnc._attach_sequences_to_nodes: NO SEQUENCE FOR LEAF:
hCoV-19/Lu_an/295/2020

15.37 ***WARNING: TreeAnc._attach_sequences_to_nodes: NO SEQUENCE FOR LEAF:
hCoV-19/Lu_an/29/2020

15.38 ***WARNING: TreeAnc._attach_sequences_to_nodes: NO SEQUENCE FOR LEAF:
hCoV-19/Lu_an/30/2020

15.39 ***WARNING: TreeAnc._attach_sequences_to_nodes: NO SEQUENCE FOR LEAF:
hCoV-19/Lu_an/99/2020

15.40 ***WARNING: TreeAnc._attach_sequences_to_nodes: NO SEQUENCE FOR LEAF:
hCoV-19/Lu_an/08/2020

15.41 ***WARNING: TreeAnc._attach_sequences_to_nodes: NO SEQUENCE FOR LEAF:
hCoV-19/Lu_an/32/2020

15.43 ***WARNING: TreeAnc._attach_sequences_to_nodes: NO SEQUENCE FOR LEAF:
hCoV-19/Lu_an/68/2020

15.44 ***WARNING: TreeAnc._attach_sequences_to_nodes: NO SEQUENCE FOR LEAF:
hCoV-19/Lu_an/33/2020

15.45 ***WARNING: TreeAnc._attach_sequences_to_nodes: NO SEQUENCE FOR LEAF:
hCoV-19/Lu_an/03/2020

15.46 ***WARNING: TreeAnc._attach_sequences_to_nodes: NO SEQUENCE FOR LEAF:
hCoV-19/Lu_an/319/2020

15.47 ***WARNING: TreeAnc._attach_sequences_to_nodes: NO SEQUENCE FOR LEAF:
hCoV-19/Lu_an/49/2020

15.49 ***WARNING: TreeAnc: 15 nodes don’t have a matching sequence in the
alignment. POSSIBLE ERROR.

17.06 WARNING: Previous versions of TreeTime (<0.7.0) RECONSTRUCTED sequences of
tips at positions with AMBIGUOUS bases. This resulted in unexpected
behavior is some cases and is no longer done by default. If you want to
replace those ambiguous sites with their most likely state, rerun with
reconstruct_tip_states=True or --reconstruct-tip-states.
Traceback (most recent call last):
File “/home/yt5266/miniconda3/envs/nextstrain/bin/augur”, line 8, in
sys.exit(main())
File “/home/yt5266/miniconda3/envs/nextstrain/lib/python3.6/site-packages/augur/main.py”, line 10, in main
return augur.run( argv[1:] )
File “/home/yt5266/miniconda3/envs/nextstrain/lib/python3.6/site-packages/augur/init.py”, line 75, in run
return args.command.run(args)
File “/home/yt5266/miniconda3/envs/nextstrain/lib/python3.6/site-packages/augur/refine.py”, line 214, in run
covariance=args.covariance, resolve_polytomies=(not args.keep_polytomies))
File “/home/yt5266/miniconda3/envs/nextstrain/lib/python3.6/site-packages/augur/refine.py”, line 70, in refine
vary_rate=vary_rate, use_covariation=covariance, **kwarks)
File “/home/yt5266/miniconda3/envs/nextstrain/lib/python3.6/site-packages/treetime/treetime.py”, line 156, in run
max_iter=1, prune_short=True, **seq_kwargs)
File “/home/yt5266/miniconda3/envs/nextstrain/lib/python3.6/site-packages/treetime/treeanc.py”, line 1305, in optimize_tree
self.optimize_branch_len(verbose=0, store_old=False, mode=branch_length_mode)
File “/home/yt5266/miniconda3/envs/nextstrain/lib/python3.6/site-packages/treetime/treeanc.py”, line 1074, in optimize_branch_len
return self.optimize_branch_lengths_joint(**kwargs)
File “/home/yt5266/miniconda3/envs/nextstrain/lib/python3.6/site-packages/treetime/treeanc.py”, line 1117, in optimize_branch_lengths_joint
new_len = max(0,self.optimal_branch_length(node))
File “/home/yt5266/miniconda3/envs/nextstrain/lib/python3.6/site-packages/treetime/treeanc.py”, line 1158, in optimal_branch_length
self.add_branch_state(node)
File “/home/yt5266/miniconda3/envs/nextstrain/lib/python3.6/site-packages/treetime/treeanc.py”, line 1065, in add_branch_state
ignore_gaps = self.ignore_gaps)
File “/home/yt5266/miniconda3/envs/nextstrain/lib/python3.6/site-packages/treetime/gtr.py”, line 606, in state_pair
if seq_ch.shape != seq_p.shape:
AttributeError: ‘NoneType’ object has no attribute ‘shape’

I have tried to delete the input of “–treetime” and the Error doesn’t appear. However the tree file with according time is exactly what I want thus I have to run with it.

May anyone show me how to fix it out? Many appreciate and thanks!

Yuntian Bai

By the way, I did a “test” run using a 49 sequnences fasta file to see if it’s applicable. I did get the treetime file I want in that 49 test. Yet this time I confront with this error with my larger 1500 sequences fasta.I hope this information could be useful.

We have run into this as well. The problem is that there are sequences called “Lu`an” or “Lu’an” which during tree building get renamed to “Lu_an”. Then augur can’t match sequences and taxa in the tree and fails (it needs sequences to infer a time tree).

If you rename “Lu’an” to “Lu_an” in your sequences and metadata, it should work.

See also this discussion thread which had the same problem.

Thank you @rneher @james both. The tree file has generated successfally when sequences with “Lu’an” were dropped due to your insrtuctions. I really appreciate your help!

Now as I acquire the tree and nodedata files out from augur refine,I run the augur export to get json file and drag it into auspice.us. There is the tree with timeline yet with no mutations or clades info on it. So I made a run of augur ancestral and get another json file by augur export, which shows null in web auspice.us. I wonder how could I combine these result files into one phylogenetic tree similar to the one displayed on Nextstrain main page( auspice)?

Much appreciate to every assistance!

I didn’t find the tutorial of Zika virus yet. Now I am running the tutorial to see how it works. Thank you again!

I think you need to tell us more what you are actually running for us to help you. In order to see mutations, you need to do ancestral reconstruction (augur ancestral) and include the result in the export.

you can find the tutorials here:
https://docs.nextstrain.org/en/latest/tutorials/index.html