def run_all_scores(msa: list) -> None: sequences = list(pair[1] for pair in msa) non_gaps = PercentageOfNonGaps() totally_conserved_columns = PercentageOfTotallyConservedColumns() percentage = non_gaps.compute(sequences) conserved = totally_conserved_columns.compute(sequences) logger.info("Percentage of non-gaps: {0} %".format(percentage)) logger.info("Percentage of totally conserved columns: {0}".format(conserved)) score_method = Entropy() value = compute_score(score_method, sequences) logger.info("Entropy score: {0}".format(value)) score_method = SumOfPairs(Blosum62()) value = compute_score(score_method, sequences) logger.info("SumOfPairs score (Blosum62): {0}".format(value)) score_method = SumOfPairs(PAM250()) value = compute_score(score_method, sequences) logger.info("{0} score (PAM250): {1}".format(score_method.get_name(), value)) score_method = Star(Blosum62()) value = compute_score(score_method, sequences) logger.info("Star score (Blosum62): {0}".format(value)) score_method = Star(PAM250()) value = compute_score(score_method, sequences) logger.info("Star score (PAM250): {0}".format(value))
def test_should_get_distance_return_the_gap_penalty_if_a_char_is_a_gap( self): matrix = Blosum62() self.assertEqual(matrix.get_gap_penalty(), matrix.get_distance('A', '-')) self.assertEqual(matrix.get_gap_penalty(), matrix.get_distance('-', 'B'))
def test_should_get_distance_return_the_correct_values_if_there_are_no_gaps( self): matrix = Blosum62() self.assertEqual(-1, matrix.get_distance('A', 'R')) self.assertEqual(-3, matrix.get_distance('N', 'F')) self.assertEqual(-2, matrix.get_distance('X', 'C')) self.assertEqual(+4, matrix.get_distance('I', 'I')) self.assertEqual(+4, matrix.get_distance('V', 'V'))
def setUp(self): self.star_PAM250 = Star(PAM250()) self.star_Blosum62 = Star(Blosum62())
def setUp(self): self.sumofpairs_PAM250 = SumOfPairs(PAM250()) self.sumofpairs_Blosum62 = SumOfPairs(Blosum62())
def test_should_constructor__modify_the_gap_penalty(self): matrix = Blosum62(-10) self.assertEqual(-10, matrix.get_gap_penalty())
def test_should_default_gap_penalty_be_minus_eight(self): matrix = Blosum62() self.assertEqual(-8, matrix.get_gap_penalty())
def test_should_get_distance_throw_an_exception_if_a_char_is_invalid(self): matrix = Blosum62() with self.assertRaises(Exception): matrix.get_distance('J', 'A')
def test_should_get_distance_return_one_if_the_two_chars_are_gaps(self): matrix = Blosum62() self.assertEqual(1, matrix.get_distance('-', '-'))