Skip to content

Commit f048578

Browse files
committed
ignore more NaNs
1 parent bcb82e3 commit f048578

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/RcppPwiz.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -802,10 +802,19 @@ void RcppPwiz::addSpectrumList(MSData& msd,
802802
UO_electronvolt);
803803
}
804804
prec.selectedIons.resize(1);
805-
prec.selectedIons[0].set(MS_selected_ion_m_z, precursorMZ[i], MS_m_z);
806-
prec.selectedIons[0].set(MS_peak_intensity, precursorIntensity[i],
807-
MS_number_of_detector_counts);
808-
prec.selectedIons[0].set(MS_charge_state, precursorCharge[i]);
805+
// Only set values if they are not NaN
806+
if (!std::isnan(precursorMZ[i])) {
807+
prec.selectedIons[0].set(MS_selected_ion_m_z, precursorMZ[i], MS_m_z);
808+
}
809+
810+
if (!std::isnan(precursorIntensity[i])) {
811+
prec.selectedIons[0].set(MS_peak_intensity, precursorIntensity[i],
812+
MS_number_of_detector_counts);
813+
}
814+
815+
if (!std::isnan(precursorCharge[i])) {
816+
prec.selectedIons[0].set(MS_charge_state, precursorCharge[i]);
817+
}
809818
// Get the spectrumId of the precursor. Assuming that precursorScanNum is
810819
// linked to the acquisitionNum of the precursor.
811820
// This seems to be correct, since both the acquisitionNum and the

0 commit comments

Comments
 (0)