I'm running this code and run into an index error:
treetime --tree /Users/ouotodou/Desktop/treeee.nex --dates /Users/ouotodou/Desktop/sampled_metadata.csv --aln /Users/ouotodou/Desktop/sampled_sequences.fasta
Attempting to parse dates...
Using column 'strain' as name. This needs match the taxon names in the tree!!
Using column 'date' as date.
0.00 -TreeAnc: set-up
0.13 -WARNING: character 0 is unknown. Treating it as missing information
0.13 -WARNING: character 1 is unknown. Treating it as missing information
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/treetime/treetime.py", line 57, in run
return self._run(**kwargs)
^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/treetime/treetime.py", line 215, in _run
self.optimize_tree(infer_gtr=infer_gtr,
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/treetime/treeanc.py", line 1356, in optimize_tree
self.optimize_branch_lengths_joint(store_old=False)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/treetime/treeanc.py", line 1157, in optimize_branch_lengths_joint
new_len = max(0,self.optimal_branch_length(node))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/treetime/treeanc.py", line 1202, in optimal_branch_length
return self.gtr.optimal_t_compressed(node.branch_state['pair'],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/treetime/gtr.py", line 854, in optimal_t_compressed
hamming_distance = np.sum(multiplicity[seq_pair[:,1]!=seq_pair[:,0]])/np.sum(multiplicity)
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
ERROR: too many indices for array: array is 1-dimensional, but 2 were indexed
ERROR in TreeTime.run: An error occurred which was not properly handled in TreeTime. If this error persists, please let us know by filing a new issue including the original command and the error above at: https://github.com/neherlab/treetime/issues
Has anyone encountered this error before and knows how to solve it? Thank you so much!
I'm running this code and run into an index error: treetime --tree /Users/ouotodou/Desktop/treeee.nex --dates /Users/ouotodou/Desktop/sampled_metadata.csv --aln /Users/ouotodou/Desktop/sampled_sequences.fasta
Attempting to parse dates... Using column 'strain' as name. This needs match the taxon names in the tree!! Using column 'date' as date.
0.00 -TreeAnc: set-up
0.13 -WARNING: character 0 is unknown. Treating it as missing information
0.13 -WARNING: character 1 is unknown. Treating it as missing information Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/treetime/treetime.py", line 57, in run return self._run(**kwargs) ^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/treetime/treetime.py", line 215, in _run self.optimize_tree(infer_gtr=infer_gtr, File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/treetime/treeanc.py", line 1356, in optimize_tree self.optimize_branch_lengths_joint(store_old=False) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/treetime/treeanc.py", line 1157, in optimize_branch_lengths_joint new_len = max(0,self.optimal_branch_length(node)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/treetime/treeanc.py", line 1202, in optimal_branch_length return self.gtr.optimal_t_compressed(node.branch_state['pair'], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/treetime/gtr.py", line 854, in optimal_t_compressed hamming_distance = np.sum(multiplicity[seq_pair[:,1]!=seq_pair[:,0]])/np.sum(multiplicity)