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

draw_struct crashes with a "weird" sequence #14

Open
lorenzo-rovigatti opened this issue Aug 18, 2024 · 0 comments
Open

draw_struct crashes with a "weird" sequence #14

lorenzo-rovigatti opened this issue Aug 18, 2024 · 0 comments

Comments

@lorenzo-rovigatti
Copy link

lorenzo-rovigatti commented Aug 18, 2024

Hi! Thanks for the lib, it's great.

I was trying to draw a very short sequence and the lib refused to do so, which is fine since the sequence and its secondary structure is non-physical, but I think the code should die gracefully rather than crash. Here is a way of reproducing this issue:

from ipynb.draw import draw_struct

sequence = "GCACGACG"
dot_parens = "().().()"
draw_struct(sequence, dot_parens)

This is the traceback I get:

Error occured while drawing RNA 1 0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/lorenzo/software/anaconda3/lib/python3.11/site-packages/draw_rna/ipynb_draw.py", line 27, in draw_struct
    d.draw_rna(seq, secstruct, seq2col(seq), line=line, cmap_name = cmap, vmin=vmin, vmax=vmax,
  File "/home/lorenzo/software/anaconda3/lib/python3.11/site-packages/draw_rna/draw.py", line 62, in draw_rna
    r.setup_tree(secstruct, NODE_R, PRIMARY_SPACE, PAIR_SPACE, external_multiplier, external_offset)
  File "/home/lorenzo/software/anaconda3/lib/python3.11/site-packages/draw_rna/render_rna.py", line 232, in setup_tree
    add_nodes_recursive(bi_pairs,self.root_, jj, bi_pairs[jj])
  File "/home/lorenzo/software/anaconda3/lib/python3.11/site-packages/draw_rna/render_rna.py", line 71, in add_nodes_recursive
    add_nodes_recursive(bi_pairs, newnode, start_index+1, end_index-1)
  File "/home/lorenzo/software/anaconda3/lib/python3.11/site-packages/draw_rna/render_rna.py", line 62, in add_nodes_recursive
    sys.exit(0)
    ^^^
NameError: name 'sys' is not defined
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

1 participant