Skip to content

Commit

Permalink
fix all
Browse files Browse the repository at this point in the history
  • Loading branch information
philouail committed Oct 27, 2023
1 parent a19aa2a commit d6c8e9d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 18 deletions.
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -586,3 +586,8 @@ importFrom("progress", "progress_bar")
exportClasses("XcmsExperiment")
exportMethods("uniqueMsLevels")
exportMethods("filterMzRange")

## saving xcms objects things
export("RDataParam")
exportMethods("storeResults")

12 changes: 6 additions & 6 deletions R/AllGenerics.R
Original file line number Diff line number Diff line change
Expand Up @@ -1944,7 +1944,7 @@ setGeneric("stitch.xml", function(object, lockMass) standardGeneric("stitch.xml"
setGeneric("stitch.netCDF", function(object, lockMass) standardGeneric("stitch.netCDF"))
setGeneric("stitch.netCDF.new", function(object, lockMass) standardGeneric("stitch.netCDF.new"))

#' @title Save Xcms objects in a specified format
#' @title Save xcms result objects in a specified format
#'
#' @description
#'
Expand All @@ -1954,7 +1954,7 @@ setGeneric("stitch.netCDF.new", function(object, lockMass) standardGeneric("stit
#'
#' Supported `param` objects are:
#'
#' - `RDataParam`: Save in an .RData format file.
#' - [`RDataParam`]: Save in an .RData format file.
#'
#' - `PlainTextParam`: Save in a plain text format (to be defined).
#'
Expand All @@ -1973,18 +1973,18 @@ setGeneric("stitch.netCDF.new", function(object, lockMass) standardGeneric("stit
#'
#' @name storeResults
#'
#' @author Philippine Louail, Johannes Rainer
#' @author Philippine Louail
#'
#' @examples
#'
#' ## Load a test `XcmsExperiment` object
#' x <-
#' ## Load a test data set with detected peaks
#' faahko_sub <- loadXcmsData("faahko_sub2")
#'
#' ## Set up parameter to save as .RData file
#' param <- RDataParam(fileName = "example_xcms_results")
#'
#' ## save as .RData
#' storeResults(object = x, param = param)
#' storeResults(object = faahko_sub, param = param)
#'
#' @md
setGeneric("storeResults", function(object, param, ...) standardGeneric("storeResults"))
Expand Down
7 changes: 4 additions & 3 deletions R/RDataParam.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#'
#' @description
#' The `RDataParam` class and method allow users to save an `XcmsExperiment`
#' object as an .RData file with a chosen filename. This new `param` class and
#' method are part of the possible dispatch of the generic function
#' `storeResults`.
#' object as an .RData file with a chosen filename. The object gets exported
#' using [`save()`] function. This `param` class and method are part of the
#' possible dispatch of the generic function `storeResults`.
#'
#' Other available `param` classes and linked methods include:
#'
Expand Down Expand Up @@ -68,3 +68,4 @@ setMethod("storeResults",
save(object, file = param@fileName)
}
)

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

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

12 changes: 6 additions & 6 deletions man/storeResults.Rd

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

3 changes: 3 additions & 0 deletions tests/testthat/test_XcmsExperiment.R
Original file line number Diff line number Diff line change
Expand Up @@ -1322,4 +1322,7 @@ test_that("storeResults,RDataParam works", {
expect_false(is.null(param2))
storeResults(xmse, param = param)
expect_true(file.exists("test"))
load("test")
expect_s4_class(object, "XcmsExperiment")
expect_equal(object, xmse)
})

0 comments on commit d6c8e9d

Please sign in to comment.