无法使用bio pythons TreeConstruction工具模块创建系统树

问题描述 投票:0回答:1

[尝试使用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的文档中使用过,但是我不确定如何进行序列比对。

python bioinformatics biopython
1个回答
0
投票

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

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

© www.soinside.com 2019 - 2024. All rights reserved.