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


Python composition.ancom函数代码示例

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


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

示例1: test_ancom_tau

    def test_ancom_tau(self):
        exp1 = pd.DataFrame({'W': np.array([8, 7, 3, 3, 7, 3, 3, 3, 3]),
                            'reject': np.array([True, False, False, False,
                                                False, False, False, False,
                                                False], dtype=bool)})
        exp2 = pd.DataFrame({'W': np.array([17, 17, 5, 6, 16, 5, 7, 5,
                                            4, 5, 8, 4, 5, 16, 5, 11, 4, 6]),
                            'reject': np.array([True, True, False, False,
                                                True, False, False, False,
                                                False, False, False, False,
                                                False, True, False, False,
                                                False, False],  dtype=bool)})
        exp3 = pd.DataFrame({'W': np.array([16, 16, 17, 10, 17, 16, 16,
                                            15, 15, 15, 13, 10, 10, 10,
                                            9, 9, 9, 9]),
                            'reject': np.array([True, True, True, False,
                                                True, True, True, True,
                                                True, True, True, False,
                                                False, False, False, False,
                                                False, False],  dtype=bool)})

        result1 = ancom(self.table4, self.cats4, tau=0.25)
        result2 = ancom(self.table9, self.cats9, tau=0.02)
        result3 = ancom(self.table10, self.cats10, tau=0.02)

        assert_data_frame_almost_equal(result1, exp1)
        assert_data_frame_almost_equal(result2, exp2)
        assert_data_frame_almost_equal(result3, exp3)
开发者ID:anderspitman,项目名称:scikit-bio,代码行数:28,代码来源:test_composition.py

示例2: test_ancom_tau

    def test_ancom_tau(self):
        exp1 = pd.DataFrame(
            {'W': np.array([8, 7, 3, 3, 7, 3, 3, 3, 3]),
             'Reject null hypothesis': np.array([True, False, False, False,
                                                 False, False, False, False,
                                                 False], dtype=bool)})
        exp2 = pd.DataFrame(
            {'W': np.array([17, 17, 5, 6, 16, 5, 7, 5,
                            4, 5, 8, 4, 5, 16, 5, 11, 4, 6]),
             'Reject null hypothesis': np.array([True, True, False, False,
                                                 True, False, False, False,
                                                 False, False, False, False,
                                                 False, True, False, False,
                                                 False, False],  dtype=bool)})
        exp3 = pd.DataFrame(
            {'W': np.array([16, 16, 17, 10, 17, 16, 16,
                            15, 15, 15, 13, 10, 10, 10,
                            9, 9, 9, 9]),
             'Reject null hypothesis': np.array([True, True, True, False,
                                                 True, True, True, True,
                                                 True, True, True, False,
                                                 False, False, False, False,
                                                 False, False], dtype=bool)})

        result1 = ancom(self.table4, self.cats4,
                        multiple_comparisons_correction=None, tau=0.25)
        result2 = ancom(self.table9, self.cats9,
                        multiple_comparisons_correction=None, tau=0.02)
        result3 = ancom(self.table10, self.cats10,
                        multiple_comparisons_correction=None, tau=0.02)

        assert_data_frame_almost_equal(result1[0], exp1)
        assert_data_frame_almost_equal(result2[0], exp2)
        assert_data_frame_almost_equal(result3[0], exp3)
开发者ID:disulfidebond,项目名称:scikit-bio,代码行数:34,代码来源:test_composition.py

示例3: test_ancom_duplicate_percentiles

 def test_ancom_duplicate_percentiles(self):
     table = pd.DataFrame([[12],
                           [9],
                           [1],
                           [22],
                           [20],
                           [23]],
                          index=['s1', 's2', 's3', 's4', 's5', 's6'],
                          columns=['b1'])
     grouping = pd.Series(['a', 'a', 'a', 'b', 'b', 'b'],
                          index=['s1', 's2', 's3', 's4', 's5', 's6'])
     with self.assertRaises(ValueError):
         ancom(table, grouping, percentiles=[10.0, 10.0])
开发者ID:disulfidebond,项目名称:scikit-bio,代码行数:13,代码来源:test_composition.py

示例4: test_ancom_no_signal

 def test_ancom_no_signal(self):
     result = ancom(self.table3,
                    self.cats3,
                    multiple_comparisons_correction=None)
     exp = pd.DataFrame({'W': np.array([0]*7),
                         'reject': np.array([False]*7, dtype=bool)})
     assert_data_frame_almost_equal(result, exp)
开发者ID:anderspitman,项目名称:scikit-bio,代码行数:7,代码来源:test_composition.py

示例5: test_ancom_percentile_order_unimportant

 def test_ancom_percentile_order_unimportant(self):
     table = pd.DataFrame([[12],
                           [9],
                           [1],
                           [22],
                           [20],
                           [23]],
                          index=['s1', 's2', 's3', 's4', 's5', 's6'],
                          columns=['b1'])
     grouping = pd.Series(['a', 'a', 'a', 'b', 'b', 'b'],
                          index=['s1', 's2', 's3', 's4', 's5', 's6'])
     # order of percentiles in unimportant after sorting
     result1 = ancom(table, grouping, percentiles=[50.0, 42.0])[1]
     result2 = ancom(table, grouping, percentiles=[42.0, 50.0])[1]
     assert_data_frame_almost_equal(
         result1.sort_index(axis=1), result2.sort_index(axis=1))
开发者ID:disulfidebond,项目名称:scikit-bio,代码行数:16,代码来源:test_composition.py

示例6: test_ancom_percentiles

    def test_ancom_percentiles(self):
        table = pd.DataFrame([[12, 11],
                              [9, 11],
                              [1, 11],
                              [22, 100],
                              [20, 53],
                              [23, 1]],
                             index=['s1', 's2', 's3', 's4', 's5', 's6'],
                             columns=['b1', 'b2'])
        grouping = pd.Series(['a', 'a', 'a', 'b', 'b', 'b'],
                             index=['s1', 's2', 's3', 's4', 's5', 's6'])

        percentiles = [0.0, 25.0, 50.0, 75.0, 100.0]
        groups = ['a', 'b']
        tuples = [(p, g) for g in groups for p in percentiles]
        exp_mi = pd.MultiIndex.from_tuples(tuples,
                                           names=['Percentile', 'Group'])
        exp_data = np.array(
            [[1.0, 11.0], [5.0, 11.0], [9.0, 11.0], [10.5, 11.0], [12.0, 11.0],
             [20.0, 1.0], [21.0, 27.0], [22.0, 53.0], [22.5, 76.5],
             [23.0, 100.0]])
        exp = pd.DataFrame(exp_data.T, columns=exp_mi, index=['b1', 'b2'])

        result = ancom(table, grouping)[1]
        assert_data_frame_almost_equal(result, exp)
开发者ID:disulfidebond,项目名称:scikit-bio,代码行数:25,代码来源:test_composition.py

示例7: test_ancom_basic_counts_swapped

 def test_ancom_basic_counts_swapped(self):
     result = ancom(self.table8, self.cats8)
     exp = pd.DataFrame({'W': np.array([5, 5, 2, 2, 2, 2, 2]),
                         'reject': np.array([True, True, False, False,
                                             False, False, False],
                                            dtype=bool)})
     assert_data_frame_almost_equal(result, exp)
开发者ID:anderspitman,项目名称:scikit-bio,代码行数:7,代码来源:test_composition.py

示例8: test_ancom_alpha

 def test_ancom_alpha(self):
     result = ancom(self.table1, self.cats1, alpha=0.5)
     exp = pd.DataFrame({'W': np.array([6, 6, 4, 5, 5, 4, 2]),
                         'reject': np.array([True, True, False, True,
                                             True, False, False],
                                            dtype=bool)})
     assert_data_frame_almost_equal(result, exp)
开发者ID:anderspitman,项目名称:scikit-bio,代码行数:7,代码来源:test_composition.py

示例9: test_ancom_theta

 def test_ancom_theta(self):
     result = ancom(self.table1, self.cats1, theta=0.3)
     exp = pd.DataFrame(
         {'W': np.array([5, 5, 2, 2, 2, 2, 2]),
          'Reject null hypothesis': np.array([True, True, False, False,
                                              False, False, False],
                                             dtype=bool)})
     assert_data_frame_almost_equal(result[0], exp)
开发者ID:disulfidebond,项目名称:scikit-bio,代码行数:8,代码来源:test_composition.py

示例10: test_ancom_multiple_comparisons

 def test_ancom_multiple_comparisons(self):
     result = ancom(self.table1,
                    self.cats1,
                    multiple_comparisons_correction='holm-bonferroni',
                    significance_test=scipy.stats.mannwhitneyu)
     exp = pd.DataFrame({'W': np.array([0]*7),
                         'reject': np.array([False]*7, dtype=bool)})
     assert_data_frame_almost_equal(result, exp)
开发者ID:anderspitman,项目名称:scikit-bio,代码行数:8,代码来源:test_composition.py

示例11: test_ancom_alpha

 def test_ancom_alpha(self):
     result = ancom(self.table1, self.cats1,
                    multiple_comparisons_correction=None, alpha=0.5)
     exp = pd.DataFrame(
         {'W': np.array([6, 6, 4, 5, 5, 4, 2]),
          'Reject null hypothesis': np.array([True, True, False, True,
                                              True, False, False],
                                             dtype=bool)})
     assert_data_frame_almost_equal(result[0], exp)
开发者ID:disulfidebond,项目名称:scikit-bio,代码行数:9,代码来源:test_composition.py

示例12: test_ancom_noncontiguous

 def test_ancom_noncontiguous(self):
     result = ancom(self.table5,
                    self.cats5,
                    multiple_comparisons_correction=None)
     exp = pd.DataFrame({'W': np.array([6, 2, 2, 2, 2, 6, 2]),
                         'reject': np.array([True, False, False, False,
                                             False, True, False],
                                            dtype=bool)})
     assert_data_frame_almost_equal(result, exp)
开发者ID:anderspitman,项目名称:scikit-bio,代码行数:9,代码来源:test_composition.py

示例13: test_ancom_letter_categories

 def test_ancom_letter_categories(self):
     result = ancom(self.table7,
                    self.cats7,
                    multiple_comparisons_correction=None)
     exp = pd.DataFrame({'W': np.array([5, 3, 3, 2, 2, 5, 2]),
                         'reject': np.array([True, False, False, False,
                                             False, True, False],
                                            dtype=bool)})
     assert_data_frame_almost_equal(result, exp)
开发者ID:anderspitman,项目名称:scikit-bio,代码行数:9,代码来源:test_composition.py

示例14: test_ancom_unbalanced

 def test_ancom_unbalanced(self):
     result = ancom(self.table6,
                    self.cats6,
                    multiple_comparisons_correction=None)
     exp = pd.DataFrame(
         {'W': np.array([5, 3, 3, 2, 2, 5, 2]),
          'Reject null hypothesis': np.array([True, False, False, False,
                                              False, True, False],
                                             dtype=bool)})
     assert_data_frame_almost_equal(result[0], exp)
开发者ID:disulfidebond,项目名称:scikit-bio,代码行数:10,代码来源:test_composition.py

示例15: test_ancom_alternative_test

 def test_ancom_alternative_test(self):
     result = ancom(self.table1,
                    self.cats1,
                    multiple_comparisons_correction=None,
                    significance_test=scipy.stats.ttest_ind)
     exp = pd.DataFrame({'W': np.array([5, 5, 2, 2, 2, 2, 2]),
                         'reject': np.array([True,  True, False, False,
                                             False, False, False],
                                            dtype=bool)})
     assert_data_frame_almost_equal(result, exp)
开发者ID:anderspitman,项目名称:scikit-bio,代码行数:10,代码来源:test_composition.py


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