无法使用生物python TreeConstruction工具模块创建后门树

尝试使用biopython创建基本的系统树,特别是遵循此文档页面https://biopython.org/DIST/docs/api/Bio.Phylo.TreeConstruction.DistanceTreeConstructor-class.html。每次我使用fastfa文件时,我似乎都会出错。

from Bio.Phylo.TreeConstruction import DistanceCalculator
aln = AlignIO.read("canine.fasta",'fasta')
constructor = DistanceTreeConstructor()
calculator = DistanceCalculator('identity')
dm = calculator.get_distance(aln)
upgmatree = constructor.upgma(dm)
print(upmgmatree) 

我得到的错误:

  File "/Users/theodorelatimer/Desktop/Interna Assment HL Biology/Bio IA.py",line 36,in <module>
    upgmatree = constructor.upgma(dm)
  File "/library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/Bio/Phylo/TreeConstruction.py",line 696,in upgma
    inner_clade.branch_length = 0
UnboundLocalError: local variable 'inner_clade' referenced before assignment
我的目标是能够生成具有多种蛋白质序列的任何种类的门生树。不知道我在做什么错。我还尝试将更多的蛋白质序列添加到align变量中,但这似乎给了我同样的问题,涉及内部进化枝。

我知道在我链接的phylip的文档中使用过,但是我不确定如何进行序列比对。

zjwmomo 回答:无法使用生物python TreeConstruction工具模块创建后门树

the source for upgma()看,您遇到未分配inner_clade的情况的唯一方法是您传入的距离矩阵为空或长度为1。

如果您打印出dm,是这样吗?如果是这样,您可能必须找出原因。

本文链接:https://www.f2er.com/3003859.html

大家都在问