def test_pm_status_gt_order(self):
        """Status should have a right order when doing gt-comparison"""

        r = Y() > Conserved(aa_pm=0) > Conserved(nt_pm=8, aa_pm=0) \
            > PM(aa_pm=0) > PM(aa_pm=5, nt_pm=10) > NA() > NA(gaps=1)
        self.assertTrue(r)
        self.assertTrue(NA(aa_pm=9999999) > NA(aa_pm=None))
    def test_convert_pm_status_to_string(self):
        """Convert status object to string"""

        input_pairs = ((Y(), 'Y'), (Conserved(aa_pm=0), 'Conserved'),
                       (PM(), 'PM'), (NA(), 'NA'))
        for status, str_status in input_pairs:
            self.assertEqual(str(status), str_status)
示例#3
0
    def test_analyze_with_PM(self):
        """pm.analyze should give the expection value"""

        seq = 'ATGTCGTTCTGCAGCTTCTTCGGGGGCGAGGTTTTCCAGAATCACTTTGAACCT'
        stdseq = 'ATGTCGTTCTGCAGCTTCTTCGGGGGCGAGGTTTTCCAGAATCACTTTGAAACT'

        status = analyze(seq, stdseq)
        self.assertEqual(status, PM(nt_pm=1, aa_pm=1, stdseq=stdseq))
        self.assertEqual(status.seq, seq)
        self.assertEqual(status.stdseq, stdseq)
        self.assertEqual(status.gaps, 0)
        self.assertEqual(status.length, len(seq))
        self.assertEqual(status.nt_pm, 1)
        self.assertEqual(status.aa_pm, 1)
        self.assertIsInstance(status.pattern, TranslatedPattern)
    def test_raise_TypeError1(self):
        """status should raise TypeError when comparing between status operand with incosistent stdseq"""

        with self.assertRaises(TypeError):
            Y(stdseq='atg') > Conserved(stdseq='tga', aa_pm=0) \
            > PM(stdseq='aaa') > NA(stdseq='tgg')
    def test_pm_status_orderablity(self):
        """pm.status should be orderable with gaps-removed but still consistent stdseq"""

        self.assertTrue(
            PM(stdseq='ATGATT', nt_pm=1) > NA(
                stdseq='ATG-ATT', gaps=1, nt_pm=1))
    def test_pm_status_ne_order(self):
        """Status should give right value when doing ne-comparison"""

        r = NA() != PM() != Conserved(aa_pm=0) != Y()
        self.assertTrue(r)
    def test_pm_status_eq_order(self):
        """Status should give right value when doing eq-comparison"""

        r = (Y() == Y()) and (Conserved(aa_pm=0) == Conserved(aa_pm=0)) \
            and (PM() == PM()) and (NA() == NA())
        self.assertTrue(r)
    def test_pm_status_lt_order(self):
        """Status should have a right order when doing lt-comparison"""

        r = NA() < PM() < Conserved(aa_pm=0) < Y()
        self.assertTrue(r)