Created
January 31, 2020 01:10
-
-
Save alexcritschristoph/9624fb1a0a567734503e0501f1503304 to your computer and use it in GitHub Desktop.
Parses all proteins from antismash and labels them by genome and cluster number
This file contains hidden or 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
import glob | |
from Bio import SeqIO | |
for fn in glob.glob('./antiSMASH/*/*cluster*.gbk'): | |
genome = fn.split("/")[-2] | |
cluster_num = fn.split("cluster")[1].split(".")[0] | |
i = 0 | |
for record in SeqIO.parse(fn, 'genbank'): | |
for feature in record.features: | |
if feature.type == 'CDS': | |
print(">" + genome + "|" + cluster_num + "|" + str(i) + "|" + str(feature.location.start) + ":" + str(feature.location.end)) | |
print(feature.qualifiers['translation'][0]) | |
i += 1 | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment