Skip to content

add kwarg strip_icodes to parsePDB parsePQR #2101

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

Merged
merged 2 commits into from
Jul 17, 2025

Conversation

jamesmkrieger
Copy link
Contributor

This enables us to have non-stripped icodes, so they can be used for selections. The default is True to maintain the old behaviour.

This should help with the problem found in #2100

In [1]: from prody import *

In [2]: ag = parsePDB('1ucy', compressed=False)
@> PDB file is found in working directory (1ucy.pdb).
@> 8165 atoms and 1 coordinate set(s) were parsed in 0.07s.

In [3]: ag.select('chain L and resnum 14').getIcodes()
Out[3]: 
array(['', '', '', '', '', '', '', '', 'A', 'A', 'A', 'A', 'A', 'A', 'A',
       'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'C',
       'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D',
       'D', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'F', 'F', 'F',
       'F', 'F', 'F', 'F', 'F', 'G', 'G', 'G', 'G', 'G', 'G', 'G', 'G',
       'G', 'G', 'G', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'I',
       'I', 'I', 'I', 'I', 'I', 'J', 'J', 'J', 'J', 'J', 'J', 'J', 'J',
       'J', 'J', 'J', 'J', 'K', 'K', 'K', 'K', 'K', 'K', 'K', 'K', 'L',
       'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'M', 'M', 'M', 'M'],
      dtype='<U1')

In [4]: ag.select('chain L and resnum 14 and icode " "')

In [5]: ag = parsePDB('1ucy', compressed=False, strip_icodes=False)
@> PDB file is found in working directory (1ucy.pdb).
@> 8165 atoms and 1 coordinate set(s) were parsed in 0.06s.

In [6]: ag.select('chain L and resnum 14').getIcodes()
Out[6]: 
array([' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'A', 'A', 'A', 'A', 'A',
       'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'C', 'C',
       'C', 'C', 'C', 'C', 'C', 'C', 'C', 'D', 'D', 'D', 'D', 'D', 'D',
       'D', 'D', 'D', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'F',
       'F', 'F', 'F', 'F', 'F', 'F', 'F', 'G', 'G', 'G', 'G', 'G', 'G',
       'G', 'G', 'G', 'G', 'G', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H',
       'H', 'I', 'I', 'I', 'I', 'I', 'I', 'J', 'J', 'J', 'J', 'J', 'J',
       'J', 'J', 'J', 'J', 'J', 'J', 'K', 'K', 'K', 'K', 'K', 'K', 'K',
       'K', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'M', 'M', 'M',
       'M'], dtype='<U1')

In [7]: ag.select('chain L and resnum 14 and icode " "')
Out[7]: <Selection: 'chain L and res...4 and icode " "' from 1ucy (8 atoms)>

@AnthonyBogetti AnthonyBogetti merged commit d7cefe8 into prody:main Jul 17, 2025
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants