本文整理汇总了Python中skbio.core.alignment.SequenceCollection.get_seq方法的典型用法代码示例。如果您正苦于以下问题:Python SequenceCollection.get_seq方法的具体用法?Python SequenceCollection.get_seq怎么用?Python SequenceCollection.get_seq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类skbio.core.alignment.SequenceCollection
的用法示例。
在下文中一共展示了SequenceCollection.get_seq方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SequenceCollectionTests
# 需要导入模块: from skbio.core.alignment import SequenceCollection [as 别名]
# 或者: from skbio.core.alignment.SequenceCollection import get_seq [as 别名]
#.........这里部分代码省略.........
def test_distribution_stats(self):
"""distribution_stats functions as expected
"""
actual1 = self.s1.distribution_stats()
self.assertEqual(actual1[0], 2)
self.assertAlmostEqual(actual1[1], 5.0, 3)
self.assertAlmostEqual(actual1[2], 2.0, 3)
actual2 = self.s2.distribution_stats()
self.assertEqual(actual2[0], 3)
self.assertAlmostEqual(actual2[1], 7.333, 3)
self.assertAlmostEqual(actual2[2], 3.682, 3)
actual3 = self.s3.distribution_stats()
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_identifiers(self):
"""identifiers functions as expected
"""
self.assertEqual(self.s1.identifiers(), ['d1', 'd2'])
self.assertEqual(self.s2.identifiers(), ['r1', 'r2', 'r3'])
self.assertEqual(self.s3.identifiers(),
['d1', 'd2', 'r1', 'r2', 'r3'])
self.assertEqual(self.empty.identifiers(), [])
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())