emmanuelparadis / ape

analysis of phylogenetics and evolution
http://ape-package.ird.fr/
GNU General Public License v2.0
52 stars 11 forks source link

Adds node labels to ace output if available #106

Closed TGuillerme closed 7 months ago

TGuillerme commented 7 months ago

Hi ape team,

This is just a small aesthetic change to ace to output estimations with node labels names if the provided phy had some. The tests are below (based on the example).

Cheers, Thomas

test_that("adding node labels to ace output works", {
    ## Example with no node labels
    data(bird.orders)
    x <- rnorm(23)
    ### Compare the three methods for continuous characters:
    out <- ace(x, bird.orders)
    expect_equal(names(out$ace), as.character(seq(from = 1+Ntip(bird.orders), to = Nnode(bird.orders)+Ntip(bird.orders))))
    expect_equal(rownames(out$CI95), as.character(seq(from = 1+Ntip(bird.orders), to = Nnode(bird.orders)+Ntip(bird.orders))))

    ## Adding node labels
    phy_nodes <- makeNodeLabel(bird.orders)
    out <- ace(x, phy_nodes)
    expect_equal(names(out$ace), phy_nodes$node.label)
    expect_equal(rownames(out$CI95), phy_nodes$node.label)
})
emmanuelparadis commented 7 months ago

Hi Thomas, Good idea! I edited your PR and added it in ape. It's pushed here now. I added your test in apeTests. Thanks! Cheers, Emmanuel