File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments