Skip to content

Commit

Permalink
get tests passing again
Browse files Browse the repository at this point in the history
  • Loading branch information
d-callan committed Mar 13, 2024
1 parent 91334ff commit 5725bdc
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
5 changes: 4 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ Description: This package is intended to be used to explore the curated datasets
License: Apache License (>= 2)
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.1
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export(getComputeResult)
export(getComputeResultWithMetadata)
export(getCuratedDatasetNames)
export(rankedAbundance)
export(selfCorrelation)
exportMethods(getComputeResult)
exportMethods(getComputeResultWithMetadata)
importFrom(microbiomeComputations,DifferentialAbundanceResult)
Expand All @@ -22,6 +23,7 @@ importFrom(microbiomeComputations,betaDiv)
importFrom(microbiomeComputations,correlation)
importFrom(microbiomeComputations,differentialAbundance)
importFrom(microbiomeComputations,rankedAbundance)
importFrom(microbiomeComputations,selfCorrelation)
importFrom(microbiomeData,BONUS)
importFrom(microbiomeData,Bangladesh)
importFrom(microbiomeData,DiabImmune)
Expand Down
4 changes: 4 additions & 0 deletions R/computes.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ microbiomeComputations::differentialAbundance
#' @importFrom microbiomeComputations correlation
#' @export
microbiomeComputations::correlation

#' @importFrom microbiomeComputations selfCorrelation
#' @export
microbiomeComputations::selfCorrelation
3 changes: 2 additions & 1 deletion man/reexports.Rd

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

10 changes: 5 additions & 5 deletions tests/testthat/test-GetComputeResult.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test_that("we can get compute results in different formats", {
mbioDataset <- microbiomeData::DiabImmune
mbioDataset <- MicrobiomeDB::DiabImmune
genus <- getCollection(mbioDataset, "16S Genus", continuousMetadataOnly = TRUE)

# make sure metadata dont contain IRIs
Expand Down Expand Up @@ -28,23 +28,23 @@ test_that("we can get compute results in different formats", {
)
)
)
diffAbundOutput <- microbiomeComputations::differentialAbundance(getCollection(mbioDataset, "16S Genus"), comparatorVariable, method='Maaslin', verbose=FALSE)
diffAbundOutput <- MicrobiomeDB::differentialAbundance(getCollection(mbioDataset, "16S Genus"), comparatorVariable, method='Maaslin', verbose=FALSE)
expect_equal(inherits(diffAbundOutput, "ComputeResult"), TRUE)

correlationOutput <- microbiomeComputations::selfCorrelation(getCollection(mbioDataset, "16S Genus"), method='spearman', verbose=FALSE)
correlationOutput <- MicrobiomeDB::selfCorrelation(getCollection(mbioDataset, "16S Genus"), method='spearman', verbose=FALSE)
correlationDT <- getComputeResult(correlationOutput, "data.table")
expect_equal(inherits(correlationDT, "data.table"), TRUE)
expect_equal(all(c('data1', 'data2', 'correlationCoef', 'pValue') %in% names(correlationDT)), TRUE)

# make sure continuousMetadataOnly flag works so we can do taxa X metadata correlations
correlationOutput <- microbiomeComputations::correlation(genus, method='spearman', verbose=FALSE)
correlationOutput <- MicrobiomeDB::correlation(genus, method='spearman', verbose=FALSE)
expect_equal(inherits(correlationOutput, "ComputeResult"), TRUE)

correlationIGraph <- getComputeResult(correlationOutput, "igraph")
expect_equal(inherits(correlationIGraph, "igraph"), TRUE)

# make sure getComputeResultWithMetadata works
alphaDivOutput <- microbiomeComputations::alphaDiv(getCollection(mbioDataset, "16S Genus"), method='shannon', verbose=FALSE)
alphaDivOutput <- MicrobiomeDB::alphaDiv(getCollection(mbioDataset, "16S Genus"), method='shannon', verbose=FALSE)
expect_equal(inherits(alphaDivOutput, "ComputeResult"), TRUE)
alphaDivDT <- getComputeResultWithMetadata(alphaDivOutput, mbioDataset, metadataVariables = c('country', 'delivery_mode'))
expect_equal(inherits(alphaDivDT, "data.table"), TRUE)
Expand Down

0 comments on commit 5725bdc

Please sign in to comment.