Esempio n. 1
0
 def setUp(self):
     self.empty = ProteinSequence('')
     self.p1 = ProteinSequence('GREG')
     self.p2 = ProteinSequence('PRTEINSEQNCE',
                               id="test-seq-2",
                               description="A test sequence")
     self.p3 = ProteinSequence('PROTEIN',
                               id="bad-seq-1",
                               description="Not a protein sequence")
Esempio n. 2
0
 def test_iupac_characters(self):
     exp = {
         'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N',
         'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b',
         'c', 'd', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'm', 'n', 'p', 'q',
         'r', 's', 't', 'v', 'w', 'x', 'y', 'z'
     }
     self.assertEqual(self.p1.iupac_characters(), exp)
     self.assertEqual(ProteinSequence.iupac_characters(), exp)
Esempio n. 3
0
 def setUp(self):
     self.empty = ProteinSequence('')
     self.p1 = ProteinSequence('GREG')
     self.p2 = ProteinSequence(
         'PRTEINSEQNCE', id="test-seq-2",
         description="A test sequence")
     self.p3 = ProteinSequence(
         'PROTEIN', id="bad-seq-1",
         description="Not a protein sequence")
Esempio n. 4
0
 def test_iupac_characters(self):
     exp = {
         'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N',
         'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c',
         'd', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'm', 'n', 'p', 'q', 'r',
         's', 't', 'v', 'w', 'x', 'y', 'z'
     }
     self.assertEqual(self.p1.iupac_characters(), exp)
     self.assertEqual(ProteinSequence.iupac_characters(), exp)
Esempio n. 5
0
 def test_iupac_degeneracies(self):
     exp = {
         'B': set(['D', 'N']), 'Z': set(['E', 'Q']),
         'X': set(['A', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M',
                   'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'Y']),
         'b': set(['d', 'n']), 'z': set(['e', 'q']),
         'x': set(['a', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'm',
                   'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'y']),
     }
     self.assertEqual(self.p1.iupac_degeneracies(), exp)
     self.assertEqual(ProteinSequence.iupac_degeneracies(), exp)
Esempio n. 6
0
 def test_iupac_degeneracies(self):
     exp = {
         'B': set(['D', 'N']), 'Z': set(['E', 'Q']),
         'X': set(['A', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M',
                   'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'Y']),
         'b': set(['d', 'n']), 'z': set(['e', 'q']),
         'x': set(['a', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'm',
                   'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'y']),
     }
     self.assertEqual(self.p1.iupac_degeneracies(), exp)
     self.assertEqual(ProteinSequence.iupac_degeneracies(), exp)
Esempio n. 7
0
 def test_iupac_degenerate_characters(self):
     exp = set(['B', 'X', 'Z', 'b', 'x', 'z'])
     self.assertEqual(self.p1.iupac_degenerate_characters(), exp)
     self.assertEqual(ProteinSequence.iupac_degenerate_characters(), exp)
Esempio n. 8
0
 def test_iupac_standard_characters(self):
     exp = set("ACDEFGHIKLMNPQRSTVWYacdefghiklmnpqrstvwy")
     self.assertEqual(self.p1.iupac_standard_characters(), exp)
     self.assertEqual(ProteinSequence.iupac_standard_characters(), exp)
Esempio n. 9
0
class ProteinSequenceTests(TestCase):

    def setUp(self):
        self.empty = ProteinSequence('')
        self.p1 = ProteinSequence('GREG')
        self.p2 = ProteinSequence(
            'PRTEINSEQNCE', id="test-seq-2",
            description="A test sequence")
        self.p3 = ProteinSequence(
            'PROTEIN', id="bad-seq-1",
            description="Not a protein sequence")

    def test_alphabet(self):
        exp = {
            'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N',
            'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c',
            'd', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'm', 'n', 'p', 'q', 'r',
            's', 't', 'v', 'w', 'x', 'y', 'z'
        }

        self.assertEqual(self.p1.alphabet(), exp)
        self.assertEqual(ProteinSequence.alphabet(), exp)

    def test_gap_alphabet(self):
        self.assertEqual(self.p1.gap_alphabet(), set('-.'))

    def test_iupac_standard_characters(self):
        exp = set("ACDEFGHIKLMNPQRSTVWYacdefghiklmnpqrstvwy")
        self.assertEqual(self.p1.iupac_standard_characters(), exp)
        self.assertEqual(ProteinSequence.iupac_standard_characters(), exp)

    def test_iupac_degeneracies(self):
        exp = {
            'B': set(['D', 'N']), 'Z': set(['E', 'Q']),
            'X': set(['A', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M',
                      'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'Y']),
            'b': set(['d', 'n']), 'z': set(['e', 'q']),
            'x': set(['a', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'm',
                      'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'y']),
        }
        self.assertEqual(self.p1.iupac_degeneracies(), exp)
        self.assertEqual(ProteinSequence.iupac_degeneracies(), exp)

    def test_iupac_degenerate_characters(self):
        exp = set(['B', 'X', 'Z', 'b', 'x', 'z'])
        self.assertEqual(self.p1.iupac_degenerate_characters(), exp)
        self.assertEqual(ProteinSequence.iupac_degenerate_characters(), exp)

    def test_iupac_characters(self):
        exp = {
            'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N',
            'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b',
            'c', 'd', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'm', 'n', 'p', 'q',
            'r', 's', 't', 'v', 'w', 'x', 'y', 'z'
        }
        self.assertEqual(self.p1.iupac_characters(), exp)
        self.assertEqual(ProteinSequence.iupac_characters(), exp)

    def test_nondegenerates(self):
        exp = [ProteinSequence('AD'), ProteinSequence('AN')]
        # Sort based on sequence string, as order is not guaranteed.
        obs = sorted(ProteinSequence('AB').nondegenerates(), key=str)
        self.assertEqual(obs, exp)
Esempio n. 10
0
 def test_nondegenerates(self):
     exp = [ProteinSequence('AD'), ProteinSequence('AN')]
     # Sort based on sequence string, as order is not guaranteed.
     obs = sorted(ProteinSequence('AB').nondegenerates(), key=str)
     self.assertEqual(obs, exp)
Esempio n. 11
0
 def test_iupac_degenerate_characters(self):
     exp = set(['B', 'X', 'Z', 'b', 'x', 'z'])
     self.assertEqual(self.p1.iupac_degenerate_characters(), exp)
     self.assertEqual(ProteinSequence.iupac_degenerate_characters(), exp)
Esempio n. 12
0
 def test_iupac_standard_characters(self):
     exp = set("ACDEFGHIKLMNPQRSTVWYacdefghiklmnpqrstvwy")
     self.assertEqual(self.p1.iupac_standard_characters(), exp)
     self.assertEqual(ProteinSequence.iupac_standard_characters(), exp)
Esempio n. 13
0
class ProteinSequenceTests(TestCase):
    def setUp(self):
        self.empty = ProteinSequence('')
        self.p1 = ProteinSequence('GREG')
        self.p2 = ProteinSequence('PRTEINSEQNCE',
                                  id="test-seq-2",
                                  description="A test sequence")
        self.p3 = ProteinSequence('PROTEIN',
                                  id="bad-seq-1",
                                  description="Not a protein sequence")

    def test_alphabet(self):
        exp = {
            'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N',
            'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c',
            'd', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'm', 'n', 'p', 'q', 'r',
            's', 't', 'v', 'w', 'x', 'y', 'z'
        }

        self.assertEqual(self.p1.alphabet(), exp)
        self.assertEqual(ProteinSequence.alphabet(), exp)

    def test_gap_alphabet(self):
        self.assertEqual(self.p1.gap_alphabet(), set('-.'))

    def test_iupac_standard_characters(self):
        exp = set("ACDEFGHIKLMNPQRSTVWYacdefghiklmnpqrstvwy")
        self.assertEqual(self.p1.iupac_standard_characters(), exp)
        self.assertEqual(ProteinSequence.iupac_standard_characters(), exp)

    def test_iupac_degeneracies(self):
        exp = {
            'B':
            set(['D', 'N']),
            'Z':
            set(['E', 'Q']),
            'X':
            set([
                'A', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N',
                'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'Y'
            ]),
            'b':
            set(['d', 'n']),
            'z':
            set(['e', 'q']),
            'x':
            set([
                'a', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'm', 'n',
                'p', 'q', 'r', 's', 't', 'v', 'w', 'y'
            ]),
        }
        self.assertEqual(self.p1.iupac_degeneracies(), exp)
        self.assertEqual(ProteinSequence.iupac_degeneracies(), exp)

    def test_iupac_degenerate_characters(self):
        exp = set(['B', 'X', 'Z', 'b', 'x', 'z'])
        self.assertEqual(self.p1.iupac_degenerate_characters(), exp)
        self.assertEqual(ProteinSequence.iupac_degenerate_characters(), exp)

    def test_iupac_characters(self):
        exp = {
            'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N',
            'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c',
            'd', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'm', 'n', 'p', 'q', 'r',
            's', 't', 'v', 'w', 'x', 'y', 'z'
        }
        self.assertEqual(self.p1.iupac_characters(), exp)
        self.assertEqual(ProteinSequence.iupac_characters(), exp)

    def test_nondegenerates(self):
        exp = [ProteinSequence('AD'), ProteinSequence('AN')]
        # Sort based on sequence string, as order is not guaranteed.
        obs = sorted(ProteinSequence('AB').nondegenerates(), key=str)
        self.assertEqual(obs, exp)