本文整理汇总了Python中skbio.TabularMSA.from_dict方法的典型用法代码示例。如果您正苦于以下问题:Python TabularMSA.from_dict方法的具体用法?Python TabularMSA.from_dict怎么用?Python TabularMSA.from_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类skbio.TabularMSA
的用法示例。
在下文中一共展示了TabularMSA.from_dict方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_from_dict_to_dict_roundtrip
# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import from_dict [as 别名]
def test_from_dict_to_dict_roundtrip(self):
d = {}
self.assertEqual(TabularMSA.from_dict(d).to_dict(), d)
# can roundtrip even with mixed key types
d1 = {'a': DNA('CAT'), 42: DNA('TAG')}
d2 = TabularMSA.from_dict(d1).to_dict()
self.assertEqual(d2, d1)
self.assertIs(d1['a'], d2['a'])
self.assertIs(d1[42], d2[42])
示例2: test_from_dict_multiple_sequences
# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import from_dict [as 别名]
def test_from_dict_multiple_sequences(self):
msa = TabularMSA.from_dict(
{1: DNA('ACG'), 2: DNA('GGG'), 3: DNA('TAG')})
# Sort because order is arbitrary.
msa.sort()
self.assertEqual(
msa,
TabularMSA([DNA('ACG'), DNA('GGG'), DNA('TAG')], keys=[1, 2, 3]))
示例3: test_from_dict_invalid_input
# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import from_dict [as 别名]
def test_from_dict_invalid_input(self):
# Basic test to make sure error-checking in the TabularMSA constructor
# is being invoked.
with six.assertRaisesRegex(self, ValueError, 'same length'):
TabularMSA.from_dict({'a': DNA('ACG'), 'b': DNA('ACGT')})
示例4: test_from_dict_single_sequence
# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import from_dict [as 别名]
def test_from_dict_single_sequence(self):
self.assertEqual(TabularMSA.from_dict({'foo': DNA('ACGT')}),
TabularMSA([DNA('ACGT')], keys=['foo']))
示例5: test_from_dict_empty
# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import from_dict [as 别名]
def test_from_dict_empty(self):
self.assertEqual(TabularMSA.from_dict({}), TabularMSA([], keys=[]))