Skip to content

Commit

Permalink
Merge pull request #267 from jorainer/master
Browse files Browse the repository at this point in the history
fix: mzML export
  • Loading branch information
sneumann committed Apr 25, 2022
2 parents 88b1c19 + 3b091f3 commit 4745773
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Expand Up @@ -2,7 +2,7 @@ Package: mzR
Type: Package
Title: parser for netCDF, mzXML, mzData and mzML and mzIdentML files
(mass spectrometry data)
Version: 2.29.5
Version: 2.29.6
Author: Bernd Fischer, Steffen Neumann, Laurent Gatto, Qiang Kou, Johannes Rainer
Authors@R: c(
person("Steffen", "Neumann", email="sneumann@ipb-halle.de", role=c("aut","cre")),
Expand Down
5 changes: 5 additions & 0 deletions NEWS
@@ -1,3 +1,8 @@
CHANGES IN VERSION 2.27.6
-------------------------
o Only export certain spectra header parameters if their values are not NA.
Closes #266.

CHANGES IN VERSION 2.27.5
-------------------------
o `peaks` method for pwiz backend sets colnames on returned matrices.
Expand Down
11 changes: 6 additions & 5 deletions src/RcppPwiz.cpp
Expand Up @@ -725,9 +725,9 @@ void RcppPwiz::addSpectrumList(MSData& msd,
Spectrum& spct = *spectrumList->spectra[i];
spct.set(MS_ms_level, msLevel[i]);
// centroided
if (centroided[i] != NA_LOGICAL && centroided[i] == TRUE)
if (!Rcpp::LogicalVector::is_na(centroided[i]) && centroided[i] == TRUE)
spct.set(MS_centroid_spectrum);
if (centroided[i] != NA_LOGICAL && centroided[i] == FALSE)
if (!Rcpp::LogicalVector::is_na(centroided[i]) && centroided[i] == FALSE)
spct.set(MS_profile_spectrum);
// [X] polarity
if (polarity[i] == 0)
Expand Down Expand Up @@ -765,12 +765,13 @@ void RcppPwiz::addSpectrumList(MSData& msd,
if (!Rcpp::StringVector::is_na(filterString[i]))
spct_scan.set(MS_filter_string, filterString[i]);

if (ionMobilityDriftTime[i] != NA_REAL)
if (!Rcpp::NumericVector::is_na(ionMobilityDriftTime[i]))
spct_scan.set(MS_ion_mobility_drift_time, ionMobilityDriftTime[i],
UO_millisecond);

// scanWindow
if (scanWindowLowerLimit[i] != NA_REAL && scanWindowUpperLimit[i] != NA_REAL) {
if (!Rcpp::NumericVector::is_na(scanWindowLowerLimit[i]) &&
!Rcpp::NumericVector::is_na(scanWindowUpperLimit[i])) {
spct_scan.scanWindows.push_back(ScanWindow(scanWindowLowerLimit[i], scanWindowUpperLimit[i], MS_m_z));
}
// MSn - precursor:
Expand Down Expand Up @@ -804,7 +805,7 @@ void RcppPwiz::addSpectrumList(MSData& msd,
prec.spectrumID = spectrumId[precursor_idx];
}
// isolation window
if (isolationWindowTargetMZ[i] != NA_REAL) {
if (!Rcpp::NumericVector::is_na(isolationWindowTargetMZ[i])) {
prec.isolationWindow.set(MS_isolation_window_target_m_z, isolationWindowTargetMZ[i]);
prec.isolationWindow.set(MS_isolation_window_lower_offset, isolationWindowLowerOffset[i]);
prec.isolationWindow.set(MS_isolation_window_upper_offset, isolationWindowUpperOffset[i]);
Expand Down

0 comments on commit 4745773

Please sign in to comment.