当前位置: 首页>>代码示例>>Python>>正文


Python TabularMSA.keys方法代码示例

本文整理汇总了Python中skbio.TabularMSA.keys方法的典型用法代码示例。如果您正苦于以下问题:Python TabularMSA.keys方法的具体用法?Python TabularMSA.keys怎么用?Python TabularMSA.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在skbio.TabularMSA的用法示例。


在下文中一共展示了TabularMSA.keys方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_keys_setter_non_empty

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import keys [as 别名]
 def test_keys_setter_non_empty(self):
     msa = TabularMSA([DNA('AC'), DNA('AG'), DNA('AT')])
     self.assertFalse(msa.has_keys())
     msa.keys = range(3)
     npt.assert_array_equal(msa.keys, np.array([0, 1, 2]))
     msa.keys = range(3, 6)
     npt.assert_array_equal(msa.keys, np.array([3, 4, 5]))
开发者ID:hainm,项目名称:scikit-bio,代码行数:9,代码来源:test_tabular_msa.py

示例2: test_keys_setter_non_hashable_keys

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import keys [as 别名]
    def test_keys_setter_non_hashable_keys(self):
        msa = TabularMSA([DNA('ACGT'), DNA('TGCA')], key=str)
        keys = np.array(['ACGT', 'TGCA'])
        npt.assert_array_equal(msa.keys, keys)

        with self.assertRaises(TypeError):
            msa.keys = [[42], [42]]

        # original state is maintained
        npt.assert_array_equal(msa.keys, keys)
开发者ID:hainm,项目名称:scikit-bio,代码行数:12,代码来源:test_tabular_msa.py

示例3: test_keys_setter_non_unique_keys

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import keys [as 别名]
    def test_keys_setter_non_unique_keys(self):
        msa = TabularMSA([DNA('ACGT'), DNA('TGCA')], key=str)
        keys = np.array(['ACGT', 'TGCA'])
        npt.assert_array_equal(msa.keys, keys)

        with six.assertRaisesRegex(self, UniqueError, 'Duplicate keys:.*42'):
            msa.keys = [42, 42]

        # original state is maintained
        npt.assert_array_equal(msa.keys, keys)
开发者ID:hainm,项目名称:scikit-bio,代码行数:12,代码来源:test_tabular_msa.py

示例4: test_keys_setter_length_mismatch

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import keys [as 别名]
    def test_keys_setter_length_mismatch(self):
        msa = TabularMSA([DNA('ACGT'), DNA('TGCA')], key=str)
        keys = np.array(['ACGT', 'TGCA'])
        npt.assert_array_equal(msa.keys, keys)

        with six.assertRaisesRegex(self, ValueError,
                                   'Number.*keys.*number.*sequences: 3 != 2'):
            msa.keys = iter(['ab', 'cd', 'ef'])

        # original state is maintained
        npt.assert_array_equal(msa.keys, keys)
开发者ID:hainm,项目名称:scikit-bio,代码行数:13,代码来源:test_tabular_msa.py

示例5: test_keys_update_subset_of_keys

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import keys [as 别名]
    def test_keys_update_subset_of_keys(self):
        # keys can be copied, modified, then re-set
        msa = TabularMSA([DNA('AC'), DNA('AG'), DNA('AT')], key=str)
        npt.assert_array_equal(msa.keys, np.array(['AC', 'AG', 'AT']))

        new_keys = msa.keys.copy()
        new_keys[1] = 42
        msa.keys = new_keys
        npt.assert_array_equal(msa.keys,
                               np.array(['AC', 42, 'AT'], dtype=object))

        self.assertFalse(msa.keys.flags.writeable)
        self.assertTrue(new_keys.flags.writeable)
        new_keys[1] = 'GG'
        npt.assert_array_equal(msa.keys,
                               np.array(['AC', 42, 'AT'], dtype=object))
开发者ID:hainm,项目名称:scikit-bio,代码行数:18,代码来源:test_tabular_msa.py

示例6: test_keys_setter_empty

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import keys [as 别名]
 def test_keys_setter_empty(self):
     msa = TabularMSA([])
     self.assertFalse(msa.has_keys())
     msa.keys = iter([])
     npt.assert_array_equal(msa.keys, np.array([]))
开发者ID:hainm,项目名称:scikit-bio,代码行数:7,代码来源:test_tabular_msa.py


注:本文中的skbio.TabularMSA.keys方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。