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

Python compare_distance_matrices.run_mantel_test函数代码示例

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

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



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

示例1: main

def main():
    option_parser, opts, args = parse_command_line_parameters(**script_info)

    # Create the output dir if it doesn't already exist.
    try:
        if not path.exists(opts.output_dir):
            create_dir(opts.output_dir)
    except:
        option_parser.error("Could not create or access output directory " "specified with the -o option.")
    sample_id_map = None
    if opts.sample_id_map_fp:
        sample_id_map = dict([(k, v[0]) for k, v in fields_to_dict(open(opts.sample_id_map_fp, "U")).items()])
    input_dm_fps = opts.input_dms
    distmats = [parse_distmat(open(dm_fp, "U")) for dm_fp in input_dm_fps]

    if opts.method == "mantel":
        output_f = open(path.join(opts.output_dir, "mantel_results.txt"), "w")
        output_f.write(
            run_mantel_test(
                "mantel",
                input_dm_fps,
                distmats,
                opts.num_permutations,
                opts.tail_type,
                comment_mantel_pmantel,
                sample_id_map=sample_id_map,
            )
        )
    elif opts.method == "partial_mantel":
        output_f = open(path.join(opts.output_dir, "partial_mantel_results.txt"), "w")
        output_f.write(
            run_mantel_test(
                "partial_mantel",
                input_dm_fps,
                distmats,
                opts.num_permutations,
                opts.tail_type,
                comment_mantel_pmantel,
                control_dm_fp=opts.control_dm,
                control_dm=parse_distmat(open(opts.control_dm, "U")),
                sample_id_map=sample_id_map,
            )
        )
    elif opts.method == "mantel_corr":
        output_f = open(path.join(opts.output_dir, "mantel_correlogram_results.txt"), "w")
        result_str, correlogram_fps, correlograms = run_mantel_correlogram(
            input_dm_fps, distmats, opts.num_permutations, comment_corr, opts.alpha, sample_id_map=sample_id_map
        )
        output_f.write(result_str)
        for corr_fp, corr in zip(correlogram_fps, correlograms):
            corr.savefig(path.join(opts.output_dir, corr_fp + opts.image_type), format=opts.image_type)
    output_f.close()
开发者ID:ranjit58,项目名称:qiime,代码行数:52,代码来源:compare_distance_matrices.py


示例2: test_run_mantel_test_single_matrix

 def test_run_mantel_test_single_matrix(self):
     """Test running mantel test on a single dm."""
     exp = '# A sample comment.\nDM\tDM\tNumber of entries\tMantel r ' + \
           'statistic\tp-value\tNumber of permutations\tTail type\n'
     obs = run_mantel_test('mantel', [self.fp1], [self.dm3], self.num_perms,
             'less', self.comment, 0.5)
     self.assertEqual(self.remove_nums(obs), exp)
开发者ID:Jorge-C,项目名称:qiime,代码行数:7,代码来源:test_compare_distance_matrices.py


示例3: test_run_mantel_test

 def test_run_mantel_test(self):
     """Test running mantel test on two distmats."""
     exp = '# A sample comment.\nDM\tDM\tNumber of entries\tMantel r ' + \
           'statistic\tp-value\tNumber of permutations\tTail type\n' + \
           'foo.txt\tbar.txt\t\t.\t.\t\tgreater\n'
     obs = run_mantel_test('mantel', [self.fp1, self.fp2],
             [self.dm1, self.dm2], self.num_perms, self.tail_type,
             self.comment, self.alpha)
     self.assertEqual(self.remove_nums(obs), exp)
开发者ID:Jorge-C,项目名称:qiime,代码行数:9,代码来源:test_compare_distance_matrices.py


示例4: test_run_mantel_test_partial_mantel_sample_id_map

 def test_run_mantel_test_partial_mantel_sample_id_map(self):
     """Test running partial mantel test with incompatible dms to map."""
     exp = '# A sample comment.\nDM\tDM\tCDM\tNumber of entries\tMantel' + \
           ' r statistic\tp-value\tNumber of permutations\tTail type\n' + \
           'foo.txt\tbar.txt\tbaz.txt\t\t.\t.\t\tgreater\n'
     obs = run_mantel_test('partial_mantel', [self.fp1, self.fp2],
             [self.dm1, self.dm2], self.num_perms, self.tail_type,
             self.comment, self.fp3, self.dm4, self.sample_id_map)
     self.assertEqual(self.remove_nums(obs), exp)
开发者ID:Jorge-C,项目名称:qiime,代码行数:9,代码来源:test_compare_distance_matrices.py


示例5: test_run_mantel_test_partial_mantel_too_small

 def test_run_mantel_test_partial_mantel_too_small(self):
     """Test running partial mantel test with incompatible dms."""
     exp = '# A sample comment.\nDM\tDM\tCDM\tNumber of entries\t' + \
           'Mantel r statistic\tp-value\tNumber of permutations\t' + \
           'Tail type\nfoo.txt\tbar.txt\tbaz.txt\t\tToo few samples\n'
     obs = run_mantel_test('partial_mantel', [self.fp1, self.fp2],
             [self.dm1, self.dm2], self.num_perms, self.tail_type,
             self.comment, self.fp3, self.dm4)
     self.assertEqual(self.remove_nums(obs), exp)
开发者ID:Jorge-C,项目名称:qiime,代码行数:9,代码来源:test_compare_distance_matrices.py


示例6: test_run_mantel_test_partial_mantel

 def test_run_mantel_test_partial_mantel(self):
     """Test running partial mantel test with two dms and a control dm."""
     exp = '# A sample comment.\nDM\tDM\tCDM\tNumber of entries\t' + \
           'Mantel r statistic\tp-value\tNumber of permutations\tTail ' + \
           'type\nfoo.txt\tbar.txt\tbaz.txt\t\t.\t.\t\tgreater\n'
     obs = run_mantel_test('partial_mantel', [self.fp1, self.fp2],
             [self.dm1, self.dm2], self.num_perms, self.tail_type,
             self.comment, self.fp3, self.dm3)
     self.assertEqual(self.remove_nums(obs), exp)
开发者ID:Jorge-C,项目名称:qiime,代码行数:9,代码来源:test_compare_distance_matrices.py


示例7: test_run_mantel_test_too_small

 def test_run_mantel_test_too_small(self):
     """Test running mantel test on two distmats that are incompatible."""
     exp = '# A sample comment.\nDM\tDM\tNumber of entries\tMantel r ' + \
     'statistic\tp-value\tNumber of permutations\tTail type\nfoo.txt\t' + \
     'bar.txt\t\tToo few samples\n'
     obs = run_mantel_test('mantel', [self.fp1, self.fp2],
             [self.dm3, self.dm4], self.num_perms, 'less',
             self.comment, 0.5)
     self.assertEqual(self.remove_nums(obs), exp)
开发者ID:Jorge-C,项目名称:qiime,代码行数:9,代码来源:test_compare_distance_matrices.py


示例8: test_run_mantel_test_sample_id_map

 def test_run_mantel_test_sample_id_map(self):
     """Test running mantel test on two distmats that need IDs mapped."""
     exp = '# A sample comment.\nDM\tDM\tNumber of entries\tMantel r ' + \
           'statistic\tp-value\tNumber of permutations\tTail type\n' + \
           'foo.txt\tbar.txt\t\t.\t.\t\tless\n'
     obs = run_mantel_test('mantel', [self.fp1, self.fp2],
             [self.dm3, self.dm4], self.num_perms, 'less',
             self.comment, 0.5, sample_id_map=self.sample_id_map)
     self.assertEqual(self.remove_nums(obs), exp)
开发者ID:Jorge-C,项目名称:qiime,代码行数:9,代码来源:test_compare_distance_matrices.py


示例9: test_run_mantel_test_multiple

 def test_run_mantel_test_multiple(self):
     """Test running mantel test on three distmats."""
     exp = (
         "# A sample comment.\nDM\tDM\tNumber of entries\tMantel r "
         + "statistic\tp-value\tNumber of permutations\tTail type\n"
         + "foo.txt\tbar.txt\t\t.\t.\t\tgreater\nfoo.txt\tbaz.txt\t\t-."
         + "\t.\t\tgreater\nbar.txt\tbaz.txt\t\t-.\t.\t\tgreater\n"
     )
     obs = run_mantel_test(
         "mantel",
         [self.fp1, self.fp2, self.fp3],
         [self.dm1, self.dm2, self.dm3],
         self.num_perms,
         self.tail_type,
         self.comment,
         self.alpha,
     )
     self.assertEqual(self.remove_nums(obs), exp)
开发者ID:ranjit58,项目名称:qiime,代码行数:18,代码来源:test_compare_distance_matrices.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python utils.check_flowgram_ali_exe函数代码示例发布时间:2022-05-26
下一篇:
Python compare_categories.compare_categories函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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