nextstrain / augur

Pipeline components for real-time phylodynamic analysis
https://docs.nextstrain.org/projects/augur/
GNU Affero General Public License v3.0
268 stars 129 forks source link

Augur refine treetime failed, please help me! #1099

Open abrahamagain opened 1 year ago

abrahamagain commented 1 year ago

$ augur refine \ --tree results/tree_raw.nwk \ --alignment results/aligned.fasta \ --metadata data/metadata.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.9.4

0.39 TreeTime.reroot: with method or node: least-squares

0.39 TreeTime.reroot: rerooting will ignore covariance and shared ancestry. Traceback (most recent call last): File "/home/abraham/anaconda3/envs/nextstrain/lib/python3.10/site-packages/augur/init.py", line 66, in run return args.command.run(args) File "/home/abraham/anaconda3/envs/nextstrain/lib/python3.10/site-packages/augur/refine.py", line 222, in run tt = refine(tree=T, aln=aln, ref=ref, dates=dates, confidence=args.date_confidence, File "/home/abraham/anaconda3/envs/nextstrain/lib/python3.10/site-packages/augur/refine.py", line 45, in refine tt.clock_filter(reroot=reroot, n_iqd=clock_filter_iqd, plot=False) #use whatever was specified File "/home/abraham/anaconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/treetime.py", line 410, in clock_filter self.reroot(root='least-squares' if reroot=='best' else reroot, covariation=False, clock_rate=fixed_clock_rate) File "/home/abraham/anaconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/treetime.py", line 521, in reroot new_root = self._find_best_root(covariation=use_cov, File "/home/abraham/anaconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/treetime.py", line 949, in _find_best_root return Treg.optimal_reroot(force_positive=force_positive, slope=slope, keep_node_order=self.keep_node_order)['node'] File "/home/abraham/anaconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/treeregression.py", line 433, in optimal_reroot best_root = self.find_best_root(force_positive=force_positive, slope=slope) File "/home/abraham/anaconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/treeregression.py", line 340, in find_best_root x, chisq = self._optimal_root_along_branch(n, tv, bv, var, slope=slope) File "/home/abraham/anaconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/treeregression.py", line 393, in _optimal_root_along_branch chisq_dist = np.inf if n==self.tree.root else base_regression(n.up.Qtot, slope=slope)['chisq'] File "/home/abraham/anaconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/treeregression.py", line 32, in base_regression raise ValueError("No variation in sampling dates! Please specify your clock rate explicitly.") ValueError: No variation in sampling dates! Please specify your clock rate explicitly.

An error occurred (see above) that has not been properly handled by Augur. To report this, please open a new issue including the original command and the error above: https://github.com/nextstrain/augur/issues/new/choose

jameshadfield commented 1 year ago

Hi @abrahamagain - have you checked the sample dates in the metadata? The error you are getting (No variation in sampling dates!) implies that all provided dates are the same. If this is the case and you still wish to infer a temporal tree you'll have to provide an explicit clock rate.

abrahamagain commented 1 year ago

Thank you so much, I will try some different sequences.

abrahamagain commented 1 year ago

augur refine is using TreeTime version 0.9.4

0.37 TreeTime.reroot: with method or node: least-squares

0.37 TreeTime.reroot: rerooting will ignore covariance and shared ancestry.

0.37 TreeTime.reroot: with method or node: least-squares

0.37 TreeTime.reroot: rerooting will ignore covariance and shared ancestry. pruning leaf NC_045512.2

0.37 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. /home/dell/miniconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/gtr.py:502: RuntimeWarning: divide by zero encountered in divide W_ij = (nij+nij.T+2pc_mat)/mu/(np.outer(pi,Ti) + np.outer(Ti,pi) /home/dell/miniconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/gtr.py:502: RuntimeWarning: invalid value encountered in divide W_ij = (nij+nij.T+2pc_mat)/mu/(np.outer(pi,Ti) + np.outer(Ti,pi) /home/dell/miniconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/gtr.py:10: RuntimeWarning: invalid value encountered in double_scalars return (np.einsum('i,ij,j', pi, W, pi) - np.sum(piW[:,gap_index])pi[gap_index])/(1-pi[gap_index]) Traceback (most recent call last): File "/home/dell/miniconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/treetime.py", line 57, in run return self._run(*kwargs) File "/home/dell/miniconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/treetime.py", line 211, in _run self.optimize_tree(infer_gtr=infer_gtr, File "/home/dell/miniconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/treeanc.py", line 1356, in optimize_tree N_diff = self.reconstruct_anc(method=method_anc, infer_gtr=infer_gtr, pc=pc, File "/home/dell/miniconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/treeanc.py", line 482, in reconstruct_anc return self.infer_ancestral_sequences(args,kwargs) File "/home/dell/miniconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/treeanc.py", line 534, in infer_ancestral_sequences self.infer_gtr(marginal=marginal, kwargs) File "/home/dell/miniconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/treeanc.py", line 1499, in infer_gtr self._gtr = GTR.infer(n_ij, T_ia.sum(axis=-1), root_state, fixed_pi=fixed_pi, pc=pc, File "/home/dell/miniconda3/envs/nextstrain/lib/python3.10/site-packages/treetime/gtr.py", line 498, in infer while LA.norm(pi_old-pi) > dp and count < Nit: File "/home/dell/miniconda3/envs/nextstrain/lib/python3.10/site-packages/scipy/linalg/_misc.py", line 145, in norm a = np.asarray_chkfinite(a) File "/home/dell/miniconda3/envs/nextstrain/lib/python3.10/site-packages/numpy/lib/function_base.py", line 627, in asarray_chkfinite raise ValueError( ValueError: array must not contain infs or NaNs

ERROR: array must not contain infs or NaNs

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

ERROR from TreeTime: An error occurred in TreeTime (see above). This may be due to an issue with TreeTime or Augur. Please report you are calling TreeTime via Augur.

Here is some new errors, please help again, thank you

victorlin commented 1 year ago

The error from TreeTime can be handled properly there, or raised as a TreeTime error that is handled by Augur's top-level exception handler.