Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace getPrevalent* and getTop* functions #118

Merged
merged 6 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion R/plotAbundance.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion R/plotAbundanceDensity.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion R/plotPrevalence.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions R/plotSeries.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions R/plotTree.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion man/plotAbundance.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plotPrevalence.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/plotSeries.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/plotTree.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-2plotTree.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 4 additions & 4 deletions vignettes/miaViz.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```

Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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`.
Expand Down Expand Up @@ -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")
Expand Down
Loading