diff --git a/MetaMorpheus/CMD/CMD.csproj b/MetaMorpheus/CMD/CMD.csproj index 51d35aafb..5ecdb2a1d 100644 --- a/MetaMorpheus/CMD/CMD.csproj +++ b/MetaMorpheus/CMD/CMD.csproj @@ -26,6 +26,9 @@ + + + diff --git a/MetaMorpheus/EngineLayer/EngineLayer.csproj b/MetaMorpheus/EngineLayer/EngineLayer.csproj index e9dd06c04..7c169641c 100644 --- a/MetaMorpheus/EngineLayer/EngineLayer.csproj +++ b/MetaMorpheus/EngineLayer/EngineLayer.csproj @@ -25,6 +25,9 @@ + + + diff --git a/MetaMorpheus/GUI/GUI.csproj b/MetaMorpheus/GUI/GUI.csproj index c0274f625..d38d23fad 100644 --- a/MetaMorpheus/GUI/GUI.csproj +++ b/MetaMorpheus/GUI/GUI.csproj @@ -19,6 +19,13 @@ true + + true + false + false + false + + x64 @@ -63,9 +70,12 @@ + + + diff --git a/MetaMorpheus/GUI/MainWindow.xaml b/MetaMorpheus/GUI/MainWindow.xaml index 7c33fd33b..4a0358de0 100644 --- a/MetaMorpheus/GUI/MainWindow.xaml +++ b/MetaMorpheus/GUI/MainWindow.xaml @@ -458,7 +458,7 @@ - Add spectra file(s) in .mzML, .mgf, or Thermo .raw format. + Add spectra file(s) in .mzML, .mgf, Thermo .raw, or Bruker .d formats. For Bruker files, either the .tdf or .tdf_bin file inside the .d folder can be selected. diff --git a/MetaMorpheus/GUI/MainWindow.xaml.cs b/MetaMorpheus/GUI/MainWindow.xaml.cs index 515344905..e1dcb2673 100644 --- a/MetaMorpheus/GUI/MainWindow.xaml.cs +++ b/MetaMorpheus/GUI/MainWindow.xaml.cs @@ -19,6 +19,7 @@ using System.Windows.Navigation; using Omics.Modifications; using TaskLayer; +using System.Text.RegularExpressions; namespace MetaMorpheusGUI { @@ -516,7 +517,7 @@ private void Window_Drop(object sender, DragEventArgs e) /// private void AddSpectraFile_Click(object sender, RoutedEventArgs e) { - var openPicker = StartOpenFileDialog("Spectra Files(*.raw;*.mzML;*.mgf)|*.raw;*.mzML;*.mgf"); + var openPicker = StartOpenFileDialog("Spectra Files(*.raw;*.mzML;*.mgf;*.tdf;*.tdf_bin)|*.raw;*.mzML;*.mgf;*.tdf;*.tdf_bin"); if (openPicker.ShowDialog() == true) { @@ -1513,14 +1514,14 @@ private void AddPreRunFiles(IEnumerable paths) { foreach (string path in paths.OrderBy(p => Path.GetFileName(p))) { - if (Directory.Exists(path)) + if (Directory.Exists(path) & !Regex.IsMatch(path, @".d$")) // don't add directories that end in ".d" (bruker data files) { foreach (string file in Directory.EnumerateFiles(path, "*.*", SearchOption.AllDirectories)) { AddPreRunFile(file); } } - else if (File.Exists(path)) + else if (File.Exists(path) || Regex.IsMatch(path, @".d$")) { AddPreRunFile(path); } @@ -1571,13 +1572,19 @@ private void AddPreRunFile(string filePath) return; } } - goto case ".mzml"; - case ".mgf": NotificationHandler(null, new StringEventArgs(".mgf files lack MS1 spectra, which are needed for quantification and searching for coisolated peptides. All other features of MetaMorpheus will function.", null)); goto case ".mzml"; - + case ".tdf": + case ".tdf_bin": + // for Bruker timsTof files, the .tdf file is in a ".d" directory which also contains a .tdf_bin file + // the fileReader is designed to take the path to the .d directory instead of either/both individual files + filePath = Path.GetDirectoryName(filePath); + goto case ".d"; + case ".d": // Bruker data files are directories that contain .d files + NotificationHandler(null, new StringEventArgs("Quantification and calibration are not currently supported for Bruker data files. All other features of MetaMorpheus will function.", null)); + goto case ".mzml"; case ".mzml": if (compressed) // not implemented yet { @@ -1592,7 +1599,6 @@ private void AddPreRunFile(string filePath) UpdateFileSpecificParamsDisplay(Path.ChangeExtension(filePath, ".toml")); UpdateOutputFolderTextbox(); break; - case ".xml": case ".fasta": case ".fa": diff --git a/MetaMorpheus/MetaMorpheusSetup/MetaMorpheusSetup.wixproj b/MetaMorpheus/MetaMorpheusSetup/MetaMorpheusSetup.wixproj index 25aef3f26..acbeb3df7 100644 --- a/MetaMorpheus/MetaMorpheusSetup/MetaMorpheusSetup.wixproj +++ b/MetaMorpheus/MetaMorpheusSetup/MetaMorpheusSetup.wixproj @@ -53,6 +53,9 @@ + + + diff --git a/MetaMorpheus/MetaMorpheusSetup/Product.wxs b/MetaMorpheus/MetaMorpheusSetup/Product.wxs index 3bbf33f48..50251903d 100644 --- a/MetaMorpheus/MetaMorpheusSetup/Product.wxs +++ b/MetaMorpheus/MetaMorpheusSetup/Product.wxs @@ -285,6 +285,19 @@ + + + + + + + + + + + + + diff --git a/MetaMorpheus/TaskLayer/CalibrationTask/CalibrationTask.cs b/MetaMorpheus/TaskLayer/CalibrationTask/CalibrationTask.cs index 11f335193..81273871a 100644 --- a/MetaMorpheus/TaskLayer/CalibrationTask/CalibrationTask.cs +++ b/MetaMorpheus/TaskLayer/CalibrationTask/CalibrationTask.cs @@ -83,10 +83,22 @@ protected override MyTaskResults RunSpecific(string OutputFolder, List { taskId, "Individual Spectra Files", originalUncalibratedFilePath }); + ReportProgress(new ProgressEventArgs(100, "Done!", new List { taskId, "Individual Spectra Files", originalUncalibratedFilenameWithoutExtension })); + continue; + } + string calibratedFilePath = Path.Combine(OutputFolder, originalUncalibratedFilenameWithoutExtension + CalibSuffix + ".mzML"); string uncalibratedFilePath = Path.Combine(OutputFolder, originalUncalibratedFilenameWithoutExtension + ".mzML"); - bool calibrated = false; + // mark the file as in-progress StartingDataFile(originalUncalibratedFilePath, new List { taskId, "Individual Spectra Files", originalUncalibratedFilePath }); CommonParameters combinedParams = SetAllFileSpecificCommonParams(CommonParameters, fileSettingsList[spectraFileIndex]); diff --git a/MetaMorpheus/TaskLayer/SearchTask/SearchTask.cs b/MetaMorpheus/TaskLayer/SearchTask/SearchTask.cs index 619680eff..e7510fa22 100644 --- a/MetaMorpheus/TaskLayer/SearchTask/SearchTask.cs +++ b/MetaMorpheus/TaskLayer/SearchTask/SearchTask.cs @@ -97,8 +97,9 @@ protected override MyTaskResults RunSpecific(string OutputFolder, List Path.GetExtension(x).Equals(".mgf", StringComparison.OrdinalIgnoreCase))) + // disable quantification if a .mgf or .d files are being used + if (currentRawFileList.Select(filepath => Path.GetExtension(filepath)) + .Any(ext => ext.Equals(".mgf", StringComparison.OrdinalIgnoreCase) || ext.Equals(".d", StringComparison.OrdinalIgnoreCase))) { SearchParameters.DoLabelFreeQuantification = false; } diff --git a/MetaMorpheus/TaskLayer/TaskLayer.csproj b/MetaMorpheus/TaskLayer/TaskLayer.csproj index 6630c4198..02c587368 100644 --- a/MetaMorpheus/TaskLayer/TaskLayer.csproj +++ b/MetaMorpheus/TaskLayer/TaskLayer.csproj @@ -24,6 +24,9 @@ + + + diff --git a/MetaMorpheus/Test/MsDataFileTest.cs b/MetaMorpheus/Test/MsDataFileTest.cs index 54c1dbde2..0c8c26207 100644 --- a/MetaMorpheus/Test/MsDataFileTest.cs +++ b/MetaMorpheus/Test/MsDataFileTest.cs @@ -18,13 +18,14 @@ public static void Setup() } [Test] - public static void TestLoadAndRunMgf() + [TestCase(@"TestData\ok.mgf", @"TestData\okk.xml")] + [TestCase(@"TestData\snippet.d", @"TestData\gapdh.fasta")] + public static void TestQuantificationDoesntCrashOnUnsupportedFiles(string filepath, string dbPath) { - //The purpose of this test is to ensure that mgfs can be run without crashing. + //The purpose of this test is to ensure that mgfs and timsTOF (.d) files can be run without crashing. + //Whenever a new feature is added that may require things an mgf does not have, //there should be a check that prevents mgfs from using that feature. - string mgfName = @"TestData\ok.mgf"; - string xmlName = @"TestData\okk.xml"; string outputFolder = Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestLoadAndRunMgf"); SearchTask task1 = new() @@ -41,7 +42,40 @@ public static void TestLoadAndRunMgf() }; //run! - var engine = new EverythingRunnerEngine(taskList, new List { mgfName }, new List { new DbForTask(xmlName, false) }, outputFolder); + var engine = new EverythingRunnerEngine(taskList, new List { filepath }, new List { new DbForTask(dbPath, false) }, outputFolder); + engine.Run(); + //Just don't crash! There should also be at least one psm at 1% FDR, but can't check for that. + Directory.Delete(outputFolder, true); + } + + [Test] + [TestCase(@"TestData\ok.mgf", @"TestData\okk.xml")] + [TestCase(@"TestData\snippet.d", @"TestData\gapdh.fasta")] + public static void TestCalibrationDoesntCrashOnUnsupportedFiles(string filepath, string dbPath) + { + //The purpose of this test is to ensure that mgfs and timsTOF (.d) files can be run without crashing. + + //Whenever a new feature is added that may require things an mgf does not have, + //there should be a check that prevents mgfs from using that feature. + string outputFolder = Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestCalibrateAndSearchMgf"); + + CalibrationTask task1 = new(); + SearchTask task2 = new() + { + SearchParameters = new SearchParameters + { + DoParsimony = true, + DoLabelFreeQuantification = false + } + }; + List<(string, MetaMorpheusTask)> taskList = new() + { + ("task1", task1), + ("task2", task2) + }; + //run! + + var engine = new EverythingRunnerEngine(taskList, new List { filepath }, new List { new DbForTask(dbPath, false) }, outputFolder); engine.Run(); //Just don't crash! There should also be at least one psm at 1% FDR, but can't check for that. Directory.Delete(outputFolder, true); diff --git a/MetaMorpheus/Test/Test.csproj b/MetaMorpheus/Test/Test.csproj index 4492cd07e..16f84019d 100644 --- a/MetaMorpheus/Test/Test.csproj +++ b/MetaMorpheus/Test/Test.csproj @@ -376,6 +376,12 @@ Always + + PreserveNewest + + + PreserveNewest + Always diff --git a/MetaMorpheus/Test/TestData/snippet.d/analysis.tdf b/MetaMorpheus/Test/TestData/snippet.d/analysis.tdf new file mode 100644 index 000000000..082f62298 Binary files /dev/null and b/MetaMorpheus/Test/TestData/snippet.d/analysis.tdf differ diff --git a/MetaMorpheus/Test/TestData/snippet.d/analysis.tdf_bin b/MetaMorpheus/Test/TestData/snippet.d/analysis.tdf_bin new file mode 100644 index 000000000..152a26cd1 Binary files /dev/null and b/MetaMorpheus/Test/TestData/snippet.d/analysis.tdf_bin differ