I recommend using biopython
from Bio import SeqIO
file = "file.gb"
#gb = next(SeqIO.parse(open(file), "genbank")) in python 3
gb = SeqIO.parse(open(file), "gb").next()
phosphorylation_list = [f for f in gb.features if f.type=="Site" and
"phosphorylation" in f.qualifiers['site_type']]
for f in phosphorylation_list:
print((int(f.location.start), int(f.location.end)))
you get,
(228, 229) (677, 678) (692, 693) (694, 695) (990, 991) (994, 995) (997, 998) (1015, 1016) (1025, 1026) (1038, 1039) (1040, 1041) (1041, 1042) (1063, 1064) (1068, 1069) (1069, 1070) (1070, 1071) (1080, 1081) (1091, 1092) (1109, 1110) (1165, 1166) (1171, 1172) (1196, 1197)
0
solved how to write in python without using Biopython package