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

Add plotNMDS to miaViz #116

Merged
merged 16 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
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export(plotColGraph)
export(plotColTile)
export(plotDMNFit)
export(plotFeaturePrevalence)
export(plotNMDS)
export(plotPrevalence)
export(plotPrevalentAbundance)
export(plotRDA)
Expand Down
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ Changes in version 1.11.x
Changes in version 1.13.x
+ plot*Tree: bugfix, ununique nodes
+ Added confidence.level parameter to plotCCA
+ add plotNMDS to miaViz (plotNMDS deprecated in mia)
21 changes: 21 additions & 0 deletions R/plotNDMS.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#' Wrapper for scater::plotReducedDim()
#'
#' @param x a
#' \code{\link[SummarizedExperiment:SummarizedExperiment-class]{SummarizedExperiment}}
#' object.
#'
#' @param ncomponents
#' A numeric scalar indicating the number of dimensions to plot, starting from
#' the first dimension. Alternatively, a numeric vector specifying the
#' dimensions to be plotted. (Default: 2)
#'
#' @param ... additional arguments passed to scater::plotReducedDim().
#'
#' @name plotNMDS
NULL

#' @rdname plotNMDS
#' @export
plotNMDS <- function(x, ..., ncomponents = 2){
plotReducedDim(x, ncomponents = ncomponents, dimred = "NMDS", ...)
}
22 changes: 22 additions & 0 deletions man/plotNMDS.Rd

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

7 changes: 7 additions & 0 deletions tests/testthat/test-plotNMDS.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test_that("plotNMDS", {
# Test the class of plotNMDS output
data("esophagus", package = "mia")
esophagus <- runNMDS(esophagus)
plot <- plotNMDS(esophagus)
expect_s3_class(plot,c("gg","ggplot"))
})
Loading