-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ebc6ef
commit a9a63c6
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# python3 | ||
import argparse | ||
from Bio.PDB import * | ||
import sys | ||
# input parameters | ||
ap = argparse.ArgumentParser() | ||
ap.add_argument("-pdb", "--input_pdb", required=True, help="input pdb file") | ||
ap.add_argument("-model", "--pdb_model", required=True, help="model from pdb file to select(integer)") | ||
ap.add_argument("-chain", "--pdb_chain", required=True, help="chain from pdb file to select") | ||
ap.add_argument("-id", "--pdb_id", required=True, help="pdb id of the protein structure") | ||
ap.add_argument("-fasta", "--fasta_file", required=True, help="output fasta file") | ||
args = vars(ap.parse_args()) | ||
#main | ||
def seq_from_pdb(structure): | ||
ppb = PPBuilder() | ||
for pp in ppb.build_peptides(structure): | ||
print(">"+args['pdb_id']+"_"+args['pdb_chain'],pp.get_sequence(), sep="\n") | ||
|
||
parser = PDBParser() | ||
s = parser.get_structure("name", args['input_pdb']) | ||
fill = s[int(args['pdb_model'])][args['pdb_chain']] | ||
sys.stdout = open(args['fasta_file'], 'a') | ||
seq_from_pdb(fill) | ||
sys.stdout.close() |