Browse code

Merge pull request #267 from jorainer/master

fix: mzML export

Steffen Neumann authored on 25/04/2022 08:18:26 • GitHub committed on 25/04/2022 08:18:26
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.29.5
5
+Version: 2.29.6
6 6
 Author: Bernd Fischer, Steffen Neumann, Laurent Gatto, Qiang Kou, Johannes Rainer
7 7
 Authors@R: c(
8 8
     person("Steffen", "Neumann", email="sneumann@ipb-halle.de", role=c("aut","cre")),
... ...
@@ -1,3 +1,8 @@
1
+CHANGES IN VERSION 2.27.6
2
+-------------------------
3
+ o Only export certain spectra header parameters if their values are not NA.
4
+   Closes #266.
5
+
1 6
 CHANGES IN VERSION 2.27.5
2 7
 -------------------------
3 8
  o `peaks` method for pwiz backend sets colnames on returned matrices.
... ...
@@ -725,9 +725,9 @@ void RcppPwiz::addSpectrumList(MSData& msd,
725 725
     Spectrum& spct = *spectrumList->spectra[i];
726 726
     spct.set(MS_ms_level, msLevel[i]);
727 727
     // centroided
728
-    if (centroided[i] != NA_LOGICAL && centroided[i] == TRUE)
728
+    if (!Rcpp::LogicalVector::is_na(centroided[i]) && centroided[i] == TRUE)
729 729
       spct.set(MS_centroid_spectrum);
730
-    if (centroided[i] != NA_LOGICAL && centroided[i] == FALSE)
730
+    if (!Rcpp::LogicalVector::is_na(centroided[i]) && centroided[i] == FALSE)
731 731
       spct.set(MS_profile_spectrum);
732 732
     // [X] polarity
733 733
     if (polarity[i] == 0)
... ...
@@ -765,12 +765,13 @@ void RcppPwiz::addSpectrumList(MSData& msd,
765 765
     if (!Rcpp::StringVector::is_na(filterString[i]))
766 766
       spct_scan.set(MS_filter_string, filterString[i]);
767 767
 
768
-    if (ionMobilityDriftTime[i] != NA_REAL)
768
+    if (!Rcpp::NumericVector::is_na(ionMobilityDriftTime[i]))
769 769
       spct_scan.set(MS_ion_mobility_drift_time, ionMobilityDriftTime[i],
770 770
 		    UO_millisecond);
771 771
 
772 772
     // scanWindow
773
-    if (scanWindowLowerLimit[i] != NA_REAL && scanWindowUpperLimit[i] != NA_REAL) {
773
+    if (!Rcpp::NumericVector::is_na(scanWindowLowerLimit[i]) &&
774
+	!Rcpp::NumericVector::is_na(scanWindowUpperLimit[i])) {
774 775
       spct_scan.scanWindows.push_back(ScanWindow(scanWindowLowerLimit[i], scanWindowUpperLimit[i], MS_m_z));
775 776
     }
776 777
     // MSn - precursor:
... ...
@@ -804,7 +805,7 @@ void RcppPwiz::addSpectrumList(MSData& msd,
804 805
 	prec.spectrumID = spectrumId[precursor_idx];
805 806
       }
806 807
       // isolation window
807
-      if (isolationWindowTargetMZ[i] != NA_REAL) {
808
+      if (!Rcpp::NumericVector::is_na(isolationWindowTargetMZ[i])) {
808 809
 	prec.isolationWindow.set(MS_isolation_window_target_m_z, isolationWindowTargetMZ[i]);
809 810
 	prec.isolationWindow.set(MS_isolation_window_lower_offset, isolationWindowLowerOffset[i]);
810 811
 	prec.isolationWindow.set(MS_isolation_window_upper_offset, isolationWindowUpperOffset[i]);