当前位置: 首页>>代码示例>>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;未经允许,请勿转载。