protected void evaluateIdentification(IDs id) { log.Debug("NoExclusion. Scores added, but nothing added to the exclusion list"); // check if the peptide is identified or not if (id == null) { performanceEvaluator.countMS2UnidentifiedAnalyzed(); return; } Peptide pep = getPeptideFromIdentification(id); // if it was going to be null, it already returned // is fragmented // add decoy or non-existent protein connections // database.addProteinFromIdentification(pep, id.getParentProteinAccessions()); Double xCorr = id.getXCorr(); Double dCN = id.getDeltaCN(); pep.addScore(xCorr, 0.0, dCN); performanceEvaluator.evaluateAnalysis(exclusionList, pep); RetentionTime rt = pep.getRetentionTime(); if (!rtCalcPredictedRT.Keys.Contains(pep.getSequence())) { rtCalcPredictedRT.Add(pep.getSequence(), rt.getRetentionTimePeak()); } ObservedPeptideRtTrackerObject observedPep = new ObservedPeptideRtTrackerObject(pep.getSequence(), id.getScanTime(), id.getXCorr(), rt.getRetentionTimePeak(), rt.getRetentionTimeStart() + GlobalVar.retentionTimeWindowSize, RetentionTime.getRetentionTimeOffset(), rtCalcPredictedRT[pep.getSequence()], (rt.IsPredicted() ? 1 : 0)); if ((xCorr > 2.5)) { // calibrates our retention time alignment if the observed time is different // from the predicted only if it passes this threshold calibrateRetentionTime(pep); } observedPep.offset = RetentionTime.getRetentionTimeOffset(); peptideIDRT.Add(observedPep); }
//actual experiment hooked up to the mass spec public static void RunRealTimeExperiment() { PreExperimentSetUp(); Console.WriteLine("Running real time experiment"); double startTime = getCurrentTime(); GlobalVar.ppmTolerance = 5.0 / 1000000.0; GlobalVar.retentionTimeWindowSize = 1.0; GlobalVar.AccordThreshold = 0.5; Console.WriteLine("Creating exclusion profile"); ExclusionProfile exclusionProfile = new MachineLearningGuidedExclusion(InputFileOrganizer.AccordNet_LogisticRegressionClassifier_WeightAndInterceptSavedFile, database, GlobalVar.ppmTolerance, GlobalVar.retentionTimeWindowSize); String experimentName = GlobalVar.experimentName + String.Format("_MLGE:ppmTol_{0}_rtWin_{1}_prThr_{2}", GlobalVar.ppmTolerance, GlobalVar.retentionTimeWindowSize, GlobalVar.AccordThreshold); Experiment experiment = new Experiment(exclusionProfile, experimentName, 1, ExclusionProfileEnum.MACHINE_LEARNING_GUIDED_EXCLUSION_PROFILE, startTime); new DataReceiver().DoJob(exclusionProfile); double analysisTime = getCurrentTime() - startTime; try { WriteUnusedSpectra(experiment); WriteScanArrivalProcessedTime(DataProcessor.scanArrivalAndProcessedTimeList); WriteScanArrivalProcessedTime(DataProcessor.spectraNotAdded); WriteUsedSpectra(experiment); WriterClass.writeln("ExclusionList size: " + exclusionProfile.getExclusionList().getExclusionList().Count); WriterClass.writeln("Number of exclusion: " + exclusionProfile.getUnusedSpectra().Count); WriterClass.writeln("Final rtoffset: " + RetentionTime.getRetentionTimeOffset()); } catch (Exception e) { Console.WriteLine("Writing exception catched at end of experiment"); } finally { WriterClass.CloseWriter(); } exclusionProfile.reset(); reset(); }
//Called by DataProcessor, entry point to Alex's program public bool evaluate(Spectra spec) { currentTime = spec.getStartTime(); updateExclusionList(spec); if (spec.getMSLevel() == 1) { log.Debug("Evaluating ms1 scan"); processMS1(spec); } else if (spec.getMSLevel() == 2) { log.Debug("evaluating ms2 scan"); if (spec.getIndex() % GlobalVar.ScansPerOutput == 0) { #if SIMULATION double progressPercent = spec.getIndex() / GlobalVar.ExperimentTotalScans * 100; log.Info("Progress: {0:F2}% Processing ID: {1}\t ScanNum: {2} \t Excluded: {3}", progressPercent, spec.getIndex(), spec.getScanNum(), excludedSpectra.Count); #else log.Info("Progress: {0}\t{1} excluded------------------------", spec.getIndex(), excludedSpectra.Count); log.Info("ExclusionListSize: {0}\tRTOffset: {1}", exclusionList.getExclusionList().Count, RetentionTime.getRetentionTimeOffset()); #endif } return(processMS2(spec)); } else { log.Debug("unrecognized msScan"); } return(true); }