def analyze_fa(fa):
if fa.name == '<STR_LIT>':<EOL><INDENT>safe = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>safe = '<STR_LIT>' % (fa.name)<EOL><DEDENT>safe = open(safe, '<STR_LIT:w>')<EOL>sequences = {} <EOL>insertions = {} <EOL>count = <NUM_LIT:0><EOL>id2name = {}<EOL>names = []<EOL>for seq in parse_fasta(fa):<EOL><INDENT>id = '<STR_LIT>' % (count,)<EOL>name = seq[<NUM_LIT:0>].split('<STR_LIT:>>', <NUM_LIT:1>)[<NUM_LIT:1>]<EOL>id2name[id] = name<EOL>id2name[name] = id<EOL>names.append(name)<EOL>insertions[id] = insertions_from_masked(seq[<NUM_LIT:1>])<EOL>sequences[id] = seq<EOL>print('<STR_LIT:\n>'.join(['<STR_LIT>' % (id), seq[<NUM_LIT:1>].upper()]), file=safe)<EOL>count += <NUM_LIT:1><EOL><DEDENT>safe.close()<EOL>lookup = open('<STR_LIT>' % (fa.name), '<STR_LIT:w>')<EOL>for i in list(id2name.items()):<EOL><INDENT>print('<STR_LIT:\t>'.join(i), file=lookup)<EOL><DEDENT>lookup.close()<EOL>return safe.name, sequences, id2name, names, insertions<EOL>
analyze fa (names, insertions) and convert fasta to prodigal/cmscan safe file
- find insertions (masked sequence)
- make upper case
- assign names to id number