Lattice-Automation / seqfold

nucleic acid folding
MIT License
79 stars 12 forks source link

Maximum Depth? #9

Closed yashlal closed 2 years ago

yashlal commented 2 years ago

When trying to run DG on a sequence that is 1448 base pairs long, I encounter the following error: RecursionError: maximum recursion depth exceeded in comparison

with the traceback:

Traceback (most recent call last): File "C:\Users\Yash Lal\Desktop\Coevolution-Informatics\playground2.py", line 5, in v = dg(s) File "C:\Users\Yash Lal\AppData\Local\Programs\Python\Python39\lib\site-packages\seqfold\fold.py", line 89, in dg structs = fold(seq, temp) File "C:\Users\Yash Lal\AppData\Local\Programs\Python\Python39\lib\site-packages\seqfold\fold.py", line 69, in fold v_cache, w_cache = _cache(seq, temp) File "C:\Users\Yash Lal\AppData\Local\Programs\Python\Python39\lib\site-packages\seqfold\fold.py", line 161, in _cache _w(seq, 0, n - 1, temp, v_cache, w_cache, emap) File "C:\Users\Yash Lal\AppData\Local\Programs\Python\Python39\lib\site-packages\seqfold\fold.py", line 198, in _w w1 = _w(seq, i + 1, j, temp, v_cache, w_cache, emap) File "C:\Users\Yash Lal\AppData\Local\Programs\Python\Python39\lib\site-packages\seqfold\fold.py", line 198, in _w w1 = _w(seq, i + 1, j, temp, v_cache, w_cache, emap) File "C:\Users\Yash Lal\AppData\Local\Programs\Python\Python39\lib\site-packages\seqfold\fold.py", line 198, in _w w1 = _w(seq, i + 1, j, temp, v_cache, w_cache, emap) [Previous line repeated 989 more times] File "C:\Users\Yash Lal\AppData\Local\Programs\Python\Python39\lib\site-packages\seqfold\fold.py", line 191, in _w if w_cache[i][j] != STRUCT_DEFAULT: File "C:\Users\Yash Lal\AppData\Local\Programs\Python\Python39\lib\site-packages\seqfold\fold.py", line 24, in eq return self.e == other.e and self.ij == other.ij RecursionError: maximum recursion depth exceeded in comparison

Is there anything I can do to make dg work with such a long sequence?

Thank you!

jjti commented 2 years ago

You should be able to change that setting: https://stackoverflow.com/a/3323013

In theory I should also be able to unwind the recursive and have it iterate without recursion, but that's a re-write I don't have time for the in very short-term.

I just updated the README with a note about using pypy3 (JIT interpreter) which may also help you with sequences as large as that one: https://github.com/Lattice-Automation/seqfold

yashlal commented 2 years ago

Thank you so much for the help!