Browse code

Merge pull request #240 from jorainer/master

Ensure header for CDF backend returns columns with correct data type

Steffen Neumann authored on 08/02/2021 13:27:25 • GitHub committed on 08/02/2021 13:27:25
Showing3 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.25.2
5
+Version: 2.25.3
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>,
... ...
@@ -1,3 +1,7 @@
1
+CHANGES IN VERSION 2.25.3
2
+-------------------------
3
+ o Ensure `header` for CDF returns columns with correct data type.
4
+
1 5
 CHANGES IN VERSION 2.25.2
2 6
 -------------------------
3 7
  o Fix issue #238: ensure `header` call returns the same columns for all
... ...
@@ -54,13 +54,14 @@ setMethod("header",
54 54
 setMethod("header", c("mzRnetCDF", "numeric"), function(object, scans) {
55 55
     ls <- length(scans)
56 56
     empty_val <- rep(-1, ls)
57
+    empty_int <- rep(-1L, ls)
57 58
     na_real <- rep(NA_real_, ls)
58 59
     result <- data.frame(
59 60
         seqNum=scans,
60 61
         acquisitionNum=scans,
61 62
         msLevel = rep(1L, length(scans)),
62
-        polarity = -1L,
63
-        peaksCount=rep(1, length(scans)),
63
+        polarity = empty_int,
64
+        peaksCount=rep(1L, length(scans)),
64 65
         totIonCurrent=netCDFVarDouble(object@backend, "total_intensity")[scans],
65 66
         retentionTime=netCDFVarDouble(object@backend, "scan_acquisition_time")[scans],
66 67
         basePeakMZ = empty_val,
... ...
@@ -69,9 +70,9 @@ setMethod("header", c("mzRnetCDF", "numeric"), function(object, scans) {
69 70
         ionisationEnergy = empty_val,
70 71
         lowMZ = empty_val,
71 72
         highMZ = empty_val,
72
-        precursorScanNum = empty_val,
73
+        precursorScanNum = empty_int,
73 74
         precursorMZ = empty_val,
74
-        precursorCharge = empty_val,
75
+        precursorCharge = empty_int,
75 76
         precursorIntensity = empty_val,
76 77
         mergedScan = empty_val,
77 78
         mergedResultScanNum = empty_val,