haddocking / pdb-tools

A dependency-free cross-platform swiss army knife for PDB files.
https://haddocking.github.io/pdb-tools/
Apache License 2.0
369 stars 112 forks source link

`pdb_selaltloc` is breaking with ANISOU lines for `7K2U.pdb` #130

Closed joaomcteixeira closed 2 years ago

joaomcteixeira commented 2 years ago

pdb_selaltloc is breaking with ANISOU lines for 7K2U.pdb

Does it break for other pdbs with ANISOU as well? If yes, or tests are not covering all the possible cases.

This bug was likely introduced with https://github.com/haddocking/pdb-tools/pull/117. Tests should have discovered it, though.

output:

· pdb_selaltloc 7K2U.pdb 
Traceback (most recent call last):
  File "/home/joao/anaconda3/envs/py39/bin/pdb_selaltloc", line 33, in <module>
    sys.exit(load_entry_point('pdb-tools', 'console_scripts', 'pdb_selaltloc')())
  File "/home/joao/github/pdb-tools/pdbtools/pdb_selaltloc.py", line 428, in main
    for lineno, line in enumerate(new_pdb):
  File "/home/joao/github/pdb-tools/pdbtools/pdb_selaltloc.py", line 180, in select_altloc
    for __line in flush_func(selloc=selloc, altloc_lines=altloc_lines, res_per_loc=res_per_loc):
  File "/home/joao/github/pdb-tools/pdbtools/pdb_selaltloc.py", line 369, in flush_resloc_occ_same_residue
    lines.sort(key=lambda x: (A[x[:4]], float(x[54:60])), reverse=True)
  File "/home/joao/github/pdb-tools/pdbtools/pdb_selaltloc.py", line 369, in <lambda>
    lines.sort(key=lambda x: (A[x[:4]], float(x[54:60])), reverse=True)
ValueError: could not convert string to float: '51   -'