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


Python _mantel._order_dms函数代码示例

本文整理汇总了Python中skbio.stats.distance._mantel._order_dms函数的典型用法代码示例。如果您正苦于以下问题:Python _order_dms函数的具体用法?Python _order_dms怎么用?Python _order_dms使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_missing_ids_in_lookup

    def test_missing_ids_in_lookup(self):
        # Mapping for '1' is missing. Should get an error while remapping IDs
        # for the first distance matrix.
        lookup = {"0": "a", "2": "c"}

        with self.assertRaisesRegexp(KeyError, "first.*(x).*'1'\"$"):
            _order_dms(self.minx_dm, self.miny_dm, lookup=lookup)

        # Mapping for 'bar' is missing. Should get an error while remapping IDs
        # for the second distance matrix.
        lookup = {"0": "a", "1": "b", "2": "c", "foo": "a", "baz": "c"}
        self.miny_dm.ids = ("foo", "bar", "baz")

        with self.assertRaisesRegexp(KeyError, "second.*(y).*'bar'\"$"):
            _order_dms(self.minx_dm, self.miny_dm, lookup=lookup)
开发者ID:josenavas,项目名称:scikit-bio,代码行数:15,代码来源:test_mantel.py

示例2: test_missing_ids_in_lookup

    def test_missing_ids_in_lookup(self):
        # Mapping for '1' is missing. Should get an error while remapping IDs
        # for the first distance matrix.
        lookup = {'0': 'a', '2': 'c'}

        with self.assertRaisesRegex(KeyError, "first.*(x).*'1'\"$"):
            _order_dms(self.minx_dm, self.miny_dm, lookup=lookup)

        # Mapping for 'bar' is missing. Should get an error while remapping IDs
        # for the second distance matrix.
        lookup = {'0': 'a', '1': 'b', '2': 'c',
                  'foo': 'a', 'baz': 'c'}
        self.miny_dm.ids = ('foo', 'bar', 'baz')

        with self.assertRaisesRegex(KeyError, "second.*(y).*'bar'\"$"):
            _order_dms(self.minx_dm, self.miny_dm, lookup=lookup)
开发者ID:RNAer,项目名称:scikit-bio,代码行数:16,代码来源:test_mantel.py

示例3: test_reordered_and_nonmatching_distance_matrices

    def test_reordered_and_nonmatching_distance_matrices(self):
        # Some matching and nonmatching IDs, with different ordering.
        x = self.minx_dm_extra.filter(['1', '0', 'foo', '2'])
        z = self.minz_dm_extra.filter(['bar', '0', '2', '1'])

        exp = (x.filter(['1', '0', '2']), z.filter(['1', '0', '2']))
        obs = _order_dms(x, z, strict=False)
        self.assertEqual(obs, exp)
开发者ID:RNAer,项目名称:scikit-bio,代码行数:8,代码来源:test_mantel.py

示例4: test_reordered_distance_matrices

    def test_reordered_distance_matrices(self):
        # All matching IDs but with different orderings.
        x = self.minx_dm.filter(['1', '0', '2'])
        y = self.miny_dm.filter(['0', '2', '1'])

        exp = (x, y.filter(['1', '0', '2']))
        obs = _order_dms(x, y)
        self.assertEqual(obs, exp)
开发者ID:RNAer,项目名称:scikit-bio,代码行数:8,代码来源:test_mantel.py

示例5: test_id_lookup

    def test_id_lookup(self):
        # Matrices have mismatched IDs but a lookup is provided.
        self.minx_dm_extra.ids = ["a", "b", "c", "foo"]
        self.minz_dm_extra.ids = ["d", "e", "f", "bar"]
        lookup = {"a": "0", "b": "1", "c": "2", "foo": "foo", "d": "0", "e": "1", "f": "2", "bar": "bar"}

        x = self.minx_dm_extra.filter(["b", "a", "foo", "c"])
        z = self.minz_dm_extra.filter(["bar", "e", "f", "d"])

        x_copy = x.copy()
        z_copy = z.copy()

        exp = (self.minx_dm.filter(["1", "0", "2"]), self.minz_dm.filter(["1", "0", "2"]))
        obs = _order_dms(x, z, strict=False, lookup=lookup)
        self.assertEqual(obs, exp)

        # Make sure the inputs aren't modified.
        self.assertEqual(x, x_copy)
        self.assertEqual(z, z_copy)
开发者ID:josenavas,项目名称:scikit-bio,代码行数:19,代码来源:test_mantel.py

示例6: test_id_lookup

    def test_id_lookup(self):
        # Matrices have mismatched IDs but a lookup is provided.
        self.minx_dm_extra.ids = ['a', 'b', 'c', 'foo']
        self.minz_dm_extra.ids = ['d', 'e', 'f', 'bar']
        lookup = {'a': '0', 'b': '1', 'c': '2', 'foo': 'foo',
                  'd': '0', 'e': '1', 'f': '2', 'bar': 'bar'}

        x = self.minx_dm_extra.filter(['b', 'a', 'foo', 'c'])
        z = self.minz_dm_extra.filter(['bar', 'e', 'f', 'd'])

        x_copy = x.copy()
        z_copy = z.copy()

        exp = (self.minx_dm.filter(['1', '0', '2']),
               self.minz_dm.filter(['1', '0', '2']))
        obs = _order_dms(x, z, strict=False, lookup=lookup)
        self.assertEqual(obs, exp)

        # Make sure the inputs aren't modified.
        self.assertEqual(x, x_copy)
        self.assertEqual(z, z_copy)
开发者ID:RNAer,项目名称:scikit-bio,代码行数:21,代码来源:test_mantel.py

示例7: test_mixed_input_types

    def test_mixed_input_types(self):
        with self.assertRaises(TypeError):
            _order_dms(self.minx, self.minz_dm)

        with self.assertRaises(TypeError):
            _order_dms(self.minz_dm, self.minx)
开发者ID:RNAer,项目名称:scikit-bio,代码行数:6,代码来源:test_mantel.py

示例8: test_no_matching_ids

    def test_no_matching_ids(self):
        self.minx_dm.ids = ['foo', 'bar', 'baz']
        self.miny_dm.ids = ['a', 'b', 'c']

        with self.assertRaises(ValueError):
            _order_dms(self.minx_dm, self.miny_dm, strict=False)
开发者ID:RNAer,项目名称:scikit-bio,代码行数:6,代码来源:test_mantel.py

示例9: test_nonmatching_ids_strict_true

 def test_nonmatching_ids_strict_true(self):
     with self.assertRaises(ValueError):
         _order_dms(self.minx_dm, self.minz_dm_extra, strict=True)
开发者ID:RNAer,项目名称:scikit-bio,代码行数:3,代码来源:test_mantel.py

示例10: test_shape_mismatch

 def test_shape_mismatch(self):
     with self.assertRaises(ValueError):
         _order_dms(self.minx, [[0, 2], [2, 0]])
开发者ID:RNAer,项目名称:scikit-bio,代码行数:3,代码来源:test_mantel.py

示例11: test_lookup_with_array_like

 def test_lookup_with_array_like(self):
     lookup = {'0': 'a', '1': 'b', '2': 'c'}
     with self.assertRaises(ValueError):
         _order_dms(self.minx, self.miny, lookup=lookup)
开发者ID:RNAer,项目名称:scikit-bio,代码行数:4,代码来源:test_mantel.py

示例12: test_array_like_input

 def test_array_like_input(self):
     obs = _order_dms(self.minx, self.miny)
     self.assertEqual(obs, (self.minx_dm, self.miny_dm))
开发者ID:RNAer,项目名称:scikit-bio,代码行数:3,代码来源:test_mantel.py


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