added chain_extract.py and pdb_chain_extract.py
This commit is contained in:
parent
a7d7bceb00
commit
619a828659
2 changed files with 94 additions and 0 deletions
24
scripts/my_pdbtools/chain_extract.py
Executable file
24
scripts/my_pdbtools/chain_extract.py
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
#=======================================================================
|
||||
# TASK: select specified chains from the pdb & save a cropped PDB with
|
||||
# the selected chains. Useful for dimer, etc modelling.
|
||||
|
||||
# link for saving each chain as a separate file
|
||||
# https://stackoverflow.com/questions/11685716/how-to-extract-chains-from-a-pdb-file
|
||||
#=======================================================================
|
||||
|
||||
from Bio.PDB import PDBParser, PDBIO, Select
|
||||
|
||||
|
||||
# Select() Method to return True for every chain in 'chains'
|
||||
class ChainExtract(Select):
|
||||
def __init__(self, chain):
|
||||
self.chain = chain
|
||||
|
||||
def accept_chain(self, chain):
|
||||
#print(dir(chain))
|
||||
if chain.id in self.chain:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
Loading…
Add table
Add a link
Reference in a new issue