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


Python TabularMSA.sort方法代码示例

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


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

示例1: test_sort_on_invalid_key

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import sort [as 别名]
 def test_sort_on_invalid_key(self):
     msa = TabularMSA([DNA('AAA'), DNA('ACG')], keys=[42, 43])
     with self.assertRaises(KeyError):
         msa.sort(key='id')
     self.assertEqual(
         msa,
         TabularMSA([DNA('AAA'), DNA('ACG')], keys=[42, 43]))
开发者ID:hainm,项目名称:scikit-bio,代码行数:9,代码来源:test_tabular_msa.py

示例2: test_sort_empty_with_msa_keys_on_metadata_key

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import sort [as 别名]
    def test_sort_empty_with_msa_keys_on_metadata_key(self):
        msa = TabularMSA([], keys=[])
        msa.sort(key='id')
        self.assertEqual(msa, TabularMSA([], keys=[]))

        msa = TabularMSA([], keys=[])
        msa.sort(key='id', reverse=True)
        self.assertEqual(msa, TabularMSA([], keys=[]))
开发者ID:hainm,项目名称:scikit-bio,代码行数:10,代码来源:test_tabular_msa.py

示例3: test_sort_single_sequence_no_msa_keys_on_metadata_key

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import sort [as 别名]
    def test_sort_single_sequence_no_msa_keys_on_metadata_key(self):
        msa = TabularMSA([RNA('UCA', metadata={'id': 42})])
        msa.sort(key='id')
        self.assertEqual(msa, TabularMSA([RNA('UCA', metadata={'id': 42})]))

        msa = TabularMSA([RNA('UCA', metadata={'id': 42})])
        msa.sort(key='id', reverse=True)
        self.assertEqual(msa, TabularMSA([RNA('UCA', metadata={'id': 42})]))
开发者ID:hainm,项目名称:scikit-bio,代码行数:10,代码来源:test_tabular_msa.py

示例4: test_sort_single_sequence_on_msa_keys

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import sort [as 别名]
    def test_sort_single_sequence_on_msa_keys(self):
        msa = TabularMSA([DNA('ACGT')], keys=[42])
        msa.sort()
        self.assertEqual(msa, TabularMSA([DNA('ACGT')], keys=[42]))

        msa = TabularMSA([DNA('ACGT')], keys=[42])
        msa.sort(reverse=True)
        self.assertEqual(msa, TabularMSA([DNA('ACGT')], keys=[42]))
开发者ID:hainm,项目名称:scikit-bio,代码行数:10,代码来源:test_tabular_msa.py

示例5: test_sort_empty_on_msa_keys

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import sort [as 别名]
    def test_sort_empty_on_msa_keys(self):
        msa = TabularMSA([], keys=[])
        msa.sort()
        self.assertEqual(msa, TabularMSA([], keys=[]))

        msa = TabularMSA([], keys=[])
        msa.sort(reverse=True)
        self.assertEqual(msa, TabularMSA([], keys=[]))
开发者ID:hainm,项目名称:scikit-bio,代码行数:10,代码来源:test_tabular_msa.py

示例6: test_sort_on_unorderable_msa_keys

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import sort [as 别名]
 def test_sort_on_unorderable_msa_keys(self):
     unorderable = Unorderable()
     msa = TabularMSA([DNA('AAA'), DNA('ACG')], keys=[42, unorderable])
     with self.assertRaises(TypeError):
         msa.sort()
     self.assertEqual(
         msa,
         TabularMSA([DNA('AAA'), DNA('ACG')], keys=[42, unorderable]))
开发者ID:hainm,项目名称:scikit-bio,代码行数:10,代码来源:test_tabular_msa.py

示例7: test_sort_empty_with_msa_keys_on_callable_key

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import sort [as 别名]
    def test_sort_empty_with_msa_keys_on_callable_key(self):
        msa = TabularMSA([], keys=[])
        msa.sort(key=str)
        self.assertEqual(msa, TabularMSA([], keys=[]))

        msa = TabularMSA([], keys=[])
        msa.sort(key=str, reverse=True)
        self.assertEqual(msa, TabularMSA([], keys=[]))
开发者ID:hainm,项目名称:scikit-bio,代码行数:10,代码来源:test_tabular_msa.py

示例8: test_sort_single_sequence_with_msa_keys_on_callable_key

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import sort [as 别名]
    def test_sort_single_sequence_with_msa_keys_on_callable_key(self):
        msa = TabularMSA([RNA('UCA')], keys=['foo'])
        msa.sort(key=str)
        self.assertEqual(msa, TabularMSA([RNA('UCA')], keys=['foo']))

        msa = TabularMSA([RNA('UCA')], keys=['foo'])
        msa.sort(key=str, reverse=True)
        self.assertEqual(msa, TabularMSA([RNA('UCA')], keys=['foo']))
开发者ID:hainm,项目名称:scikit-bio,代码行数:10,代码来源:test_tabular_msa.py

示例9: test_sort_no_msa_keys_and_key_not_specified

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import sort [as 别名]
    def test_sort_no_msa_keys_and_key_not_specified(self):
        msa = TabularMSA([])
        with self.assertRaises(OperationError):
            msa.sort()
        # original state is maintained
        self.assertEqual(msa, TabularMSA([]))

        msa = TabularMSA([DNA('TC'), DNA('AA')])
        with self.assertRaises(OperationError):
            msa.sort()
        self.assertEqual(msa, TabularMSA([DNA('TC'), DNA('AA')]))
开发者ID:hainm,项目名称:scikit-bio,代码行数:13,代码来源:test_tabular_msa.py

示例10: test_sort_reverse_sorted

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import sort [as 别名]
    def test_sort_reverse_sorted(self):
        msa = TabularMSA([DNA('T'), DNA('G'), DNA('A')], keys=[3, 2, 1])
        msa.sort()
        self.assertEqual(
            msa,
            TabularMSA([DNA('A'), DNA('G'), DNA('T')], keys=[1, 2, 3]))

        msa = TabularMSA([DNA('T'), DNA('G'), DNA('A')], keys=[1, 2, 3])
        msa.sort(reverse=True)
        self.assertEqual(
            msa,
            TabularMSA([DNA('A'), DNA('G'), DNA('T')], keys=[3, 2, 1]))
开发者ID:hainm,项目名称:scikit-bio,代码行数:14,代码来源:test_tabular_msa.py

示例11: test_sort_on_key_with_all_repeats

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import sort [as 别名]
 def test_sort_on_key_with_all_repeats(self):
     msa = TabularMSA([
         DNA('TTT', metadata={'id': 'a'}),
         DNA('TTT', metadata={'id': 'b'}),
         DNA('TTT', metadata={'id': 'c'})], keys=range(3))
     msa.sort(key=str)
     self.assertEqual(
         msa,
         TabularMSA([
             DNA('TTT', metadata={'id': 'a'}),
             DNA('TTT', metadata={'id': 'b'}),
             DNA('TTT', metadata={'id': 'c'})], keys=range(3)))
开发者ID:hainm,项目名称:scikit-bio,代码行数:14,代码来源:test_tabular_msa.py

示例12: test_sort_multiple_sequences_no_msa_keys_on_callable_key

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import sort [as 别名]
    def test_sort_multiple_sequences_no_msa_keys_on_callable_key(self):
        msa = TabularMSA([RNA('UCC'),
                          RNA('UCG'),
                          RNA('UCA')])
        msa.sort(key=str)
        self.assertEqual(msa, TabularMSA([RNA('UCA'), RNA('UCC'), RNA('UCG')]))

        msa = TabularMSA([RNA('UCC'),
                          RNA('UCG'),
                          RNA('UCA')])
        msa.sort(key=str, reverse=True)
        self.assertEqual(msa, TabularMSA([RNA('UCG'), RNA('UCC'), RNA('UCA')]))
开发者ID:hainm,项目名称:scikit-bio,代码行数:14,代码来源:test_tabular_msa.py

示例13: test_sort_on_unorderable_key

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import sort [as 别名]
 def test_sort_on_unorderable_key(self):
     unorderable = Unorderable()
     msa = TabularMSA([
         DNA('AAA', metadata={'id': 42}),
         DNA('ACG', metadata={'id': unorderable})], keys=[42, 43])
     with self.assertRaises(TypeError):
         msa.sort(key='id')
     self.assertEqual(
         msa,
         TabularMSA([
             DNA('AAA', metadata={'id': 42}),
             DNA('ACG', metadata={'id': unorderable})], keys=[42, 43]))
开发者ID:hainm,项目名称:scikit-bio,代码行数:14,代码来源:test_tabular_msa.py

示例14: test_sort_multiple_sequences_with_msa_keys_on_callable_key

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import sort [as 别名]
    def test_sort_multiple_sequences_with_msa_keys_on_callable_key(self):
        msa = TabularMSA([RNA('UCC'),
                          RNA('UCG'),
                          RNA('UCA')], keys=[1, 'abc', None])
        msa.sort(key=str)
        self.assertEqual(msa, TabularMSA([RNA('UCA'), RNA('UCC'), RNA('UCG')],
                                         keys=[None, 1, 'abc']))

        msa = TabularMSA([RNA('UCC'),
                          RNA('UCG'),
                          RNA('UCA')], keys=[1, 'abc', None])
        msa.sort(key=str, reverse=True)
        self.assertEqual(msa, TabularMSA([RNA('UCG'), RNA('UCC'), RNA('UCA')],
                                         keys=['abc', 1, None]))
开发者ID:hainm,项目名称:scikit-bio,代码行数:16,代码来源:test_tabular_msa.py

示例15: test_sort_on_key_with_some_repeats

# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import sort [as 别名]
 def test_sort_on_key_with_some_repeats(self):
     msa = TabularMSA([
         DNA('TCCG', metadata={'id': 10}),
         DNA('TAGG', metadata={'id': 10}),
         DNA('GGGG', metadata={'id': 8}),
         DNA('ACGT', metadata={'id': 0}),
         DNA('TAGG', metadata={'id': 10})], keys=range(5))
     msa.sort(key='id')
     self.assertEqual(
         msa,
         TabularMSA([
             DNA('ACGT', metadata={'id': 0}),
             DNA('GGGG', metadata={'id': 8}),
             DNA('TCCG', metadata={'id': 10}),
             DNA('TAGG', metadata={'id': 10}),
             DNA('TAGG', metadata={'id': 10})], keys=[3, 2, 0, 1, 4]))
开发者ID:hainm,项目名称:scikit-bio,代码行数:18,代码来源:test_tabular_msa.py


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