Skip to content

Commit

Permalink
last fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
philouail committed May 16, 2024
1 parent 08fd5b2 commit e753de4
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 11 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: xcms
Version: 4.3.0
Version: 4.3.1
Title: LC-MS and GC-MS Data Analysis
Description: Framework for processing and visualization of chromatographically
separated and single-spectra mass spectral data. Imports from AIA/ANDI NetCDF,
Expand Down Expand Up @@ -60,7 +60,7 @@ Imports:
S4Vectors,
IRanges,
SummarizedExperiment,
MsCoreUtils (>= 1.15.5),
MsCoreUtils (>= 1.16.0),
MsFeatures,
MsExperiment (>= 1.5.4),
Spectra (>= 1.13.7),
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ importFrom("SummarizedExperiment", "rowData")
importFrom("SummarizedExperiment", "rowData<-")
importFrom("SummarizedExperiment", "assay")
importFrom("MsCoreUtils", "rbindFill", "closest", "i2index", "sumi", "between",
"maxi", "breaks_ppm", "force_sorted")
"maxi", "breaks_ppm", "force_sorted", "common_path")
importFrom("RColorBrewer", "brewer.pal")

importFrom("graphics", "image", "boxplot", "matplot", "rect", "axis",
Expand Down
7 changes: 6 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# xcms 4.1
# xcms 4.3

## Changes in version 4.3.1

- Addition of generic function `loadResults()`and method for import using
`RDataParam` and `PlaintTextParam`.

## Changes in version 4.1.14

Expand Down
2 changes: 1 addition & 1 deletion R/AllGenerics.R
Original file line number Diff line number Diff line change
Expand Up @@ -1523,7 +1523,7 @@ setGeneric("levelplot", function(x, data, ...) standardGeneric("levelplot"))
#'
#' ## Save as a collection of plain text files
#' pth = file.path(tempdir(), "test")
#' param <- PlainTextParam(path = pth)
#' param <- PlainTextParam(path = pth, spectraExport = TRUE)
#' storeResults(object = faahko_sub, param = param)
#'
#' ## Load this saved dataset
Expand Down
10 changes: 9 additions & 1 deletion R/PlainTextParam.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@
#' `storeResults`. If the folder already exists, previous exports in that
#' folder might get overwritten.
#'
#' If the `spectraExport` parameter is set to `TRUE`, the spectra data will be
#' exported/imported. The import should be done in a file system similar to the
#' one used for the export. The `spectraFilePath` parameter can be used to
#' define the absolute path where the spectra files should be imported from
#' when loading the object. The default will be set using the common file path
#' of all the spectra files when exporting. If the `spectraExport` parameter is
#' set to `FALSE`, the spectra data will not be exported/imported.
#'
#' @param path for `PlainTextParam` `character(1)`, defining where the files
#' are going to be stored/ should be loaded from. The default will be
#' `tempdir()`.
Expand Down Expand Up @@ -109,7 +117,7 @@
#'
#' ## Define param
#' pth = file.path(tempdir(), "test")
#' param <- PlainTextParam(path = pth)
#' param <- PlainTextParam(path = pth, spectraExport = TRUE)
#'
#' ## Save as a collection of plain text files
#' storeResults(object = faahko_sub, param = param)
Expand Down
10 changes: 9 additions & 1 deletion man/PlainTextParam.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/loadResults.Rd

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

9 changes: 6 additions & 3 deletions tests/testthat/test_PlainTextParam.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test_that("loadResults, PlainTextParam works", {
storeResults(mse, param = param)
load_mse <- loadResults(param)
expect_true(inherits(load_mse, "MsExperiment"))
expect_equal(mse, load_mse) # does nto work but make sense because no spectra data. other checks ?
expect_equal(mse, load_mse) # does nto work but make sense because no spectra data. ideas for other checks ?
expect_equal(sampleData(mse), sampleData(load_mse))
#with spectra ?
param <- PlainTextParam(path = pth, spectraExport = TRUE)
Expand All @@ -61,12 +61,15 @@ test_that("loadResults, PlainTextParam works", {
storeResults(xmse_full, param = param)
load_xmse <- loadResults(param)
expect_true(inherits(load_xmse, "XcmsExperiment"))
expect_equal(xmse_full, load_xmse)
expect_equal(processHistory(xmse_full), processHistory(load_xmse))
expect_equal(xmse_full, load_xmse) # also fail probably because of spectra missing
expect_equal(processHistory(xmse_full), processHistory(load_xmse)) #fail why ?
expect_equal(xmse_full@featureDefinitions,
load_xmse@featureDefinitions)
expect_equal(adjustedRtime(xmse_full), adjustedRtime(load_xmse))
param <- PlainTextParam(path = pth, spectraExport = TRUE)
storeResults(xmse_full, param = param)
load_xmse <- loadResults(param)
expect_equal(xmse_full, load_xmse)
# not sure how to check for `spectraFilePath`
})

0 comments on commit e753de4

Please sign in to comment.