當前位置: 首頁>>代碼示例>>Python>>正文


Python sequence.NucleotideSequence類代碼示例

本文整理匯總了Python中skbio.core.sequence.NucleotideSequence的典型用法代碼示例。如果您正苦於以下問題:Python NucleotideSequence類的具體用法?Python NucleotideSequence怎麽用?Python NucleotideSequence使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了NucleotideSequence類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_lower

 def test_lower(self):
     """ lower functions as expected
     """
     b = NucleotideSequence('GAt.ACa-', identifier='x', description='42')
     expected = NucleotideSequence('gat.aca-', identifier='x',
                                   description='42')
     self.assertEqual(b.lower(), expected)
開發者ID:teravest,項目名稱:scikit-bio,代碼行數:7,代碼來源:test_sequence.py

示例2: test_iupac_degeneracies

    def test_iupac_degeneracies(self):
        exp = {
            # upper
            'B': set(['C', 'U', 'T', 'G']), 'D': set(['A', 'U', 'T', 'G']),
            'H': set(['A', 'C', 'U', 'T']), 'K': set(['U', 'T', 'G']),
            'M': set(['A', 'C']), 'N': set(['A', 'C', 'U', 'T', 'G']),
            'S': set(['C', 'G']), 'R': set(['A', 'G']),
            'W': set(['A', 'U', 'T']), 'V': set(['A', 'C', 'G']),
            'Y': set(['C', 'U', 'T']),
            # lower
            'b': set(['c', 'u', 't', 'g']), 'd': set(['a', 'u', 't', 'g']),
            'h': set(['a', 'c', 'u', 't']), 'k': set(['u', 't', 'g']),
            'm': set(['a', 'c']), 'n': set(['a', 'c', 'u', 't', 'g']),
            's': set(['c', 'g']), 'r': set(['a', 'g']),
            'w': set(['a', 'u', 't']), 'v': set(['a', 'c', 'g']),
            'y': set(['c', 'u', 't'])
        }
        self.assertEqual(self.b1.iupac_degeneracies(), exp)
        self.assertEqual(NucleotideSequence.iupac_degeneracies(), exp)

        # Test that we can modify a copy of the mapping without altering the
        # canonical representation.
        degen = NucleotideSequence.iupac_degeneracies()
        degen.update({'V': set("BRO"), 'Z': set("ZORRO")})
        self.assertNotEqual(degen, exp)
        self.assertEqual(NucleotideSequence.iupac_degeneracies(), exp)
開發者ID:BANSHEE-,項目名稱:scikit-bio,代碼行數:26,代碼來源:test_sequence.py

示例3: test_upper

 def test_upper(self):
     """ upper functions as expected
     """
     b = NucleotideSequence('GAt.ACa-', identifier='x', description='42')
     expected = NucleotideSequence('GAT.ACA-', identifier='x',
                                   description='42')
     self.assertEqual(b.upper(), expected)
開發者ID:teravest,項目名稱:scikit-bio,代碼行數:7,代碼來源:test_sequence.py

示例4: setUp

 def setUp(self):
     """ Initialize values to be used in tests
     """
     self.empty = NucleotideSequence('')
     self.b1 = NucleotideSequence('GATTACA')
     self.b2 = NucleotideSequence(
         'ACCGGUACC', identifier="test-seq-2",
         description="A test sequence")
開發者ID:teravest,項目名稱:scikit-bio,代碼行數:8,代碼來源:test_sequence.py

示例5: test_iupac_characters

    def test_iupac_characters(self):
        exp = {
            'A', 'C', 'B', 'D', 'G', 'H', 'K', 'M', 'N', 'S', 'R', 'U', 'T',
            'W', 'V', 'Y', 'a', 'c', 'b', 'd', 'g', 'h', 'k', 'm', 'n', 's',
            'r', 'u', 't', 'w', 'v', 'y'
        }

        self.assertEqual(self.b1.iupac_characters(), exp)
        self.assertEqual(NucleotideSequence.iupac_characters(), exp)
開發者ID:BANSHEE-,項目名稱:scikit-bio,代碼行數:9,代碼來源:test_sequence.py

示例6: test_alphabet

    def test_alphabet(self):
        exp = {
            'A', 'C', 'B', 'D', 'G', 'H', 'K', 'M', 'N', 'S', 'R', 'U', 'T',
            'W', 'V', 'Y', 'a', 'c', 'b', 'd', 'g', 'h', 'k', 'm', 'n', 's',
            'r', 'u', 't', 'w', 'v', 'y'
        }

        # Test calling from an instance and purely static context.
        self.assertEqual(self.b1.alphabet(), exp)
        self.assertEqual(NucleotideSequence.alphabet(), exp)
開發者ID:BANSHEE-,項目名稱:scikit-bio,代碼行數:10,代碼來源:test_sequence.py

示例7: test_iupac_degenerate_characters

 def test_iupac_degenerate_characters(self):
     exp = set(['B', 'D', 'H', 'K', 'M', 'N', 'S', 'R', 'W', 'V', 'Y',
                'b', 'd', 'h', 'k', 'm', 'n', 's', 'r', 'w', 'v', 'y'])
     self.assertEqual(self.b1.iupac_degenerate_characters(), exp)
     self.assertEqual(NucleotideSequence.iupac_degenerate_characters(), exp)
開發者ID:BANSHEE-,項目名稱:scikit-bio,代碼行數:5,代碼來源:test_sequence.py

示例8: test_iupac_standard_characters

 def test_iupac_standard_characters(self):
     exp = set("ACGTUacgtu")
     self.assertEqual(self.b1.iupac_standard_characters(), exp)
     self.assertEqual(NucleotideSequence.iupac_standard_characters(), exp)
開發者ID:BANSHEE-,項目名稱:scikit-bio,代碼行數:4,代碼來源:test_sequence.py

示例9: test_complement_map

 def test_complement_map(self):
     exp = {}
     self.assertEqual(self.b1.complement_map(), exp)
     self.assertEqual(NucleotideSequence.complement_map(), exp)
開發者ID:BANSHEE-,項目名稱:scikit-bio,代碼行數:4,代碼來源:test_sequence.py

示例10: setUp

 def setUp(self):
     self.empty = NucleotideSequence('')
     self.b1 = NucleotideSequence('GATTACA')
     self.b2 = NucleotideSequence(
         'ACCGGUACC', id="test-seq-2",
         description="A test sequence")
開發者ID:BANSHEE-,項目名稱:scikit-bio,代碼行數:6,代碼來源:test_sequence.py

示例11: NucelotideSequenceTests

class NucelotideSequenceTests(TestCase):

    def setUp(self):
        self.empty = NucleotideSequence('')
        self.b1 = NucleotideSequence('GATTACA')
        self.b2 = NucleotideSequence(
            'ACCGGUACC', id="test-seq-2",
            description="A test sequence")

    def test_alphabet(self):
        exp = {
            'A', 'C', 'B', 'D', 'G', 'H', 'K', 'M', 'N', 'S', 'R', 'U', 'T',
            'W', 'V', 'Y', 'a', 'c', 'b', 'd', 'g', 'h', 'k', 'm', 'n', 's',
            'r', 'u', 't', 'w', 'v', 'y'
        }

        # Test calling from an instance and purely static context.
        self.assertEqual(self.b1.alphabet(), exp)
        self.assertEqual(NucleotideSequence.alphabet(), exp)

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

    def test_complement_map(self):
        exp = {}
        self.assertEqual(self.b1.complement_map(), exp)
        self.assertEqual(NucleotideSequence.complement_map(), exp)

    def test_iupac_standard_characters(self):
        exp = set("ACGTUacgtu")
        self.assertEqual(self.b1.iupac_standard_characters(), exp)
        self.assertEqual(NucleotideSequence.iupac_standard_characters(), exp)

    def test_iupac_degeneracies(self):
        exp = {
            # upper
            'B': set(['C', 'U', 'T', 'G']), 'D': set(['A', 'U', 'T', 'G']),
            'H': set(['A', 'C', 'U', 'T']), 'K': set(['U', 'T', 'G']),
            'M': set(['A', 'C']), 'N': set(['A', 'C', 'U', 'T', 'G']),
            'S': set(['C', 'G']), 'R': set(['A', 'G']),
            'W': set(['A', 'U', 'T']), 'V': set(['A', 'C', 'G']),
            'Y': set(['C', 'U', 'T']),
            # lower
            'b': set(['c', 'u', 't', 'g']), 'd': set(['a', 'u', 't', 'g']),
            'h': set(['a', 'c', 'u', 't']), 'k': set(['u', 't', 'g']),
            'm': set(['a', 'c']), 'n': set(['a', 'c', 'u', 't', 'g']),
            's': set(['c', 'g']), 'r': set(['a', 'g']),
            'w': set(['a', 'u', 't']), 'v': set(['a', 'c', 'g']),
            'y': set(['c', 'u', 't'])
        }
        self.assertEqual(self.b1.iupac_degeneracies(), exp)
        self.assertEqual(NucleotideSequence.iupac_degeneracies(), exp)

        # Test that we can modify a copy of the mapping without altering the
        # canonical representation.
        degen = NucleotideSequence.iupac_degeneracies()
        degen.update({'V': set("BRO"), 'Z': set("ZORRO")})
        self.assertNotEqual(degen, exp)
        self.assertEqual(NucleotideSequence.iupac_degeneracies(), exp)

    def test_iupac_degenerate_characters(self):
        exp = set(['B', 'D', 'H', 'K', 'M', 'N', 'S', 'R', 'W', 'V', 'Y',
                   'b', 'd', 'h', 'k', 'm', 'n', 's', 'r', 'w', 'v', 'y'])
        self.assertEqual(self.b1.iupac_degenerate_characters(), exp)
        self.assertEqual(NucleotideSequence.iupac_degenerate_characters(), exp)

    def test_iupac_characters(self):
        exp = {
            'A', 'C', 'B', 'D', 'G', 'H', 'K', 'M', 'N', 'S', 'R', 'U', 'T',
            'W', 'V', 'Y', 'a', 'c', 'b', 'd', 'g', 'h', 'k', 'm', 'n', 's',
            'r', 'u', 't', 'w', 'v', 'y'
        }

        self.assertEqual(self.b1.iupac_characters(), exp)
        self.assertEqual(NucleotideSequence.iupac_characters(), exp)

    def test_complement(self):
        self.assertRaises(BiologicalSequenceError,
                          self.b1.complement)

    def test_reverse_complement(self):
        self.assertRaises(BiologicalSequenceError,
                          self.b1.reverse_complement)

    def test_is_reverse_complement(self):
        self.assertRaises(BiologicalSequenceError,
                          self.b1.is_reverse_complement, self.b1)

    def test_nondegenerates_invalid(self):
        with self.assertRaises(BiologicalSequenceError):
            list(NucleotideSequence('AZA').nondegenerates())

    def test_nondegenerates_empty(self):
        self.assertEqual(list(self.empty.nondegenerates()), [self.empty])

    def test_nondegenerates_no_degens(self):
        self.assertEqual(list(self.b1.nondegenerates()), [self.b1])

    def test_nondegenerates_all_degens(self):
        # Same chars.
#.........這裏部分代碼省略.........
開發者ID:BANSHEE-,項目名稱:scikit-bio,代碼行數:101,代碼來源:test_sequence.py

示例12: test_lower

 def test_lower(self):
     b = NucleotideSequence('GAt.ACa-', id='x', description='42')
     expected = NucleotideSequence('gat.aca-', id='x',
                                   description='42')
     self.assertEqual(b.lower(), expected)
開發者ID:BANSHEE-,項目名稱:scikit-bio,代碼行數:5,代碼來源:test_sequence.py

示例13: test_upper

 def test_upper(self):
     b = NucleotideSequence('GAt.ACa-', id='x', description='42')
     expected = NucleotideSequence('GAT.ACA-', id='x',
                                   description='42')
     self.assertEqual(b.upper(), expected)
開發者ID:BANSHEE-,項目名稱:scikit-bio,代碼行數:5,代碼來源:test_sequence.py

示例14: test_iupac_standard_characters

 def test_iupac_standard_characters(self):
     """iupac_standard_characters property functions as expected"""
     exp = set("ACGTUacgtu")
     self.assertEqual(self.b1.iupac_standard_characters(), exp)
     self.assertEqual(NucleotideSequence.iupac_standard_characters(), exp)
開發者ID:teravest,項目名稱:scikit-bio,代碼行數:5,代碼來源:test_sequence.py

示例15: test_complement_map

 def test_complement_map(self):
     """complement_map property functions as expected"""
     exp = {}
     self.assertEqual(self.b1.complement_map(), exp)
     self.assertEqual(NucleotideSequence.complement_map(), exp)
開發者ID:teravest,項目名稱:scikit-bio,代碼行數:5,代碼來源:test_sequence.py


注:本文中的skbio.core.sequence.NucleotideSequence類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。