Skip to content

Commit

Permalink
mzlib update to fix filename mismatch and failure to load ids (#118)
Browse files Browse the repository at this point in the history
* mzlib update and shift to x64

* mzlib 535

* periodTolerantFilename

* variable rename

* vxc

* name simplified

* style

* configuration manager changes

* netserializer 4.1.2

Co-authored-by: MICHAEL SHORTREED <mrshortreed@wisc.edu>
  • Loading branch information
trishorts and MICHAEL SHORTREED authored Sep 16, 2022
1 parent b6b5496 commit eba779a
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 35 deletions.
7 changes: 4 additions & 3 deletions CMD/CMD.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<ApplicationIcon>FlashLFQ_Icon.ico</ApplicationIcon>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.7.82" />
<PackageReference Include="MathNet.Numerics" Version="4.9.0" />
<PackageReference Include="mzLib" Version="1.0.529" />
<PackageReference Include="NetSerializer" Version="4.1.1" />
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
<PackageReference Include="mzLib" Version="1.0.535" />
<PackageReference Include="NetSerializer" Version="4.1.2" />
<PackageReference Include="Nett" Version="0.15.0" />
<PackageReference Include="SharpLearning.Common.Interfaces" Version="0.28.0" />
<PackageReference Include="SharpLearning.Containers" Version="0.28.0" />
Expand Down
12 changes: 6 additions & 6 deletions CMD/FlashLFQExecutable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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');
Expand All @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions FlashLFQ.sln
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 4 additions & 3 deletions GUI/GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<ApplicationIcon>FlashLFQ_Icon.ico</ApplicationIcon>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MathNet.Numerics" Version="4.9.0" />
<PackageReference Include="mzLib" Version="1.0.529" />
<PackageReference Include="NetSerializer" Version="4.1.1" />
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
<PackageReference Include="mzLib" Version="1.0.535" />
<PackageReference Include="NetSerializer" Version="4.1.2" />
<PackageReference Include="Nett" Version="0.15.0" />
<PackageReference Include="SharpLearning.Common.Interfaces" Version="0.28.0" />
<PackageReference Include="SharpLearning.Containers" Version="0.28.0" />
Expand Down
6 changes: 3 additions & 3 deletions Test/Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -214,7 +214,7 @@ public void TestPercolatorReadPsmsGetsRTsFromFileHeader()

SpectraFileInfo sfi = new SpectraFileInfo(pathOfMzml, "A", 1, 1, 1);

List<double> expectedRetentionTimes = new List<double> { 7.54, 7.54, 7.56, 7.58, 7.61, 7.63 };
List<double> expectedRetentionTimes = new() { 7.54, 7.54, 7.56, 7.58, 7.61, 7.63 };

List<Identification> ids = PsmReader.ReadPsms(pathOfIdentificationFile, true, new List<SpectraFileInfo> { sfi });
Assert.AreEqual(6, ids.Count);
Expand All @@ -234,7 +234,7 @@ public void TestPercolatorReadPsmsGetsRTsFromFileHeader()
}
CollectionAssert.AreEquivalent(expectedRetentionTimes, actualRetentionTimes);

List<int> proteinGroupCounts = new List<int> { 11, 6, 3, 2, 15, 3 };
List<int> proteinGroupCounts = new() { 11, 6, 3, 2, 15, 3 };
CollectionAssert.AreEquivalent(proteinGroupCounts, ids.Select(i => i.ProteinGroups.Count).ToList());
}

Expand Down
7 changes: 4 additions & 3 deletions Test/Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MathNet.Numerics" Version="4.9.0" />
<PackageReference Include="mzLib" Version="1.0.529" />
<PackageReference Include="NetSerializer" Version="4.1.1" />
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
<PackageReference Include="mzLib" Version="1.0.535" />
<PackageReference Include="NetSerializer" Version="4.1.2" />
<PackageReference Include="nunit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
Expand Down
5 changes: 2 additions & 3 deletions Util/OutputWriter.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using FlashLFQ;
Expand All @@ -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))
{
Expand All @@ -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))
{
Expand Down
9 changes: 5 additions & 4 deletions Util/PsmReader.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using FlashLFQ;
using MzLibUtil;
using System;
using System.Collections.Generic;
using System.Globalization;
Expand Down Expand Up @@ -94,7 +95,7 @@ public static List<Identification> ReadPsms(string filepath, bool silent, List<S
throw new Exception("Could not interpret PSM header labels from file: " + filepath);
}

var psmsGroupedByFile = inputPsms.GroupBy(p => Path.GetFileNameWithoutExtension(p.Split('\t')[_fileNameCol])).ToList();
var psmsGroupedByFile = inputPsms.GroupBy(p => PeriodTolerantFilenameWithoutExtension.GetPeriodTolerantFilenameWithoutExtension(p.Split('\t')[_fileNameCol])).ToList();

foreach (var fileSpecificPsms in psmsGroupedByFile)
{
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -445,7 +446,7 @@ private static Identification GetPercolatorIdentification(string line, List<Scan

if (int.TryParse(param[_msmsScanCol], NumberStyles.Number, CultureInfo.InvariantCulture, out int scanNumber))
{
ms2RetentionTime = scanHeaderInfo.Where(i => 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
Expand Down Expand Up @@ -532,7 +533,7 @@ private static Identification GetPercolatorIdentification(string line, List<Scan
}
}

if (!rawFileDictionary.TryGetValue(fileName, out SpectraFileInfo spectraFileInfoToUse))
if (!rawFileDictionary.TryGetValue(PeriodTolerantFilenameWithoutExtension.GetPeriodTolerantFilenameWithoutExtension(fileName), out SpectraFileInfo spectraFileInfoToUse))
{
// skip PSMs for files with no spectrum data input
return null;
Expand Down
2 changes: 1 addition & 1 deletion Util/ScanInfoRecovery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private enum DataFileType

public static List<ScanHeaderInfo> FileScanHeaderInfo(string fullFilePathWithExtension)
{
string filename = Path.GetFileNameWithoutExtension(fullFilePathWithExtension);
string filename = PeriodTolerantFilenameWithoutExtension.GetPeriodTolerantFilenameWithoutExtension(fullFilePathWithExtension);
List<ScanHeaderInfo> scanHeaderInfoList = new();
switch (GetDataFileType(fullFilePathWithExtension))
{
Expand Down
7 changes: 4 additions & 3 deletions Util/Util.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.7.82" />
<PackageReference Include="MathNet.Numerics" Version="4.9.0" />
<PackageReference Include="mzLib" Version="1.0.529" />
<PackageReference Include="NetSerializer" Version="4.1.1" />
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
<PackageReference Include="mzLib" Version="1.0.535" />
<PackageReference Include="NetSerializer" Version="4.1.2" />
<PackageReference Include="Nett" Version="0.15.0" />
</ItemGroup>

Expand Down

0 comments on commit eba779a

Please sign in to comment.