INNER CODE UNIT · Python

sequence_length

nickjcroucher/gubbins · python/gubbins/ValidateFastaAlignment.py:55

          sequence_length = -1
          for alignment in alignments:
              for record in alignment:
                 if sequence_length == -1:
                   sequence_length = len(record.seq)
                 elif sequence_length != len(record.seq):
                   print("Error with the input FASTA file: The sequences are not of the same length, this is not an alignment: "+record.name)
                   return False
      except:
        print("Unexpected error:", sys.exc_info()[0])
        print("Error with the input FASTA file: It is in the wrong format, check it is an alignment")
        return False
      return True

    def are_sequence_names_unique(self):
        any_modified_names = False
        with open(self.input_filename) as input_handle:
            alignment = AlignIO.read(input_handle, "fasta")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…