Skip to content

Instantly share code, notes, and snippets.

@JoaoRodrigues
Last active August 29, 2015 14:07
Show Gist options
  • Save JoaoRodrigues/6a2569e8e12eb8c9f35b to your computer and use it in GitHub Desktop.
Save JoaoRodrigues/6a2569e8e12eb8c9f35b to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from Bio.PDB import PDBParser, PDBIO,
class PREFilter(Select):
def accept_atom(self, atom):
forbidden_atoms = set(['N', 'C', '...'])
if atom.parent.resname == 'CYS' and atom.name in forbidden_atoms:
if atom - atom.parent['CA'] > 3.0:
continue
parser = PDBParser(QUIET=1)
structure = parser.get_structure('example', 'example.pdb')
io = PDBIO()
io.set_structure(structure)
io.save('exmaple_filtered.pdb', PREFilter())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment