Esempio n. 1
0
class StarTestCases(unittest.TestCase):
    def setUp(self):
        self.star_PAM250 = Star(PAM250())
        self.star_Blosum62 = Star(Blosum62())

    def test_most_frequent_A_with_BLOSUM62(self):
        # setup
        sequences = ['AA', 'AC', 'AC']

        # results
        result = self.star_Blosum62.compute(sequences)
        expected = 30

        # check
        self.assertEqual(expected, result)

    def test_most_frequent_with_PAM250(self):
        # setup
        sequences = ['AA', 'AC', 'AC']

        # results
        result = self.star_PAM250.compute(sequences)
        expected = 28

        # check
        self.assertEqual(expected, result)

    def test_most_frequent_gaps_with_PAM250(self):
        # setup
        sequences = ['AA', 'A-', 'AC']

        # results
        result = self.star_PAM250.compute(sequences)
        expected = -2

        # check
        self.assertEqual(expected, result)

    def test_most_frequent_gaps_with_BLOSUM62(self):
        # setup
        sequences = ['AA', 'A-', 'AC']

        # results
        result = self.star_Blosum62.compute(sequences)
        expected = 8

        # check
        self.assertEqual(expected, result)
Esempio n. 2
0
    def test_should_print_class_name(self):
        # setup
        sumofpairs = SumOfPairs().get_name()
        star = Star().get_name()
        entropy = Entropy().get_name()

        # check
        self.assertEqual("SumOfPairs", sumofpairs)
        self.assertEqual("Star", star)
        self.assertEqual("Entropy", entropy)
Esempio n. 3
0
    def test_most_frequent_A_with_BLOSUM62(self):
        # setup
        sequences = MSA(['AA', 'AC', 'AC'])

        # results
        result = Star(sequences, Blosum62()).compute()
        expected = 30

        # check
        self.assertEqual(expected, result)
Esempio n. 4
0
    def test_most_frequent_gaps_with_PAM250(self):
        # setup
        sequences = MSA(['AA', 'A-', 'AC'])

        # results
        result = Star(sequences, PAM250()).compute()
        expected = -2

        # check
        self.assertEqual(expected, result)
Esempio n. 5
0
def run_all_scores(msa: list) -> None:
    align_sequences = list(pair[1] for pair in msa)
    sequences_id = list(pair[0] for pair in msa)

    # Percentage of non-gaps and totally conserved columns
    non_gaps = PercentageOfNonGaps()
    totally_conserved_columns = PercentageOfTotallyConservedColumns()

    percentage = non_gaps.compute(align_sequences)
    conserved = totally_conserved_columns.compute(align_sequences)
    print("Percentage of non-gaps: {0} %".format(percentage))
    print("Percentage of totally conserved columns: {0}".format(conserved))

    # Entropy
    value = Entropy().compute(align_sequences=align_sequences)
    print("Entropy score: {0}".format(value))

    # Sum of pairs
    value = SumOfPairs(Blosum62()).compute(align_sequences=align_sequences)
    print("SumOfPairs score (Blosum62): {0}".format(value))

    value = SumOfPairs(PAM250()).compute(align_sequences=align_sequences)
    print("SumOfPairs score (PAM250): {0}".format(value))

    value = SumOfPairs(FileMatrix('PAM380.txt')).compute(align_sequences=align_sequences)
    print("SumOfPairs score (PAM380): {0}".format(value))

    # Star
    value = Star(Blosum62()).compute(align_sequences=align_sequences)
    print("Star score (Blosum62): {0}".format(value))

    value = Star(PAM250()).compute(align_sequences=align_sequences)
    print("Star score (PAM250): {0}".format(value))

    # STRIKE
    value = Strike().compute(align_sequences=align_sequences,
                             sequences_id=sequences_id,
                             chains=['A', 'E', 'A', 'A'])
    print("STRIKE score: {0}".format(value))
Esempio n. 6
0
 def setUp(self):
     self.star_PAM250 = Star(PAM250())
     self.star_Blosum62 = Star(Blosum62())