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


Python RarefactionMaker.rarefy_to_list方法代码示例

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


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

示例1: test_rarefy_to_list

# 需要导入模块: from qiime.rarefaction import RarefactionMaker [as 别名]
# 或者: from qiime.rarefaction.RarefactionMaker import rarefy_to_list [as 别名]
 def test_rarefy_to_list(self):
     """rarefy_to_list should rarefy correctly, same names, rm empty samples
     
     """
     maker = RarefactionMaker(self.otu_tuple, 0, 1, 1, 1)
     res = maker.rarefy_to_list(include_full=True)
     self.assertFloatEqual(res[-1][2], self.sample_names)
     self.assertFloatEqual(res[-1][3], self.taxon_names)
     self.assertFloatEqual(res[-1][4], self.otu_table_transpose.T)
     
     # each sample should have 1 seq, sample z should be removed
     self.assertFloatEqual((res[1][4]).sum(0),[1.0,1.0] )
开发者ID:carze,项目名称:clovr-base,代码行数:14,代码来源:test_rarefaction.py

示例2: test_rarefy_to_list

# 需要导入模块: from qiime.rarefaction import RarefactionMaker [as 别名]
# 或者: from qiime.rarefaction.RarefactionMaker import rarefy_to_list [as 别名]
    def test_rarefy_to_list(self):
        """rarefy_to_list should rarefy correctly, same names
        
        """
        maker = RarefactionMaker(self.otu_table_fp, 0, 1, 1, 1)
        res = maker.rarefy_to_list(include_full=True)
        self.assertFloatEqual(res[-1][2].SampleIds, self.otu_table.SampleIds)
        self.assertFloatEqual(res[-1][2].ObservationIds, self.otu_table.ObservationIds)
        self.assertEqual(res[-1][2], self.otu_table)

        sample_value_sum = []
        for val in res[1][2].iterSampleData():
            sample_value_sum.append(val.sum())
        self.assertFloatEqual(sample_value_sum, [1.0, 1.0])
开发者ID:DDomogala3,项目名称:qiime,代码行数:16,代码来源:test_rarefaction.py

示例3: test_rarefy_to_list

# 需要导入模块: from qiime.rarefaction import RarefactionMaker [as 别名]
# 或者: from qiime.rarefaction.RarefactionMaker import rarefy_to_list [as 别名]
    def test_rarefy_to_list(self):
        """rarefy_to_list should rarefy correctly, same names

        """
        maker = RarefactionMaker(self.otu_table_fp, 0, 1, 1, 1)
        res = maker.rarefy_to_list(include_full=True)
        self.assertItemsEqual(res[-1][2].ids(), self.otu_table.ids())
        self.assertItemsEqual(
            res[-1][2].ids(axis='observation'),
            self.otu_table.ids(axis='observation'))
        self.assertEqual(res[-1][2], self.otu_table)

        sample_value_sum = []
        for val in res[1][2].iter_data(axis='sample'):
            sample_value_sum.append(val.sum())
        npt.assert_almost_equal(sample_value_sum, [1.0, 1.0])
开发者ID:cuttlefishh,项目名称:qiime,代码行数:18,代码来源:test_rarefaction.py

示例4: get_rarefactions

# 需要导入模块: from qiime.rarefaction import RarefactionMaker [as 别名]
# 或者: from qiime.rarefaction.RarefactionMaker import rarefy_to_list [as 别名]
def get_rarefactions(biom_object, minimum, maximum, iterations, steps):
	"""rarify biom object and return rarefactions

	Inputs:
	biom_object: object to rarefy
	minimum: starting point for the rarefactions
	maximum: ending point for the rarefactions
	iterations: repetitions per rarefaction depth
	steps: number of levels between minimum and maximum

	Outputs:
	list of 3 element tuples, where each tuple contains as a 1st element the
	rarefaction depth, as a 2nd element the iteration number and as a 3rd
	element the rarefied biom corresponding to this depth
	"""

	rarefaction_step_size = int((maximum - minimum)/steps)

	rarefaction_maker = RarefactionMaker(biom_object, minimum,  maximum,\
		rarefaction_step_size, iterations)
	rarefactions = rarefaction_maker.rarefy_to_list()

	return rarefactions
开发者ID:wdwvt1,项目名称:evident,代码行数:25,代码来源:rarefaction.py


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