aaronmussig / PhyloDM

Efficient calculation of phylogenetic distance matrices.
GNU General Public License v3.0
45 stars 2 forks source link

An error occured when I load tree file #16

Closed CNwangbin closed 4 months ago

CNwangbin commented 1 year ago

I met an error when I loaded tree file. Can you offer some help for me? ` tree_path = 'data/97_otus.tree' ---> pdm = PhyloDM.load_from_newick_path(tree_path) File /home/software/anaconda3/envs/py3.9/lib/python3.9/site-packages/phylodm/init.py:36, in PhyloDM.load_from_newick_path(cls, path) 32 print(f'Unable to load newick tree using light_phylogeny (Rust). ' 33 f'This is likely due to it not supporting the extended Newick format... ' 34 f'falling back to DendroPy to load the tree.') 35 tree = dendropy.Tree.get(path=path, schema='newick') ---> 36 return cls.load_from_dendropy(tree)

File /home/software/anaconda3/envs/py3.9/lib/python3.9/site-packages/phylodm/init.py:57, in PhyloDM.load_from_dendropy(cls, tree) 55 for node in tree.postorder_node_iter(): 56 if node.parent_node is not None: ---> 57 pdm.add_edge(parent_id=node_to_id[node.parent_node], 58 child_id=node_to_id[node], 59 length=node.edge_length) 60 return pdm

File /home/software/anaconda3/envs/py3.9/lib/python3.9/site-packages/phylodm/init.py:81, in PhyloDM.add_edge(self, parent_id, child_id, length) 73 def add_edge(self, parent_id: int, child_id: int, length: float): 74 """Add an edge between the two nodes 75 76 Args: (...) 79 length: The length of the edge. 80 """ ---> 81 return self._rs.add_edge(parent_id=parent_id, child_id=child_id, length=length)

TypeError: argument 'length': must be real number, not NoneType `

aaronmussig commented 4 months ago

Hi, can you send me the tree? I suspect this is due to one of the branches being None.