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


Python TabularMSA.from_dict方法代碼示例

本文整理匯總了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])
開發者ID:hainm,項目名稱:scikit-bio,代碼行數:12,代碼來源:test_tabular_msa.py

示例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]))
開發者ID:hainm,項目名稱:scikit-bio,代碼行數:10,代碼來源:test_tabular_msa.py

示例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')})
開發者ID:hainm,項目名稱:scikit-bio,代碼行數:7,代碼來源:test_tabular_msa.py

示例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']))
開發者ID:hainm,項目名稱:scikit-bio,代碼行數:5,代碼來源:test_tabular_msa.py

示例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=[]))
開發者ID:hainm,項目名稱:scikit-bio,代碼行數:4,代碼來源:test_tabular_msa.py


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