Skip to content

subsetByLeaf(tse) mixes up the rowTree tips and rownames of the new object #83

@Begia

Description

@Begia

f you want to subset the tree in a tse object, because e.g., PhILR requires the rowTree(tse) to match the taxa present in the tse, as in rownames(tse), the recommendation was to use: subsetByLeaf(tse, rowLeaf = rowLinks(tse)$nodeLab)
However, this messes up the connection between the new tree tips (or rowLinks(tse)$nodeLab) and rownames(tse).

Instead, the subsetting done directly with rowtree(tse) <- ape::keep.tip(phy = rowTree(greengenes2_16S), tip = rowLinks(greengenes2_16S)$nodeLab) appears to work without issues
further evidence:

> identical(rownames(tse), rowLinks(tse)$nodeLab)
[1] TRUE
> new_tse <- subsetByLeaf(tse, rowLeaf = rowLinks(tse)$nodeLab)
> identical(rownames(new_tse), rowLinks(new_tse)$nodeLab)
[1] FALSE
> ape_tse <- tse
> rowTree(ape_tse) <- ape::keep.tip(phy = rowTree(ape_tse), tip = rowLinks(ape_tse)$nodeLab)
> identical(rownames(ape_tse), rowLinks(ape_tse)$nodeLab)
[1] TRUE

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions