Skip to content

Commit bb2d837

Browse files
committed
replace ete3 by ete4
1 parent d4b0021 commit bb2d837

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

.github/workflows/github_build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
echo "TEST fdog.setup"
4545
fdog.setup -d /home/runner/work/fDOG/fDOG/dt --woFAS
4646
echo "TEST fdog.checkData"
47-
fdog.checkData -s /home/runner/work/fDOG/fDOG/dt/searchTaxa_dir -c /home/runner/work/fDOG/fDOG/dt/coreTaxa_dir -a /home/runner/work/fDOG/fDOG/dt/annotation_dir --reblast
47+
fdog.checkData -s /home/runner/work/fDOG/fDOG/dt/searchTaxa_dir -c /home/runner/work/fDOG/fDOG/dt/coreTaxa_dir -a /home/runner/work/fDOG/fDOG/dt/annotation_dir --reblast --ignoreAnno
4848
echo "TEST fdog.showTaxa"
4949
fdog.showTaxa
5050
echo "TEST fdog.run"

fdog/libs/tree.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ def get_ancestor(id1, id2, ncbi):
5757
Return dictionary {ancestor_id: ancestor_rank}
5858
"""
5959
tree = ncbi.get_topology([id1, id2], intermediate_nodes = False)
60-
ancestor = tree.get_common_ancestor(id1, id2).name
61-
return(ncbi.get_rank([ancestor]))
60+
ancestor_name = tree.common_ancestor(id1, id2)
61+
ancestor_id = int(ancestor_name.name)
62+
return(ncbi.get_rank([ancestor_id]))
6263

6364

6465
def check_common_ancestor(ref_id, ancestor, minDist, maxDist, ncbi):
@@ -68,6 +69,7 @@ def check_common_ancestor(ref_id, ancestor, minDist, maxDist, ncbi):
6869
"""
6970
ref_lineage = ncbi.get_lineage(ref_id)
7071
(min_ref, max_ref) = get_rank_range(ref_lineage, minDist, maxDist, ncbi)
72+
ancestor = int(ancestor)
7173
if not ancestor in ref_lineage:
7274
return(0)
7375
ancestor_index = len(ref_lineage) - ref_lineage.index(ancestor) - 1
@@ -78,7 +80,7 @@ def check_common_ancestor(ref_id, ancestor, minDist, maxDist, ncbi):
7880

7981
def remove_clade(tree, node_id):
8082
""" Remove a clade from a tree """
81-
removed_clade = tree.search_nodes(name = str(node_id))[0]
83+
removed_clade = list(tree.search_nodes(name = str(node_id)))[0]
8284
removed_node = removed_clade.detach()
8385
return(tree)
8486

@@ -96,12 +98,12 @@ def get_leaves_dict(spec_lineage, tree, min_index, max_index):
9698
for i in range(len(spec_lineage)):
9799
if i >= min_index and i <= max_index:
98100
curr_node = spec_lineage[i]
99-
node = tree.search_nodes(name = str(curr_node))
101+
node = list(tree.search_nodes(name = str(curr_node)))
100102
if len(node) > 0:
101103
for leaf in node:
102104
node_dict[spec_lineage[i]] = []
103105
for t in leaf.traverse():
104-
if t.is_leaf():
106+
if t.is_leaf:
105107
if not t.name in already_added:
106108
already_added.append(t.name)
107109
node_dict[spec_lineage[i]].append(t.name)

0 commit comments

Comments
 (0)