treetime icon indicating copy to clipboard operation
treetime copied to clipboard

Error running treetime; RecursionError: maximum recursion depth exceeded while calling a Python object

Open jsan4christ opened this issue 2 years ago • 2 comments

Hallo TT team,

I'm getting this error running treetime locally on my Mac and on the server (CentOS 7).

treetime clock --tree new_tree3.nwk --dates dates.csv --aln nextalign.aligned.new_tree3.fasta --reroot "oldest"

0.00 -TreeAnc: set-up

Attempting to parse dates... Using column 'strain' as name. This needs match the taxon names in the tree!! Using column 'date_decimal' as date.

391.48 TreeTime.reroot: with method or node: oldest

448.94 TreeTime.reroot: with method or node: oldest

485.78 TreeTime.reroot: with method or node: oldest

Root-Tip-Regression: --rate: 2.431e-03 --r^2: 0.58

The R^2 value indicates the fraction of variation inroot-to-tip distance explained by the sampling times.Higher values corresponds more clock-like behavior (max 1.0).

The rate is the slope of the best fit of the date tothe root-to-tip distance and provides an estimate ofthe substitution rate. The rate needs to be positive!Negative rates suggest an inappropriate root.

The estimated rate and tree correspond to a root date:

--- root-date: 2020.35

Traceback (most recent call last): File "/Users/sanem/miniconda3/envs/nextstrain/bin/treetime", line 12, in return_code = params.func(params) File "/Users/sanem/miniconda3/envs/nextstrain/lib/python3.6/site-packages/treetime/wrappers.py", line 1056, in estimate_clock_model Phylo.write(myTree.tree, outtree_name, 'newick') File "/Users/sanem/miniconda3/envs/nextstrain/lib/python3.6/site-packages/Bio/Phylo/_io.py", line 77, in write n = getattr(supported_formats[format], "write")(trees, fp, **kwargs) File "/Users/sanem/miniconda3/envs/nextstrain/lib/python3.6/site-packages/Bio/Phylo/NewickIO.py", line 61, in write return Writer(trees).write(handle, plain=plain, **kwargs) File "/Users/sanem/miniconda3/envs/nextstrain/lib/python3.6/site-packages/Bio/Phylo/NewickIO.py", line 260, in write for treestr in self.to_strings(**kwargs): File "/Users/sanem/miniconda3/envs/nextstrain/lib/python3.6/site-packages/Bio/Phylo/NewickIO.py", line 308, in to_strings rawtree = newickize(tree.root) + ";" File "/Users/sanem/miniconda3/envs/nextstrain/lib/python3.6/site-packages/Bio/Phylo/NewickIO.py", line 301, in newickize return "(%s)%s" % (",".join(subtrees), label + make_info_string(clade))

--

File "/Users/sanem/miniconda3/envs/nextstrain/lib/python3.6/site-packages/Bio/Phylo/NewickIO.py", line 300, in subtrees = (newickize(sub) for sub in clade) File "/Users/sanem/miniconda3/envs/nextstrain/lib/python3.6/site-packages/Bio/Phylo/NewickIO.py", line 293, in newickize unquoted_label = re.match(token_dict["unquoted node label"], label) File "/Users/sanem/miniconda3/envs/nextstrain/lib/python3.6/re.py", line 172, in match return _compile(pattern, flags).match(string) File "/Users/sanem/miniconda3/envs/nextstrain/lib/python3.6/re.py", line 289, in _compile p, loc = _cache[type(pattern), pattern, flags] RecursionError: maximum recursion depth exceeded while calling a Python object

What have I tried?

  • Check that alignment, tree and dates are in sync
  • Update treetime from 0.8.6 to 0.9.0 to 0.9.1
  • Remove and re-install nextstrain conda environment and treetime.

None has worked. Is there something I'm missing?

NB: A colleague was able to run the same command on the same data on his computer and it worked fine.

Please advise

jsan4christ avatar Jul 23 '22 00:07 jsan4christ

Hi San,

this has to do with the cap on recursive function calls. In augur, we have a way to set it via environment variables. but this is currently not implemented in treetime proper. I'll add this to treetime as well. Beyond that, there is not much I can do since this error happens when Biopython converts the tree to newick.

best, richard

rneher avatar Aug 04 '22 09:08 rneher

Right, thanks for the response. I totally understand.

Please do let me know when the change is implemented.

Regards.

jsan4christ avatar Aug 04 '22 09:08 jsan4christ