本文整理匯總了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=[]))