-
Notifications
You must be signed in to change notification settings - Fork 4
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
Showing
10 changed files
with
480 additions
and
76 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
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
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
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
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,42 @@ | ||
import os | ||
import sys | ||
from Bio import SeqIO | ||
import argparse | ||
|
||
def create_parser(): | ||
""" Parse arguments """ | ||
parser = argparse.ArgumentParser(description=""" | ||
Program: extractProteinsFromGenBank.py | ||
Author: Rauf Salamzade | ||
Affiliation: Kalan Lab, UW Madison, Department of Medical Microbiology and Immunology | ||
A simple script | ||
""", formatter_class=argparse.RawTextHelpFormatter) | ||
|
||
parser.add_argument('-i', '--gene_cluster_genbank', help='Path to gene cluster genbank.', required=True) | ||
args = parser.parse_args() | ||
return args | ||
|
||
myargs = create_parser() | ||
gbk_file = myargs.gene_cluster_genbank | ||
|
||
counter = 0 | ||
with open(gbk_file) as ogbf: | ||
for rec in SeqIO.parse(ogbf, 'genbank'): | ||
for feat in rec.features: | ||
if not feat.type == 'CDS': continue | ||
protein_id = None | ||
try: | ||
protein_id = feat.qualifiers.get('locus_tag')[0] | ||
except: | ||
pass | ||
|
||
if protein_id == None: | ||
try: | ||
protein_id = feat.qualifiers.get('protein_id')[0] | ||
except: | ||
pass | ||
if protein_id == None: | ||
protein_id = 'CDS_' + str(counter) | ||
counter += 1 | ||
print('>' + protein_id + '\n' + str(feat.qualifiers.get('translation')[0])) |
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
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
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
Oops, something went wrong.