Skip to content

Commit 4558811

Browse files
author
stefanks
authored
Merge pull request #244 from smith-chem-wisc/StefanBranch
Stuffs
2 parents 63e58ce + ef8d698 commit 4558811

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

GUI/MainWindow.xaml.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,9 @@ private void ClearOutput_Click(object sender, RoutedEventArgs e)
503503
private void ResetTasksButton_Click(object sender, RoutedEventArgs e)
504504
{
505505
tasksGroupBox.IsEnabled = true;
506-
ClearTasksButton.IsEnabled = false;
507-
RemoveLastTaskButton.IsEnabled = false;
508-
RunTasksButton.IsEnabled = false;
506+
ClearTasksButton.IsEnabled = true;
507+
RemoveLastTaskButton.IsEnabled = true;
508+
RunTasksButton.IsEnabled = true;
509509
addCalibrateTaskButton.IsEnabled = true;
510510
addGPTMDTaskButton.IsEnabled = true;
511511
addSearchTaskButton.IsEnabled = true;

TaskLayer/CalibrationTask/CalibrationTask.cs

+18-15
Original file line numberDiff line numberDiff line change
@@ -171,17 +171,18 @@ protected override MyTaskResults RunSpecific(string OutputFolder, List<DbForTask
171171
IMsDataFile<IMsDataScan<IMzSpectrum<IMzPeak>>> myMsDataFile;
172172
lock (lock1) // Lock because reading is sequential
173173
{
174-
StartingDataFile(origDataFileName, new List<string> { taskId });
175-
Status("Loading spectra file " + origDataFileName + "...", new List<string> { taskId });
174+
NewCollection(Path.GetFileName(origDataFileName), new List<string> { taskId, "Individual Searches", origDataFileName });
175+
StartingDataFile(origDataFileName, new List<string> { taskId, "Individual Searches", origDataFileName });
176+
Status("Loading spectra file " + origDataFileName + "...", new List<string> { taskId, "Individual Searches", origDataFileName });
176177
if (Path.GetExtension(origDataFileName).Equals(".mzML"))
177178
myMsDataFile = Mzml.LoadAllStaticData(origDataFileName);
178179
else
179180
myMsDataFile = ThermoStaticData.LoadAllStaticData(origDataFileName);
180-
Status("Opening spectra file " + origDataFileName + "...", new List<string> { taskId });
181+
Status("Opening spectra file " + origDataFileName + "...", new List<string> { taskId, "Individual Searches", origDataFileName });
181182
listOfSortedms2Scans = MyEngine.GetMs2Scans(myMsDataFile).OrderBy(b => b.MonoisotopicPrecursorMass).ToArray();
182183
}
183184

184-
var searchEngine = new ClassicSearchEngine(listOfSortedms2Scans, myMsDataFile.NumSpectra, variableModifications, fixedModifications, proteinList, ProductMassTolerance, Protease, searchModes, MaxMissedCleavages, MaxModificationIsoforms, origDataFileName, lp, new List<string> { taskId });
185+
var searchEngine = new ClassicSearchEngine(listOfSortedms2Scans, myMsDataFile.NumSpectra, variableModifications, fixedModifications, proteinList, ProductMassTolerance, Protease, searchModes, MaxMissedCleavages, MaxModificationIsoforms, origDataFileName, lp, new List<string> { taskId, "Individual Searches", origDataFileName });
185186

186187
var searchResults = (ClassicSearchResults)searchEngine.Run();
187188
myTaskResults.AddResultText(searchResults);
@@ -191,7 +192,7 @@ protected override MyTaskResults RunSpecific(string OutputFolder, List<DbForTask
191192

192193
InitiatorMethionineBehavior initiatorMethionineBehavior = InitiatorMethionineBehavior.Variable;
193194
// Run analysis on single file results
194-
var analysisEngine = new AnalysisEngine(searchResults.OuterPsms, compactPeptideToProteinPeptideMatching, proteinList, variableModifications, fixedModifications, localizeableModifications, Protease, searchModes, myMsDataFile, ProductMassTolerance, (BinTreeStructure myTreeStructure, string s) => WriteTree(myTreeStructure, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s, new List<string> { taskId, origDataFileName }), (List<NewPsmWithFdr> h, string s) => WritePsmsToTsv(h, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s, new List<string> { taskId, origDataFileName }), null, false, false, MaxMissedCleavages, MaxModificationIsoforms, false, lp, double.NaN, initiatorMethionineBehavior, new List<string> { taskId }, false, 0, 0);
195+
var analysisEngine = new AnalysisEngine(searchResults.OuterPsms, compactPeptideToProteinPeptideMatching, proteinList, variableModifications, fixedModifications, localizeableModifications, Protease, searchModes, myMsDataFile, ProductMassTolerance, (BinTreeStructure myTreeStructure, string s) => WriteTree(myTreeStructure, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s, new List<string> { taskId, "Individual Searches", origDataFileName }), (List<NewPsmWithFdr> h, string s) => WritePsmsToTsv(h, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s, new List<string> { taskId, "Individual Searches", origDataFileName }), null, false, false, MaxMissedCleavages, MaxModificationIsoforms, false, lp, double.NaN, initiatorMethionineBehavior, new List<string> { taskId, "Individual Searches", origDataFileName }, false, 0, 0);
195196

196197
var analysisResults = (AnalysisResults)analysisEngine.Run();
197198
myTaskResults.AddResultText(analysisResults);
@@ -206,56 +207,58 @@ protected override MyTaskResults RunSpecific(string OutputFolder, List<DbForTask
206207

207208
// TODO: fix the tolerance calculation below
208209

209-
var a = new CalibrationEngine(myMsDataFile, ProductMassTolerance, identifications, minMS1isotopicPeaksNeededForConfirmedIdentification, minMS2isotopicPeaksNeededForConfirmedIdentification, numFragmentsNeededForEveryIdentification, PrecursorMassTolerance, fragmentTypesForCalibration, (List<LabeledMs1DataPoint> theList, string s) => WriteMs1DataPoints(theList, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s, new List<string> { taskId, origDataFileName }), (List<LabeledMs2DataPoint> theList, string s) => WriteMs2DataPoints(theList, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s, new List<string> { taskId, origDataFileName }), false, new List<string> { taskId });
210+
var a = new CalibrationEngine(myMsDataFile, ProductMassTolerance, identifications, minMS1isotopicPeaksNeededForConfirmedIdentification, minMS2isotopicPeaksNeededForConfirmedIdentification, numFragmentsNeededForEveryIdentification, PrecursorMassTolerance, fragmentTypesForCalibration, (List<LabeledMs1DataPoint> theList, string s) => WriteMs1DataPoints(theList, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s, new List<string> { taskId, "Individual Searches", origDataFileName }), (List<LabeledMs2DataPoint> theList, string s) => WriteMs2DataPoints(theList, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s, new List<string> { taskId, "Individual Searches", origDataFileName }), false, new List<string> { taskId, "Individual Searches", origDataFileName });
210211

211212
var resultBeforeFC = a.Run();
212213
myTaskResults.AddResultText(resultBeforeFC);
213214

214215
// Second search round
215216

216217
var listOfSortedms2ScansTest = MyEngine.GetMs2Scans(myMsDataFile).OrderBy(b => b.MonoisotopicPrecursorMass).ToArray();
217-
var searchEngineTest = new ClassicSearchEngine(listOfSortedms2ScansTest, myMsDataFile.NumSpectra, variableModifications, fixedModifications, proteinList, ProductMassTolerance, Protease, searchModes, MaxMissedCleavages, MaxModificationIsoforms, origDataFileName, lp, new List<string> { taskId });
218+
var searchEngineTest = new ClassicSearchEngine(listOfSortedms2ScansTest, myMsDataFile.NumSpectra, variableModifications, fixedModifications, proteinList, ProductMassTolerance, Protease, searchModes, MaxMissedCleavages, MaxModificationIsoforms, origDataFileName, lp, new List<string> { taskId, "Individual Searches", origDataFileName });
218219
var searchResultsTest = (ClassicSearchResults)searchEngineTest.Run();
219220
myTaskResults.AddResultText(searchResultsTest);
220-
var analysisEngineTest = new AnalysisEngine(searchResultsTest.OuterPsms, compactPeptideToProteinPeptideMatching, proteinList, variableModifications, fixedModifications, localizeableModifications, Protease, searchModes, myMsDataFile, ProductMassTolerance, (BinTreeStructure myTreeStructure, string s) => WriteTree(myTreeStructure, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s + "test", new List<string> { taskId, origDataFileName }), (List<NewPsmWithFdr> h, string s) => WritePsmsToTsv(h, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s + "test", new List<string> { taskId, origDataFileName }), null, false, false, MaxMissedCleavages, MaxModificationIsoforms, false, lp, double.NaN, initiatorMethionineBehavior, new List<string> { taskId }, false, 0, 0);
221+
var analysisEngineTest = new AnalysisEngine(searchResultsTest.OuterPsms, compactPeptideToProteinPeptideMatching, proteinList, variableModifications, fixedModifications, localizeableModifications, Protease, searchModes, myMsDataFile, ProductMassTolerance, (BinTreeStructure myTreeStructure, string s) => WriteTree(myTreeStructure, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s + "test", new List<string> { taskId, "Individual Searches", origDataFileName }), (List<NewPsmWithFdr> h, string s) => WritePsmsToTsv(h, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s + "test", new List<string> { taskId, "Individual Searches", origDataFileName }), null, false, false, MaxMissedCleavages, MaxModificationIsoforms, false, lp, double.NaN, initiatorMethionineBehavior, new List<string> { taskId, "Individual Searches", origDataFileName }, false, 0, 0);
221222
var analysisResultsTest = (AnalysisResults)analysisEngineTest.Run();
222223
myTaskResults.AddResultText(analysisResultsTest);
223224

224225
//
225226

226-
var resultAfterFC = new CalibrationEngine(myMsDataFile, ProductMassTolerance, analysisResultsTest.AllResultingIdentifications[0], minMS1isotopicPeaksNeededForConfirmedIdentification, minMS2isotopicPeaksNeededForConfirmedIdentification, numFragmentsNeededForEveryIdentification, PrecursorMassTolerance, fragmentTypesForCalibration, (List<LabeledMs1DataPoint> theList, string s) => WriteMs1DataPoints(theList, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s + "after", new List<string> { taskId, origDataFileName }), (List<LabeledMs2DataPoint> theList, string s) => WriteMs2DataPoints(theList, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s + "after", new List<string> { taskId, origDataFileName }), true, new List<string> { taskId }).Run();
227+
var resultAfterFC = new CalibrationEngine(myMsDataFile, ProductMassTolerance, analysisResultsTest.AllResultingIdentifications[0], minMS1isotopicPeaksNeededForConfirmedIdentification, minMS2isotopicPeaksNeededForConfirmedIdentification, numFragmentsNeededForEveryIdentification, PrecursorMassTolerance, fragmentTypesForCalibration, (List<LabeledMs1DataPoint> theList, string s) => WriteMs1DataPoints(theList, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s + "after", new List<string> { taskId, "Individual Searches", origDataFileName }), (List<LabeledMs2DataPoint> theList, string s) => WriteMs2DataPoints(theList, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s + "after", new List<string> { taskId, "Individual Searches", origDataFileName }), true, new List<string> { taskId, "Individual Searches", origDataFileName }).Run();
227228
myTaskResults.AddResultText(resultAfterFC);
228229

229230
// Final search round - not required
230231

231232
var listOfSortedms2ScansTest2 = MyEngine.GetMs2Scans(myMsDataFile).OrderBy(b => b.MonoisotopicPrecursorMass).ToArray();
232-
var searchEngineTest2 = new ClassicSearchEngine(listOfSortedms2ScansTest2, myMsDataFile.NumSpectra, variableModifications, fixedModifications, proteinList, ProductMassTolerance, Protease, searchModes, MaxMissedCleavages, MaxModificationIsoforms, origDataFileName, lp, new List<string> { taskId });
233+
var searchEngineTest2 = new ClassicSearchEngine(listOfSortedms2ScansTest2, myMsDataFile.NumSpectra, variableModifications, fixedModifications, proteinList, ProductMassTolerance, Protease, searchModes, MaxMissedCleavages, MaxModificationIsoforms, origDataFileName, lp, new List<string> { taskId, "Individual Searches", origDataFileName });
233234
var searchResultsTest2 = (ClassicSearchResults)searchEngineTest2.Run();
234235
myTaskResults.AddResultText(searchResultsTest2);
235-
var analysisEngineTest2 = new AnalysisEngine(searchResultsTest2.OuterPsms, compactPeptideToProteinPeptideMatching, proteinList, variableModifications, fixedModifications, localizeableModifications, Protease, searchModes, myMsDataFile, ProductMassTolerance, (BinTreeStructure myTreeStructure, string s) => WriteTree(myTreeStructure, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s + "test2", new List<string> { taskId, origDataFileName }), (List<NewPsmWithFdr> h, string s) => WritePsmsToTsv(h, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s + "test2", new List<string> { taskId, origDataFileName }), null, false, false, MaxMissedCleavages, MaxModificationIsoforms, false, lp, double.NaN, initiatorMethionineBehavior, new List<string> { taskId }, false, 0, 0);
236+
var analysisEngineTest2 = new AnalysisEngine(searchResultsTest2.OuterPsms, compactPeptideToProteinPeptideMatching, proteinList, variableModifications, fixedModifications, localizeableModifications, Protease, searchModes, myMsDataFile, ProductMassTolerance, (BinTreeStructure myTreeStructure, string s) => WriteTree(myTreeStructure, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s + "test2", new List<string> { taskId, "Individual Searches", origDataFileName }), (List<NewPsmWithFdr> h, string s) => WritePsmsToTsv(h, OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + s + "test2", new List<string> { taskId, "Individual Searches", origDataFileName }), null, false, false, MaxMissedCleavages, MaxModificationIsoforms, false, lp, double.NaN, initiatorMethionineBehavior, new List<string> { taskId, "Individual Searches", origDataFileName }, false, 0, 0);
237+
236238
var analysisResultsTest2 = (AnalysisResults)analysisEngineTest2.Run();
237239
myTaskResults.AddResultText(analysisResultsTest2);
238240

239241
//
240242

241243
if (resultBeforeFC is MyErroredResults)
242244
{
243-
Warn(a.ToString(), new List<string> { taskId });
245+
Warn(a.ToString(), new List<string> { taskId, "Individual Searches", origDataFileName });
244246
}
245247
else
246248
{
247-
Status("Creating _indexedmzMLConnection, putting data in it, and writing!", new List<string> { taskId });
249+
Status("Creating _indexedmzMLConnection, putting data in it, and writing!", new List<string> { taskId, "Individual Searches", origDataFileName });
248250
var path = Path.Combine(OutputFolder, Path.GetFileNameWithoutExtension(origDataFileName) + "-Calibrated.mzML");
249251
lock (lock2) // Lock because writing is sequential
250252
{
251253
MzmlMethods.CreateAndWriteMyMzmlWithCalibratedSpectra(myMsDataFile, path);
252254

253-
SucessfullyFinishedWritingFile(path, new List<string> { taskId, origDataFileName });
255+
SucessfullyFinishedWritingFile(path, new List<string> { taskId, "Individual Searches", origDataFileName });
254256

255257
myTaskResults.newSpectra.Add(path);
256258
}
257259
}
258-
FinishedDataFile(origDataFileName, new List<string> { taskId });
260+
FinishedDataFile(origDataFileName, new List<string> { taskId, "Individual Searches", origDataFileName });
261+
Status("Done!", new List<string> { taskId, "Individual Searches", origDataFileName });
259262
}
260263
);
261264
return myTaskResults;

0 commit comments

Comments
 (0)