Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
Choose a Base Repository
Nothing to show
Choose a base branch
Nothing to show
...
Choose a Head Repository
Nothing to show
Choose a head branch
Nothing to show
Checking mergeability… Don’t worry, you can still create the pull request.
  • 6 commits
  • 50 files changed
  • 0 commit comments
  • 1 contributor
Commits on Aug 24, 2012
Simplify `filepattern` specification.
Using the `ignore.case` argument to `list.files` obviates the need to specify
upper- and lower-case characters in the regex pattern.
Re-indent, remove trailing whitespace, and fix comment syntax.
Reformat according to the Bioconductor coding standards
(http://wiki.fhcrc.org/bioc/Coding_Standards). No attempt to break up 80+
character lines has been made.

Some comments were using a single `#`, whereas the recommended style is `##` for
indented comments.

"writemzdata.R" had DOS-style line endings; these were corrected to Unix-style.
Use S4 generic methods for creating `xcmsRaw` objects.
Loading the raw data is now handled by generic "loadRaw" methods. This allows
data loading via alternate means, such as from a database, without having to
make modifications to the xcms source. New data backends can be used simply by
passing them as the `filename` argument to `xcmsRaw` and defining a `loadRaw`
method on that class.
Commits on Aug 25, 2012
Refactor `xcmsRaw` to use generic `xcmsSource` methods.
`xcmsRaw` no longer has hard-coded loading of raw data; it uses children of the
`xcmsSource` class to provide the raw data it uses. This means that different
backends could be added freely simply by defining new implementations of the
`xcmsSource` method.

Currently, there are classes which handle reading from files to provide the same
level of functionality as the hard-coded version of `xcmsRaw`.
Showing with 3,557 additions and 3,245 deletions.
  1. +122 −118 NAMESPACE
  2. +6 −7 R/00xcmsFragments-class.R
  3. 0 R/00xcmsSet-class.R
  4. +6 −0 R/00xcmsSource-class.R
  5. +7 −0 R/01xcmsFileSource-class.R
  6. +2 −3 R/{00xcmsRaw-class.R → 01xcmsRaw-class.R}
  7. +25 −0 R/02netCdfSource-class.R
  8. +26 −0 R/02rampSource-class.R
  9. +218 −218 R/CleanData.R
  10. +237 −237 R/MPI.R
  11. +31 −31 R/c.R
  12. +427 −427 R/cwTools.R
  13. +23 −23 R/databases.R
  14. +28 −28 R/fastMatch.R
  15. +72 −72 R/init.R
  16. +11 −11 R/matchpeaks.R
  17. 0 R/models.R
  18. 0 R/netCDF.R
  19. +48 −48 R/present.R
  20. +36 −36 R/ramp.R
  21. +102 −102 R/specDist.R
  22. +7 −8 R/unix/zzz.R
  23. +7 −8 R/windows/zzz.R
  24. +201 −201 R/writemzdata.R
  25. +6 −8 R/xcmsEIC.R
  26. +201 −201 R/xcmsFragments.R
  27. +615 −651 R/xcmsRaw.R
  28. +454 −455 R/xcmsSet.R
  29. +9 −0 R/xcmsSource.R
  30. +68 −68 inst/CHANGELOG
  31. +6 −6 inst/CITATION
  32. +20 −22 inst/NEWS
  33. +6 −6 inst/unitTests/Makefile
  34. +72 −73 inst/unitTests/runit.absentPresent.R
  35. +4 −6 inst/unitTests/runit.fillPeaks.R
  36. +4 −4 inst/unitTests/runit.group.R
  37. +21 −21 inst/unitTests/runit.msms.R
  38. +29 −29 inst/unitTests/runit.phenoData.R
  39. +17 −18 inst/unitTests/runit.ramp.R
  40. +4 −4 inst/unitTests/runit.snames.R
  41. +2 −2 inst/unitTests/runit.specDist.R
  42. +29 −30 inst/unitTests/runit.splitRaw.R
  43. +5 −5 inst/unitTests/runit.xcmsSet.R
  44. +57 −0 man/loadRaw-methods.Rd
  45. +64 −0 man/netCdfSource-class.Rd
  46. +67 −0 man/rampSource-class.Rd
  47. +47 −0 man/xcmsFileSource-class.Rd
  48. +27 −0 man/xcmsSource-class.Rd
  49. +23 −0 man/xcmsSource-methods.Rd
  50. +58 −58 tests/doRUnit.R
View
240 NAMESPACE
@@ -1,118 +1,122 @@
-useDynLib(xcms)
-
-import("methods")
-importFrom("graphics", "plot", "image")
-importFrom("mzR", "peaks", "close", "openMSfile", "header")
-
-export(
- "etg",
- "medianFilter",
- "retexp",
- "specNoise",
- "specPeaks",
- "SSgauss",
- "xcmsRaw",
- "xcmsSet",
- "xcmsFragments",
- "xcmsPapply"
- )
-
-S3method(plot, xcmsEIC)
-
-S3method(split, xcmsSet)
-S3method(c, xcmsSet)
-
-S3method(split, xcmsRaw)
-
-exportClasses(
- "xcmsEIC",
- "xcmsPeaks",
- "xcmsRaw",
- "xcmsSet",
- "xcmsFragments"
- )
-
-exportMethods(
- "absent",
- "AutoLockMass",
- "calibrate",
- "collect",
- "deepCopy",
- "filepaths",
- "filepaths<-",
- "diffreport",
- "findMZ",
- "findneutral",
- "fillPeaks",
- "fillPeaks.MSW",
- "fillPeaks.chrom",
- "findPeaks.centWave",
- "findPeaks.massifquant",
- "findPeaks.matchedFilter",
- "findPeaks.MSW",
- "findPeaks",
- "getEIC",
- "getPeaks",
- "getScan",
- "getMsnScan",
- "getSpec",
- "group",
- "group.density",
- "group.mzClust",
- "group.nearest",
- "groupidx",
- "groupidx<-",
- "groupnames",
- "groups",
- "groups<-",
- "groupval",
- "image",
- "mzrange",
- "peaks",
- "peaks<-",
- "peakTable",
- "phenoData",
- "phenoData<-",
- "plotChrom",
- "plotEIC",
- "plotPeaks",
- "plotRaw",
- "plotrt",
- "plotScan",
- "plotSpec",
- "plotSurf",
- "plotTIC",
- "plotTree",
- "present",
- "profinfo",
- "profinfo<-",
- "profMedFilt",
- "profMethod",
- "profMethod<-",
- "profMz",
- "profRange",
- "profStep",
- "profStep<-",
- "progressCallback",
- "progressCallback<-",
- "rawEIC",
- "rawMat",
- "retcor",
- "retcor.peakgroups",
- "retcor.obiwarp",
- "revMz",
- "rtrange",
- "sampclass",
- "sampclass<-",
- "sampnames",
- "sampnames<-",
- "specDist",
- "specDist.cosine",
- "specDist.meanMZmatch",
- "specDist.peakCount",
- "show",
- "sortMz",
- "stitch",
- "write.cdf",
- "write.mzdata"
- )
+useDynLib(xcms)
+
+import("methods")
+importFrom("graphics", "plot", "image")
+importFrom("mzR", "peaks", "close", "openMSfile", "header")
+
+export(
+ "etg",
+ "medianFilter",
+ "retexp",
+ "specNoise",
+ "specPeaks",
+ "SSgauss",
+ "xcmsRaw",
+ "xcmsSet",
+ "xcmsFragments",
+ "xcmsPapply"
+ )
+
+S3method(plot, xcmsEIC)
+
+S3method(split, xcmsSet)
+S3method(c, xcmsSet)
+
+S3method(split, xcmsRaw)
+
+exportClasses(
+ "xcmsEIC",
+ "xcmsPeaks",
+ "xcmsRaw",
+ "xcmsSet",
+ "xcmsFragments",
+ "xcmsSource",
+ "xcmsFileSource"
+ )
+
+exportMethods(
+ "absent",
+ "AutoLockMass",
+ "calibrate",
+ "collect",
+ "deepCopy",
+ "filepaths",
+ "filepaths<-",
+ "diffreport",
+ "findMZ",
+ "findneutral",
+ "fillPeaks",
+ "fillPeaks.MSW",
+ "fillPeaks.chrom",
+ "findPeaks.centWave",
+ "findPeaks.massifquant",
+ "findPeaks.matchedFilter",
+ "findPeaks.MSW",
+ "findPeaks",
+ "getEIC",
+ "getPeaks",
+ "getScan",
+ "getMsnScan",
+ "getSpec",
+ "group",
+ "group.density",
+ "group.mzClust",
+ "group.nearest",
+ "groupidx",
+ "groupidx<-",
+ "groupnames",
+ "groups",
+ "groups<-",
+ "groupval",
+ "image",
+ "mzrange",
+ "peaks",
+ "peaks<-",
+ "peakTable",
+ "phenoData",
+ "phenoData<-",
+ "plotChrom",
+ "plotEIC",
+ "plotPeaks",
+ "plotRaw",
+ "plotrt",
+ "plotScan",
+ "plotSpec",
+ "plotSurf",
+ "plotTIC",
+ "plotTree",
+ "present",
+ "profinfo",
+ "profinfo<-",
+ "profMedFilt",
+ "profMethod",
+ "profMethod<-",
+ "profMz",
+ "profRange",
+ "profStep",
+ "profStep<-",
+ "progressCallback",
+ "progressCallback<-",
+ "rawEIC",
+ "rawMat",
+ "retcor",
+ "retcor.peakgroups",
+ "retcor.obiwarp",
+ "revMz",
+ "rtrange",
+ "sampclass",
+ "sampclass<-",
+ "sampnames",
+ "sampnames<-",
+ "specDist",
+ "specDist.cosine",
+ "specDist.meanMZmatch",
+ "specDist.peakCount",
+ "show",
+ "sortMz",
+ "stitch",
+ "write.cdf",
+ "write.mzdata",
+ "xcmsSource",
+ "loadRaw"
+ )
View
13 R/00xcmsFragments-class.R 100755 → 100644
@@ -1,13 +1,12 @@
require(methods) || stop("Couldnt load package methods")
setClass("xcmsFragments", representation(peaks = "matrix",
- MS2spec = "list",
- specinfo = "matrix"
- #, pipeline = "xcmsRawPipeline"
+ MS2spec = "list",
+ specinfo = "matrix"
+ ##, pipeline = "xcmsRawPipeline"
),
prototype(peaks = matrix(nrow = 0, ncol = 6),
- MS2spec=NULL,
- specinfo=NULL
- #, pipeline = new("xcmsRawPipeline")
+ MS2spec=NULL,
+ specinfo=NULL
+ ##, pipeline = new("xcmsRawPipeline")
))
-
View
0 R/00xcmsSet-class.R 100755 → 100644
No changes.
View
@@ -0,0 +1,6 @@
+setClass("xcmsSource", representation("VIRTUAL"))
+setGeneric("loadRaw", function(object, ...) standardGeneric("loadRaw"))
+setGeneric("xcmsSource", function(object, ...) standardGeneric("xcmsSource"))
+
+## If given an xcmsSource object, simply return it unchanged
+setMethod("xcmsSource", "xcmsSource", function(object) object)
@@ -0,0 +1,7 @@
+setClass("xcmsFileSource",
+ representation("character"),
+ contains="xcmsSource",
+ validity=function(object) {
+ if (file.exists(object)) TRUE
+ else paste("File not found:", object)
+ })
View
@@ -15,7 +15,7 @@ setClass("xcmsRaw", representation(env = "environment", tic = "numeric",
msnPrecursorIntensity = "numeric",
msnPrecursorCharge = "numeric",
msnCollisionEnergy = "numeric",
- filepath = "character"),
+ filepath = "xcmsSource"),
prototype(env = new.env(parent=.GlobalEnv), tic = numeric(0),
scantime = numeric(0), scanindex = integer(0),
@@ -32,6 +32,5 @@ setClass("xcmsRaw", representation(env = "environment", tic = "numeric",
msnPrecursorMz = numeric(0),
msnPrecursorIntensity = numeric(0),
msnPrecursorCharge = numeric(0),
- msnCollisionEnergy = numeric(0),
- filepath = ""
+ msnCollisionEnergy = numeric(0)
))
View
@@ -0,0 +1,25 @@
+setClass("netCdfSource",
+ representation(cdf="integer"),
+ contains="xcmsFileSource",
+ validity=function(object) {
+ if (!is.null(attr(object@cdf, "errortext"))) {
+ mzR:::netCDFClose(object@cdf)
+ attr(object@cdf, "errortext")
+ } else TRUE
+ })
+
+setMethod("initialize", "netCdfSource", function(.Object, path) {
+ .Object@cdf <- mzR:::netCDFOpen(path)
+ .Object <- setDataPart(.Object, path)
+ validObject(.Object)
+ .Object
+})
+
+setMethod("loadRaw", "netCdfSource", function(object, includeMSn) {
+ if (!missing(includeMSn) && includeMSn) {
+ warning("Reading of MSn spectra for NetCDF not supported")
+ }
+
+ on.exit(mzR:::netCDFClose(object@cdf))
+ mzR:::netCDFRawData(object@cdf)
+})
View
@@ -0,0 +1,26 @@
+setClass("rampSource",
+ representation(rampid="integer"),
+ contains="xcmsFileSource",
+ validity=function(object) {
+ if (object@rampid < 0) {
+ mzR:::rampClose(object@rampid)
+ paste("Could not open mzML/mzXML/mzData file:", object)
+ } else TRUE
+ })
+
+setMethod("initialize", "rampSource", function(.Object, path) {
+ .Object@rampid <- mzR:::rampOpen(path)
+ .Object <- setDataPart(.Object, path)
+ validObject(.Object)
+ .Object
+})
+
+setMethod("loadRaw", "rampSource", function(object, includeMSn) {
+ on.exit(mzR:::rampClose(object@rampid))
+ rawdata <- mzR:::rampRawData(object@rampid)
+
+ if (!missing(includeMSn) && includeMSn) {
+ rawdata$MSn <- mzR:::rampRawDataMSn(object@rampid)
+ }
+ rawdata
+})
Oops, something went wrong.

No commit comments for this range