Skip to content

Instantly share code, notes, and snippets.

@alexcritschristoph
Created January 31, 2020 01:10
Show Gist options
  • Save alexcritschristoph/9624fb1a0a567734503e0501f1503304 to your computer and use it in GitHub Desktop.
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
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