我不确定我是否做错了什么,但我一直在尝试使用birth_death_tree(下面的代码片段:)
import dendropy
tree = dendropy.model.birthdeath.birth_death_tree(1.0,0.1,max_time = 5.0)
# Returns distance of node furthest from root, i.e., maximum time available on
# tree
total_time = tree.max_distance_from_root()
# Divide time span into 10 steps
step = float(total_time) / 10
# To store tuples of (time, number of lineages)
ltt = []
# Start at first time step
current_time = step
while current_time <= total_time:
# Get number of lineages at current time
num_lineages = tree.num_lineages_at(current_time)
# Store it
ltt.append( (current_time, num_lineages) )
# Move to next time step
current_time += step
# Get the final number of lineages
# Note: may not be the same as the number of tips if the tree has extinct
# tips/taxa; though, if this were the case, we would not be dealing with an
# ultrametric tree.
if current_time < total_time:
ltt.append( (total_time, tree.num_lineages_at(total_time)) )
# Print results
for t, num_lineages in ltt:
print("{:12.8f}\t{}".format(t, num_lineages))
我正在使用他们在文档中的 ltt 函数,并用模型树https://pythonhosted.org/DendroPy/library/birthdeath.html替换内置树
血统数量的输出使我在 LTT 图结束时减少了节点数量。这是不可能的,因为模型中的所有节点都应该在完全相同的位置结束,即一个常数。有人能弄清楚为什么会这样吗?