INNER CODE UNIT · Python
is_input_fasta_file_valid
nickjcroucher/gubbins · python/gubbins/ValidateFastaAlignment.py:18
def is_input_fasta_file_valid(self):
try:
if not self.does_each_sequence_have_the_same_length():
print("Each sequence must be the same length")
return False
if not self.are_sequence_names_unique():
print("All sequence names in the fasta file must be unique")
return False
if not self.does_each_sequence_have_a_name_and_genomic_data():
print("Each sequence must have a name and some genomic data")
return False
except:
return False
return True
def does_each_sequence_have_a_name_and_genomic_data(self):
with open(self.input_filename, "r") as input_handle:
alignments = AlignIO.parse(input_handle, "fasta")