diff --git a/src/maven/background_peaks_update.cpp b/src/maven/background_peaks_update.cpp index d14e8398..cce69eae 100644 --- a/src/maven/background_peaks_update.cpp +++ b/src/maven/background_peaks_update.cpp @@ -135,6 +135,8 @@ void BackgroundPeakUpdate::processSlices(vector&slices, string setName mzSlice* slice = slices[s]; Compound* compound = slice->compound; + // if (compound) cerr << "Searching for: " << compound->name << "\trt=" << compound->expectedRt << endl; + if ( compound != NULL && compound->hasGroup() ) compound->unlinkGroup(); @@ -162,6 +164,8 @@ void BackgroundPeakUpdate::processSlices(vector&slices, string setName //for ( unsigned int j=0; j < eics.size(); j++ ) eics[j]->getPeakPositions(eic_smoothingWindow); vector peakgroups = EIC::groupPeaks(eics,eic_smoothingWindow,grouping_maxRtWindow); + //cerr << "\tFound " << peakgroups.size() << "\n"; + //score quality of each group vector groupsToAppend; @@ -172,13 +176,23 @@ void BackgroundPeakUpdate::processSlices(vector&slices, string setName groupCount++; peakCount += group.peakCount(); - Peak* peak = group.getHighestIntensityPeak(); - if(!peak) continue; + Peak* highestpeak = group.getHighestIntensityPeak(); + if(!highestpeak) continue; + - vector isotopes = peak->getScan()->getIsotopicPattern(peak->peakMz,compoundPPMWindow,6,10); + if (clsf->hasModel()) { clsf->classify(&group); group.groupStatistics(); } + if (clsf->hasModel()&& group.goodPeakCount < minGoodPeakCount) continue; + // if (group.blankMean*minBlankRatio > group.sampleMean ) continue; + if (group.blankMax*minSignalBlankRatio > group.maxIntensity) continue; + if (group.maxNoNoiseObs < minNoNoiseObs) continue; + if (group.maxSignalBaselineRatio < minSignalBaseLineRatio) continue; + if (group.maxIntensity < minGroupIntensity ) continue; + + group.chargeState = group.getChargeStateFromMS1(compoundPPMWindow); + vector isotopes = highestpeak->getScan()->getIsotopicPattern(highestpeak->peakMz,compoundPPMWindow,6,10); if(isotopes.size() > 0) { - group.chargeState = isotopes.front().charge; + //group.chargeState = isotopes.front().charge; for(Isotope& isotope: isotopes) { if (mzUtils::ppmDist((float) isotope.mass, (float) group.meanMz) < compoundPPMWindow) { group.isotopicIndex=isotope.C13; @@ -186,18 +200,14 @@ void BackgroundPeakUpdate::processSlices(vector&slices, string setName } } - if (clsf->hasModel()) { clsf->classify(&group); group.groupStatistics(); } - if (clsf->hasModel()&& group.goodPeakCount < minGoodPeakCount) continue; - // if (group.blankMean*minBlankRatio > group.sampleMean ) continue; - if (group.blankMax*minSignalBlankRatio > group.maxIntensity) continue; - if (group.maxNoNoiseObs < minNoNoiseObs) continue; - if (group.maxSignalBaselineRatio < minSignalBaseLineRatio) continue; - if (group.maxIntensity < minGroupIntensity ) continue; - if ((excludeIsotopicPeaks or compound) and not group.isMonoisotopic(compoundPPMWindow)) continue; + if ((excludeIsotopicPeaks or compound)) { + if (group.chargeState > 0 and not group.isMonoisotopic(compoundPPMWindow)) continue; + } //if (getChargeStateFromMS1(&group) < minPrecursorCharge) continue; //build consensus ms2 specta vectorms2events = group.getFragmenationEvents(); + //cerr << "\tFound ms2events" << ms2events.size() << "\n"; group.computeFragPattern(productPpmTolr); // BROKEN group.findHighestPurityMS2Pattern(compoundPPMWindow); @@ -293,7 +303,7 @@ void BackgroundPeakUpdate::processSlices(vector&slices, string setName if(keepFoundGroups) { emit(newPeakGroup(&allgroups[j],false)); - qDebug() << "Emmiting..." << allgroups[j].meanMz; + //qDebug() << "Emmiting..." << allgroups[j].meanMz; QCoreApplication::processEvents(); }