Skip to content

Instantly share code, notes, and snippets.

@normcyr
Created August 2, 2017 15:26
Show Gist options
  • Save normcyr/8daac70b125569782de588a64973b652 to your computer and use it in GitHub Desktop.
Save normcyr/8daac70b125569782de588a64973b652 to your computer and use it in GitHub Desktop.
Read a PDB entry using the pypdb module
from pypdb import *
#testPdb = '4xkl'
#testPdb = '5v4k'
testPdb = '3vtv'
entityExtraInfo = get_all_info(testPdb)
print(entityExtraInfo)
print('\n')
if int(describe_pdb(testPdb)['nr_entities']) == 1:
print(entityExtraInfo.get('polymer').get('macroMolecule').get('@name'))
elif int(describe_pdb(testPdb)['nr_entities']) > 1:
for mol in entityExtraInfo['polymer']:
print(mol.get('macroMolecule').get('@name'))
else:
print('No molecule name available')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment