【问题标题】:Is there a way to build trees in Biopython Phylotree from scratch?有没有办法从头开始在 Biopython Phylotree 中构建树?
【发布时间】:2020-07-01 18:50:47
【问题描述】:

我正在尝试使用 Biopython Phylo 构建二叉树,但我无法将新子节点添加到当前节点,并且我没有 XML 文件或任何类型的类似数据可供读取。我只想编写代码,以便它构建并绘制具有不同边缘大小的树。这是我的代码:

from Bio.Phylo.BaseTree import Tree, Clade
from Bio import Phylo

lengths = [10, 12, 32, 44]
tree = Tree(rooted='True')
s = Clade(branch_length=lengths[0], clades = [Clade(branch_length=lengths[1]), Clade(branch_length=lengths[2])])
Phylo.draw(s)

a binary tree

将任何新的进化枝添加到列表中只会添加与此相同代的新分支,但我想通过向两个现有分支添加更多子代来扩展树。 我将不胜感激!

【问题讨论】:

    标签: python bioinformatics biopython phylogeny


    【解决方案1】:

    我找到了!这是一个小例子:

    t = Tree(rooted='True')
    c = Clade(branch_length=10, clades=[Clade(12, clades=[Clade(10), Clade(5)]), Clade(14)])
    Phylo.draw(c)
    

    clades() 内应该有 Clade()。 可能没有简单的方法让它迭代。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-08
      相关资源
      最近更新 更多