wutron / dlcpar

Modeling gene duplication, loss, and coalescence (through parsimony)
GNU General Public License v3.0
9 stars 6 forks source link

Maximum recursion depth exceeded #4

Open davidemms opened 7 years ago

davidemms commented 7 years ago

Hi

With some (large) trees I get an error "maximum recursion depth exceeded". The command I used was: "dlcpar_search -s SpeciesTree_ids_0_rooted.txt -S GeneMap.smap OG0000007_tree_id.txt" with the attached files. The output was:

Traceback (most recent call last): File "/usr/local/bin/dlcpar_search", line 236, in sys.exit(main()) File "/usr/local/bin/dlcpar_search", line 206, in main log=log_out) File "/usr/local/lib/python2.7/dist-packages/dlcpar/simplerecon.py", line 39, in dlc_recon return reconer.recon(nsearch, nconverge).get_dict() File "/usr/local/lib/python2.7/dist-packages/dlcpar/simplerecon.py", line 83, in recon proposal = self.proposer.init_proposal() File "/usr/local/lib/python2.7/dist-packages/dlcpar/simplerecon.py", line 249, in init_proposal self._recon = self._recon_lca(self._locus_search.get_tree().copy()) File "/usr/local/lib/python2.7/dist-packages/dlcpar/simplerecon.py", line 283, in _recon_lca self._gene2species) File "/usr/local/lib/python2.7/dist-packages/dlcpar/deps/compbio/phylo.py", line 130, in reconcile walk(gtree.root) File "/usr/local/lib/python2.7/dist-packages/dlcpar/deps/compbio/phylo.py", line 124, in walk

...... ...... etc ..... File "/usr/local/lib/python2.7/dist-packages/dlcpar/deps/rasmus/treelib.py", line 83, in recurse func(child, args) File "/usr/local/lib/python2.7/dist-packages/dlcpar/deps/compbio/phylo.py", line 124, in walk node.recurse(walk) File "/usr/local/lib/python2.7/dist-packages/dlcpar/deps/rasmus/treelib.py", line 83, in recurse func(child, args) RuntimeError: maximum recursion depth exceeded

Thanks David error_files.zip

wutron commented 7 years ago

Hi David,

I reconcile the locus tree to the species tree using the LCA mapping, and phylo.py uses recursion to determine the LCA mapping. I suspect the problem is that your gene tree is very deep, which causes Python to exceed the max recursion limit. One easy but non-optimal way to get around this issue is to increase the default limit: e.g. "sys.setrecursionlimit(1500)". A better way would be to rewrite the LCA algorithm using DP, but this is not high on my list of priorities. Let me know if the first fix works for you.

Thanks,