Created
June 30, 2022 05:48
-
-
Save ipetrushin/eef0bb2dcded2e5529f2386653911d33 to your computer and use it in GitHub Desktop.
count genes in GenBank file
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
#!/usr/bin/env python | |
from Bio import SeqIO | |
import sys | |
import os | |
from collections import OrderedDict | |
gbk_file = sys.argv[1] | |
genes_list = ("porQ", "porV") | |
if not os.path.isfile(gbk_file): | |
print ("Input file doesn't exists") | |
sys.exit() | |
for index, record in enumerate(SeqIO.parse(gbk_file, "genbank")): | |
for f in record.features: | |
if ('gene' in f.qualifiers) and (f.qualifiers['gene'][0] in genes_list): | |
print(f.qualifiers['gene'][0]) #locus_prot[f.qualifiers['protein_id'][0]] = f.qualifiers['old_locus_tag'][0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment