def parse_orf(insertion, gff):
offset = insertion['<STR_LIT>']<EOL>if type(insertion['<STR_LIT>']) is not str:<EOL><INDENT>return gff<EOL><DEDENT>for orf in parse_fasta(insertion['<STR_LIT>'].split('<STR_LIT:|>')):<EOL><INDENT>ID = orf[<NUM_LIT:0>].split('<STR_LIT:>>')[<NUM_LIT:1>].split()[<NUM_LIT:0>]<EOL>Start, End, strand = [int(i) for i in orf[<NUM_LIT:0>].split('<STR_LIT>')[<NUM_LIT:1>:<NUM_LIT:4>]]<EOL>if strand == <NUM_LIT:1>:<EOL><INDENT>strand = '<STR_LIT:+>'<EOL><DEDENT>else:<EOL><INDENT>strand = '<STR_LIT:->'<EOL><DEDENT>GeneStrand = insertion['<STR_LIT>']<EOL>if strand != GeneStrand:<EOL><INDENT>if strand == '<STR_LIT:+>':<EOL><INDENT>strand = '<STR_LIT:->'<EOL><DEDENT>else:<EOL><INDENT>strand = '<STR_LIT:+>'<EOL><DEDENT>Start, End = End - <NUM_LIT:2>, Start - <NUM_LIT:2><EOL><DEDENT>Start, End = abs(Start + offset) - <NUM_LIT:1>, abs(End + offset) - <NUM_LIT:1><EOL>annot = orf[<NUM_LIT:0>].split()[<NUM_LIT:1>]<EOL>if annot == '<STR_LIT>':<EOL><INDENT>annot = '<STR_LIT>'<EOL><DEDENT>gff['<STR_LIT>'].append(insertion['<STR_LIT>'])<EOL>gff['<STR_LIT:source>'].append('<STR_LIT>')<EOL>gff['<STR_LIT>'].append('<STR_LIT>')<EOL>gff['<STR_LIT:start>'].append(Start)<EOL>gff['<STR_LIT:end>'].append(End)<EOL>gff['<STR_LIT>'].append('<STR_LIT:.>')<EOL>gff['<STR_LIT>'].append(strand)<EOL>gff['<STR_LIT>'].append('<STR_LIT:.>')<EOL>gff['<STR_LIT>'].append('<STR_LIT>' % (ID, annot))<EOL><DEDENT>return gff<EOL>
parse ORF to gff format