Browse code

Remove Ramp backend with dependencies

jorainer authored on 20/09/2021 12:19:56
Showing68 changed files

... ...
@@ -2,7 +2,7 @@ Package: mzR
2 2
 Type: Package
3 3
 Title: parser for netCDF, mzXML, mzData and mzML and mzIdentML files
4 4
        (mass spectrometry data)
5
-Version: 2.27.1
5
+Version: 2.27.2
6 6
 Author: Bernd Fischer, Steffen Neumann, Laurent Gatto, Qiang Kou, Johannes Rainer
7 7
 Maintainer: Steffen Neumann <sneumann@ipb-halle.de>,
8 8
             Laurent Gatto <laurent.gatto@uclouvain.be>,
... ...
@@ -16,12 +16,31 @@ Description: mzR provides a unified API to the common file formats and
16 16
         reading code has previously been used in XCMS.
17 17
 License: Artistic-2.0
18 18
 LazyLoad: yes
19
-Depends: Rcpp (>= 0.10.1), methods, utils
20
-Imports: Biobase, BiocGenerics (>= 0.13.6), ProtGenerics (>= 1.17.3), ncdf4
21
-Suggests: msdata (>= 0.15.1), RUnit, mzID, BiocStyle (>= 2.5.19), knitr, XML, rmarkdown
19
+Depends:
20
+    Rcpp (>= 0.10.1),
21
+    methods,
22
+    utils
23
+Imports:
24
+    Biobase,
25
+    BiocGenerics (>= 0.13.6),
26
+    ProtGenerics (>= 1.17.3),
27
+    ncdf4
28
+Suggests:
29
+    msdata (>= 0.15.1),
30
+    RUnit,
31
+    mzID,
32
+    BiocStyle (>= 2.5.19),
33
+    knitr,
34
+    XML,
35
+    rmarkdown
22 36
 VignetteBuilder: knitr
23
-LinkingTo: Rcpp, zlibbioc, Rhdf5lib (>= 1.1.4)
24
-RcppModules: Ramp, Pwiz, Ident
37
+LinkingTo:
38
+    Rcpp,
39
+    zlibbioc,
40
+    Rhdf5lib (>= 1.1.4)
41
+RcppModules:
42
+    Pwiz,
43
+    Ident
25 44
 SystemRequirements: C++11, GNU make
26 45
 URL: https://github.com/sneumann/mzR/
27 46
 BugReports: https://github.com/sneumann/mzR/issues/
... ...
@@ -17,7 +17,6 @@ export(openMSfile,
17 17
 
18 18
 exportMethods(close,
19 19
               isInitialized,
20
-              initializeRamp,
21 20
               runInfo,
22 21
               fileName,
23 22
               instrumentInfo,
... ...
@@ -52,7 +51,6 @@ exportMethods(close,
52 51
               writeMSData)
53 52
 
54 53
 exportClasses("mzR",
55
-              "mzRramp",
56 54
               "mzRnetCDF",
57 55
               "mzRpwiz",
58 56
               "mzRident")
... ...
@@ -1,3 +1,7 @@
1
+CHANGES IN VERSION 2.27.2
2
+-------------------------
3
+ o Remove support for the ramp backend.
4
+
1 5
 CHANGES IN VERSION 2.27.1
2 6
 -------------------------
3 7
  o Add missing atomic_count_sync.hpp BH file (see PR #248 by vjcitn)
... ...
@@ -21,9 +21,6 @@ setGeneric("model", function(object) standardGeneric("model"))
21 21
 setGeneric("ionisation", function(object) standardGeneric("ionisation"))
22 22
 setGeneric("detector", function(object) standardGeneric("detector"))
23 23
 setGeneric("isInitialized", function(object) standardGeneric("isInitialized"))
24
-setGeneric("initializeRamp",
25
-           signature = c("object"),
26
-           function(object) standardGeneric("initializeRamp"))
27 24
 setGeneric("header", function(object, scans, ...) standardGeneric("header"))
28 25
 setGeneric("peaksCount",
29 26
            function(object, scans, ...) standardGeneric("peaksCount"))
... ...
@@ -1,7 +1,7 @@
1 1
 ##############################################################
2 2
 ## Defines supported backend APIs
3 3
 ##  - NULL: default
4
-##  - C++Object: for Rcpp modules for ramp and pwiz backends
4
+##  - C++Object: for Rcpp modules for pwiz backends
5 5
 ##  - ncdf4 for netCDF files
6 6
 setOldClass("ncdf4")
7 7
 setClassUnion("msAPI",
... ...
@@ -28,27 +28,6 @@ setClass("mzR",
28 28
            else msg
29 29
          })
30 30
 
31
-
32
-##############################################################
33
-## mzRramp - ramp backend through RcppRamp module
34
-setClass("mzRramp",
35
-         representation(backend="C++Object"),
36
-         contains=c("mzR"),
37
-         prototype=prototype(
38
-           new("Versioned", versions=c(mzR="0.1.0"))),
39
-         validity=function(object) {
40
-           msg <- validMsg(NULL,NULL)
41
-           if (is.null(object@backend))
42
-             msg <- validMsg(msg,"cRamp object not initialised.")
43
-           if (!object@backend$OK())
44
-             msg <- validMsg(msg,"cRamp object not OK.")
45
-           if (object@fileName!=object@backend$getFilename())
46
-             msg <- validMsg(msg,"R slot and ramp filenames do not match.") 
47
-           if (is.null(msg)) TRUE
48
-           else msg
49
-         })
50
-
51
-
52 31
 ##############################################################
53 32
 ## mzRpwiz - pwiz backend through an Rcpp module 
54 33
 setClass("mzRpwiz",
... ...
@@ -10,18 +10,9 @@ openMSfile <- function(filename,
10 10
     filename <- path.expand(filename)
11 11
     if (is.null(backend))
12 12
         backend <- .mzRBackend(filename)
13
-    backend <- match.arg(backend, c("pwiz", "Ramp", "netCDF"))
13
+    backend <- match.arg(backend, c("pwiz", "netCDF"))
14 14
     
15
-    if (backend == "Ramp") {
16
-        rampModule <- new( Ramp ) 
17
-        rampModule$open(filename, declaredOnly = TRUE)
18
-        if (!rampModule$OK()) {
19
-            stop("Unable to create valid cRamp object.")
20
-        }
21
-        return(new("mzRramp",
22
-                   backend=rampModule,
23
-                   fileName=filename))
24
-    } else if (backend == "netCDF") { 
15
+    if (backend == "netCDF") { 
25 16
         if (netCDFIsFile(filename)) {
26 17
             ncid <- netCDFOpen(filename)
27 18
             if (!is.null(attr(ncid, "errortext"))) {
... ...
@@ -56,7 +47,7 @@ openMSfile <- function(filename,
56 47
 #' @param x \code{character(1)} representing the file name.
57 48
 #'
58 49
 #' @return A \code{character(1)} with the name of the backend (either
59
-#'     \code{"netCDF"}, \code{"Ramp"} or \code{"pwiz"}.
50
+#'     \code{"netCDF"} or \code{"pwiz"}.
60 51
 #'
61 52
 #' @author Johannes Rainer, Sebastian Gibb
62 53
 #'
... ...
@@ -65,13 +56,11 @@ openMSfile <- function(filename,
65 56
     if (length(x) != 1)
66 57
         stop("parameter 'x' has to be of length 1")
67 58
     ## Use if/else conditions based on a suggestion from sgibb to avoid loops.
68
-    if (grepl("\\.mzml($|\\.)|\\.mzxml($|\\.)", x, ignore.case = TRUE)) {
59
+    if (grepl("\\.mzml($|\\.)|\\.mzxml($|\\.)", x, ignore.case = TRUE))
69 60
         return("pwiz")
70
-    } else if (grepl("\\.mzdata($|\\.)", x, ignore.case = TRUE)) {
71
-        return("Ramp")
72
-    } else if (grepl("\\.cdf($|\\.)|\\.nc($|\\.)", x, ignore.case = TRUE)) {
61
+    else if (grepl("\\.cdf($|\\.)|\\.nc($|\\.)", x, ignore.case = TRUE))
73 62
         return("netCDF")
74
-    } else
63
+    else
75 64
         suppressWarnings(.mzRBackendFromContent(x))
76 65
 }
77 66
 
... ...
@@ -89,8 +78,6 @@ openMSfile <- function(filename,
89 78
 
90 79
     if (any(grepl("<mz[X]?ML", first_lines))) {
91 80
         return("pwiz")
92
-    } else if (any(grepl("<mzData", first_lines))) {
93
-        return("Ramp")
94 81
     } else if (rawToChar(readBin(x, raw(), n = 10)[2:4]) == "HDF") {
95 82
         return("pwiz")
96 83
     } else if (substr(readBin(x, character(), n = 1), 1, 3) == "CDF") {
97 84
deleted file mode 100644
... ...
@@ -1,188 +0,0 @@
1
-setMethod("get3Dmap",
2
-          signature="mzRramp",
3
-          function(object,scans,lowMz,highMz,resMz) 
4
-          return(object@backend$get3DMap(scans,lowMz,highMz,resMz)))
5
-
6
-setMethod("initializeRamp",
7
-          signature="mzRramp",
8
-          function(object) {
9
-            if (!file.exists(fileName(object)))
10
-                stop("File ", fileName(object), " not found.\n")
11
-            object@backend$open(fileName(object), declaredOnly = TRUE)
12
-            if (isInitialized(object)) invisible(TRUE)
13
-            else stop("Could not initialize ramp slot.")
14
-          })
15
-
16
-setMethod("length",
17
-          signature=c("mzRramp"),
18
-          function(x) return(x@backend$getLastScan()))
19
-
20
-setMethod("peaks", "mzRramp",
21
-          function(object, scans) .peaks_ramp(object, scans))
22
-
23
-setMethod("spectra", "mzRramp",
24
-          function(object, scans) .peaks_ramp(object, scans))
25
-
26
-setMethod("peaksCount",
27
-          signature=c("mzRramp","numeric"),
28
-          function(object,scans) {
29
-              if (length(scans)==1) {
30
-                  object@backend$getPeakList(scans)$peaksCount
31
-              } else {
32
-                  sapply(scans,function(x) object@backend$getPeakList(x)$peaksCount)
33
-              }
34
-          })
35
-
36
-setMethod("peaksCount",
37
-          signature=c("mzRramp","missing"),
38
-          function(object) {
39
-              n <- length(object)
40
-              return(peaksCount(object,1:n))
41
-          })
42
-
43
-setMethod("header",
44
-          signature=c("mzRramp","missing"),
45
-          function(object) {
46
-              res <- object@backend$getAllScanHeaderInfo()
47
-              res$filterString <- NA_character_
48
-              res$spectrumId <- paste0("scan=", res$acquisitionNum)
49
-              res$centroided <- NA
50
-              res$ionMobilityDriftTime <- NA_real_
51
-              res$isolationWindowTargetMZ <- NA_real_
52
-              res$isolationWindowLowerOffset <- NA_real_
53
-              res$isolationWindowUpperOffset <- NA_real_
54
-              res$scanWindowLowerLimit <- NA_real_
55
-              res$scanWindowUpperLimit <- NA_real_
56
-              res
57
-})
58
-
59
-
60
-setMethod("header",
61
-          signature=c("mzRramp","numeric"),
62
-          function(object, scans) {
63
-              if (length(scans)==1) {
64
-                  res <- object@backend$getScanHeaderInfo(scans)
65
-              } else {
66
-                  res <- data.frame(t(sapply(scans, function(x)
67
-                      unlist(object@backend$getScanHeaderInfo(x)))))
68
-              }
69
-              res$filterString <- NA_character_
70
-              res$spectrumId <- paste0("scan=", res$acquisitionNum)
71
-              res$centroided <- NA
72
-              res$ionMobilityDriftTime <- NA_real_
73
-              res$isolationWindowTargetMZ <- NA_real_
74
-              res$isolationWindowLowerOffset <- NA_real_
75
-              res$isolationWindowUpperOffset <- NA_real_
76
-              res$scanWindowLowerLimit <- NA_real_
77
-              res$scanWindowUpperLimit <- NA_real_
78
-              res
79
-          })
80
-
81
-setMethod("close", 
82
-          signature="mzRramp",
83
-          function(con,...) return(con@backend$close()))
84
-
85
-setMethod("isInitialized", 
86
-          signature="mzRramp",
87
-          function(object) return(object@backend$OK()))
88
-
89
-setMethod("runInfo",
90
-          signature="mzRramp",
91
-          function(object) {
92
-              ##return(object@backend$getRunInfo())
93
-              hd <- header(object)
94
-              ll <- list()
95
-              ll$'scanCount' <- length(object)
96
-              ll$'lowMz' <- min(hd$lowMZ)
97
-              ll$'highMz' <- max(hd$highMZ)
98
-              ll$'dStartTime' <- min(hd$retentionTime)
99
-              ll$'dEndTime' <- max(hd$retentionTime)
100
-              ll$'msLevels' <- unique(hd$msLevel)
101
-              ll$'startTimeStamp' <- NA
102
-              return(ll)
103
-          })
104
-
105
-
106
-setMethod("instrumentInfo",
107
-          signature="mzRramp",
108
-          function(object) 
109
-              return(object@backend$getInstrumentInfo()))
110
-
111
-
112
-setMethod("manufacturer",
113
-          signature="mzRramp",
114
-          function(object) {
115
-              info <- instrumentInfo(object)           
116
-              return(info$manufacturer)
117
-          })
118
-
119
-setMethod("model",
120
-          signature="mzRramp",
121
-          function(object) {
122
-              info <- instrumentInfo(object)           
123
-              return(info$model)
124
-          })
125
-
126
-setMethod("ionisation",
127
-          signature="mzRramp",
128
-          function(object) {
129
-              info <- instrumentInfo(object)           
130
-              return(info$ionisation)
131
-          })
132
-
133
-setMethod("analyzer",
134
-          signature="mzRramp",
135
-          function(object) {
136
-              info <- instrumentInfo(object)           
137
-              return(info$analyzer)
138
-          })
139
-
140
-setMethod("detector",
141
-          signature="mzRramp",
142
-          function(object) {
143
-              info <- instrumentInfo(object)           
144
-              return(info$detector)
145
-          })
146
-
147
-
148
-setMethod("show",
149
-          signature="mzRramp",
150
-          function(object) {
151
-              if (!isInitialized(object)) {
152
-                  cat("Your object's ramp slot is not initialized.\n")
153
-                  cat("Use initializeRamp(object) to fix this.\n")
154
-              } else {
155
-                  filename <- fileName(object)
156
-                  ## info <- instrumentInfo(object)
157
-                  ## run  <- runInfo(object)
158
-                  cat("Mass Spectrometry file handle.\n")
159
-                  cat("Filename: ", basename(filename), "\n")
160
-                  cat("Number of scans: ", length(object), "\n")
161
-                  ## if (any(info != "")) {
162
-                  ##   cat("Manufacturer: ", info$manufacturer, "\n")
163
-                  ##   cat("Model:        ", info$model, "\n")
164
-                  ##   cat("Ionisation:   ", info$ionisation, "\n")
165
-                  ##   cat("Analyzer:     ", info$analyzer, "\n")
166
-                  ##   cat("Detector:     ", info$detector, "\n")
167
-                  ## }
168
-                  ## cat("Number of scans: ", run$scanCount, "\n")
169
-                  ## cat("lowMZ:        ", run$lowMZ, " \thighMZ: ", run$highMZ, "\n")
170
-                  ## cat("startMZ:      ", run$startMZ, " \tendMZ: ",  run$endMZ, "\n")
171
-                  ## cat("dStartTime:   ", run$dStartTime, " \tdEndTime: ", run$dEndTime, "\n")
172
-              }
173
-              invisible(NULL)
174
-          })
175
-
176
-setMethod("isolationWindow", "mzRramp",
177
-          function(object, ...) .isolationWindow(fileName(object), ...))
178
-
179
-setMethod("chromatograms", "mzRramp", function(object, chrom)
180
-    chromatogram(object, chrom))
181
-setMethod("chromatogram", "mzRramp", function(object, chrom) {
182
-    warning("The mzRnetCdf backend does not support chromatographic data")
183
-    .empty_chromatogram()
184
-})
185
-setMethod("chromatogramHeader", "mzRramp", function(object, chrom) {
186
-    warning("The mzRnetCdf backend does not support chromatographic data")
187
-    .empty_chromatogram_header()
188
-})
189 0
deleted file mode 100644
... ...
@@ -1,144 +0,0 @@
1
-rampInit <- function() {
2
-
3
-    result <- .C("RampRInit",
4
-                 PACKAGE = "mzR")
5
-}
6
-
7
-rampPrintFiles <- function() {
8
-
9
-    result <- .C("RampRPrintFiles",
10
-                 PACKAGE = "mzR")
11
-}
12
-
13
-rampIsFile <- function(filename) {
14
-
15
-    # The C version doesn't do anything extra
16
-    #.C("RampRIsFile",
17
-    #   as.character(filename),
18
-    #   isfile = logical(1),
19
-    #   PACKAGE = "mzR")$isfile
20
-
21
-    if (!file.exists(filename))
22
-        return(FALSE)
23
-    text <- readChar(filename, 1024)
24
-
25
-    length(text) > 0
26
-}
27
-
28
-rampOpen <- function(filename) {
29
-
30
-    result <- .C("RampROpen",
31
-                 as.character(filename),
32
-                 rampid = integer(1),
33
-                 status = integer(1),
34
-                 PACKAGE = "mzR")
35
-
36
-    if (result$status)
37
-        return(result$status)
38
-
39
-    return(result$rampid)
40
-}
41
-
42
-rampClose <- function(rampid) {
43
-
44
-    result <- .C("RampRClose",
45
-                 as.integer(rampid),
46
-                 PACKAGE = "mzR")
47
-}
48
-
49
-rampCloseAll <- function() {
50
-
51
-    result <- .C("RampRCloseAll",
52
-                 PACKAGE = "mzR")
53
-}
54
-
55
-rampNumScans <- function(rampid) {
56
-
57
-    result <- .C("RampRNumScans",
58
-                 as.integer(rampid),
59
-                 numscans = integer(1),
60
-                 status = integer(1),
61
-                 PACKAGE = "mzR")
62
-
63
-    if (result$status)
64
-        return(NA)
65
-
66
-    return(result$numscans)
67
-}
68
-
69
-rampScanHeaders <- function(rampid) {
70
-
71
-    .Call("RampRScanHeaders",
72
-          as.integer(rampid),
73
-          PACKAGE = "mzR")
74
-}
75
-
76
-rampSIPeaks <- function(rampid, seqNum, peaksCount) {
77
-
78
-    if (!is.integer(seqNum))
79
-        seqNum <- as.integer(seqNum)
80
-    if (!is.integer(peaksCount))
81
-        peaksCount <- as.integer(peaksCount)
82
-    .Call("RampRSIPeaks",
83
-          as.integer(rampid),
84
-          seqNum,
85
-          peaksCount,
86
-          PACKAGE = "mzR")
87
-}
88
-
89
-rampRawData <- function(rampid) {
90
-
91
-    scanHeaders <- rampScanHeaders(rampid)
92
-
93
-    # Some of these checks work around buggy RAMP indexing code
94
-    scans <- scanHeaders$msLevel == 1 & scanHeaders$seqNum > 0 &
95
-             !duplicated(scanHeaders$acquisitionNum) &
96
-             scanHeaders$peaksCount > 0
97
-    if ("Full" %in% levels(scanHeaders$scanType))
98
-        scans <- scans & scanHeaders$scanType == "Full"
99
-
100
-    scans <- which(scans)
101
-
102
-    sipeaks <- rampSIPeaks(rampid, scans, scanHeaders$peaksCount[scans])
103
-
104
-    return(list(rt = scanHeaders$retentionTime[scans],
105
-                acquisitionNum = scanHeaders$acquisitionNum[scans],
106
-                tic = scanHeaders$totIonCurrent[scans],
107
-                scanindex = sipeaks$scanindex,
108
-                mz = sipeaks$mz,
109
-                intensity = sipeaks$intensity,
110
-                polarity = scanHeaders$polarity[scans]))
111
-}
112
-
113
-rampRawDataMSn <- function(rampid) {
114
-
115
-    # Check if we have MSn at all
116
-    scanHeaders <- rampScanHeaders(rampid)
117
-    if (max(scanHeaders[,"msLevel"]) < 2) {
118
-        warning("MSn spectra requested but not found")
119
-        return (NULL);
120
-    }
121
-
122
-    # Some of these checks work around buggy RAMP indexing code
123
-    scans <- ( scanHeaders$msLevel >= 2 & scanHeaders$seqNum > 0
124
-              & !duplicated(scanHeaders$acquisitionNum)
125
-              & scanHeaders$peaksCount > 0)
126
-
127
-    scans <- which(scans)
128
-
129
-    sipeaks <- rampSIPeaks(rampid, scans, scanHeaders$peaksCount[scans])
130
-
131
-    retdata <- list(rt = scanHeaders$retentionTime[scans],
132
-                    acquisitionNum = scanHeaders$acquisitionNum[scans],
133
-                    precursorNum=scanHeaders$precursorScanNum[scans],
134
-                    precursorMZ = scanHeaders$precursorMZ[scans],
135
-                    precursorIntensity = scanHeaders$precursorIntensity[scans],
136
-                    peaksCount=scanHeaders$peaksCount[scans],
137
-                    msLevel = scanHeaders$msLevel[scans],
138
-                    precursorCharge = scanHeaders$precursorCharge[scans],
139
-                    scanindex = sipeaks$scanindex, collisionEnergy = scanHeaders$collisionEnergy[scans],
140
-                    mz = sipeaks$mz,
141
-                    intensity =sipeaks$intensity);
142
-
143
-    return(retdata)
144
-}
... ...
@@ -7,17 +7,6 @@
7 7
     else res
8 8
 }
9 9
 
10
-.peaks_ramp <- function(object, scans) {
11
-    if (missing(scans))
12
-        scans <- 1:length(object)
13
-    if (length(scans) == 1) {
14
-        object@backend$getPeakList(scans)$peaks
15
-    } else {
16
-        sapply(scans, function(x) object@backend$getPeakList(x)$peaks,
17
-               simplify = FALSE)
18
-    }
19
-}
20
-
21 10
 setMethod("isolationWindow", "character",
22 11
           function(object, ...) .isolationWindow(object, ...))
23 12
 
... ...
@@ -18,7 +18,6 @@ BUILT_RCPP_VERSION = package_version("1.0.6")
18 18
       require2 <- require
19 19
       require2("methods", character.only = TRUE, quietly = TRUE)
20 20
       #loadRcppModules()
21
-      loadModule("Ramp", TRUE)
22 21
       loadModule("Pwiz", TRUE)
23 22
       loadModule("Ident", TRUE)
24 23
       Sys.setenv("HDF5_DISABLE_VERSION_CHECK"=2)
... ...
@@ -18,7 +18,6 @@ BUILT_RCPP_VERSION = package_version("@BUILT_RCPP_VERSION@")
18 18
       require2 <- require
19 19
       require2("methods", character.only = TRUE, quietly = TRUE)
20 20
       #loadRcppModules()
21
-      loadModule("Ramp", TRUE)
22 21
       loadModule("Pwiz", TRUE)
23 22
       loadModule("Ident", TRUE)
24 23
       Sys.setenv("HDF5_DISABLE_VERSION_CHECK"=2)
... ...
@@ -1,7 +1,5 @@
1 1
 test_backends <- function() {
2 2
     f <- system.file("lockmass", "LockMass_test.mzXML", package = "msdata")
3
-    mr <- openMSfile(f, backend = "Ramp")
4
-    checkTrue(validObject(mr))
5 3
     mp <- openMSfile(f, backend = "pwiz")
6 4
     checkTrue(validObject(mp))
7 5
 
... ...
@@ -13,11 +13,6 @@ test_filter_string <- function() {
13 13
     checkTrue("filterString" %in% colnames(hdr))
14 14
     fl <- system.file("threonine", "threonine_i2_e35_pH_tree.mzXML",
15 15
                       package = "msdata")
16
-    mzxml <- openMSfile(fl, backend = "Ramp")
17
-    hdr <- header(mzxml)
18
-    mzR::close(mzxml)
19
-    checkTrue(all(is.na(hdr$filterString)))
20
-    checkTrue("filterString" %in% colnames(hdr))
21 16
 
22 17
     ## mzML - with filter string present.
23 18
     fl <- system.file("proteomics",
... ...
@@ -11,10 +11,5 @@ test_header_all <- function() {
11 11
     header_pwiz <- header(mzxml)
12 12
     close(mzxml)
13 13
 
14
-    mzxml <- openMSfile(file, backend="Ramp")
15
-    header_ramp <- header(mzxml)
16
-    close(mzxml)
17
-
18 14
     checkEquals(colnames(header_cdf), colnames(header_pwiz))
19
-    checkEquals(colnames(header_ramp), colnames(header_pwiz))
20 15
 }
... ...
@@ -12,11 +12,6 @@ test_injection_time <- function() {
12 12
     checkTrue(any(colnames(hdr) == "injectionTime"))
13 13
     fl <- system.file("threonine", "threonine_i2_e35_pH_tree.mzXML",
14 14
                       package = "msdata")
15
-    mzxml <- openMSfile(fl, backend = "Ramp")
16
-    hdr <- header(mzxml)
17
-    mzR::close(mzxml)
18
-    checkTrue(all(hdr$injectionTime == 0))
19
-    checkTrue(any(colnames(hdr) == "injectionTime"))
20 15
 
21 16
     ## CDF
22 17
     fl <- system.file("cdf", "ko15.CDF",
... ...
@@ -2,21 +2,16 @@ test_isolationWindow <- function() {
2 2
     library("msdata")
3 3
     f <- msdata::proteomics(full.names = TRUE,
4 4
                             pattern = "TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01.mzML.gz")
5
-    rw1 <- openMSfile(f, backend = "Ramp")
6 5
     rw2 <- openMSfile(f, backend = "pwiz")
7 6
     i1 <- isolationWindow(f)
8
-    i2 <- isolationWindow(rw1)
9 7
     i3 <- isolationWindow(rw2)
10
-    checkEquals(i1, i2)
11 8
     checkEquals(i1, i3)
12 9
     i1 <- isolationWindow(f, unique = FALSE)
13
-    i2 <- isolationWindow(rw1, unique = FALSE)
14 10
     i3 <- isolationWindow(rw2, unique = FALSE)
15
-    checkEquals(i1, i2)
16 11
     checkEquals(i1, i3)
17 12
     i1 <- isolationWindow(c(f, f), unique = FALSE)
18 13
     checkEquals(length(i1), 2L)
19 14
     checkEquals(i1[[1]], i1[[2]])
20
-    hd <- header(rw1)
15
+    hd <- header(rw2)
21 16
     checkEquals(sum(hd$msLevel == 2), nrow(i1[[1]]))
22 17
 }
23 18
deleted file mode 100644
... ...
@@ -1,55 +0,0 @@
1
-test_oldramp.mzXML <- function() {
2
-    cdfpath <- system.file("threonine", package = "msdata")
3
-    filename <- list.files(cdfpath, pattern="threonine_i2_e35_pH_tree.mzXML",
4
-                       full.names=TRUE, recursive = TRUE)
5
-
6
-    rampid <- mzR:::rampOpen(filename)
7
-    if (rampid < 0)
8
-       stop("Could not open mzXML/mzData file")
9
-
10
-    on.exit(mzR:::rampClose(rampid))
11
-    rawdata <- mzR:::rampRawData(rampid)
12
-    mzR:::rampClose(rampid)
13
-}
14
-
15
-test_oldramp.mzML <- function() {
16
-    cdfpath <- system.file("microtofq", package = "msdata")
17
-    filename <- list.files(cdfpath, pattern="MM14.mzML",
18
-                       full.names=TRUE, recursive = TRUE)
19
-
20
-    rampid <- mzR:::rampOpen(filename)
21
-    if (rampid < 0)
22
-       stop("Could not open mzXML/mzData file")
23
-
24
-    on.exit(mzR:::rampClose(rampid))
25
-    rawdata <- mzR:::rampRawData(rampid)
26
-    mzR:::rampClose(rampid)
27
-}
28
-
29
-test_oldramp.mzData <- function() {
30
-    cdfpath <- system.file("microtofq", package = "msdata")
31
-    filename <- list.files(cdfpath, pattern="MM14.mzdata$",
32
-                       full.names=TRUE, recursive = TRUE)
33
-
34
-    rampid <- mzR:::rampOpen(filename)
35
-    if (rampid < 0)
36
-       stop("Could not open mzXML/mzData file")
37
-
38
-    on.exit(mzR:::rampClose(rampid))
39
-    rawdata <- mzR:::rampRawData(rampid)
40
-    mzR:::rampClose(rampid)
41
-}
42
-
43
-test_oldramp.mzData.gz <- function() {
44
-    cdfpath <- system.file("microtofq", package = "msdata")
45
-    filename <- list.files(cdfpath, pattern = "MM14.mzdata.gz",
46
-                       full.names = TRUE, recursive = TRUE)
47
-
48
-    rampid <- mzR:::rampOpen(filename)
49
-    if (rampid < 0)
50
-       stop("Could not open mzXML/mzData file")
51
-
52
-    on.exit(mzR:::rampClose(rampid))
53
-    rawdata <- mzR:::rampRawData(rampid)
54
-    mzR:::rampClose(rampid)
55
-}
... ...
@@ -80,79 +80,50 @@ test_getScanHeaderInfo <- function() {
80 80
     ## by the Ramp backend.
81 81
     file <- system.file("microtofq", "MM14.mzML", package = "msdata")
82 82
     mzml <- openMSfile(file, backend = "pwiz")
83
-    ramp <- openMSfile(file, backend = "Ramp")
84 83
     ## Read single scan header.
85 84
     scan_3 <- header(mzml, scans = 3)
86
-    scan_3_ramp <- header(ramp, scans = 3)
87 85
     cn <- names(scan_3)
88 86
     cn <- cn[!(cn %in% c("spectrumId", "scanWindowLowerLimit",
89 87
                          "scanWindowUpperLimit", "centroided"))]
90 88
     scan_3 <- scan_3[cn]
91
-    scan_3_ramp <- scan_3_ramp[cn]
92 89
     ## Special case for columns that have an NA reported: they might have a
93 90
     ## 0 or NA in Ramp.
94 91
     nas <- is.na(scan_3)
95 92
     ## Ramp does not read polarity
96 93
     scan_3$polarity <- 0
97
-    checkEquals(scan_3[!nas], scan_3_ramp[!nas])
98
-    ## All others have to be 0 or NA
99
-    checkEquals(all(scan_3_ramp[nas] == 0 | is.na(scan_3_ramp[nas])), TRUE)
100 94
 
101 95
     ## Read all scan header
102 96
     all_scans <- header(mzml)
103
-    all_scans_ramp <- header(ramp)
104 97
     all_scans <- all_scans[, cn]
105
-    all_scans_ramp <- all_scans_ramp[, cn]
106 98
     all_scans$polarity <- 0
107 99
     nas <- vapply(all_scans, function(z) all(is.na(z)), logical(1))
108
-    checkEquals(all_scans[, !nas], all_scans_ramp[, !nas])
109
-    ## All others have to be 0 or NA
110
-    checkEquals(all(all_scans_ramp[nas] == 0 | is.na(all_scans_ramp[nas])), TRUE)
111 100
         
112 101
     ## passing the index of all scan headers should return the same
113 102
     all_scans <- header(mzml, scans = 1:nrow(all_scans))
114
-    all_scans_ramp <- header(ramp, scans = 1:nrow(all_scans))
115 103
     all_scans <- all_scans[, cn]
116
-    all_scans_ramp <- all_scans_ramp[, cn]
117 104
     all_scans$polarity <- 0
118 105
     nas <- vapply(all_scans, function(z) all(is.na(z)), logical(1))
119
-    checkEquals(all_scans[, !nas], all_scans_ramp[, !nas])
120
-    ## All others have to be 0 or NA
121
-    checkEquals(all(all_scans_ramp[, nas] == 0 | is.na(all_scans_ramp[, nas])), TRUE)
122 106
     
123 107
     ## Some selected scans
124 108
     all_scans <- header(mzml, scans = c(3, 1, 14))
125
-    all_scans_ramp <- header(ramp, scans = c(3, 1, 14))
126 109
     all_scans <- all_scans[, cn]
127
-    all_scans_ramp <- all_scans_ramp[, cn]
128 110
     all_scans$polarity <- 0
129 111
     nas <- vapply(all_scans, function(z) all(is.na(z)), logical(1))
130
-    checkEquals(all_scans[, !nas], all_scans_ramp[, !nas])
131
-    ## All others have to be 0 or NA
132
-    checkEquals(all(all_scans_ramp[, nas] == 0 | is.na(all_scans_ramp[, nas])), TRUE)
133 112
 
134 113
     close(mzml)
135
-    close(ramp)
136 114
 
137 115
     ## The same for an mzXML file:
138 116
     file <- system.file("threonine", "threonine_i2_e35_pH_tree.mzXML",
139 117
                         package = "msdata")
140 118
     mzml <- openMSfile(file, backend = "pwiz")
141
-    ramp <- openMSfile(file, backend = "Ramp")
142 119
     ## Read single scan header.
143 120
     scan_3 <- header(mzml, scans = 3)
144
-    scan_3_ramp <- header(ramp, scans = 3)
145 121
     scan_3 <- scan_3[cn]
146
-    scan_3_ramp <- scan_3_ramp[cn]
147 122
     nas <- vapply(scan_3, function(z) all(is.na(z)), logical(1))
148
-    checkEquals(scan_3[!nas], scan_3_ramp[!nas])
149
-    checkEquals(all(scan_3_ramp[nas] == 0 | is.na(scan_3_ramp[nas])), TRUE)
150 123
     
151 124
     ## Read all scan header
152 125
     all_scans <- header(mzml)
153
-    all_scans_ramp <- header(ramp)
154 126
     all_scans <- all_scans[, cn]
155
-    all_scans_ramp <- all_scans_ramp[, cn]
156 127
     
157 128
     ## Ramp unable to read precursorScanNum from an mzXML file.
158 129
     all_scans$precursorScanNum <- 0
... ...
@@ -161,57 +132,35 @@ test_getScanHeaderInfo <- function() {
161 132
         z[is.na(z)] <- 0
162 133
         z
163 134
     }))
164
-    all_scans_ramp <- data.frame(lapply(all_scans_ramp, function(z) {
165
-        z[is.na(z)] <- 0
166
-        z
167
-    }))
168
-    checkEquals(all_scans, all_scans_ramp)
169 135
     
170 136
     ## passing the index of all scan headers should return the same
171 137
     all_scans <- header(mzml, scans = 1:nrow(all_scans))
172
-    all_scans_ramp <- header(ramp, scans = 1:nrow(all_scans))
173 138
     all_scans$precursorScanNum <- 0
174 139
     all_scans <- all_scans[, cn]
175
-    all_scans_ramp <- all_scans_ramp[, cn]
176 140
     ## Replace all NA in all_scans with 0
177 141
     all_scans <- data.frame(lapply(all_scans, function(z) {
178 142
         z[is.na(z)] <- 0
179 143
         z
180 144
     }))
181
-    all_scans_ramp <- data.frame(lapply(all_scans_ramp, function(z) {
182
-        z[is.na(z)] <- 0
183
-        z
184
-    }))
185
-    checkEquals(all_scans, all_scans_ramp)
186 145
 
187 146
     ## Some selected scans
188 147
     all_scans <- header(mzml, scans = c(3, 1, 14))
189
-    all_scans_ramp <- header(ramp, scans = c(3, 1, 14))
190 148
     all_scans$precursorScanNum <- 0
191 149
     all_scans <- all_scans[, cn]
192
-    all_scans_ramp <- all_scans_ramp[, cn]
193 150
     ## Replace all NA in all_scans with 0
194 151
     all_scans <- data.frame(lapply(all_scans, function(z) {
195 152
         z[is.na(z)] <- 0
196 153
         z
197 154
     }))
198
-    all_scans_ramp <- data.frame(lapply(all_scans_ramp, function(z) {
199
-        z[is.na(z)] <- 0
200
-        z
201
-    }))
202
-    checkEquals(all_scans, all_scans_ramp)
203 155
 
204 156
     close(mzml)
205
-    close(ramp)
206 157
 
207 158
     ## Again for an MSn mzml file.
208 159
     file <- msdata::proteomics(full.names = TRUE,
209 160
                                pattern = "TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01.mzML.gz")
210 161
     mzml <- openMSfile(file, backend = "pwiz")
211
-    ramp <- openMSfile(file, backend = "Ramp")
212 162
     ## Read single scan header.
213 163
     scan_3 <- header(mzml, scans = 3)
214
-    scan_3_ramp <- header(ramp, scans = 3)
215 164
     ## Ramp does not read polarity, injectionTime or filterString
216 165
     cn <- names(scan_3)
217 166
     cn <- cn[!(cn %in% c("spectrumId", "scanWindowLowerLimit",
... ...
@@ -222,54 +171,32 @@ test_getScanHeaderInfo <- function() {
222 171
                          "isolationWindowUpperOffset",
223 172
                          "injectionTime"))]
224 173
     scan_3 <- scan_3[cn]
225
-    scan_3_ramp <- scan_3_ramp[cn]
226 174
     scan_3[is.na(scan_3)] <- 0 
227
-    scan_3_ramp[is.na(scan_3_ramp)] <- 0
228
-    checkEquals(scan_3, scan_3_ramp)
229 175
         
230 176
     ## Read all scan header
231 177
     all_scans <- header(mzml)[, cn]
232
-    all_scans_ramp <- header(ramp)[, cn]
233 178
     ## Replace all NA in all_scans with 0
234 179
     all_scans <- data.frame(lapply(all_scans, function(z) {
235 180
         z[is.na(z)] <- 0
236 181
         z
237 182
     }))
238
-    all_scans_ramp <- data.frame(lapply(all_scans_ramp, function(z) {
239
-        z[is.na(z)] <- 0
240
-        z
241
-    }))
242
-    checkEquals(all_scans, all_scans_ramp)
243 183
     
244 184
     ## passing the index of all scan headers should return the same
245 185
     all_scans_2 <- header(mzml, scans = 1:nrow(all_scans))[, cn]
246
-    all_scans_ramp <- header(ramp, scans = 1:nrow(all_scans))[, cn]
247 186
     ## Replace all NA in all_scans with 0
248 187
     all_scans_2 <- data.frame(lapply(all_scans_2, function(z) {
249 188
         z[is.na(z)] <- 0
250 189
         z
251 190
     }))
252
-    all_scans_ramp <- data.frame(lapply(all_scans_ramp, function(z) {
253
-        z[is.na(z)] <- 0
254
-        z
255
-    }))
256
-    checkEquals(all_scans, all_scans_ramp)
257 191
     checkEquals(all_scans, all_scans_2)
258 192
     
259 193
     ## Some selected scans
260 194
     all_scans <- header(mzml, scans = c(3, 1, 14))[, cn]
261
-    all_scans_ramp <- header(ramp, scans = c(3, 1, 14))[, cn]
262 195
     ## Replace all NA in all_scans with 0
263 196
     all_scans <- data.frame(lapply(all_scans, function(z) {
264 197
         z[is.na(z)] <- 0
265 198
         z
266 199
     }))
267
-    all_scans_ramp <- data.frame(lapply(all_scans_ramp, function(z) {
268
-        z[is.na(z)] <- 0
269
-        z
270
-    }))
271
-    checkEquals(all_scans, all_scans_ramp)
272 200
 
273 201
     close(mzml)
274
-    close(ramp)
275 202
 }
276 203
deleted file mode 100644
... ...
@@ -1,145 +0,0 @@
1
-test_mzXML <- function() {
2
-    file <- system.file("threonine", "threonine_i2_e35_pH_tree.mzXML", package = "msdata")
3
-    mzxml <- openMSfile(file, backend="Ramp")
4
-    checkTrue(class(mzxml)=="mzRramp")
5
-    show(mzxml)
6
-    length(mzxml)
7
-    runInfo(mzxml)
8
-    instrumentInfo(mzxml)
9
-    peaks(mzxml)
10
-    peaks(mzxml,1)
11
-    peaks(mzxml,2:3)
12
-    peaksCount(mzxml)
13
-    header(mzxml)
14
-    header(mzxml,1)
15
-    header(mzxml,2:3)
16
-    fileName(mzxml)
17
-    hdr <- header(mzxml)
18
-    checkTrue(any(colnames(hdr) == "centroided"))
19
-    checkTrue(all(is.na(hdr$centroided)))
20
-    checkTrue(any(colnames(hdr) == "ionMobilityDriftTime"))
21
-    checkTrue(all(is.na(hdr$ionMobilityDriftTime)))
22
-    checkTrue(any(colnames(hdr) == "scanWindowLowerLimit"))
23
-    checkTrue(any(colnames(hdr) == "scanWindowUpperLimit"))
24
-    checkTrue(all(is.na(hdr$scanWindowLowerLimit)))
25
-    checkTrue(all(is.na(hdr$scanWindowUpperLimit)))
26
-    close(mzxml)
27
-}
28
-
29
-test_mzML <- function() {
30
-    file <- system.file("microtofq", "MM14.mzML", package = "msdata")
31
-    mzml <- openMSfile(file, backend="Ramp")
32
-    checkTrue(class(mzml)=="mzRramp")
33
-    show(mzml)
34
-    length(mzml)
35
-    runInfo(mzml)
36
-    instrumentInfo(mzml)
37
-    peaks(mzml)
38
-    peaks(mzml,1)
39
-    peaks(mzml,2:3)
40
-    peaksCount(mzml)
41
-    hdr <- header(mzml)
42
-    checkTrue(any(colnames(hdr) == "spectrumId"))
43
-    checkEquals(hdr$spectrumId, paste0("scan=", hdr$acquisitionNum))
44
-    header(mzml,1)
45
-    header(mzml,2:3)
46
-    checkTrue(any(colnames(hdr) == "ionMobilityDriftTime"))
47
-    checkTrue(all(is.na(hdr$ionMobilityDriftTime)))
48
-    checkTrue(any(colnames(hdr) == "scanWindowLowerLimit"))
49
-    checkTrue(any(colnames(hdr) == "scanWindowUpperLimit"))
50
-    checkTrue(all(is.na(hdr$scanWindowLowerLimit)))
51
-    checkTrue(all(is.na(hdr$scanWindowUpperLimit)))
52
-
53
-    checkTrue(ncol(header(mzml))>4)
54
-    checkTrue(length(header(mzml,1))>4)
55
-    checkTrue(ncol(header(mzml,2:3))>4)
56
-
57
-    ## Check polarity reporting
58
-#    checkTrue(all(header(mzml)$polarity==1))
59
-
60
-    fileName(mzml)
61
-    close(mzml)
62
-}
63
-
64
-test_mzData <- function() {
65
-    file <- system.file("microtofq", "MM14.mzdata", package = "msdata")
66
-    mzdata <- openMSfile(file, backend="Ramp")
67
-    checkTrue(class(mzdata)=="mzRramp")
68
-    show(mzdata)
69
-    length(mzdata)
70
-    runInfo(mzdata)
71
-    checkTrue(all(instrumentInfo(mzdata)==""))
72
-    peaks(mzdata)
73
-    peaks(mzdata,1)
74
-    peaks(mzdata,2:3)
75
-    peaksCount(mzdata)
76
-    hdr <- header(mzdata)
77
-    checkTrue(any(colnames(hdr) == "spectrumId"))
78
-    checkEquals(hdr$spectrumId, paste0("scan=", hdr$acquisitionNum))
79
-    header(mzdata,1)
80
-    header(mzdata,2:3)
81
-    fileName(mzdata)
82
-
83
-    ## Check polarity reporting
84
-    checkTrue(all(header(mzdata)$polarity==1))
85
-   
86
-    close(mzdata)    
87
-}
88
-
89
-test_mzData.gz <- function() {
90
-    file <- system.file("microtofq", "MM14.mzdata.gz", package = "msdata")
91
-    mzdata <- openMSfile(file, backend="Ramp")
92
-    checkTrue(class(mzdata)=="mzRramp")
93
-    show(mzdata)
94
-    length(mzdata)
95
-    runInfo(mzdata)
96
-    checkTrue(all(instrumentInfo(mzdata)==""))
97
-    peaks(mzdata)
98
-    peaks(mzdata,1)
99
-    peaks(mzdata,2:3)
100
-    peaksCount(mzdata)
101
-    hdr <- header(mzdata)
102
-    checkTrue(any(colnames(hdr) == "spectrumId"))
103
-    checkEquals(hdr$spectrumId, paste0("scan=", hdr$acquisitionNum))
104
-    header(mzdata,1)
105
-    header(mzdata,2:3)
106
-    fileName(mzdata)
107
-    close(mzdata)    
108
-}
109
-
110
-test_peaks_spectra <- function() {
111
-    library("msdata")
112
-    f <- proteomics(full.names = TRUE)
113
-    x <- openMSfile(f[1])
114
-    p <- peaks(x, 1:10)
115
-    s <- spectra(x, 1:10)
116
-    checkIdentical(p, s)
117
-    close(x)
118
-}
119
-
120
-test_chromatogram <- function() {
121
-    library("msdata")
122
-    f <- proteomics(full.names = TRUE)
123
-    x <- openMSfile(f[1], backend = "Ramp")
124
-    suppressWarnings(
125
-        chr <- chromatogram(x)
126
-    )
127
-    checkTrue(length(chr) == 0)
128
-    suppressWarnings(
129
-        chr <- chromatograms(x)
130
-    )
131
-    checkTrue(length(chr) == 0)
132
-    close(x)
133
-}
134
-
135
-test_chromatogramHeader <- function() {
136
-    library("msdata")
137
-    f <- proteomics(full.names = TRUE)
138
-    x <- openMSfile(f[1], backend = "Ramp")
139
-    suppressWarnings(
140
-        ch <- chromatogramHeader(x)
141
-    )
142
-    checkTrue(nrow(ch) == 0)
143
-    close(x)
144
-}
145
-
... ...
@@ -43,14 +43,4 @@ test_runStartTimeStamp_cdf <- function() {
43 43
     mzR::close(fh)
44 44
 }
45 45
 
46
-test_runStartTimeStamp_ramp <- function() {
47
-    ## Can not extract from ramp
48
-    f <- system.file("iontrap/extracted.mzData", package = "msdata")
49
-    fh <- mzR::openMSfile(f, backend = "Ramp")
50
-    run_info <- runInfo(fh)
51
-    checkTrue(any(names(run_info) == "startTimeStamp"))
52
-    checkTrue(is.na(run_info$startTimeStamp))
53
-    mzR::close(fh)
54
-}
55
-
56 46
 
... ...
@@ -122,10 +122,6 @@ test_copyWriteMSData <- function() {
122 122
                                         original_file = orig_file,
123 123
                                         header = hdr, object = hdr,
124 124
                                         backend = "pwiz"))
125
-    checkException(mzR::copyWriteMSData(file = fnew,
126
-                                        original_file = orig_file,
127
-                                        header = hdr, object = pks,
128
-                                        backend = "Ramp"))
129 125
     checkException(mzR::copyWriteMSData(file = fnew,
130 126
                                         original_file = "somefile",
131 127
                                         header = hdr, object = pks,
... ...
@@ -556,51 +552,5 @@ test_writeMSData <- function() {
556 552
     checkEquals(pks, pks_2)
557 553
     cn <- c("spectrumId", "scanWindowLowerLimit", "scanWindowUpperLimit")
558 554
     checkEquals(hdr[, !(colnames(hdr_2) %in% cn)],
559
-                hdr_2[, !(colnames(hdr_2) %in% cn)])
560
-    
561
-    ## mzData:
562
-    test_file <- system.file("iontrap", "extracted.mzData", package = "msdata")
563
-    in_file <- openMSfile(test_file, backend = "Ramp")
564
-    hdr <- header(in_file)
565
-    hdr_orig <- hdr
566
-    pks <- peaks(in_file)
567
-    mzR::close(in_file)
568
-
569
-    ## mzML
570
-    out_file <- paste0(test_folder, "/test_write.mzML")
571
-    writeMSData(file = out_file, header = hdr_orig, object = pks)
572
-    in_file <- openMSfile(out_file, backend = "pwiz")
573
-    hdr_2 <- header(in_file)
574
-    pks_2 <- peaks(in_file)
575
-    mzR::close(in_file)
576
-    hdr <- data.frame(lapply(hdr, function(z) {
577
-        z[is.na(z)] <- 0
578
-        z
579
-    }))
580
-    hdr_2 <- data.frame(lapply(hdr_2, function(z) {
581
-        z[is.na(z)] <- 0
582
-        z
583
-    }))
584
-    checkEquals(hdr, hdr_2)
585
-    checkEquals(pks, pks_2)
586
-    ## validate mzML:
587
-    doc <- XML::xmlInternalTreeParse(out_file)
588
-    res <- XML::xmlSchemaValidate(mzML_xsd_idx, doc)
589
-    checkEquals(res$status, 0)
590
-
591
-    ## mzXML output:
592
-    out_file <- paste0(test_folder, "test_write.mzXML")
593
-    writeMSData(file = out_file, header = hdr_orig, object = pks,
594
-                outformat = "mzXML")
595
-    in_file <- openMSfile(out_file, backend = "pwiz")
596
-    hdr_2 <- header(in_file)
597
-    hdr_2 <- data.frame(lapply(hdr_2, function(z) {
598
-        z[is.na(z)] <- 0
599
-        z
600
-    }))
601
-    pks_2 <- peaks(in_file)
602
-    mzR::close(in_file)
603
-    checkEquals(pks, pks_2)
604
-    checkEquals(hdr[, colnames(hdr_2) != "centroided"],
605
-                hdr_2[, colnames(hdr_2) != "centroided"])
555
+                hdr_2[, !(colnames(hdr_2) %in% cn)])    
606 556
 }
... ...
@@ -4,7 +4,6 @@
4 4
 \alias{isolationWindow-methods}
5 5
 \alias{isolationWindow,character-method}
6 6
 \alias{isolationWindow,mzRpwiz-method}
7
-\alias{isolationWindow,mzRramp-method}
8 7
 
9 8
 \title{ Returns the ion selection isolation window }
10 9
 
... ...
@@ -36,9 +35,6 @@
36 35
     \item{\code{signature(object = "mzRpwiz", unique. = "logical",
37 36
 	simplify = "logical")}}{As above for \code{mzRpwiz} objects. }
38 37
 
39
-    \item{\code{signature(object = "mzRramp", unique. = "logical",
40
-	simplify = "logical")}}{As above for \code{mzRramp} object. }
41
-
42 38
   }
43 39
 }
44 40
 
... ...
@@ -2,48 +2,35 @@
2 2
 \Rdversion{1.1}
3 3
 \docType{class}
4 4
 \alias{mzR-class}
5
-\alias{mzRramp-class}
6 5
 \alias{mzRnetCDF-class}
7 6
 \alias{mzRpwiz-class}
8 7
 \alias{mzRident-class}
9 8
 \alias{class:mzR}
10
-\alias{class:mzRramp}
11 9
 \alias{class:mzRnetCDF}
12 10
 \alias{class:mzRpwiz}
13 11
 \alias{class:mzRident}
14 12
 \alias{close,mzRpwiz-method}
15
-\alias{close,mzRramp-method}
16 13
 \alias{close,mzRnetCDF-method}
17 14
 \alias{close}
18
-\alias{analyzer,mzRramp-method}
19 15
 \alias{analyzer,mzRpwiz-method}
20 16
 \alias{analyzer,mzRnetCDF-method}
21
-\alias{detector,mzRramp-method}
22 17
 \alias{detector,mzRpwiz-method}
23 18
 \alias{detector,mzRnetCDF-method}
24 19
 \alias{fileName,mzR-method}
25
-\alias{initializeRamp,mzRramp-method}
26
-\alias{instrumentInfo,mzRramp-method}
27 20
 \alias{instrumentInfo,mzRpwiz-method}
28 21
 \alias{instrumentInfo,mzRnetCDF-method}
29
-\alias{ionisation,mzRramp-method}
30 22
 \alias{ionisation,mzRpwiz-method}
31 23
 \alias{ionisation,mzRnetCDF-method}
32
-\alias{isInitialized,mzRramp-method}
33 24
 \alias{isInitialized,mzRnetCDF-method}
34 25
 \alias{length,mzRident-method}
35
-\alias{length,mzRramp-method}
36 26
 \alias{length,mzRpwiz-method}
37 27
 \alias{length,mzRnetCDF-method}
38 28
 \alias{length}
39
-\alias{manufacturer,mzRramp-method}
40 29
 \alias{manufacturer,mzRpwiz-method}
41 30
 \alias{manufacturer,mzRnetCDF-method}
42
-\alias{model,mzRramp-method}
43 31
 \alias{model,mzRpwiz-method}
44 32
 \alias{model,mzRnetCDF-method}
45 33
 
46
-\alias{runInfo,mzRramp-method}
47 34
 \alias{runInfo,mzRpwiz-method}
48 35
 \alias{runInfo,mzRnetCDF-method}
49 36
 \alias{chromatogramsInfo,mzRpwiz-method}
... ...
@@ -71,9 +58,8 @@
71 58
   directly.
72 59
 
73 60
   The sub-classes implement specific APIs to access the underlying data
74
-  and metadata in the files. Currently, \code{mzRramp} and
75
-  \code{mzRpwiz} are available implementations. \code{mzRramp} uses the
76
-  ISB 'RAMP' random access C/C++ API, and \code{mzRpwiz} uses
61
+  and metadata in the files. Currently \code{mzRpwiz} is available.
62
+  \code{mzRpwiz} uses
77 63
   Proteowizard to access the relevant information in \code{mzData},
78 64
   \code{mzXML} and \code{mzML} files. \code{mzRident} is used as an
79 65
   interface to \code{mzIdentML} files.
... ...
@@ -93,7 +79,7 @@
93 79
 \section{Objects from the Class}{
94 80
   \code{mzR} is a virtual class, so instances cannot be created.
95 81
 
96
-  Objects can be created by calls of the form \code{new("mzRramp",
82
+  Objects can be created by calls of the form \code{new("mzRpwiz",
97 83
     ...)}, but more often they will be created with
98 84
   \code{\link{openMSfile}}.
99 85
 
... ...
@@ -127,23 +113,6 @@
127 113
 
128 114
   \describe{ \item{fileName}{\code{signature(object = "mzR")}: ... } }
129 115
 
130
-  Methods currently implemented for \code{mzRramp}
131
-
132
-  \describe{
133
-    \item{analyzer}{\code{signature(object = "mzRramp")}: ... }
134
-    \item{close}{\code{signature(con = "mzRramp")}: ... }
135
-    \item{detector}{\code{signature(object = "mzRramp")}: ... }
136
-    \item{fileName}{\code{signature(object = "mzRramp")}: ... }
137
-    \item{initializeRamp}{\code{signature(object = "mzRramp")}: ... }
138
-    \item{instrumentInfo}{\code{signature(object = "mzRramp")}: ... }
139
-    \item{ionisation}{\code{signature(object = "mzRramp")}: ... }
140
-    \item{isInitialized}{\code{signature(object = "mzRramp")}: ... }
141
-    \item{length}{\code{signature(x = "mzRramp")}: ... }
142
-    \item{manufacturer}{\code{signature(object = "mzRramp")}: ... }
143
-    \item{model}{\code{signature(object = "mzRramp")}: ... }
144
-    \item{runInfo}{\code{signature(object = "mzRramp")}: ... }
145
-
146
-  }
147 116
   Methods currently implemented for \code{mzRpwiz}
148 117
   \describe{
149 118
     \item{analyzer}{\code{signature(object = "mzRpwiz")}: ... }
... ...
@@ -174,7 +143,6 @@
174 143
 }
175 144
 
176 145
 \references{
177
-  RAMP: http://tools.proteomecenter.org/wiki/index.php?title=Software:RAMP
178 146
   Proteowizard: http://proteowizard.sourceforge.net/
179 147
 }
180 148
 
... ...
@@ -1,6 +1,5 @@
1 1
 \name{openMSfile}
2 2
 \alias{openMSfile}
3
-\alias{initializeRamp}
4 3
 \alias{isInitialized}
5 4
 \alias{fileName}
6 5
 \alias{openIDfile}
... ...
@@ -11,8 +10,6 @@
11 10
 \usage{
12 11
  openMSfile(filename, backend = NULL, verbose = FALSE)
13 12
 
14
- initializeRamp(object)
15
-
16 13
  isInitialized(object)
17 14
 
18 15
  fileName(object, ...)
... ...
@@ -26,7 +23,7 @@
26 23
   }
27 24
   \item{backend}{
28 25
     A \code{character(1)} specifiying which backend API to
29
-    use. Currently 'Ramp', 'netCDF'  and 'pwiz' are supported. If
26
+    use. Currently 'netCDF'  and 'pwiz' are supported. If
30 27
     \code{backend = NULL} (the default), the function tries to determine
31 28
     the backend to be used based on either the file extension of the
32 29
     file content.
... ...
@@ -39,7 +36,7 @@
39 36
 \description{
40 37
   The \code{openMSfile} constructor will create a new format-specifc
41 38
   \code{mzR} object, open 'filename' file and all header information is
42
-  loaded as a Rcpp module and made accessible through the \code{ramp} or \code{pwiz}
39
+  loaded as a Rcpp module and made accessible through the \code{pwiz}
43 40
   slot of the resulting object.
44 41
   
45 42
   The \code{openIDfile} constructor will create a new format-specifc
... ...
@@ -47,11 +44,6 @@
47 44
   loaded as a Rcpp module. The mzid format is supported throught
48 45
   \code{pwiz} backend. Only mzIdentML 1.1 is supported.
49 46
 
50
-  % If the object was created manually with e.g. new("mzR"), then
51
-  % initializeRamp() will open the given file. An mzR object can be
52
-  % queried, whether it is assigned to a raw file with isInitialized(),
53
-  % and finally fileName(object) will return the path to the file "behind"
54
-  % the mzR object.
55 47
 }
56 48
 
57 49
 \author{
... ...
@@ -5,33 +5,23 @@
5 5
 \alias{peaksCount}
6 6
 \alias{get3Dmap}
7 7
 
8
-\alias{header,mzRramp,missing-method}
9
-\alias{header,mzRramp,numeric-method}
10 8
 \alias{header,mzRpwiz,missing-method}
11 9
 \alias{header,mzRpwiz,numeric-method}
12 10
 \alias{header,mzRnetCDF,missing-method}
13 11
 \alias{header,mzRnetCDF,numeric-method}
14 12
 
15
-\alias{peaksCount,mzRramp,missing-method}
16
-\alias{peaksCount,mzRramp,numeric-method}
17 13
 \alias{peaksCount,mzRpwiz,missing-method}
18 14
 \alias{peaksCount,mzRpwiz,numeric-method}
19
-\alias{peaks,mzRramp-method}
20
-\alias{spectra,mzRramp-method}
21 15
 \alias{peaks,mzRpwiz-method}
22 16
 \alias{spectra,mzRpwiz-method}
23 17
 \alias{peaks,mzRnetCDF-method}
24 18
 \alias{spectra,mzRnetCDF-method}
25 19
 
26
-\alias{get3Dmap,mzRramp-method}
27 20
 \alias{get3Dmap,mzRpwiz-method}
28 21
 
29 22
 \alias{chromatogram,mzRpwiz-method}
30 23
 \alias{chromatogramHeader,mzRpwiz-method}
31 24
 \alias{chromatograms,mzRpwiz-method}
32
-\alias{chromatogram,mzRramp-method}
33
-\alias{chromatogramHeader,mzRramp-method}
34
-\alias{chromatograms,mzRramp-method}
35 25
 \alias{chromatogram,mzRnetCDF-method}
36 26
 \alias{chromatogramHeader,mzRnetCDF-method}
37 27
 \alias{chromatograms,mzRnetCDF-method}
... ...
@@ -54,11 +44,9 @@
54 44
  peaksCount(object, scans, ...)
55 45
 
56 46
  \S4method{peaks}{mzRpwiz}(object, scans)
57
- \S4method{peaks}{mzRramp}(object, scans)
58 47
  \S4method{peaks}{mzRnetCDF}(object, scans)
59 48
 
60 49
  \S4method{spectra}{mzRpwiz}(object, scans)   ## same as peaks
61
- \S4method{spectra}{mzRramp}(object, scans)
62 50
  \S4method{spectra}{mzRnetCDF}(object, scans)
63 51
 
64 52
  get3Dmap(object, scans, lowMz, highMz, resMz, ...)
... ...
@@ -65,14 +65,12 @@ PWIZOBJECTS=\
65 65
 ./pwiz/data/msdata/IO.o \
66 66
 ./pwiz/data/msdata/SpectrumList_BTDX.o \
67 67
 ./pwiz/data/msdata/SpectrumInfo.o \
68
-./pwiz/data/msdata/RAMPAdapter.o \
69 68
 ./pwiz/data/msdata/LegacyAdapter.o \
70 69
 ./pwiz/data/msdata/SpectrumIterator.o \
71 70
 ./pwiz/data/msdata/MSDataFile.o \
72 71
 ./pwiz/data/msdata/MSNumpress.o \
73 72
 ./pwiz/data/msdata/SpectrumListCache.o \
74 73
 ./pwiz/data/msdata/Index_mzML.o \
75
-./pwiz/data/msdata/ramp/wglob.o \
76 74
 ./pwiz/data/identdata/IdentDataFile.o \
77 75
 ./pwiz/data/identdata/IdentData.o \
78 76
 ./pwiz/data/identdata/DefaultReaderList.o \
... ...
@@ -100,9 +98,7 @@ PWIZOBJECTS=\
100 98
 ./pwiz/utility/misc/SHA1.o \
101 99
 ./pwiz/utility/misc/SHA1Calculator.o \
102 100
 ./pwiz/utility/minimxml/XMLWriter.o \
103
-./pwiz/utility/minimxml/SAXParser.o \
104
-./random_access_gzFile.o \
105
-adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
101
+./pwiz/utility/minimxml/SAXParser.o
106 102
 
107 103
 
108 104
 all: libpwiz.a
... ...
@@ -62,7 +62,6 @@ PWIZOBJECTS=\
62 62
 ./pwiz/data/msdata/IO.o \
63 63
 ./pwiz/data/msdata/SpectrumList_BTDX.o \
64 64
 ./pwiz/data/msdata/SpectrumInfo.o \
65
-./pwiz/data/msdata/RAMPAdapter.o \
66 65
 ./pwiz/data/msdata/LegacyAdapter.o \
67 66
 ./pwiz/data/msdata/SpectrumIterator.o \
68 67
 ./pwiz/data/msdata/MSDataFile.o \
... ...
@@ -99,7 +98,6 @@ PWIZOBJECTS=\
99 98
 ./pwiz/utility/misc/SHA1.o \
100 99
 ./pwiz/utility/misc/SHA1Calculator.o \
101 100
 ./pwiz/utility/misc/sha1calc.o \
102
-./random_access_gzFile.o \
103 101
 ./RcppExports.o
104 102
 
105 103
 
... ...
@@ -110,7 +108,6 @@ ARCH_OBJS=./boost/libs/filesystem/src/path_traits.o \
110 108
 ./boost/libs/thread/src/win32/tss_pe.o \
111 109
 ./boost/libs/thread/src/win32/tss_dll.o \
112 110
 ./boost/libs/thread/src/win32/thread.o \
113
-./pwiz/data/msdata/ramp/wglob.o \
114 111
 ./boost_aux/boost/nowide/iostream.o
115 112
 ARCH_CPPFLAGS=-fpermissive -DWINDOWS_NATIVE -DWIN32 -DBOOST_HAS_WINTHREADS -DBOOST_THREAD_BUILD_LIB
116 113
 ARCH_LIBS=-lws2_32 -lz
... ...
@@ -121,9 +118,9 @@ ARCH_OBJS=./boost/libs/thread/src/pthread/once.o \
121 118
 RHDF5_LIBS=$(shell echo 'Rhdf5lib::pkgconfig("PKG_CXX_LIBS")'| "${R_HOME}/bin/R" --vanilla --slave)
122 119
 endif
123 120
 
124
-MZROBJECTS=cramp.o ramp_base64.o ramp.o RcppRamp.o RcppRampModule.o RcppPwiz.o RcppPwizModule.o RcppIdent.o RcppIdentModule.o
121
+MZROBJECTS= RcppPwiz.o RcppPwizModule.o RcppIdent.o RcppIdentModule.o
125 122
 
126
-OBJECTS= $(MZROBJECTS) $(PWIZOBJECTS) $(ARCH_OBJS) rampR.o 
123
+OBJECTS= $(MZROBJECTS) $(PWIZOBJECTS) $(ARCH_OBJS)
127 124
 
128 125
 ## Generate dependency files
129 126
 #DEPFLAGS = -MT $@ -MMD -MP 
... ...
@@ -8,7 +8,7 @@
8 8
 #undef Free
9 9
 #endif
10 10
 
11
-#include "pwiz/data/msdata/RAMPAdapter.hpp"
11
+// #include "pwiz/data/msdata/RAMPAdapter.hpp"
12 12
 #include "pwiz/data/msdata/MSDataFile.hpp"
13 13
 #include "pwiz/data/msdata/MSData.hpp"
14 14
 #include "pwiz/data/msdata/LegacyAdapter.hpp"
15 15
deleted file mode 100644
... ...
@@ -1,440 +0,0 @@
1
-#include "RcppRamp.h"
2
-
3
-RcppRamp::RcppRamp()
4
-{
5
-    ramp = NULL;
6
-    runInfo = Rcpp::List::create( );
7
-    isInCacheRunInfo = FALSE;
8
-    instrumentInfo = Rcpp::List::create( );
9
-    isInCacheInstrumentInfo = FALSE;
10
-    allScanHeaderInfo = Rcpp::DataFrame::create( );
11
-    isInCacheAllScanHeaderInfo = FALSE;
12
-    filename = Rcpp::StringVector::create( );
13
-}
14
-
15
-RcppRamp::~RcppRamp()
16
-{
17
-    RcppRamp::close();
18
-}
19
-
20
-void RcppRamp::open( const char* fileName, bool declaredScansOnly )
21
-{
22
-    RcppRamp::close();
23
-    ramp = new cRamp(fileName, declaredScansOnly);
24
-    if (ramp->OK())
25
-    {
26
-        filename = Rcpp::StringVector::create( fileName );
27
-    }
28
-    else
29
-    {
30
-        RcppRamp::close();
31
-        Rprintf("Failed to open file.\n ");
32
-    }
33
-}
34
-
35
-void RcppRamp::close()
36
-{
37
-    if (ramp != NULL)
38
-    {
39
-        delete ramp;
40
-        ramp = NULL;
41
-        runInfo = Rcpp::List::create( );
42
-        isInCacheRunInfo = FALSE;
43
-        instrumentInfo = Rcpp::List::create( );
44
-        isInCacheInstrumentInfo = FALSE;
45
-        allScanHeaderInfo = Rcpp::List::create( );
46
-        isInCacheAllScanHeaderInfo = FALSE;
47
-        filename = Rcpp::StringVector::create( );
48
-    }
49
-}
50
-
51
-
52
-Rcpp::StringVector RcppRamp::getFilename (  )
53
-{
54
-    if (ramp != NULL)
55
-    {
56
-        return filename;
57
-    }
58
-    Rf_warningcall(R_NilValue, "Ramp not yet initialized.");
59
-    return filename;
60
-}
61
-
62
-Rcpp::List RcppRamp::getRunInfo (  )
63
-{
64
-    if (ramp != NULL)
65
-    {
66
-        if (!isInCacheRunInfo)
67
-        {
68
-            // Rprintf("Read from disk.\n ");
69
-            rampRunInfo *info = ramp->getRunInfo();
70
-            RunHeaderStruct data = info->m_data;
71
-            delete info;
72
-            runInfo = Rcpp::List::create(
73
-                          Rcpp::_["scanCount"]  = data.scanCount,
74
-                          Rcpp::_["lowMZ"]      = data.lowMZ,
75
-                          Rcpp::_["highMZ"]     = data.highMZ,
76
-                          Rcpp::_["startMZ"]    = data.startMZ,
77
-                          Rcpp::_["endMZ"]      = data.endMZ,
78
-                          Rcpp::_["dStartTime"] = data.dStartTime,
79
-                          Rcpp::_["dEndTime"]   = data.dEndTime
80
-                      );
81
-            isInCacheRunInfo = TRUE;
82
-        }
83
-        else
84
-        {
85
-            // Rprintf("Read from cache.\n ");
86
-        }
87
-        return runInfo;
88
-    }
89
-    Rf_warningcall(R_NilValue, "Ramp not yet initialized.");
90
-    return runInfo;
91
-}
92
-
93
-Rcpp::List RcppRamp::getInstrumentInfo ( )
94
-{
95
-    if (ramp != NULL)
96
-    {
97
-        if (!isInCacheInstrumentInfo)
98
-        {
99
-            // Rprintf("Read from disk.\n ");
100
-            rampInstrumentInfo *info = ramp->getInstrumentInfo(); // NULL for mzData
101
-
102
-            if (info != NULL)
103
-            {
104
-                InstrumentStruct * data = info->m_instrumentStructPtr;
105
-
106
-                instrumentInfo = Rcpp::List::create(
107
-                                     Rcpp::_["manufacturer"]  = std::string(data->manufacturer),
108
-                                     Rcpp::_["model"]         = std::string(data->model),
109
-                                     Rcpp::_["ionisation"]    = std::string(data->ionisation),
110
-                                     Rcpp::_["analyzer"]      = std::string(data->analyzer),
111
-                                     Rcpp::_["detector"]      = std::string(data->detector)
112
-                                 ) ;
113
-                delete info;
114
-            }
115
-            else
116
-            {
117
-                instrumentInfo = Rcpp::List::create(
118
-                                     Rcpp::_["manufacturer"]  = "",
119
-                                     Rcpp::_["model"]         = "",
120
-                                     Rcpp::_["ionisation"]    = "",
121
-                                     Rcpp::_["analyzer"]      = "",
122
-                                     Rcpp::_["detector"]      = ""
123
-                                 ) ;
124
-            }
125
-            isInCacheInstrumentInfo = TRUE;
126
-        }
127
-        else
128
-        {
129
-            // Rprintf("Read from cache.\n ");
130
-        }
131
-        return(instrumentInfo);
132
-    }
133
-    Rf_warningcall(R_NilValue, "Ramp not yet initialized.");
134
-    return instrumentInfo;
135
-}
136
-
137
-Rcpp::List RcppRamp::getScanHeaderInfo ( int whichScan  )
138
-{
139
-    if (ramp != NULL)
140
-    {
141
-        if ((whichScan <= 0) || (whichScan > ramp->getLastScan()))
142
-        {
143
-            Rprintf("Index whichScan out of bounds [1 ... %d].\n", ramp->getLastScan());
144
-            return Rcpp::List::create( );
145
-        }
146
-        rampScanInfo *info = ramp->getScanHeaderInfo( whichScan );
147
-        ScanHeaderStruct data = info->m_data;
148
-        delete info;
149
-
150
-        std::vector<std::string> names;
151
-        Rcpp::List header(22);
152
-        int i = 0;
153
-
154
-        names.push_back("seqNum");
155
-        header[i++] = Rcpp::wrap(data.seqNum);
156
-        names.push_back("acquisitionNum");
157
-        header[i++] = Rcpp::wrap(data.acquisitionNum);
158
-        names.push_back("msLevel");
159
-        header[i++] = Rcpp::wrap(data.msLevel);
160
-        names.push_back("polarity");
161
-        header[i++] = Rcpp::wrap(data.polarity);
162
-        names.push_back("peaksCount");
163
-        header[i++] = Rcpp::wrap(data.peaksCount);
164
-        names.push_back("totIonCurrent");
165
-        header[i++] = Rcpp::wrap(data.totIonCurrent);
166
-        names.push_back("retentionTime");
167
-        header[i++] = Rcpp::wrap(data.retentionTime);
168
-        names.push_back("basePeakMZ");
169
-        header[i++] = Rcpp::wrap(data.basePeakMZ);
170
-        names.push_back("basePeakIntensity");
171
-        header[i++] = Rcpp::wrap(data.basePeakIntensity);
172
-        names.push_back("collisionEnergy");
173
-        header[i++] = Rcpp::wrap(data.collisionEnergy);
174
-        names.push_back("ionisationEnergy");
175
-        header[i++] = Rcpp::wrap(data.ionisationEnergy);
176
-        names.push_back("lowMZ");
177
-        header[i++] = Rcpp::wrap(data.lowMZ);
178
-        names.push_back("highMZ");
179
-        header[i++] = Rcpp::wrap(data.highMZ);
180
-        names.push_back("precursorScanNum");
181
-        header[i++] = Rcpp::wrap(data.precursorScanNum);
182
-        names.push_back("precursorMZ");
183
-        header[i++] = Rcpp::wrap(data.precursorMZ);
184
-        names.push_back("precursorCharge");
185
-        header[i++] = Rcpp::wrap(data.precursorCharge);
186
-        names.push_back("precursorIntensity");
187
-        header[i++] = Rcpp::wrap(data.precursorIntensity);
188
-        names.push_back("mergedScan");
189
-        header[i++] = Rcpp::wrap(data.mergedScan);
190
-        names.push_back("mergedResultScanNum");
191
-        header[i++] = Rcpp::wrap(data.mergedResultScanNum);
192
-        names.push_back("mergedResultStartScanNum");
193
-        header[i++] = Rcpp::wrap(data.mergedResultStartScanNum);
194
-        names.push_back("mergedResultEndScanNum");
195
-        header[i++] = Rcpp::wrap(data.mergedResultEndScanNum);
196
-        names.push_back("injectionTime");
197
-        header[i++] = 0;
198
-
199
-        header.attr("names") = names;
200
-
201
-        return  header;
202
-    }
203
-    Rf_warningcall(R_NilValue, "Ramp not yet initialized.");
204
-    return Rcpp::List::create( );
205
-}
206
-
207
-Rcpp::DataFrame RcppRamp::getAllScanHeaderInfo ( )
208
-{
209
-    if (ramp != NULL)
210
-    {
211
-        if (!isInCacheAllScanHeaderInfo)
212
-        {
213
-            // Rprintf("Read from disk.\n ");
214
-            int N = ramp->getLastScan();
215
-            rampScanInfo *info = ramp->getScanHeaderInfo( 1 );
216
-            ScanHeaderStruct scanHeader;
217
-            Rcpp::IntegerVector seqNum(N); // number in sequence observed file (1-based)
218
-            Rcpp::IntegerVector acquisitionNum(N); // scan number as declared in File (may be gaps)
219
-            Rcpp::IntegerVector  msLevel(N);
220
-            Rcpp::IntegerVector  polarity(N);
221
-            Rcpp::IntegerVector  peaksCount(N);
222
-            Rcpp::NumericVector totIonCurrent(N);
223
-            Rcpp::NumericVector retentionTime(N);        /* in seconds */
224
-            Rcpp::NumericVector basePeakMZ(N);
225
-            Rcpp::NumericVector basePeakIntensity(N);
226
-            Rcpp::NumericVector collisionEnergy(N);
227
-            Rcpp::NumericVector ionisationEnergy(N);
228
-            Rcpp::NumericVector lowMZ(N);
229
-            Rcpp::NumericVector highMZ(N);
230
-            Rcpp::IntegerVector precursorScanNum(N); /* only if MS level > 1 */
231
-            Rcpp::NumericVector precursorMZ(N);  /* only if MS level > 1 */
232
-            Rcpp::IntegerVector precursorCharge(N);  /* only if MS level > 1 */
233
-            Rcpp::NumericVector precursorIntensity(N);  /* only if MS level > 1 */
234
-            Rcpp::IntegerVector mergedScan(N);  /* only if MS level > 1 */
235
-            Rcpp::IntegerVector mergedResultScanNum(N); /* scan number of the resultant merged scan */
236
-            Rcpp::IntegerVector mergedResultStartScanNum(N); /* smallest scan number of the scanOrigin for merged scan */
237
-            Rcpp::IntegerVector mergedResultEndScanNum(N); /* largest scan number of the scanOrigin for merged scan */
238
-
239
-            for (int whichScan=1; whichScan <= N; whichScan++)
240
-            {
241
-                readHeader(ramp->m_handle, ramp->m_scanOffsets[whichScan], &scanHeader);
242
-                seqNum[whichScan-1] = scanHeader.seqNum;
243
-                acquisitionNum[whichScan-1] = scanHeader.acquisitionNum;
244
-                msLevel[whichScan-1] = scanHeader.msLevel;
245
-                polarity[whichScan-1] = scanHeader.polarity;
246
-                peaksCount[whichScan-1] = scanHeader.peaksCount;
247
-                totIonCurrent[whichScan-1] = scanHeader.totIonCurrent;
248
-                retentionTime[whichScan-1] = scanHeader.retentionTime;
249
-                basePeakMZ[whichScan-1] = scanHeader.basePeakMZ;
250
-                basePeakIntensity[whichScan-1] = scanHeader.basePeakIntensity;
251
-                collisionEnergy[whichScan-1] = scanHeader.collisionEnergy;
252
-                ionisationEnergy[whichScan-1] = scanHeader.ionisationEnergy;
253
-                lowMZ[whichScan-1] = scanHeader.lowMZ;
254
-                highMZ[whichScan-1] = scanHeader.highMZ;
255
-                precursorScanNum[whichScan-1] = scanHeader.precursorScanNum;
256
-                precursorMZ[whichScan-1] = scanHeader.precursorMZ;
257
-                precursorCharge[whichScan-1] = scanHeader.precursorCharge;
258
-                precursorIntensity[whichScan-1] = scanHeader.precursorIntensity;
259
-                mergedScan[whichScan-1] = scanHeader.mergedScan;
260
-                mergedResultScanNum[whichScan-1] = scanHeader.mergedResultScanNum;
261
-                mergedResultStartScanNum[whichScan-1] = scanHeader.mergedResultStartScanNum;
262
-                mergedResultEndScanNum[whichScan-1] = scanHeader.mergedResultEndScanNum;
263
-            }
264
-
265
-            Rcpp::List header(22);
266
-            std::vector<std::string> names;
267
-            int i = 0;
268
-
269
-            names.push_back("seqNum");
270
-            header[i++] =Rcpp::wrap(seqNum);
271
-            names.push_back("acquisitionNum");
272
-            header[i++] =Rcpp::wrap( acquisitionNum);
273
-            names.push_back("msLevel");
274
-            header[i++] =Rcpp::wrap(msLevel);
275
-            names.push_back("polarity");
276
-            header[i++] =Rcpp::wrap(polarity);
277
-            names.push_back("peaksCount");
278
-            header[i++] =Rcpp::wrap(peaksCount);
279
-            names.push_back("totIonCurrent");
280
-            header[i++] =Rcpp::wrap(totIonCurrent);
281
-            names.push_back("retentionTime");
282
-            header[i++] =Rcpp::wrap(retentionTime);
283
-            names.push_back("basePeakMZ");
284
-            header[i++] =Rcpp::wrap(basePeakMZ);
285
-            names.push_back("basePeakIntensity");
286
-            header[i++] =Rcpp::wrap(basePeakIntensity);
287
-            names.push_back("collisionEnergy");
288
-            header[i++] =Rcpp::wrap(collisionEnergy);
289
-            names.push_back("ionisationEnergy");
290
-            header[i++] =Rcpp::wrap(ionisationEnergy);
291
-            names.push_back("lowMZ");
292
-            header[i++] =Rcpp::wrap(lowMZ);
293
-            names.push_back("highMZ");
294
-            header[i++] =Rcpp::wrap(highMZ);
295
-            names.push_back("precursorScanNum");
296
-            header[i++] =Rcpp::wrap(precursorScanNum);
297
-            names.push_back("precursorMZ");
298
-            header[i++] =Rcpp::wrap(precursorMZ);
299
-            names.push_back("precursorCharge");
300
-            header[i++] =Rcpp::wrap(precursorCharge);
301
-            names.push_back("precursorIntensity");
302
-            header[i++] =Rcpp::wrap(precursorIntensity);
303
-            names.push_back("mergedScan");
304
-            header[i++] =Rcpp::wrap(mergedScan);
305
-            names.push_back("mergedResultScanNum");
306
-            header[i++] =Rcpp::wrap(mergedResultScanNum);
307
-            names.push_back("mergedResultStartScanNum");
308
-            header[i++] =Rcpp::wrap(mergedResultStartScanNum);
309
-            names.push_back("mergedResultEndScanNum");
310
-            header[i++] =Rcpp::wrap(mergedResultEndScanNum);
311
-            names.push_back("injectionTime");
312
-            header[i++] = 0;
313
-            
314
-			header.attr("names") = names;
315
-			
316
-            allScanHeaderInfo = header;
317
-            isInCacheAllScanHeaderInfo = TRUE;
318
-        }
319
-        else
320
-        {
321
-            // Rprintf("Read from cache.\n ");
322
-        }
323
-        return(allScanHeaderInfo);
324
-    }
325
-    Rf_warningcall(R_NilValue, "Ramp not yet initialized.");
326
-    return Rcpp::DataFrame::create( );
327
-}
328
-
329
-Rcpp::List RcppRamp::getPeakList ( int whichScan )
330
-{
331
-    if (ramp != NULL)
332
-    {
333
-        if ((whichScan <= 0) || (whichScan > ramp->getLastScan()))
334
-        {
335
-            Rprintf("Index whichScan out of bounds [1 ... %d].\n", ramp->getLastScan());
336
-            return Rcpp::List::create( );
337
-        }
338
-        rampPeakList *pl = ramp->getPeakList( whichScan );
339
-        int peaksCount = 0;
340
-        if (pl != NULL)
341
-        {
342
-            peaksCount = pl->getPeakCount();
343
-        }
344
-        Rcpp::NumericMatrix peaks(peaksCount, 2);
345
-        if (pl != NULL)
346
-        {
347
-            rampPeakInfoStruct *peak;
348
-            peak = pl->getPeak(0);
349
-            peaks(0,0) = peak->mz;
350
-            peaks(0,1) = peak->intensity;
351
-            for (int i=1; i < peaksCount; i++)
352
-            {
353
-                peak++;
354
-                peaks(i,0) = peak->mz;
355
-                peaks(i,1) = peak->intensity;
356
-            }
357
-            delete pl;
358
-        }
359
-        return Rcpp::List::create(
360
-                   Rcpp::_["peaksCount"]  = peaksCount,
361
-                   Rcpp::_["peaks"]  = peaks
362
-               ) ;
363
-    }
364
-    Rf_warningcall(R_NilValue, "Ramp not yet initialized.");
365
-    return Rcpp::List::create( );
366
-}
367
-
368
-Rcpp::NumericMatrix RcppRamp::get3DMap ( std::vector<int> scanNumbers, double whichMzLow, double whichMzHigh, double resMz )
369
-{
370
-    if (ramp != NULL)
371
-    {
372
-        double f = 1 / resMz;
373
-        int low = round(whichMzLow * f);
374
-        int high = round(whichMzHigh * f);
375
-        int dmz = high - low + 1;
376
-        int drt = scanNumbers.size();
377
-        Rcpp::NumericMatrix map3d(drt, dmz);
378
-        for (int i = 0; i < drt; i++)
379
-        {
380
-            for (int j = 0; j < dmz; j++)
381
-            {
382
-                map3d(i,j) = 0.0;
383
-            }
384
-        }
385
-        // map3d = 0.0;
386
-        int j=0;
387
-        //Rprintf("%d\n",1);
388
-        for (int i = 0; i < scanNumbers.size(); i++)
389
-        {
390
-            rampPeakList *pl = ramp->getPeakList( scanNumbers[i] );
391
-            int peaksCount = pl->getPeakCount();
392
-            rampPeakInfoStruct *peak;
393
-            peak = pl->getPeak(0);
394
-            j = round(peak->mz * f) - low;
395
-            if ((j >= 0) & (j < dmz))
396
-            {
397
-                if (peak->intensity > map3d(i,j))
398
-                {
399
-                    map3d(i,j) = peak->intensity;
400
-                }
401
-            }
402
-            for (int k=1; k < peaksCount; k++)
403
-            {
404
-                peak++;
405
-                j = round(peak->mz * f) - low;
406
-                if ((j >= 0) & (j < dmz))
407
-                {
408
-                    if (peak->intensity > map3d(i,j))
409
-                    {
410
-                        map3d(i,j) = peak->intensity;
411
-                    }
412
-                }
413
-            }
414
-            delete pl;
415
-        }
416
-        return(map3d);
417
-    }
418
-    Rf_warningcall(R_NilValue, "Ramp not yet initialized.");
419
-    return Rcpp::NumericMatrix(0,0);
420
-}
421
-
422
-int RcppRamp::getLastScan() const
423
-{
424
-    if (ramp != NULL)
425
-    {
426
-        return ramp->getLastScan();
427
-    }
428
-    Rf_warningcall(R_NilValue, "Ramp not yet initialized.");
429
-    return -1;
430
-}
431
-
432
-bool RcppRamp::OK (  )
433
-{
434
-    if (ramp != NULL)
435
-    {
436
-        return ramp->OK();
437
-    }
438
-    // Rprintf("Warning: Ramp not yet initialized.\n ");
439
-    return false;
440
-}
441 0
deleted file mode 100644
... ...
@@ -1,122 +0,0 @@
1
-#ifndef _mzR_RCPP_RAMP_H
2
-#define _mzR_RCPP_RAMP_H
3
-
4
-#include "Rcpp.h"
5
-// Taken from http://tolstoy.newcastle.edu.au/R/e2/devel/06/11/1242.html
6
-// and http://stackoverflow.com/questions/11588765/using-rcpp-with-windows-specific-includes
7
-// Undefine the Realloc macro, which is defined by both R and by Windows stuff
8
-// Also need to undefine the Free macro
9
-#if defined(__MINGW32__)
10
-#undef Realloc
11
-#undef Free
12
-#endif
13
-
14
-#include "cramp.h"
15
-
16
-#if defined(__MINGW32__)
17
-#include <windows.h>
18
-#endif
19
-
20
-class RcppRamp
21
-{
22
-
23
-private:
24
-    cRamp *ramp;
25
-    Rcpp::List runInfo;
26
-    bool isInCacheRunInfo;
27
-    Rcpp::List instrumentInfo;
28
-    bool isInCacheInstrumentInfo;
29
-    Rcpp::DataFrame allScanHeaderInfo;
30
-    bool isInCacheAllScanHeaderInfo;
31
-    Rcpp::StringVector filename;
32
-
33
-public:
34
-    RcppRamp();          // Constructor
35
-    virtual ~RcppRamp(); // Destructor
36
-
37
-    /**
38
-     * Opens a mass spec file (mzXML, mzData, etc.) and creates a cRamp object.
39
-     * @param fileName: Name of the msxml file
40
-     * @param declaredScansOnly: suppress RAMP's behavior of creating sparse
41
-     *        tables to accomodate unlisted scans
42
-     */
43
-    void open( const char* fileName, bool declaredScansOnly=false );
44
-
45
-    /**
46
-     * Closes the mzXML file. Releases the memory of the cRamp object.
47
-     * This function allows memory management from R site.
48
-     */
49
-    void close();
50
-
51
-    /**
52
-     * Returns the filename.
53
-     * @return the filename
54
-     */
55
-    Rcpp::StringVector getFilename (  );
56
-
57
-    /**
58
-     * Reads the run information from the mzXML header.
59
-     * @return rampRunInfo* is parsed to a Rcpp::List
60
-     */
61
-    Rcpp::List getRunInfo (  );
62
-
63
-    /**
64
-     * Reads the instrument information from the mzXML header.
65
-     * @return rampInstrumentInfo* is parsed to a Rcpp::List
66
-     */
67
-    Rcpp::List getInstrumentInfo();
68
-
69
-    /**
70
-     * Reads the scan header info. It reads for one mass spectrum the
71
-     * header information, like ms level, retention time, ion current, ... .
72
-     * @return rampScanInfo* is parsed to a Rcpp::List
73
-     */
74
-    Rcpp::List getScanHeaderInfo ( int whichScan  );
75
-
76
-    /**
77
-     * Reads the scan header info. It reads for all mass spectra the header
78
-     * information, like ms level, retention time, ion current, ... .
79
-     * @return rampScanInfo* is parsed to a Rcpp::List
80
-     */
81
-    Rcpp::DataFrame getAllScanHeaderInfo ( );
82
-
83
-    /**
84
-     * This function performs a non-sequential parsing operation on an indexed
85
-     * mzXML file to obtain the peak list (i.e. the mass spectrum) for a numbered scan.
86
-     * @param whichScan: Number of the scan we want to read from
87
-     * @return rampPeakList* is parsed to a Rcpp::List. The first list element
88
-     *         contains the number of peaks, the second contains a n x 2 matrix
89
-     *         with the peak list.
90
-     */
91
-    Rcpp::List getPeakList ( int whichScan );
92
-
93
-    /**
94
-     * This function reads all scans and returns them as a matrix. The number of
95
-     * rows is equal to the given number of scan numbers. The columns represent
96
-     * equidistant m/z values. mzXML file to obtain the peak list (i.e. the mass spectrum)
97
-     * for a numbered scan.
98
-     * @param whichScan: The scan numbers we want to read from.
99
-     * @param whichMzLow: The lowest m/z value to be returned.
100
-     * @param whichMzHigh: The highest m/z value to be returned.
101
-     * @param resMz: The resolution in m/z direction.
102
-     * @return The matrix is given back as a Rcpp::NumericMatrix.
103
-     */
104
-    Rcpp::NumericMatrix
105
-    get3DMap ( std::vector<int> scanNumbers,
106
-               double whichMzLow,
107
-               double whichMzHigh,
108
-               double resMz );
109
-
110
-    /**
111
-     * Getting for the last scan number (not necessarily the number of scans
112
-     * because of missing scans).
113
-     */
114
-    int getLastScan() const;
115
-
116
-    /**
117
-     * checks the status of the object.
118
-     */
119
-    bool OK();
120
-};
121
-
122
-#endif
123 0
deleted file mode 100644
... ...
@@ -1,25 +0,0 @@
1
-#include <Rcpp.h>
2
-#include "RcppRamp.h"
3
-
4
-
5
-RCPP_MODULE(Ramp)
6
-{
7
-    using namespace Rcpp;
8
-
9
-    class_<RcppRamp>( "Ramp" )
10
-    .constructor("Initialises a new Rccp Ramp object.")
11
-    .method( "open", &RcppRamp::open, "Opens a mass spec file (mzXML, mzData, etc.) and creates a cRamp object" )
12
-    .method( "close", &RcppRamp::close, "Closes the mzXML file. Releases the memory of the cRamp object." )
13
-    .method( "getFilename", &RcppRamp::getFilename, "Returns the mass spec filename.")
14
-    .method( "getRunInfo", &RcppRamp::getRunInfo, "Reads the run information from the mzXML header." )
15
-    .method( "getInstrumentInfo", &RcppRamp::getInstrumentInfo, "Reads the instrument information from the mzXML header." )
16
-    .method( "getScanHeaderInfo", &RcppRamp::getScanHeaderInfo, "Reads the header info for one mass spectrum." )
17
-    .method( "getAllScanHeaderInfo", &RcppRamp::getAllScanHeaderInfo, "Reads the head