def de_rep(fastas, append_index, return_original = False):
ids = []<EOL>for fasta in fastas:<EOL><INDENT>for seq in parse_fasta(fasta):<EOL><INDENT>header = seq[<NUM_LIT:0>].split('<STR_LIT:>>')[<NUM_LIT:1>].split()<EOL>id = header[<NUM_LIT:0>]<EOL>if id not in ids:<EOL><INDENT>ids.append(id)<EOL>if return_original is True:<EOL><INDENT>yield [header, seq]<EOL><DEDENT>else:<EOL><INDENT>yield seq<EOL><DEDENT><DEDENT>elif append_index == True:<EOL><INDENT>new, ids = append_index_id(id, ids) <EOL>if return_original is True:<EOL><INDENT>yield [header, ['<STR_LIT>' % (new, '<STR_LIT:U+0020>'.join(header[<NUM_LIT:1>::])), seq[<NUM_LIT:1>]]]<EOL><DEDENT>else:<EOL><INDENT>yield ['<STR_LIT>' % (new, '<STR_LIT:U+0020>'.join(header[<NUM_LIT:1>::])), seq[<NUM_LIT:1>]]<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
de-replicate fastas based on sequence names