• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python composition.ancom函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: test_ancom_multiple_comparisons

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


示例17: test_ancom_normal_data

 def test_ancom_normal_data(self):
     result = ancom(self.table2,
                    self.cats2,
                    multiple_comparisons_correction=None,
                    significance_test=scipy.stats.ttest_ind)
     exp = pd.DataFrame(
         {'W': np.array([8, 8, 3, 3, 8, 3, 3, 3, 3]),
          'Reject null hypothesis': np.array([True, True, False, False,
                                              True, False, False,
                                              False, False],
                                             dtype=bool)})
     assert_data_frame_almost_equal(result[0], exp)
开发者ID:disulfidebond,项目名称:scikit-bio,代码行数:12,代码来源:test_composition.py


示例18: test_ancom_no_percentiles

 def test_ancom_no_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'])
     result = ancom(table, grouping, percentiles=[])[1]
     assert_data_frame_almost_equal(result, pd.DataFrame())
开发者ID:disulfidebond,项目名称:scikit-bio,代码行数:13,代码来源:test_composition.py


示例19: test_ancom_multiple_groups

 def test_ancom_multiple_groups(self):
     test_table = pd.DataFrame(self.table4)
     original_table = copy.deepcopy(test_table)
     test_cats = pd.Series(self.cats4)
     original_cats = copy.deepcopy(test_cats)
     result = ancom(test_table, test_cats)
     # Test to make sure that the input table hasn't be altered
     assert_data_frame_almost_equal(original_table, test_table)
     # Test to make sure that the input table hasn't be altered
     pdt.assert_series_equal(original_cats, test_cats)
     exp = pd.DataFrame({'W': np.array([8, 7, 3, 3, 7, 3, 3, 3, 3]),
                         'reject': np.array([True, True, False, False,
                                             True, False, False, False,
                                             False], dtype=bool)})
     assert_data_frame_almost_equal(result, exp)
开发者ID:anderspitman,项目名称:scikit-bio,代码行数:15,代码来源:test_composition.py


示例20: test_ancom_basic_counts

 def test_ancom_basic_counts(self):
     test_table = pd.DataFrame(self.table1)
     original_table = copy.deepcopy(test_table)
     test_cats = pd.Series(self.cats1)
     original_cats = copy.deepcopy(test_cats)
     result = ancom(test_table,
                    test_cats,
                    multiple_comparisons_correction=None)
     # Test to make sure that the input table hasn't be altered
     assert_data_frame_almost_equal(original_table, test_table)
     # Test to make sure that the input table hasn't be altered
     pdt.assert_series_equal(original_cats, test_cats)
     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,代码行数:17,代码来源:test_composition.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python composition.closure函数代码示例发布时间:2022-05-27
下一篇:
Python sequences.parse_fasta函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap