extract res if only 1 in extendAtoms#1963
Conversation
|
Could you provide the PDB code and what to check? |
|
I'll forward you the pdb file with the problem. The code and error should be the following |
karolamik13
left a comment
There was a problem hiding this comment.
Old code:
In [1]: from prody import *
In [2]: fex = parsePDB('comp_min.pdb')
@> 136109 atoms and 1 coordinate set(s) were parsed in 2.23s.
In [3]: fex_bb = fex.select('protein name CA C N O or resname CY1 name CA C N O')
In [4]: fex_ca = fex.select('protein name CA or resname CY1 name CA')
In [5]: y = extendAtoms(fex_ca, fex_bb)
ValueError Traceback (most recent call last)
in
----> 1 y = extendAtoms(fex_ca, fex_bb)
~/anaconda3/lib/python3.9/site-packages/ProDy-2.5.0-py3.9-linux-x86_64.egg/prody/atomic/functions.py in extendAtoms(nodes, atoms, is3d)
347 raise ValueError('atoms must contain a residue for all atoms')
348 if isinstance(res, list):
--> 349 raise ValueError('not enough data to get a single residue for all atoms')
350
351 res_atom_indices = res._getIndices()
ValueError: not enough data to get a single residue for all atoms
New code:
In [1]: from prody import *
In [2]: x = parsePDB('comp_min.pdb')
@> 136109 atoms and 1 coordinate set(s) were parsed in 2.24s.
In [3]: x_bb = x.select('protein name CA C N O or resname CY1 name CA C N O')
In [4]: x_ca = x.select('protein name CA or resname CY1 name CA')
In [5]: y = extendAtoms(x_ca, x_bb)
In [6]: y
Out[7]:
(array([ 0, 0, 0, ..., 680, 680, 680]),
<AtomMap: comp_min from comp_min (2724 atoms)>)
fixes #1962
for some reason HierView getResidue gets atoms from multiple residues for GLN 357 and it's fixed in the list comprehension of _getResidue so we only have one entry in the list. So, it throws an error that there's a list when really we can extract it, which we now do.