Skip to content

Commit

Permalink
Run mediation example only if miaTime installed
Browse files Browse the repository at this point in the history
  • Loading branch information
RiboRings committed Apr 19, 2024
1 parent 1caeb00 commit 6336cac
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 24 deletions.
2 changes: 0 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ Suggests:
reldist,
ade4,
microbiomeDataSets,
miaTime,
rmarkdown
Remotes: microbiome/miaTime
URL: https://github.com/microbiome/mia
BugReports: https://github.com/microbiome/mia/issues
Roxygen: list(markdown = TRUE)
Expand Down
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,4 @@ Changes in version 1.11.x
+ Rename cluster to addCluster
+ rename importers loadFromBiom, loadFromQIIME2, readQZA, loadFromMothur,
loadFromMetaphlan, loadFromHumann
+ add new functions getMediation and addMediation
2 changes: 2 additions & 0 deletions R/mediate.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#' @name getMediation
#'
#' @examples
#' if( require("miaTime") ){
#' # Import libraries
#' library(mia)
#' library(miaTime)
Expand Down Expand Up @@ -143,6 +144,7 @@
#'
#' # Show results for first 5 mediators
#' head(metadata(tse)$reddim_mediation, 5)
#' }
#'
NULL

Expand Down
53 changes: 31 additions & 22 deletions man/getMediation.Rd

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

2 changes: 2 additions & 0 deletions tests/testthat/test-mediate.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test_that("getMediation", {

if( require("miaTime") ){
data("hitchip1006", package = "miaTime")
tse <- hitchip1006

Expand Down Expand Up @@ -81,5 +82,6 @@ test_that("getMediation", {
expect_named(tse, med_df[["Mediator"]])

expect_named(med_df, c("Mediator", "ACME_estimate", "ADE_estimate", "ACME_pval", "ADE_pval"))
}

})

0 comments on commit 6336cac

Please sign in to comment.