def parse_gbk(gbks):
for gbk in gbks:<EOL><INDENT>for record in SeqIO.parse(open(gbk), '<STR_LIT>'):<EOL><INDENT>for feature in record.features:<EOL><INDENT>if feature.type == '<STR_LIT>':<EOL><INDENT>try:<EOL><INDENT>locus = feature.qualifiers['<STR_LIT>'][<NUM_LIT:0>]<EOL><DEDENT>except:<EOL><INDENT>continue<EOL><DEDENT><DEDENT>if feature.type == '<STR_LIT>':<EOL><INDENT>try:<EOL><INDENT>locus = feature.qualifiers['<STR_LIT>'][<NUM_LIT:0>]<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT>start = int(feature.location.start) + int(feature.qualifiers['<STR_LIT>'][<NUM_LIT:0>])<EOL>end, strand = int(feature.location.end), feature.location.strand<EOL>if strand is None:<EOL><INDENT>strand = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>strand = -<NUM_LIT:1><EOL><DEDENT>contig = record.id<EOL><INDENT>contig = record.id.rsplit('<STR_LIT:.>', <NUM_LIT:1>)[<NUM_LIT:0>]<EOL><DEDENT>yield contig, [locus,[start, end, strand],feature.qualifiers]<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
parse gbk file