Skip to content

Commit

Permalink
replace getPrevalent* and getTop* functions
Browse files Browse the repository at this point in the history
  • Loading branch information
thpralas committed Apr 22, 2024
1 parent 10b923a commit 9995a5a
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: miaViz
Title: Microbiome Analysis Plotting and Visualization
Version: 1.11.3
Version: 1.11.4
Authors@R:
c(person(given = "Tuomas", family = "Borman", role = c("aut", "cre"),
email = "[email protected]",
Expand Down
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ Changes in version 1.9.x

Changes in version 1.11.x
+ replace addTaxonomyTree with addHierarchyTree after renaming in mia package
+ replace getPrevalent* with getPrevalent and getTop* with getTop
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
4 changes: 2 additions & 2 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 @@ -149,7 +149,7 @@
#' # please note that the original tree of GlobalPatterns is dropped by
#' # unsplitByRanks
#' altExps(GlobalPatterns) <- splitByRanks(GlobalPatterns)
#' top_phyla <- getTopFeatures(altExp(GlobalPatterns,"Phylum"),
#' 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.

4 changes: 2 additions & 2 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

0 comments on commit 9995a5a

Please sign in to comment.