Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jsan4christ opened this issue Jul 23, 2022 · 2 comments

Comments

@jsan4christ
Copy link

jsan4christ commented Jul 23, 2022

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

@rneher
Copy link
Member

rneher commented Aug 4, 2022

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

@jsan4christ
Copy link
Author

Right, thanks for the response. I totally understand.

Please do let me know when the change is implemented.

Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants