Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: mzML export #267

Merged
merged 1 commit into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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