Skip to content

Commit

Permalink
Merge pull request #757 from sneumann/jomain
Browse files Browse the repository at this point in the history
refactor: dump all data export functionality from xcms
  • Loading branch information
sneumann authored Jul 26, 2024
2 parents 88bdd81 + 703c7f6 commit ea3f776
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 678 deletions.
9 changes: 3 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: xcms
Version: 4.3.1
Version: 4.3.2
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 @@ -65,7 +65,6 @@ Imports:
MsExperiment (>= 1.5.4),
Spectra (>= 1.13.7),
progress,
jsonlite,
RColorBrewer,
MetaboCoreUtils (>= 1.11.2)
Suggests:
Expand Down Expand Up @@ -93,7 +92,7 @@ URL: https://github.com/sneumann/xcms
BugReports: https://github.com/sneumann/xcms/issues/new
VignetteBuilder: knitr
biocViews: ImmunoOncology, MassSpectrometry, Metabolomics
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Encoding: UTF-8
Collate:
'AllGenerics.R'
Expand All @@ -104,11 +103,9 @@ Collate:
'MPI.R'
'MsExperiment-functions.R'
'MsExperiment.R'
'XcmsExperiment.R'
'PlainTextParam.R'
'RDataParam.R'
'XcmsExperiment-functions.R'
'XcmsExperiment-plotting.R'
'XcmsExperiment.R'
'c.R'
'cwTools.R'
'databases.R'
Expand Down
13 changes: 4 additions & 9 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ importMethodsFrom("MSnbase", "intensity", "mz", "rtime", "fileNames", "fromFile"
importFrom("MSnbase", "as.data.frame.Spectrum", "Chromatogram",
"MChromatograms", "MSpectra", "requiredFvarLabels", "selectFeatureData")


export(
"etg",
"medianFilter",
Expand Down Expand Up @@ -254,7 +255,8 @@ export(
"loadXcmsData",
"matchLamasChromPeaks",
"summarizeLamaMatch",
"matchedRtimes"
"matchedRtimes",
"XcmsExperiment"
)

## New analysis methods
Expand Down Expand Up @@ -566,7 +568,7 @@ importMethodsFrom("Spectra", "precursorMz")
importMethodsFrom("Spectra", "$")
importMethodsFrom("Spectra", "uniqueMsLevels")
importMethodsFrom("Spectra", "backendBpparam")
importFrom("Spectra", "MsBackendMemory")
importFrom("Spectra", "MsBackendMemory", "filterEmptySpectra")

## MsExperiment things
importClassesFrom("MsExperiment", "MsExperiment")
Expand All @@ -590,13 +592,6 @@ exportMethods("filterMzRange")
exportMethods("fromFile")
exportMethods("fileNames")

## saving xcms objects things
importFrom("jsonlite", "serializeJSON", "write_json", "unserializeJSON",
"read_json")
export("RDataParam")
export("PlainTextParam")
exportMethods("storeResults")

## filtering features things
importFrom("MetaboCoreUtils", "rowRsd", "rowDratio", "rowPercentMissing",
"rowBlank", "mclosest")
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# xcms 4.3

## Changes in version 4.3.2

- Remove data/results import/export functionality as it is being developed in
the *MsIO* package.

## Changes in version 4.3.1

- Support excluding samples or sample groups from defining features with
Expand Down
55 changes: 0 additions & 55 deletions R/AllGenerics.R
Original file line number Diff line number Diff line change
Expand Up @@ -2051,61 +2051,6 @@ 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 result objects in a specified format
#'
#' @description
#'
#' The `storeResults` function saves an `object` resulting from processing with
#' the `xcms` package (mainly `XcmsExperiment`). Multiple formats for storing
#' and exporting are available and can be defined by the `param` argument.
#'
#' Supported `param` objects are:
#'
#' - [`RDataParam`]: Save in an .RData format file. The name of the file can be
#' specified in the `fileName` argument.
#'
#' - [`PlainTextParam`]: Store `MsExperiment` and `XcmsExperiment` objects as a
#' folder of plain text files, folder path defined in the `path` argument.
#'
#' - `MzTabMParam`: Save in MzTab format (to be defined).
#'
#' For specific examples, see the help pages of the individual parameter classes
#' listed above.
#'
#' @param object `MsExperiment` or `XcmsExperiment` The data object that needs
#' to be saved.
#'
#' @param param The parameter object selecting and configuring the format for
#' saving. It can be one of the following classes: [`RDataParam`],
#' [`PlainTextParam`], or `MzTabMParam`.
#'
#' @param ... Optional parameters.
#'
#' @name storeResults
#'
#' @author Philippine Louail
#'
#' @examples
#'
#' ## Load a test data set with detected peaks
#' library(xcms)
#' library(MsExperiment)
#' faahko_sub <- loadXcmsData("faahko_sub2")
#'
#' ## Set up parameter to save as .RData file
#' param <- RDataParam(fileName = "example_xcms_results")
#'
#' ## save as .RData
#' storeResults(object = faahko_sub, param = param)
#'
#' ## Set up parameter to save as a collection of plain text file
#' param <- PlainTextParam(path = "test/path/")
#'
#' ## Save as a collection of plain text files
#' storeResults(object = faahko_sub, param = param)
#'
#' @md
setGeneric("storeResults", function(object, param, ...) standardGeneric("storeResults"))
setGeneric("subset<-", function(object, value) standardGeneric("subset<-"))
setGeneric("subsetAdjust", function(object, ...) standardGeneric("subsetAdjust"))
setGeneric("subsetAdjust<-", function(object, value) standardGeneric("subsetAdjust<-"))
Expand Down
226 changes: 0 additions & 226 deletions R/PlainTextParam.R

This file was deleted.

Loading

0 comments on commit ea3f776

Please sign in to comment.