Skip to content

Instantly share code, notes, and snippets.

@zeffii
Forked from anonymous/remap_speci.py
Created February 27, 2015 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/5aa56e22193ef6fff7ce to your computer and use it in GitHub Desktop.
Save zeffii/5aa56e22193ef6fff7ce to your computer and use it in GitHub Desktop.
def specific_remap_dict(path_to_pdb):
sd = {}
idx = 0
with open(path_to_pdb) as pdb_file:
for line in pdb_file:
if line.startswith('ATOM'):
annotated = line[12].strip()
specific_element = line[13:16].strip()
if annotated:
element = annotated
else:
element = line[13].strip()
sd[specific_element] = element
idx += 1
return sd
fp = r'C:\Users\dealga\Documents\GitHub\BioBlender\Test_molecules\06_1L2Y_4GE.pdb'
sd = specific_remap_dict(path_to_pdb=fp)
import pprint
pprint.pprint(sd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment