INNER CODE UNIT · Python
taxa_to_remove
nickjcroucher/gubbins · python/gubbins/PreProcessFasta.py:88
taxa_to_remove = self.taxa_of_duplicate_sequences() + self.taxa_missing_too_much_data()
with open(self.input_filename) as input_handle:
alignments = AlignIO.parse(input_handle, "fasta")
output_alignments = []
number_of_included_alignments = 0
for alignment in alignments:
for record in alignment:
if record.id not in taxa_to_remove:
output_alignments.append(record)
number_of_included_alignments += 1
if number_of_included_alignments <= 1:
sys.exit("Not enough sequences are left after removing duplicates.Please check you input data.")
with open(output_filename, "w") as output_handle:
AlignIO.write(MultipleSeqAlignment(output_alignments), output_handle, "fasta")
return taxa_to_remove