diff --git a/src/maven/background_peaks_update.cpp b/src/maven/background_peaks_update.cpp index 9b1ee7bf..76f01e9c 100644 --- a/src/maven/background_peaks_update.cpp +++ b/src/maven/background_peaks_update.cpp @@ -670,37 +670,42 @@ void BackgroundPeakUpdate::pullIsotopes(PeakGroup* parentgroup) { //cerr << "pullIsotopes: " << isotopeMass << " " << rtmin-w << " " << rtmin+w << " c=" << c << endl; - EIC* eic=NULL; + EIC* eic=nullptr; for( int i=0; igetEIC(mzmin,mzmax,rtmin-window,rtmax+window,1); + if(!eic) continue; + eic->setSmootherType((EIC::SmootherType) eic_smoothingAlgorithm); eic->getPeakPositions(eic_smoothingWindow); - if ( eic->peaks.size() == 0 ) continue; - if ( eic->peaks.size() > 1 ) break; - } - if (!eic) continue; - - Peak* nearestPeak=NULL; float d=FLT_MAX; - for(int i=0; i < eic->peaks.size(); i++ ) { - Peak& x = eic->peaks[i]; - float dist = abs(x.rt - rt); - if ( dist > maxIsotopeScanDiff*avgScanTime) continue; - if ( dist < d ) { d=dist; nearestPeak = &x; } + if (eic->peaks.size() > 1 ) break; + + //clean up + delete(eic); eic=nullptr; } - if (nearestPeak) { - if (isotopes.count(isotopeName)==0) { - PeakGroup g; - g.meanMz=isotopeMass; - g.tagString=isotopeName; - g.expectedAbundance=expectedAbundance; - g.isotopeC13count= x.C13; - isotopes[isotopeName] = g; + if (eic) { + Peak* nearestPeak=nullptr; float d=FLT_MAX; + for(int i=0; i < eic->peaks.size(); i++ ) { + Peak& x = eic->peaks[i]; + float dist = abs(x.rt - rt); + if ( dist > maxIsotopeScanDiff*avgScanTime) continue; + if ( dist < d ) { d=dist; nearestPeak = &x; } + } + + if (nearestPeak) { + if (isotopes.count(isotopeName)==0) { + PeakGroup g; + g.meanMz=isotopeMass; + g.tagString=isotopeName; + g.expectedAbundance=expectedAbundance; + g.isotopeC13count= x.C13; + isotopes[isotopeName] = g; + } + isotopes[isotopeName].addPeak(*nearestPeak); } - isotopes[isotopeName].addPeak(*nearestPeak); + delete(eic); } - delete(eic); } } diff --git a/src/maven_core b/src/maven_core index c6cc8195..242e8b09 160000 --- a/src/maven_core +++ b/src/maven_core @@ -1 +1 @@ -Subproject commit c6cc8195828c9df68696aca65f1c545d03de963b +Subproject commit 242e8b09f5bf2236c543c9a707fd055068d02e0a