From c5d5f67b2d174ce50be47f13583e3d61c6875d9b Mon Sep 17 00:00:00 2001 From: brendanf Date: Thu, 15 Oct 2020 15:03:38 +0200 Subject: [PATCH] restructure output of phylotax() --- DESCRIPTION | 2 +- NEWS.md | 17 +++++ R/taxonomy.R | 75 ++++++++++++++-------- README.Rmd | 15 ++++- README.md | 78 ++++++++++++++--------- man/figures/README-unnamed-chunk-2-1.png | Bin 4004 -> 4705 bytes man/phylotax.Rd | 24 ++++--- tests/testthat/node_taxa.rds | Bin 0 -> 247 bytes tests/testthat/phylotax.rds | Bin 500 -> 0 bytes tests/testthat/rejected.rds | Bin 0 -> 256 bytes tests/testthat/retained.rds | Bin 0 -> 275 bytes tests/testthat/test-consensus.R | 9 +++ tests/testthat/test-phylotax.R | 7 +- tests/testthat/tip_taxa.rds | Bin 0 -> 282 bytes 14 files changed, 160 insertions(+), 67 deletions(-) create mode 100644 tests/testthat/node_taxa.rds delete mode 100644 tests/testthat/phylotax.rds create mode 100644 tests/testthat/rejected.rds create mode 100644 tests/testthat/retained.rds create mode 100644 tests/testthat/test-consensus.R create mode 100644 tests/testthat/tip_taxa.rds diff --git a/DESCRIPTION b/DESCRIPTION index 31424ca..8b8cd5a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: phylotax Type: Package Title: Refine taxonomic assignment of environmental sequences using a taxonomic tree -Version: 0.0.2.1 +Version: 0.0.3 Authors@R: person(given = "Brendan", family = "Furneaux", email = "brendan.furneaux@gmail.com", role = c("aut", "cre")) diff --git a/NEWS.md b/NEWS.md index c16494a..2dbf068 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,20 @@ +# phlotax 0.0.3 + +* **BREAKING CHANGE** `phylotax` returns taxonomic tables in four categories; + * "`tip_taxa`" is the assignments which PHYLOTAX has made itself. + * "`rejected`" are primary assignments which PHYLOTAX has rejected. + * "`retained`" are primary assignments which PHYLOTAX has not rejected; + however some of them may still be ambiguous. + * "`missing`" are primary assignments whose labels are not present in the + tree, so PHYLOTAX has not done anything with them. (But note that this will + be empty if no tree was given). +* `phylotax()` now returns an S3 object of class "`phylotax`". This should not + break anything, and it allows the possibility of nice improvements in the + future. +* `phylotax()$node_taxa` now includes a "`label`" column, and populates it with + node labels if they exist, or just the numbers if they don't. Node labels are + also used in trace output. + # phylotax 0.0.2.1 * Two quick bugfix, applying to errors in `taxonomy_sintax()` and diff --git a/R/taxonomy.R b/R/taxonomy.R index 3b267ba..4535057 100644 --- a/R/taxonomy.R +++ b/R/taxonomy.R @@ -541,10 +541,14 @@ new_phylotax_env <- function(tree, taxa, parent = parent.frame()) { .parent = parent, node_taxa = tibble::tibble( node = integer(), + label = NULL, rank = taxa$rank[FALSE], taxon = character() ), - tip_taxa = dplyr::filter(taxa, .data$label %in% tree$tip.label), + tip_taxa = dplyr::filter(taxa, FALSE), + retained = dplyr::filter(taxa, .data$label %in% tree$tip.label), + rejected = dplyr::filter(taxa, FALSE), + missing = dplyr::filter(taxa, !.data$label %in% tree$tip.label), tree = tree ) } @@ -552,35 +556,39 @@ new_phylotax_env <- function(tree, taxa, parent = parent.frame()) { phylotax_ <- function(tree, taxa, node, ranks, method, e) { if (length(ranks) == 0) return() - + nodelabel <- if (!is.null(tree$node.label)) { + tree$node.label[node - ape::Ntip(tree)] + } else { + as.character(node) + } parents <- phangorn::Ancestors(tree, node, type = "all") for (r in ranks) { if (is.ordered(ranks)) r <- ordered(r, levels = levels(ranks)) if (any(e$node_taxa$node %in% parents & e$node_taxa$rank == r)) next - taxon <- clade_taxon(tree, e$tip_taxa, node, r) + taxon <- clade_taxon(tree, e$retained, node, r) if (is.na(taxon)) { - futile.logger::flog.debug("Could not assign a %s to node %d.", r, node) + futile.logger::flog.debug("Could not assign a %s to node %s.", r, nodelabel) for (n in phangorn::Children(tree, node)) { - phylotax_(tree, e$tip_taxa, n, ranks, method, e) + phylotax_(tree, e$retained, n, ranks, method, e) } break } else { children <- phangorn::Children(tree, node) if (length(children) > 0) { futile.logger::flog.info( - "Assigned node %d and its %d children to %s %s.", - node, length(children), as.character(r), taxon) + "Assigned node %s and its %d children to %s %s.", + nodelabel, length(children), as.character(r), taxon) } else { - futile.logger::flog.info("Assigned node %d to %s %s.", node, + futile.logger::flog.info("Assigned node %s to %s %s.", nodelabel, as.character(r), taxon) } ranks <- ranks[-1] e$node_taxa <- dplyr::bind_rows( e$node_taxa, - tibble::tibble(node = node, rank = r, taxon = taxon) + tibble::tibble(node = node, label = nodelabel, rank = r, taxon = taxon) ) tips <- tree$tip.label[phangorn::Descendants(tree, node, type = "tips")[[1]]] - wrongTaxa <- e$tip_taxa %>% + wrongTaxa <- e$retained %>% dplyr::filter( .data$label %in% tips, .data$rank == r, @@ -596,11 +604,16 @@ phylotax_ <- function(tree, taxa, node, ranks, method, e) { newAssign[[n]] <- unname(method[n]) } # remove assignments which are not consistent with the one we just chose - e$tip_taxa <- dplyr::bind_rows( - dplyr::filter(e$tip_taxa, .data$rank < r), - dplyr::filter(e$tip_taxa, .data$rank >= r) %>% - dplyr::anti_join(wrongTaxa, by = names(wrongTaxa)), - newAssign + e$tip_taxa <- dplyr::bind_rows(e$tip_taxa, newAssign) + e$rejected <- dplyr::bind_rows( + e$rejected, + dplyr::filter(e$retained, .data$rank >= r) %>% + dplyr::semi_join(wrongTaxa, by = names(wrongTaxa)) + ) + e$retained <- dplyr::bind_rows( + dplyr::filter(e$retained, .data$rank < r), + dplyr::filter(e$retained, .data$rank >= r) %>% + dplyr::anti_join(wrongTaxa, by = names(wrongTaxa)) ) } } @@ -647,14 +660,20 @@ phylotax_ <- function(tree, taxa, node, ranks, method, e) { #' treat each unique combination of values in these columns as a distinct #' method. #' -#' @return a list with two elements, "tip_taxa" and "node_taxa". "tip_taxa" is -#' a `tibble::tibble()` with the same format as `taxa`, in -#' which assignments which are inconsistent with the phylogeny have been -#' removed, and new assignments deduced or confirmed from the phylogeny. -#' These are identified by the value "phylotax" in the "method" column, -#' which is created if it does not already exist. "node_taxa" has columns -#' "node", "rank" and "taxon", giving taxonomic assignments for the nodes of -#' the tree. +#' @return an S3 object with class "`phylotax`", with five elements: +#' * "`tip_taxa` a `tibble::tibble()` with the same format as `taxa`, containing +#' taxonomy assignments made by PHYLOTAX to tips. +#' * "`node_taxa`" a `tibble::tibble()` with columns "`node`", "`label`", +#' "`rank`" and "`taxon`" giving taxonomy assignments made by PHYLOTAX to +#' internal nodes. +#' * "`rejected`" a `tibble::tibble()` with the same format as `taxa` giving +#' primary assignments which have been rejected by PHYLOTAX. +#' * "`retained`" a `tibble::tibble()` with the same format as `taxa` giving +#' primary assignments which have not been rehected by PHYLOTAX. These may +#' contain inconsistencies that PHYLOTAX was unable to resolve. +#' * "`missing`" a `tibble::tibble()` with the same format as `taxa`, giving the +#' primary assignments which have not been assessed by PHULOTAX because they +#' have labels which are not present on the tree. #' #' @export phylotax <- function( @@ -670,9 +689,13 @@ phylotax <- function( e <- new_phylotax_env(tree, count_assignments(taxa), ranks) ranks <- sort(unique(taxa$rank)) phylotax_(tree, taxa, phangorn::getRoot(tree), ranks, method, e) - e$tip_taxa$n_tot <- NULL - e$tip_taxa$n_diff <- NULL - as.list(e) + for (member in c("missing", "retained", "rejected", "tip_taxa")) + for (n in c("n_tot", "n_diff")) + e[[member]][[n]] <- NULL + structure( + as.list(e), + class = "phylotax" + ) } #' Simple phylogenetic tree for use in examples diff --git a/README.Rmd b/README.Rmd index bb1c490..8aa7e7c 100644 --- a/README.Rmd +++ b/README.Rmd @@ -76,13 +76,24 @@ supports it. phylotax_out <- phylotax(tree = example_tree(), taxa = example_taxa()) ``` -PHYLOTAX returns a list containing the tree, taxa assigned to tips, -and taxa assigned to nodes. Let's look at the tip taxa assignments. +PHYLOTAX returns a list of class "`phylotax`" containing the tree, +taxa assignments for tips and internal nodes, as well as tables dividing the +primary assignments into those which were rejected, those which were retained, +and those which were missing from the input tree. ```{r} phylotax_out$tip_taxa ``` +```{r} +phylotax_out$retained +``` + +```{r} +phylotax_out$rejected +``` + + Phylotax has used the following logic: 1. It's not possible to decide what the root (node 1) is, because one of its diff --git a/README.md b/README.md index 24fefaf..c7309e6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ -# phylotax +phylotax +======== @@ -11,7 +12,8 @@ status](https://travis-ci.com/brendanf/phylotax.svg?branch=master)](https://trav coverage](https://codecov.io/gh/brendanf/phylotax/branch/master/graph/badge.svg)](https://codecov.io/gh/brendanf/phylotax?branch=master) -## Installation +Installation +------------ Install the development version from [GitHub](https://github.com/) with: @@ -20,7 +22,8 @@ Install the development version from [GitHub](https://github.com/) with: devtools::install_github("brendanf/phylotax") ``` -## Usage +Usage +----- The PHYLOTAX algorithm takes as input taxonomic annotations from one or more primary taxonomic assignment algoirthms, and refines them using a @@ -40,15 +43,14 @@ plot(example_tree(), show.node.label = TRUE) And here is a set of taxonomic assignments for the tips of the tree, based on two hypothetical primary assignment algorithms “XTAX” and -“YTAX”. Some of the tips have been assigned to two genera: “Tax1” -and “Tax2”. The `phylotax` package includes the function `taxtable()` -which can generate a table of this type based on the output of various -primary assignment algorithms, but all that’s important is that it -contains the columns “label”, “rank”, and “taxon”. The ranks need to be -one of “rootrank”, “domain”, “kingdom”, “phylum”, “class”, “order”, -“family”, “genus”, and “species”. Our example also has a “method” -column, which PHYLOTAX uses to identify which assignments come from the -same source. +“YTAX”. Some of the tips have been assigned to two genera: “Tax1” and +“Tax2”. The `phylotax` package includes the function `taxtable()` which +can generate a table of this type based on the output of various primary +assignment algorithms, but all that’s important is that it contains the +columns “label”, “rank”, and “taxon”. The ranks need to be one of +“rootrank”, “domain”, “kingdom”, “phylum”, “class”, “order”, “family”, +“genus”, and “species”. Our example also has a “method” column, which +PHYLOTAX uses to identify which assignments come from the same source. ``` r example_taxa() @@ -87,28 +89,46 @@ tree supports it. ``` r phylotax_out <- phylotax(tree = example_tree(), taxa = example_taxa()) -#> INFO [2020-10-14 17:35:34] Assigned node 9 and its 2 children to genus Tax2. -#> INFO [2020-10-14 17:35:34] Assigned node 10 and its 2 children to genus Tax1. +#> INFO [2020-10-15 15:02:50] Assigned node 3 and its 2 children to genus Tax2. +#> INFO [2020-10-15 15:02:50] Assigned node 4 and its 2 children to genus Tax1. ``` -PHYLOTAX returns a list containing the tree, taxa assigned to tips, and -taxa assigned to nodes. Let’s look at the tip taxa assignments. +PHYLOTAX returns a list of class “`phylotax`” containing the tree, taxa +assignments for tips and internal nodes, as well as tables dividing the +primary assignments into those which were rejected, those which were +retained, and those which were missing from the input tree. ``` r phylotax_out$tip_taxa -#> # A tibble: 10 x 4 -#> label method rank taxon -#> -#> 1 C XTAX genus Tax2 -#> 2 B YTAX genus Tax2 -#> 3 C YTAX genus Tax2 -#> 4 D YTAX genus Tax1 -#> 5 F YTAX genus Tax1 -#> 6 B PHYLOTAX genus Tax2 -#> 7 C PHYLOTAX genus Tax2 -#> 8 E PHYLOTAX genus Tax1 -#> 9 F PHYLOTAX genus Tax1 -#> 10 D PHYLOTAX genus Tax1 +#> # A tibble: 5 x 4 +#> label method rank taxon +#> +#> 1 B PHYLOTAX genus Tax2 +#> 2 C PHYLOTAX genus Tax2 +#> 3 E PHYLOTAX genus Tax1 +#> 4 F PHYLOTAX genus Tax1 +#> 5 D PHYLOTAX genus Tax1 +``` + +``` r +phylotax_out$retained +#> # A tibble: 5 x 4 +#> label method rank taxon +#> +#> 1 C XTAX genus Tax2 +#> 2 B YTAX genus Tax2 +#> 3 C YTAX genus Tax2 +#> 4 D YTAX genus Tax1 +#> 5 F YTAX genus Tax1 +``` + +``` r +phylotax_out$rejected +#> # A tibble: 2 x 4 +#> label method rank taxon +#> +#> 1 B XTAX genus Tax1 +#> 2 D XTAX genus Tax2 ``` Phylotax has used the following logic: diff --git a/man/figures/README-unnamed-chunk-2-1.png b/man/figures/README-unnamed-chunk-2-1.png index cd8d860bbbba59931b5c5fdc0d0f2a94a3c78877..aa6631e29a06a7ae60b842881a4cc124339710e2 100644 GIT binary patch literal 4705 zcmeHKXH=6}8V;gFrKu=A2?&S<7;7{@outdv^BB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C=}jOkNOn+5r@F8PjbkO zg;L^;S$9AfyCy*p#xK~5_s0q&J7t#TBl7q=6ie&i9o~YQ0TAN;xO#P-<-y97X znL+Cc*drb0fkvApxR#ERKf1vytHYQU?U5n18fybt-lgQT@QY9WPGY7wlZ$K&Mn;mL z5OXPcJVs8GNv!gZEDqW_H-UQLAV0GV z>8y&6TW5mn3=HlxVMBjJbe~Era>9qD$}cvhWxvvuu{Ofb>Hk9Qqr#n@$=dJekFb*fLKA$BL>%Az@STxOin-3d9?HSXr&Y1}Q zejkp<2#GP@v&wOMhNK(RO#T?=vsLnC0j;bt<7$ntcy2tV4ntkQ+sJ;uH)Rv0$2zfn z2!Ah1nAsQLgvqB&JV8`yreMX_C43%hWg|@#Zl0e9zY4UFIGaJ(Ayyb|49{Y| z1$kIs`6c1^=;MVF^xp~$cd;_;FJ9aOQ8f6O75gm1v=~r&D8M9kBfK3D2}u0$OmUx8 zS`f7Ex{L07L0kC@(}6uFmC_dn4A(J60fMMkpY<)hHkiVXKY31$@v^iaP#Gf-oDYyQ z6cz$-xGhIt2c|g9jsv*)MUlh8kG#B#j8XUmr#orK`^9H`$?3MbcWRP{VbxR!ucoxc pWGEA;&_u9tEdDS5Q3f^;mCPs#|4Pjk_$$L@X=Y>k>g1J}e*-j%xn=+W diff --git a/man/phylotax.Rd b/man/phylotax.Rd index 8a82ecd..11dee32 100644 --- a/man/phylotax.Rd +++ b/man/phylotax.Rd @@ -36,14 +36,22 @@ with values/levels from the set rootrank, domain, kingdom, phylum, class, order, how to identify different methods. See details.} } \value{ -a list with two elements, "tip_taxa" and "node_taxa". "tip_taxa" is -a \code{tibble::tibble()} with the same format as \code{taxa}, in -which assignments which are inconsistent with the phylogeny have been -removed, and new assignments deduced or confirmed from the phylogeny. -These are identified by the value "phylotax" in the "method" column, -which is created if it does not already exist. "node_taxa" has columns -"node", "rank" and "taxon", giving taxonomic assignments for the nodes of -the tree. +an S3 object with class "\code{phylotax}", with five elements: +\itemize{ +\item "\code{tip_taxa} a \code{tibble::tibble()} with the same format as \code{taxa}, containing +taxonomy assignments made by PHYLOTAX to tips. +\item "\code{node_taxa}" a \code{tibble::tibble()} with columns "\code{node}", "\code{label}", +"\code{rank}" and "\code{taxon}" giving taxonomy assignments made by PHYLOTAX to +internal nodes. +\item "\code{rejected}" a \code{tibble::tibble()} with the same format as \code{taxa} giving +primary assignments which have been rejected by PHYLOTAX. +\item "\code{retained}" a \code{tibble::tibble()} with the same format as \code{taxa} giving +primary assignments which have not been rehected by PHYLOTAX. These may +contain inconsistencies that PHYLOTAX was unable to resolve. +\item "\code{missing}" a \code{tibble::tibble()} with the same format as \code{taxa}, giving the +primary assignments which have not been assessed by PHULOTAX because they +have labels which are not present on the tree. +} } \description{ Assign taxon labels to nodes in a tree when there is a consensus of IDs on descendent tips. diff --git a/tests/testthat/node_taxa.rds b/tests/testthat/node_taxa.rds new file mode 100644 index 0000000000000000000000000000000000000000..0649f0b7d8e380c0b6224a3ded5889ed86b800a1 GIT binary patch literal 247 zcmV0eu3{A^RLPFv{kl=y*002TVY%u@; literal 0 HcmV?d00001 diff --git a/tests/testthat/phylotax.rds b/tests/testthat/phylotax.rds deleted file mode 100644 index ae68a108ec29e84a7b5a0538a84886317296691c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 500 zcmVgiwFP!000001JzW`PQx$^&YE^xHw_`db4(g9fPjHGAmFgWIH9m)TSeMT zUHH54$ecJ*oYsc6W6~zLP|3~b#IYTJPR1R^n8$d~U>V;}ujEW2?mFDpDw)|i?YT^hr1j87 zi@p|jO5;SwE#gcq)YoH z)TY%eNASm^qcP!|?Qr}0{O027FLcIx*puzeq*C9eR*y;(6(M;~jj^dn?#W7;SVReG zt@|jM!3-@r-X7vAwH5ZzZYttPztGZ5B@blRS}xQia^2^W;~A#o(Q@ua$!|v!Ytn-I zDkCHDe6Rr?tijvb4~m36O4z5vm9IfFR(5VEdB0TFz=~&+)EEg<^VFxim_IqM@XNC7 zy;dDg{_UN=q%=$D?d qbtE;j8YdsW=H%yGY^o@iHax4hkb|K9aCsIJ;NTO_Hm&v`2LJ%U-TnIj diff --git a/tests/testthat/rejected.rds b/tests/testthat/rejected.rds new file mode 100644 index 0000000000000000000000000000000000000000..c72805a01ac4676b9b5e2365c199c8d63fe00c25 GIT binary patch literal 256 zcmV+b0ssCViwFP!0000016`2Oj=~@iMQNd1Yhtp={)dVFfyPhpp>Lb9Otq1M0o>KM z{cg}q2(~Qr?K4X*T z5)Yll%!k4sR4!7gSe;m7yaj!vlr%kbI=b@M>3yhB^K`hXGr6Ks;2araC0fe0(0A%e ztv%{9JEcZ94tJZQ*%K>j z10fJ`UTIId2D;W9>1eI(o^<1|({-yu7A|?6vvJa%Jhl3Dt)ugZzVoYF!r}1>{O}KF z2`qG)5=d$qSZPD^I~_NU(#SuTRzx^Bn;Dkgeay&ocqIObOW*fjXCd#?FhTxtW!_Yi Zm_U}`R6&GURPQx$|bZv){N=QijMe!X- zLVM%CkqDdCD=MR&IIJ_X9?y=Q>4-7LnJ5N~3xwhV7m0O_RUj(yJGdcmOW>Zs1A)8j z(CN$L>(le(dirn9#M#aldw)yvet0@_V)VN+A`D=Gsa5OH2Si|z52`l0HdGBSeF6-0Q5_Ww*UYD literal 0 HcmV?d00001