Skip to content

Commit

Permalink
Fix multi-tree testing
Browse files Browse the repository at this point in the history
  • Loading branch information
richardreeve committed Nov 22, 2023
1 parent 58e07bd commit 142ee86
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
22 changes: 13 additions & 9 deletions test/run_rcall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,22 @@ global skipR = !rcopy(R"require(ape)")
end

@testset "Testing reading in newick trees from disk" begin
jtree = open(parsenewick, Phylo.path("H1N1.newick"))
rtree = rcall(Symbol("read.tree"), Phylo.path("H1N1.newick"))
@test rcopy(rcall(Symbol("all.equal"), jtree, rtree))
if nodedatatype(TreeType) <: Dict
jtree = open(io -> parsenewick(io, TreeType), Phylo.path("H1N1.newick"))
rtree = rcall(Symbol("read.tree"), Phylo.path("H1N1.newick"))
@test rcopy(rcall(Symbol("all.equal"), jtree, rtree))
end
end

@testset "Testing reading in nexus trees from disk" begin
jts = open(parsenexus, Phylo.path("H1N1.trees"))
rtree1 = R"read.nexus($(Phylo.path(\"H1N1.trees\")))$TREE1"
jtree1 = jts["TREE1"]
@test rcopy(rcall(Symbol("all.equal"), jtree1, rtree1))
@test "H1N1_A_MIYAGI_3_2000" nodenameiter(jtree1)
@test collect(keys(gettreeinfo(jts)["TREE1"])) == ["lnP"]
if nodedatatype(TreeType) <: Dict
jts = open(io -> parsenexus(io, TreeType), Phylo.path("H1N1.trees"))
rtree1 = R"read.nexus($(Phylo.path(\"H1N1.trees\")))$TREE1"
jtree1 = jts["TREE1"]
@test rcopy(rcall(Symbol("all.equal"), jtree1, rtree1))
@test "H1N1_A_MIYAGI_3_2000" nodenameiter(jtree1)
@test collect(keys(gettreeinfo(jts)["TREE1"])) == ["lnP"]
end
end
end
end
Expand Down
10 changes: 10 additions & 0 deletions test/test_Interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ using DataFrames
using Test

matchbranch = true

@testset "Parsing multi-root trees" begin
jts = open(parsenexus, Phylo.path("H1N1.trees"))
@test ntrees(jts) == 2
@test gettreeinfo(jts, "TREE2") gettreeinfo(jts)["TREE2"]
@test all(values(nroots(jts)) .== nroots(jts, "TREE1"))
@test getroot(jts)["TREE1"] getroot(jts, "TREE1")
@test getroots(jts)["TREE1"] getroots(jts, "TREE1")
end

@testset "Build and tear down trees" begin
@testset "For $TreeType" for TreeType in
[NamedTree, NamedBinaryTree,
Expand Down

0 comments on commit 142ee86

Please sign in to comment.