LSHTM_analysis/scripts/chain_splitter.py

28 lines
745 B
Python
Executable file

#!/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