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


Python Tree.make_tree_binary方法代码示例

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


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

示例1: __init__

# 需要导入模块: import Tree [as 别名]
# 或者: from Tree import make_tree_binary [as 别名]
	def __init__(self, msa, tree, single_model, paired_model, treat_gap_as_missing):
		"""
		Input:

		msa  --- MSA object (the alignment)
		tree --- initially is the starting tree (dendropy.Tree)
		single/paired model -- EvoModel.{single|paired}model objects

		Also has the following attributes:
		single_cols --- list of unpaired positions
		paired_cols --- list of paired positions (i, j)
		order --- postorder traversal (often changes! beware!)
		like --- positive log likelihood (often changes! beware!)
		nnode, ncol, nbase for single/paired parameters...

		NOTE: ENFORCES tree TO BE BINARY
		"""
		self.msa = msa
		self.tree = tree
		self.single_model = single_model
		self.paired_model = paired_model
		self.treat_gap_as_missing = treat_gap_as_missing
		self.log_freq_single = log(self.single_model.Frequency)
		self.log_freq_paired = log(self.paired_model.Frequency)

		self.single_cols = msa.single_cols()
		self.paired_cols = msa.BP.items()
		self.paired_cols.sort()

		self.nnode = 2*msa.nseq + 1
		self.ncol = len(self.single_cols)
		self.nbase = 5
		self.nnode_p = self.nnode
		self.ncol_p = len(self.paired_cols)
		self.nbase_p = 25

		Tree.make_tree_binary(self.tree) # must preceded self.order!

		self.order = Tree.postorder_assign_then_traverse(tree, list(msa.ids))
		self.like = None # should be the positive log likelihood

		self.S = None # likelihood matrix for single positions
		self.P = None # likelihood matrix for paired positions
开发者ID:pombredanne,项目名称:gbpML,代码行数:45,代码来源:TreeLikelihood.py


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