added pdb_chain splitter code and wrapper

This commit is contained in:
Tanushree Tunstall 2020-05-13 16:54:20 +01:00
parent 3425d8fa2b
commit 65db4a090e
5 changed files with 114 additions and 2 deletions

28
scripts/chain_splitter.py Executable file
View file

@ -0,0 +1,28 @@
#!/usr/bin/python3
#=======================================================================
# TASK: extract chain from pdb and save each chain as a separate file
# link for saving each chain as a separate file
#=======================================================================
__description__ = \
"""
pdb_chain_splitter.py
extracts chains and saves them as separate pdb files.
"""
__author__ = "Tanushree Tunstall"
__date__ = ""
from Bio.PDB import Select, PDBIO
from Bio.PDB.PDBParser import PDBParser
class ChainSelect(Select):
def __init__(self, chain):
self.chain = chain
def accept_chain(self, chain):
if chain.get_id() == self.chain:
return 1
else:
return 0