diff --git a/CMD/CMD.csproj b/CMD/CMD.csproj index 0ce2012..83ee0c9 100644 --- a/CMD/CMD.csproj +++ b/CMD/CMD.csproj @@ -11,13 +11,14 @@ false false FlashLFQ_Icon.ico + AnyCPU - - - + + + diff --git a/CMD/FlashLFQExecutable.cs b/CMD/FlashLFQExecutable.cs index 07ee81b..1da5fea 100644 --- a/CMD/FlashLFQExecutable.cs +++ b/CMD/FlashLFQExecutable.cs @@ -2,9 +2,9 @@ using CommandLine.Text; using FlashLFQ; using IO.ThermoRawFileReader; +using MzLibUtil; using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; using Util; @@ -69,11 +69,11 @@ private static void Run(FlashLfqSettings settings) .Where(f => acceptedSpectrumFileFormats.Contains(Path.GetExtension(f).ToLowerInvariant())).ToList(); // check for duplicate file names (agnostic of file extension) - foreach (var fileNameWithoutExtension in filePaths.GroupBy(p => Path.GetFileNameWithoutExtension(p))) + foreach (var fileNameWithoutExtension in filePaths.GroupBy(p => PeriodTolerantFilenameWithoutExtension.GetPeriodTolerantFilenameWithoutExtension(p))) { if (fileNameWithoutExtension.Count() > 1) { - var types = fileNameWithoutExtension.Select(p => Path.GetFileNameWithoutExtension(p)).Distinct(); + var types = fileNameWithoutExtension.Select(p => PeriodTolerantFilenameWithoutExtension.GetPeriodTolerantFilenameWithoutExtension(p)).Distinct(); if (!settings.Silent) { @@ -140,9 +140,9 @@ private static void Run(FlashLfqSettings settings) var experimentalDesign = File.ReadAllLines(assumedPathToExpDesign) .ToDictionary(v => v.Split('\t')[0], v => v); - foreach (var file in filePaths) + foreach (var filePath in filePaths) { - string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file); + string fileNameWithoutExtension = PeriodTolerantFilenameWithoutExtension.GetPeriodTolerantFilenameWithoutExtension(filePath); var expDesignForThisFile = experimentalDesign[fileNameWithoutExtension]; var split = expDesignForThisFile.Split('\t'); @@ -153,7 +153,7 @@ private static void Run(FlashLfqSettings settings) int techrep = int.Parse(split[4]); // experimental design info passed in here for each spectra file - spectraFileInfos.Add(new SpectraFileInfo(fullFilePathWithExtension: file, + spectraFileInfos.Add(new SpectraFileInfo(fullFilePathWithExtension: filePath, condition: condition, biorep: biorep - 1, fraction: fraction - 1, diff --git a/FlashLFQ.sln b/FlashLFQ.sln index 09e1b7c..34e0df5 100644 --- a/FlashLFQ.sln +++ b/FlashLFQ.sln @@ -1,15 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29418.71 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32825.248 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GUI", "GUI\GUI.csproj", "{976C4F84-5EF1-4549-BC2C-4F5E946D36E9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GUI", "GUI\GUI.csproj", "{976C4F84-5EF1-4549-BC2C-4F5E946D36E9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CMD", "CMD\CMD.csproj", "{6020A640-2854-41EC-BC90-73D6A0C1F74D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CMD", "CMD\CMD.csproj", "{6020A640-2854-41EC-BC90-73D6A0C1F74D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{E59D0D0F-EEC9-48AA-8DBF-F488CF0B5FA4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test", "Test\Test.csproj", "{E59D0D0F-EEC9-48AA-8DBF-F488CF0B5FA4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Util", "Util\Util.csproj", "{2C3A8087-6AFB-4EED-BF7E-93E872C699A5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Util", "Util\Util.csproj", "{2C3A8087-6AFB-4EED-BF7E-93E872C699A5}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/GUI/GUI.csproj b/GUI/GUI.csproj index 6cd5209..658bd82 100644 --- a/GUI/GUI.csproj +++ b/GUI/GUI.csproj @@ -12,12 +12,13 @@ false false FlashLFQ_Icon.ico + AnyCPU - - - + + + diff --git a/Test/Test.cs b/Test/Test.cs index a213f13..3f3b810 100644 --- a/Test/Test.cs +++ b/Test/Test.cs @@ -184,7 +184,7 @@ public static void TestPercolatorOutput() "5" }; - CMD.FlashLfqExecutable.Main(myargs); + FlashLfqExecutable.Main(myargs); string peaksPath = Path.Combine(myDirectory, "QuantifiedPeaks.tsv"); Assert.That(File.Exists(peaksPath)); @@ -214,7 +214,7 @@ public void TestPercolatorReadPsmsGetsRTsFromFileHeader() SpectraFileInfo sfi = new SpectraFileInfo(pathOfMzml, "A", 1, 1, 1); - List expectedRetentionTimes = new List { 7.54, 7.54, 7.56, 7.58, 7.61, 7.63 }; + List expectedRetentionTimes = new() { 7.54, 7.54, 7.56, 7.58, 7.61, 7.63 }; List ids = PsmReader.ReadPsms(pathOfIdentificationFile, true, new List { sfi }); Assert.AreEqual(6, ids.Count); @@ -234,7 +234,7 @@ public void TestPercolatorReadPsmsGetsRTsFromFileHeader() } CollectionAssert.AreEquivalent(expectedRetentionTimes, actualRetentionTimes); - List proteinGroupCounts = new List { 11, 6, 3, 2, 15, 3 }; + List proteinGroupCounts = new() { 11, 6, 3, 2, 15, 3 }; CollectionAssert.AreEquivalent(proteinGroupCounts, ids.Select(i => i.ProteinGroups.Count).ToList()); } diff --git a/Test/Test.csproj b/Test/Test.csproj index a204772..843931f 100644 --- a/Test/Test.csproj +++ b/Test/Test.csproj @@ -10,12 +10,13 @@ false false false + AnyCPU - - - + + + diff --git a/Util/OutputWriter.cs b/Util/OutputWriter.cs index 4a184cb..02fad71 100644 --- a/Util/OutputWriter.cs +++ b/Util/OutputWriter.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; using FlashLFQ; @@ -16,7 +15,7 @@ public static void WriteOutput(string inputPath, FlashLfqResults results, bool s outputPath = Path.GetDirectoryName(inputPath); } - string inputFileName = Path.GetFileNameWithoutExtension(inputPath); + string inputFileName = PeriodTolerantFilenameWithoutExtension.GetPeriodTolerantFilenameWithoutExtension(inputPath); if (!Directory.Exists(outputPath)) { @@ -41,7 +40,7 @@ public static void WriteErrorReport(Exception e, string inputPath, string output outputPath = Path.GetDirectoryName(inputPath); } - string inputFileName = Path.GetFileNameWithoutExtension(inputPath); + string inputFileName = PeriodTolerantFilenameWithoutExtension.GetPeriodTolerantFilenameWithoutExtension(inputPath); if (!Directory.Exists(outputPath)) { diff --git a/Util/PsmReader.cs b/Util/PsmReader.cs index 7d9dc35..21e8bfb 100644 --- a/Util/PsmReader.cs +++ b/Util/PsmReader.cs @@ -1,4 +1,5 @@ using FlashLFQ; +using MzLibUtil; using System; using System.Collections.Generic; using System.Globalization; @@ -94,7 +95,7 @@ public static List ReadPsms(string filepath, bool silent, List Path.GetFileNameWithoutExtension(p.Split('\t')[_fileNameCol])).ToList(); + var psmsGroupedByFile = inputPsms.GroupBy(p => PeriodTolerantFilenameWithoutExtension.GetPeriodTolerantFilenameWithoutExtension(p.Split('\t')[_fileNameCol])).ToList(); foreach (var fileSpecificPsms in psmsGroupedByFile) { @@ -187,7 +188,7 @@ private static Identification GetIdentification(string line, bool silent, Dictio } // spectrum file name - string fileName = Path.GetFileNameWithoutExtension(param[_fileNameCol]); + string fileName = PeriodTolerantFilenameWithoutExtension.GetPeriodTolerantFilenameWithoutExtension(param[_fileNameCol]); // base sequence string baseSequence = param[_baseSequCol]; @@ -445,7 +446,7 @@ private static Identification GetPercolatorIdentification(string line, List Path.GetFileNameWithoutExtension(i.FileNameWithoutExtension) == Path.GetFileNameWithoutExtension(fileName) && i.ScanNumber == scanNumber).FirstOrDefault().RetentionTime; + ms2RetentionTime = scanHeaderInfo.Where(i => PeriodTolerantFilenameWithoutExtension.GetPeriodTolerantFilenameWithoutExtension(i.FileNameWithoutExtension) == PeriodTolerantFilenameWithoutExtension.GetPeriodTolerantFilenameWithoutExtension(fileName) && i.ScanNumber == scanNumber).FirstOrDefault().RetentionTime; } // charge state @@ -532,7 +533,7 @@ private static Identification GetPercolatorIdentification(string line, List FileScanHeaderInfo(string fullFilePathWithExtension) { - string filename = Path.GetFileNameWithoutExtension(fullFilePathWithExtension); + string filename = PeriodTolerantFilenameWithoutExtension.GetPeriodTolerantFilenameWithoutExtension(fullFilePathWithExtension); List scanHeaderInfoList = new(); switch (GetDataFileType(fullFilePathWithExtension)) { diff --git a/Util/Util.csproj b/Util/Util.csproj index ec8bb63..516dee0 100644 --- a/Util/Util.csproj +++ b/Util/Util.csproj @@ -9,13 +9,14 @@ false false false + AnyCPU - - - + + +