Skip to content

Instantly share code, notes, and snippets.

@fusion809
Last active July 25, 2017 16:53
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 fusion809/11278bea129cee1adfa495e0767c8439 to your computer and use it in GitHub Desktop.
Save fusion809/11278bea129cee1adfa495e0767c8439 to your computer and use it in GitHub Desktop.
./ligand-pdb.py: line 4: FK5: command not found
./ligand-pdb.py: line 6: isatom: command not found
./ligand-pdb.py: line 7: syntax error near unexpected token `('
./ligand-pdb.py: line 7: `with open(dataname) as f:'
# Remove rows from .pdb
import numpy as np
dataname='1yat.pdb'
keyword= 'FK5'
isatom = False
with open(dataname) as f:
for line in f:
new_str=' '.join(line.split())
vals= new_str.split(' ')
if isatom == False:
print(line, end='')
if vals[0] == 'ATOM':
isatom = True
if vals[0] == 'ATOM' or vals[0] == 'HETATM' :
if vals[3] != keyword:
print(line,end='')
pass
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment