Skip to content

Commit 10edb28

Browse files
author
stefanks
authored
Merge pull request #217 from smith-chem-wisc/StefanBranch
hm
2 parents 3bb4ea8 + 491e0a3 commit 10edb28

25 files changed

+449
-408
lines changed

CMD/CMD.csproj

+18-18
Original file line numberDiff line numberDiff line change
@@ -35,40 +35,40 @@
3535
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
3636
</PropertyGroup>
3737
<ItemGroup>
38-
<Reference Include="Chemistry, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
39-
<HintPath>..\packages\mzLib.1.0.91\lib\Chemistry.dll</HintPath>
38+
<Reference Include="Chemistry, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
39+
<HintPath>..\packages\mzLib.1.0.93\lib\Chemistry.dll</HintPath>
4040
<Private>True</Private>
4141
</Reference>
42-
<Reference Include="MassSpectrometry, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
43-
<HintPath>..\packages\mzLib.1.0.91\lib\MassSpectrometry.dll</HintPath>
42+
<Reference Include="MassSpectrometry, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
43+
<HintPath>..\packages\mzLib.1.0.93\lib\MassSpectrometry.dll</HintPath>
4444
<Private>True</Private>
4545
</Reference>
4646
<Reference Include="MathNet.Numerics, Version=3.17.0.0, Culture=neutral, processorArchitecture=MSIL">
4747
<HintPath>..\packages\MathNet.Numerics.3.17.0\lib\net40\MathNet.Numerics.dll</HintPath>
4848
<Private>True</Private>
4949
</Reference>
50-
<Reference Include="mzIdentML, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
51-
<HintPath>..\packages\mzLib.1.0.91\lib\mzIdentML.dll</HintPath>
50+
<Reference Include="mzIdentML, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
51+
<HintPath>..\packages\mzLib.1.0.93\lib\mzIdentML.dll</HintPath>
5252
<Private>True</Private>
5353
</Reference>
54-
<Reference Include="MzLibUtil, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
55-
<HintPath>..\packages\mzLib.1.0.91\lib\MzLibUtil.dll</HintPath>
54+
<Reference Include="MzLibUtil, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
55+
<HintPath>..\packages\mzLib.1.0.93\lib\MzLibUtil.dll</HintPath>
5656
<Private>True</Private>
5757
</Reference>
58-
<Reference Include="MzML, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
59-
<HintPath>..\packages\mzLib.1.0.91\lib\MzML.dll</HintPath>
58+
<Reference Include="MzML, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
59+
<HintPath>..\packages\mzLib.1.0.93\lib\MzML.dll</HintPath>
6060
<Private>True</Private>
6161
</Reference>
6262
<Reference Include="NetSerializer, Version=4.1.0.0, Culture=neutral, processorArchitecture=MSIL">
6363
<HintPath>..\packages\NetSerializer.4.1.0\lib\net45\NetSerializer.dll</HintPath>
6464
<Private>True</Private>
6565
</Reference>
66-
<Reference Include="Proteomics, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
67-
<HintPath>..\packages\mzLib.1.0.91\lib\Proteomics.dll</HintPath>
66+
<Reference Include="Proteomics, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
67+
<HintPath>..\packages\mzLib.1.0.93\lib\Proteomics.dll</HintPath>
6868
<Private>True</Private>
6969
</Reference>
70-
<Reference Include="Spectra, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
71-
<HintPath>..\packages\mzLib.1.0.91\lib\Spectra.dll</HintPath>
70+
<Reference Include="Spectra, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
71+
<HintPath>..\packages\mzLib.1.0.93\lib\Spectra.dll</HintPath>
7272
<Private>True</Private>
7373
</Reference>
7474
<Reference Include="System" />
@@ -80,12 +80,12 @@
8080
<Reference Include="System.Data" />
8181
<Reference Include="System.Net.Http" />
8282
<Reference Include="System.Xml" />
83-
<Reference Include="Thermo, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
84-
<HintPath>..\packages\mzLib.1.0.91\lib\Thermo.dll</HintPath>
83+
<Reference Include="Thermo, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
84+
<HintPath>..\packages\mzLib.1.0.93\lib\Thermo.dll</HintPath>
8585
<Private>True</Private>
8686
</Reference>
87-
<Reference Include="UsefulProteomicsDatabases, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
88-
<HintPath>..\packages\mzLib.1.0.91\lib\UsefulProteomicsDatabases.dll</HintPath>
87+
<Reference Include="UsefulProteomicsDatabases, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
88+
<HintPath>..\packages\mzLib.1.0.93\lib\UsefulProteomicsDatabases.dll</HintPath>
8989
<Private>True</Private>
9090
</Reference>
9191
<Reference Include="Zlib.Portable, Version=1.11.0.0, Culture=neutral, processorArchitecture=MSIL">

CMD/packages.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="MathNet.Numerics" version="3.17.0" targetFramework="net451" />
4-
<package id="mzLib" version="1.0.91" targetFramework="net451" />
4+
<package id="mzLib" version="1.0.93" targetFramework="net451" />
55
<package id="NetSerializer" version="4.1.0" targetFramework="net451" />
66
<package id="Zlib.Portable" version="1.11.0" targetFramework="net451" />
77
</packages>

EngineLayer/Analysis/AnalysisEngine.cs

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using MassSpectrometry;
22
using MzLibUtil;
33
using Proteomics;
4-
using Spectra;
54
using System;
65
using System.Collections.Concurrent;
76
using System.Collections.Generic;
@@ -490,8 +489,6 @@ public void ScoreProteinGroups(List<ProteinGroup> proteinGroups, List<NewPsmWith
490489
// var sortedProteinGroups =
491490
proteinGroup.StrictRazorPeptideList.Add(peptide);
492491
}
493-
494-
495492
}
496493

497494
// calculate sequence coverage for each protein in the group
@@ -664,15 +661,15 @@ private static void IdentifyMods(BinTreeStructure myTreeStructure)
664661
for (int i = 0; i < hehe.Item2.Count(); i++)
665662
{
666663
char ye = hehe.Item2[i];
667-
if (ye.Equals('('))
664+
if (ye.Equals('['))
668665
{
669666
inModLevel++;
670667
if (inModLevel == 1)
671668
{
672669
continue;
673670
}
674671
}
675-
else if (ye.Equals(')'))
672+
else if (ye.Equals(']'))
676673
{
677674
inModLevel--;
678675
if (inModLevel == 0)

EngineLayer/CalibrationEngine/CalibrationEngine.cs

+57-26
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
using Chemistry;
22
using MassSpectrometry;
33
using MathNet.Numerics.Statistics;
4+
using MzLibUtil;
45
using Proteomics;
5-
using Spectra;
66
using System;
77
using System.Collections.Generic;
88
using System.IO;
99
using System.Linq;
10-
using MzLibUtil;
1110

1211
namespace EngineLayer.Calibration
1312
{
@@ -238,45 +237,77 @@ private CalibrationFunction Calibrate(List<LabeledDataPoint> trainingPoints)
238237
{
239238
foreach (var transform in transforms)
240239
{
241-
var ms1regressorLinear = new LinearCalibrationFunctionMathNet(transform);
242-
var ms2regressorLinear = new LinearCalibrationFunctionMathNet(transform);
243-
ms1regressorLinear.Train(trainList1);
244-
ms2regressorLinear.Train(trainList2);
245-
var MS1mse = ms1regressorLinear.getMSE(testList1);
246-
var MS2mse = ms2regressorLinear.getMSE(testList2);
247-
if (MS1mse < bestMS1MSE)
240+
Console.WriteLine("trying linear!");
241+
try
242+
{
243+
var ms1regressorLinear = new LinearCalibrationFunctionMathNet(transform);
244+
ms1regressorLinear.Train(trainList1);
245+
var MS1mse = ms1regressorLinear.getMSE(testList1);
246+
if (MS1mse < bestMS1MSE)
247+
{
248+
bestMS1MSE = MS1mse;
249+
bestMS1predictor = ms1regressorLinear;
250+
}
251+
}
252+
catch
248253
{
249-
bestMS1MSE = MS1mse;
250-
bestMS1predictor = ms1regressorLinear;
254+
Console.WriteLine("errored!");
251255
}
252-
if (MS2mse < bestMS2MSE)
256+
257+
try
253258
{
254-
bestMS2MSE = MS2mse;
255-
bestMS2predictor = ms2regressorLinear;
259+
var ms2regressorLinear = new LinearCalibrationFunctionMathNet(transform);
260+
ms2regressorLinear.Train(trainList2);
261+
var MS2mse = ms2regressorLinear.getMSE(testList2);
262+
if (MS2mse < bestMS2MSE)
263+
{
264+
bestMS2MSE = MS2mse;
265+
bestMS2predictor = ms2regressorLinear;
266+
}
267+
}
268+
catch
269+
{
270+
Console.WriteLine("errored!");
256271
}
257272
}
258273
foreach (var transform in transforms)
259274
{
260-
var ms1regressorQuadratic = new QuadraticCalibrationFunctionMathNet(transform);
261-
var ms2regressorQuadratic = new QuadraticCalibrationFunctionMathNet(transform);
262-
ms1regressorQuadratic.Train(trainList1);
263-
ms2regressorQuadratic.Train(trainList2);
264-
var MS1mse = ms1regressorQuadratic.getMSE(testList1);
265-
var MS2mse = ms2regressorQuadratic.getMSE(testList2);
266-
if (MS1mse < bestMS1MSE)
275+
Console.WriteLine("trying quadratic!");
276+
try
277+
{
278+
var ms1regressorQuadratic = new QuadraticCalibrationFunctionMathNet(transform);
279+
ms1regressorQuadratic.Train(trainList1);
280+
var MS1mse = ms1regressorQuadratic.getMSE(testList1);
281+
if (MS1mse < bestMS1MSE)
282+
{
283+
bestMS1MSE = MS1mse;
284+
bestMS1predictor = ms1regressorQuadratic;
285+
}
286+
}
287+
catch
267288
{
268-
bestMS1MSE = MS1mse;
269-
bestMS1predictor = ms1regressorQuadratic;
289+
Console.WriteLine("errored!");
290+
}
291+
try
292+
{
293+
var ms2regressorQuadratic = new QuadraticCalibrationFunctionMathNet(transform);
294+
ms2regressorQuadratic.Train(trainList2);
295+
var MS2mse = ms2regressorQuadratic.getMSE(testList2);
296+
if (MS2mse < bestMS2MSE)
297+
{
298+
bestMS2MSE = MS2mse;
299+
bestMS2predictor = ms2regressorQuadratic;
300+
}
270301
}
271-
if (MS2mse < bestMS2MSE)
302+
catch
272303
{
273-
bestMS2MSE = MS2mse;
274-
bestMS2predictor = ms2regressorQuadratic;
304+
Console.WriteLine("errored!");
275305
}
276306
}
277307
}
278308
catch (ArgumentException)
279309
{
310+
Console.WriteLine("Errored!");
280311
}
281312

282313
CalibrationFunction bestCf = new SeparateCalibrationFunction(bestMS1predictor, bestMS2predictor);

EngineLayer/EngineLayer.csproj

+24-18
Original file line numberDiff line numberDiff line change
@@ -34,36 +34,36 @@
3434
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
3535
</PropertyGroup>
3636
<ItemGroup>
37-
<Reference Include="Chemistry, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
38-
<HintPath>..\packages\mzLib.1.0.91\lib\Chemistry.dll</HintPath>
37+
<Reference Include="Chemistry, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
38+
<HintPath>..\packages\mzLib.1.0.93\lib\Chemistry.dll</HintPath>
3939
<Private>True</Private>
4040
</Reference>
41-
<Reference Include="MassSpectrometry, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
42-
<HintPath>..\packages\mzLib.1.0.91\lib\MassSpectrometry.dll</HintPath>
41+
<Reference Include="MassSpectrometry, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
42+
<HintPath>..\packages\mzLib.1.0.93\lib\MassSpectrometry.dll</HintPath>
4343
<Private>True</Private>
4444
</Reference>
4545
<Reference Include="MathNet.Numerics, Version=3.17.0.0, Culture=neutral, processorArchitecture=MSIL">
4646
<HintPath>..\packages\MathNet.Numerics.3.17.0\lib\net40\MathNet.Numerics.dll</HintPath>
4747
<Private>True</Private>
4848
</Reference>
49-
<Reference Include="mzIdentML, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
50-
<HintPath>..\packages\mzLib.1.0.91\lib\mzIdentML.dll</HintPath>
49+
<Reference Include="mzIdentML, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
50+
<HintPath>..\packages\mzLib.1.0.93\lib\mzIdentML.dll</HintPath>
5151
<Private>True</Private>
5252
</Reference>
53-
<Reference Include="MzLibUtil, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
54-
<HintPath>..\packages\mzLib.1.0.91\lib\MzLibUtil.dll</HintPath>
53+
<Reference Include="MzLibUtil, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
54+
<HintPath>..\packages\mzLib.1.0.93\lib\MzLibUtil.dll</HintPath>
5555
<Private>True</Private>
5656
</Reference>
57-
<Reference Include="MzML, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
58-
<HintPath>..\packages\mzLib.1.0.91\lib\MzML.dll</HintPath>
57+
<Reference Include="MzML, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
58+
<HintPath>..\packages\mzLib.1.0.93\lib\MzML.dll</HintPath>
5959
<Private>True</Private>
6060
</Reference>
61-
<Reference Include="Proteomics, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
62-
<HintPath>..\packages\mzLib.1.0.91\lib\Proteomics.dll</HintPath>
61+
<Reference Include="Proteomics, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
62+
<HintPath>..\packages\mzLib.1.0.93\lib\Proteomics.dll</HintPath>
6363
<Private>True</Private>
6464
</Reference>
65-
<Reference Include="Spectra, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
66-
<HintPath>..\packages\mzLib.1.0.91\lib\Spectra.dll</HintPath>
65+
<Reference Include="Spectra, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
66+
<HintPath>..\packages\mzLib.1.0.93\lib\Spectra.dll</HintPath>
6767
<Private>True</Private>
6868
</Reference>
6969
<Reference Include="System" />
@@ -74,12 +74,12 @@
7474
<Reference Include="System.Data" />
7575
<Reference Include="System.Net.Http" />
7676
<Reference Include="System.Xml" />
77-
<Reference Include="Thermo, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
78-
<HintPath>..\packages\mzLib.1.0.91\lib\Thermo.dll</HintPath>
77+
<Reference Include="Thermo, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
78+
<HintPath>..\packages\mzLib.1.0.93\lib\Thermo.dll</HintPath>
7979
<Private>True</Private>
8080
</Reference>
81-
<Reference Include="UsefulProteomicsDatabases, Version=1.0.91.0, Culture=neutral, processorArchitecture=AMD64">
82-
<HintPath>..\packages\mzLib.1.0.91\lib\UsefulProteomicsDatabases.dll</HintPath>
81+
<Reference Include="UsefulProteomicsDatabases, Version=1.0.93.0, Culture=neutral, processorArchitecture=AMD64">
82+
<HintPath>..\packages\mzLib.1.0.93\lib\UsefulProteomicsDatabases.dll</HintPath>
8383
<Private>True</Private>
8484
</Reference>
8585
<Reference Include="Zlib.Portable, Version=1.11.0.0, Culture=neutral, processorArchitecture=MSIL">
@@ -174,6 +174,12 @@
174174
<Content Include="Mods\glyco.txt">
175175
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
176176
</Content>
177+
<Content Include="Mods\pt.txt">
178+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
179+
</Content>
180+
<Content Include="Mods\metals.txt">
181+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
182+
</Content>
177183
<Content Include="Mods\m.txt">
178184
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
179185
</Content>

EngineLayer/Gptmd/GptmdEngine.cs

+30-28
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using MzLibUtil;
22
using Proteomics;
3-
using Spectra;
43
using System;
54
using System.Collections.Generic;
65
using System.Linq;
@@ -34,6 +33,36 @@ public GptmdEngine(List<NewPsmWithFdr> allIdentifications, bool isotopeErrors, L
3433

3534
#endregion Public Constructors
3635

36+
#region Public Methods
37+
38+
public static bool ModFits(ModificationWithMass attemptToLocalize, string proteinBaseSequence, int peptideOneBasedIndex, int peptideLength, int proteinOneBasedIndex, int proteinLength)
39+
{
40+
var motif = attemptToLocalize.motif.Motif;
41+
// First find the capital letter...
42+
var hehe = motif.IndexOf(motif.First(b => char.IsUpper(b)));
43+
44+
var proteinToMotifOffset = proteinOneBasedIndex - hehe - 1;
45+
var indexUp = 0;
46+
// Look up starting at and including the capital letter
47+
while (indexUp < motif.Length)
48+
{
49+
if (indexUp + proteinToMotifOffset < 0 || indexUp + proteinToMotifOffset >= proteinLength || (!char.ToUpper(motif[indexUp]).Equals('X') && !char.ToUpper(motif[indexUp]).Equals(proteinBaseSequence[indexUp + proteinToMotifOffset])))
50+
return false;
51+
indexUp++;
52+
}
53+
if (attemptToLocalize.position == ModificationSites.NProt && (proteinOneBasedIndex > 2))
54+
return false;
55+
if (attemptToLocalize.position == ModificationSites.NPep && peptideOneBasedIndex > 1)
56+
return false;
57+
if (attemptToLocalize.position == ModificationSites.PepC && peptideOneBasedIndex < peptideLength)
58+
return false;
59+
if (attemptToLocalize.position == ModificationSites.ProtC && proteinOneBasedIndex < proteinLength)
60+
return false;
61+
return true;
62+
}
63+
64+
#endregion Public Methods
65+
3766
#region Protected Methods
3867

3968
protected override MyResults RunSpecific()
@@ -77,35 +106,8 @@ protected override MyResults RunSpecific()
77106

78107
#endregion Protected Methods
79108

80-
81109
#region Private Methods
82110

83-
public static bool ModFits(ModificationWithMass attemptToLocalize, string proteinBaseSequence, int peptideOneBasedIndex, int peptideLength, int proteinOneBasedIndex, int proteinLength)
84-
{
85-
var motif = attemptToLocalize.motif.Motif;
86-
// First find the capital letter...
87-
var hehe = motif.IndexOf(motif.First(b => char.IsUpper(b)));
88-
89-
var proteinToMotifOffset = proteinOneBasedIndex - hehe - 1;
90-
var indexUp = 0;
91-
// Look up starting at and including the capital letter
92-
while (indexUp < motif.Length)
93-
{
94-
if (!char.ToUpper(motif[indexUp]).Equals('X') && !char.ToUpper(motif[indexUp]).Equals(proteinBaseSequence[indexUp + proteinToMotifOffset]))
95-
return false;
96-
indexUp++;
97-
}
98-
if (attemptToLocalize.position == ModificationSites.NProt && (proteinOneBasedIndex > 2))
99-
return false;
100-
if (attemptToLocalize.position == ModificationSites.NPep && peptideOneBasedIndex > 1)
101-
return false;
102-
if (attemptToLocalize.position == ModificationSites.PepC && peptideOneBasedIndex < peptideLength)
103-
return false;
104-
if (attemptToLocalize.position == ModificationSites.ProtC && proteinOneBasedIndex < proteinLength)
105-
return false;
106-
return true;
107-
}
108-
109111
private static IEnumerable<ModificationWithMass> GetMod(double scanPrecursorMass, double peptideMonoisotopicMass, bool isotopeErrors, IEnumerable<ModificationWithMass> allMods, IEnumerable<Tuple<double, double>> combos, Tolerance precursorTolerance)
110112
{
111113
foreach (var Mod in allMods)

0 commit comments

Comments
 (0)