diff --git a/NEWS b/NEWS index 8fa8af51..5931bea2 100644 --- a/NEWS +++ b/NEWS @@ -27,4 +27,4 @@ Changes in version 1.11.x Changes in version 1.13.x + plot*Tree: bugfix, ununique nodes -+ Added confidence.level parameter to plotCCA ++ Added confidence.level parameter to plotCCA diff --git a/R/plotAbundance.R b/R/plotAbundance.R index b6df4844..beb9e703 100644 --- a/R/plotAbundance.R +++ b/R/plotAbundance.R @@ -112,7 +112,7 @@ #' # Getting top taxa on a Phylum level #' se <- transformAssay(se, method="relabundance") #' se_phylum <- agglomerateByRank(se, rank ="Phylum", onRankOnly=TRUE) -#' top_taxa <- getTopFeatures(se_phylum,top = 5, assay.type = "relabundance") +#' top_taxa <- getTop(se_phylum,top = 5, assay.type = "relabundance") #' #' # Renaming the "Phylum" rank to keep only top taxa and the rest to "Other" #' phylum_renamed <- lapply(rowData(se)$Phylum, diff --git a/R/plotAbundanceDensity.R b/R/plotAbundanceDensity.R index 278c2063..ae3749d5 100644 --- a/R/plotAbundanceDensity.R +++ b/R/plotAbundanceDensity.R @@ -214,7 +214,7 @@ setMethod("plotAbundanceDensity", signature = c(object = "SummarizedExperiment") # Gets the assay mat <- assay(object, assay.type, withDimnames = TRUE) # Gets the most abundant taxa - top_taxa <- getTopFeatures(object, top = n, assay.type = assay.type) + top_taxa <- getTop(object, top = n, assay.type = assay.type) # Subsets abundance table by taking taxa of highest abundance mat <- mat[top_taxa, , drop=FALSE] # enable conversion to data.frame for non-matrix assays, e.g. sparseMatrices diff --git a/R/plotPrevalence.R b/R/plotPrevalence.R index a67ea4b3..6e082d8c 100644 --- a/R/plotPrevalence.R +++ b/R/plotPrevalence.R @@ -78,7 +78,7 @@ #' \code{rank} argument. #' #' To exclude certain taxa, preprocess \code{x} to your liking, for example -#' with subsetting via \code{getPrevalentTaxa} or +#' with subsetting via \code{getPrevalent} or #' \code{agglomerateByPrevalence}. #' #' @return diff --git a/R/plotSeries.R b/R/plotSeries.R index 5b3eae12..46cdfac3 100644 --- a/R/plotSeries.R +++ b/R/plotSeries.R @@ -63,7 +63,7 @@ #' # Plots 2 most abundant taxa, which are colored by their family #' plotSeries(object, #' x = "DAY_ORDER", -#' y = getTopFeatures(object, 2), +#' y = getTop(object, 2), #' colour_by = "Family") #' #' # Counts relative abundances @@ -82,7 +82,7 @@ #' # In addition to 'colour_by' and 'linetype_by', 'size_by' can also be used to group taxa. #' plotSeries(object, #' x = "DAY_ORDER", -#' y = getTopFeatures(object, 5), +#' y = getTop(object, 5), #' colour_by = "Family", #' size_by = "Phylum", #' assay.type = "counts") diff --git a/R/plotTree.R b/R/plotTree.R index 5d066bf7..573b5675 100644 --- a/R/plotTree.R +++ b/R/plotTree.R @@ -112,7 +112,7 @@ #' log(rowData(altExp(GlobalPatterns,"Genus"))$mean) #' rowData(altExp(GlobalPatterns,"Genus"))$detected <- #' rowData(altExp(GlobalPatterns,"Genus"))$detected / 100 -#' top_genus <- getTopFeatures(altExp(GlobalPatterns,"Genus"), +#' top_genus <- getTop(altExp(GlobalPatterns,"Genus"), #' method="mean", #' top=100L, #' assay.type="counts") @@ -148,8 +148,8 @@ #' # aggregating data over the taxonomic levels for plotting a taxonomic tree #' # please note that the original tree of GlobalPatterns is dropped by #' # unsplitByRanks -#' GlobalPatterns <- agglomerateByRanks(GlobalPatterns) -#' top_phyla <- getTopFeatures(altExp(GlobalPatterns,"Phylum"), +#' altExps(GlobalPatterns) <- splitByRanks(GlobalPatterns) +#' top_phyla <- getTop(altExp(GlobalPatterns,"Phylum"), #' method="mean", #' top=10L, #' assay.type="counts") diff --git a/man/plotAbundance.Rd b/man/plotAbundance.Rd index 5a234fd6..2d0367ac 100644 --- a/man/plotAbundance.Rd +++ b/man/plotAbundance.Rd @@ -136,7 +136,7 @@ wrap_plots(plot, ncol = 1, heights = c(0.8,0.2)) # Getting top taxa on a Phylum level se <- transformAssay(se, method="relabundance") se_phylum <- agglomerateByRank(se, rank ="Phylum", onRankOnly=TRUE) -top_taxa <- getTopFeatures(se_phylum,top = 5, assay.type = "relabundance") +top_taxa <- getTop(se_phylum,top = 5, assay.type = "relabundance") # Renaming the "Phylum" rank to keep only top taxa and the rest to "Other" phylum_renamed <- lapply(rowData(se)$Phylum, diff --git a/man/plotPrevalence.Rd b/man/plotPrevalence.Rd index 0884ae88..3aa55b78 100644 --- a/man/plotPrevalence.Rd +++ b/man/plotPrevalence.Rd @@ -146,7 +146,7 @@ Agglomeration on different taxonomic levels is available through the \code{rank} argument. To exclude certain taxa, preprocess \code{x} to your liking, for example -with subsetting via \code{getPrevalentTaxa} or +with subsetting via \code{getPrevalent} or \code{agglomerateByPrevalence}. } \examples{ diff --git a/man/plotSeries.Rd b/man/plotSeries.Rd index 44e10314..a6c4bd29 100644 --- a/man/plotSeries.Rd +++ b/man/plotSeries.Rd @@ -92,7 +92,7 @@ object <- SilvermanAGutData # Plots 2 most abundant taxa, which are colored by their family plotSeries(object, x = "DAY_ORDER", - y = getTopFeatures(object, 2), + y = getTop(object, 2), colour_by = "Family") # Counts relative abundances @@ -111,7 +111,7 @@ plotSeries(object[taxa,], # In addition to 'colour_by' and 'linetype_by', 'size_by' can also be used to group taxa. plotSeries(object, x = "DAY_ORDER", - y = getTopFeatures(object, 5), + y = getTop(object, 5), colour_by = "Family", size_by = "Phylum", assay.type = "counts") diff --git a/man/plotTree.Rd b/man/plotTree.Rd index 72903efe..c76ad51f 100644 --- a/man/plotTree.Rd +++ b/man/plotTree.Rd @@ -173,7 +173,7 @@ rowData(altExp(GlobalPatterns,"Genus"))$log_mean <- log(rowData(altExp(GlobalPatterns,"Genus"))$mean) rowData(altExp(GlobalPatterns,"Genus"))$detected <- rowData(altExp(GlobalPatterns,"Genus"))$detected / 100 -top_genus <- getTopFeatures(altExp(GlobalPatterns,"Genus"), +top_genus <- getTop(altExp(GlobalPatterns,"Genus"), method="mean", top=100L, assay.type="counts") @@ -209,8 +209,8 @@ plotRowTree(x[rownames(x) \%in\% top_genus,], # aggregating data over the taxonomic levels for plotting a taxonomic tree # please note that the original tree of GlobalPatterns is dropped by # unsplitByRanks -GlobalPatterns <- agglomerateByRanks(GlobalPatterns) -top_phyla <- getTopFeatures(altExp(GlobalPatterns,"Phylum"), +altExps(GlobalPatterns) <- splitByRanks(GlobalPatterns) +top_phyla <- getTop(altExp(GlobalPatterns,"Phylum"), method="mean", top=10L, assay.type="counts") diff --git a/tests/testthat/test-2plotTree.R b/tests/testthat/test-2plotTree.R index be96472c..a9687c1d 100644 --- a/tests/testthat/test-2plotTree.R +++ b/tests/testthat/test-2plotTree.R @@ -61,7 +61,7 @@ test_that("plot tree", { altExp(GlobalPatterns,"genus") <- agglomerateByRank(GlobalPatterns,"Genus", make_unique = FALSE) altExp(GlobalPatterns,"genus") <- addPerFeatureQC(altExp(GlobalPatterns,"genus")) rowData(altExp(GlobalPatterns,"genus"))$log_mean <- log(rowData(altExp(GlobalPatterns,"genus"))$mean) - top_taxa <- getTopFeatures(altExp(GlobalPatterns,"genus"), + top_taxa <- getTop(altExp(GlobalPatterns,"genus"), method="mean", top=100L, assay.type="counts") diff --git a/vignettes/miaViz.Rmd b/vignettes/miaViz.Rmd index 1159cc64..3c4bb22d 100644 --- a/vignettes/miaViz.Rmd +++ b/vignettes/miaViz.Rmd @@ -73,7 +73,7 @@ plotAbundance(GlobalPatterns, rank = "Kingdom", assay.type = "relabundance") With subsetting to selected features the plot can be fine tuned. ```{r} -prev_phylum <- getPrevalentTaxa(GlobalPatterns, rank = "Phylum", +prev_phylum <- getPrevalent(GlobalPatterns, rank = "Phylum", detection = 0.01, onRankOnly = TRUE) ``` @@ -155,7 +155,7 @@ rowData(altExp(GlobalPatterns,"Genus"))$log_mean <- log(rowData(altExp(GlobalPatterns,"Genus"))$mean) rowData(altExp(GlobalPatterns,"Genus"))$detected <- rowData(altExp(GlobalPatterns,"Genus"))$detected / 100 -top_taxa <- getTopFeatures(altExp(GlobalPatterns,"Genus"), +top_taxa <- getTop(altExp(GlobalPatterns,"Genus"), method="mean", top=100L, assay.type="counts") @@ -268,7 +268,7 @@ library("miaTime") data(SilvermanAGutData, package="miaTime") tse <- SilvermanAGutData tse <- transformAssay(tse, method = "relabundance") -taxa <- getTopFeatures(tse, 2) +taxa <- getTop(tse, 2) ``` Data from samples collected along time can be visualized using `plotSeries`. @@ -300,7 +300,7 @@ Additional variables can be used to modify line type aesthetics. ```{r, eval=FALSE} plotSeries(tse, x = "DAY_ORDER", - y = getTopFeatures(tse, 5), + y = getTop(tse, 5), colour_by = "Family", linetype_by = "Phylum", assay.type = "counts")