本文整理匯總了Python中skbio.SequenceCollection.int_map方法的典型用法代碼示例。如果您正苦於以下問題:Python SequenceCollection.int_map方法的具體用法?Python SequenceCollection.int_map怎麽用?Python SequenceCollection.int_map使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類skbio.SequenceCollection
的用法示例。
在下文中一共展示了SequenceCollection.int_map方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: SequenceCollectionTests
# 需要導入模塊: from skbio import SequenceCollection [as 別名]
# 或者: from skbio.SequenceCollection import int_map [as 別名]
#.........這裏部分代碼省略.........
self.assertEqual(actual3[0], 5)
self.assertAlmostEqual(actual3[1], 6.400, 3)
self.assertAlmostEqual(actual3[2], 3.323, 3)
actual4 = self.empty.distribution_stats()
self.assertEqual(actual4[0], 0)
self.assertEqual(actual4[1], 0.0)
self.assertEqual(actual4[2], 0.0)
def test_degap(self):
"""degap functions as expected
"""
expected = [(id_, seq.replace('.', '').replace('-', ''))
for id_, seq in self.seqs2_t]
expected = SequenceCollection.from_fasta_records(expected, RNASequence)
actual = self.s2.degap()
self.assertEqual(actual, expected)
def test_get_seq(self):
"""getseq functions asexpected
"""
self.assertEqual(self.s1.get_seq('d1'), self.d1)
self.assertEqual(self.s1.get_seq('d2'), self.d2)
def test_ids(self):
"""ids functions as expected
"""
self.assertEqual(self.s1.ids(), ['d1', 'd2'])
self.assertEqual(self.s2.ids(), ['r1', 'r2', 'r3'])
self.assertEqual(self.s3.ids(),
['d1', 'd2', 'r1', 'r2', 'r3'])
self.assertEqual(self.empty.ids(), [])
def test_int_map(self):
"""int_map functions as expected
"""
expected1 = {"1": self.d1, "2": self.d2}
expected2 = {"1": "d1", "2": "d2"}
self.assertEqual(self.s1.int_map(), (expected1, expected2))
expected1 = {"h-1": self.d1, "h-2": self.d2}
expected2 = {"h-1": "d1", "h-2": "d2"}
self.assertEqual(self.s1.int_map(prefix='h-'), (expected1, expected2))
def test_is_empty(self):
"""is_empty functions as expected
"""
self.assertFalse(self.s1.is_empty())
self.assertFalse(self.s2.is_empty())
self.assertFalse(self.s3.is_empty())
self.assertTrue(self.empty.is_empty())
def test_is_valid(self):
"""is_valid functions as expected
"""
self.assertTrue(self.s1.is_valid())
self.assertTrue(self.s2.is_valid())
self.assertTrue(self.s3.is_valid())
self.assertTrue(self.empty.is_valid())
self.assertFalse(self.invalid_s1.is_valid())
def test_iteritems(self):
"""iteritems functions as expected
"""