mmagnus / rna-tools

🔧rna-tools: a toolbox to analyze sequences, structures and simulations of RNA (and more) used by RNA CASP, RNA PUZZLES, and me ;-) docs @ http://rna-tools.rtfd.io web @ http://rna-tools.online
http://rna-tools.online
GNU General Public License v3.0
152 stars 43 forks source link

rna_pdb_tools.py -- TypeError when running --edit option #147

Closed mjustynaPhD closed 7 months ago

mjustynaPhD commented 8 months ago

When running a command: rna_pdb_tools.py --edit "A:1651-1656>A:1-6,A:2004-2006>A:1-3" pdbs/7RQB_1_1A.pdb I encountered the following error:

Traceback (most recent call last):
  File "/home/marek/anaconda3/envs/rna-tools/bin/rna_pdb_tools.py", line 844, in <module>
    output = edit_pdb(f, args)
             ^^^^^^^^^^^^^^^^^
  File "/home/marek/anaconda3/envs/rna-tools/lib/python3.12/site-packages/rna_tools/rna_tools_lib.py", line 2012, in edit_pdb
    output += edits
TypeError: can only concatenate str (not "list") to str

I did some debugging and fixed the issue, but unfortunately, I have no permission to publish a hotfix branch or create a PR. The problem is with the line indicated in the error (rna_tools_lib.py:2012). I think that this might be an artifact from the past. The easiest fix I found was just to remove this line (output += edits), as it's not needed. I think that you wanted to keep the command in the output file, but it is actually already added in line rna_tools_lib.py:1999.

mmagnus commented 7 months ago

dear @mjustynaPhD can you send me this pdb file?

I see that edits could be combined.

~~Can you run this edits sequentially, I'm not sure if you can do two edits at once (I have to look into the code, this should be in the documentation, sorry for missing this information) rna_pdb_tools.py --edit "A:1651-1656>A:1-6" pdbs/7RQB_1_1A.pdb > a.pdb rna_pdb_tools.py --edit "A:2004-2006>A:1-3" a.pdb > b.pdb~~

mmagnus commented 7 months ago

OK, there was a stupid typo in the code, I'm not sure why it was there. It should work now with GitHub or 3.20.2