Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into gptmdApproachUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
trishorts committed Sep 19, 2024
2 parents 7a7dad6 + 4d5e0ef commit 22fb336
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 12 deletions.
2 changes: 1 addition & 1 deletion MetaMorpheus/CMD/CMD.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PackageReference Include="Microsoft.ML.CpuMath" Version="3.0.1" />
<PackageReference Include="Microsoft.ML.FastTree" Version="3.0.1" />
<PackageReference Include="Microsoft.NETCore.App" Version="2.2.8" />
<PackageReference Include="mzLib" Version="1.0.551" />
<PackageReference Include="mzLib" Version="1.0.552" />
<PackageReference Include="Nett" Version="0.15.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion MetaMorpheus/EngineLayer/EngineLayer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PackageReference Include="Microsoft.ML.CpuMath" Version="3.0.1" />
<PackageReference Include="Microsoft.ML.FastTree" Version="3.0.1" />
<PackageReference Include="Microsoft.NETCore.App" Version="2.2.8" />
<PackageReference Include="mzLib" Version="1.0.551" />
<PackageReference Include="mzLib" Version="1.0.552" />
<PackageReference Include="NETStandard.Library" Version="2.0.3" />
<PackageReference Include="Nett" Version="0.15.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
Expand Down
11 changes: 11 additions & 0 deletions MetaMorpheus/EngineLayer/FdrAnalysis/FdrInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,16 @@ public class FdrInfo
public double QValueNotch { get; set; }
public double PEP { get; set; }
public double PEP_QValue { get; set; }

/// <summary>
/// Creates a new FdrInfo object where Q-Values and PEP_Qvalues are set to 2 by default
/// This is done to avoid situations where q-values aren't calcualted for a given peptides, but it is still
/// reported in the final results.
/// </summary>
public FdrInfo()
{
QValue = 2;
PEP_QValue = 2;
}
}
}
25 changes: 23 additions & 2 deletions MetaMorpheus/EngineLayer/FdrAnalysis/PEPAnalysisEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,27 @@ namespace EngineLayer
{
public class PepAnalysisEngine
{
private int _randomSeed = 42;

/// <summary>
/// This method contains the hyper-parameters that will be used when training the machine learning model
/// </summary>
/// <returns> Options object to be passed in to the FastTree constructor </returns>
public Microsoft.ML.Trainers.FastTree.FastTreeBinaryTrainer.Options BGDTreeOptions =>
new Microsoft.ML.Trainers.FastTree.FastTreeBinaryTrainer.Options
{
NumberOfThreads = 1,
NumberOfTrees = 400,
MinimumExampleCountPerLeaf = 10,
NumberOfLeaves = 20,
LearningRate = 0.2,
LabelColumnName = "Label",
FeatureColumnName = "Features",
Seed = _randomSeed,
FeatureSelectionSeed = _randomSeed,
RandomStart = false
};

private static readonly double AbsoluteProbabilityThatDistinguishesPeptides = 0.05;

//These two dictionaries contain the average and standard deviations of hydrophobicitys measured in 1 minute increments accross each raw
Expand Down Expand Up @@ -105,10 +126,10 @@ public string ComputePEPValuesForAllPSMs()
}
}

MLContext mlContext = new MLContext();
MLContext mlContext = new MLContext(seed: _randomSeed);
TransformerChain<BinaryPredictionTransformer<Microsoft.ML.Calibrators.CalibratedModelParametersBase<Microsoft.ML.Trainers.FastTree.FastTreeBinaryModelParameters, Microsoft.ML.Calibrators.PlattCalibrator>>>[] trainedModels = new TransformerChain<BinaryPredictionTransformer<Microsoft.ML.Calibrators.CalibratedModelParametersBase<Microsoft.ML.Trainers.FastTree.FastTreeBinaryModelParameters, Microsoft.ML.Calibrators.PlattCalibrator>>>[numGroups];

var trainer = mlContext.BinaryClassification.Trainers.FastTree(labelColumnName: "Label", featureColumnName: "Features", numberOfTrees: 400);
var trainer = mlContext.BinaryClassification.Trainers.FastTree(BGDTreeOptions);
var pipeline = mlContext.Transforms.Concatenate("Features", TrainingVariables)
.Append(trainer);

Expand Down
2 changes: 1 addition & 1 deletion MetaMorpheus/GUI/GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<PackageReference Include="Microsoft.ML.CpuMath" Version="3.0.1" />
<PackageReference Include="Microsoft.ML.FastTree" Version="3.0.1" />
<PackageReference Include="Microsoft.NETCore.App" Version="2.2.8" />
<PackageReference Include="mzLib" Version="1.0.551" />
<PackageReference Include="mzLib" Version="1.0.552" />
<PackageReference Include="Nett" Version="0.15.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="OxyPlot.Core" Version="2.0.0" />
Expand Down
2 changes: 1 addition & 1 deletion MetaMorpheus/GuiFunctions/GuiFunctions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<ItemGroup>
<PackageReference Include="itext7" Version="8.0.5" />
<PackageReference Include="itext7.bouncy-castle-adapter" Version="8.0.5" />
<PackageReference Include="mzLib" Version="1.0.551" />
<PackageReference Include="mzLib" Version="1.0.552" />
<PackageReference Include="OxyPlot.Wpf" Version="2.0.0" />
<PackageReference Include="Svg" Version="3.4.7" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions MetaMorpheus/TaskLayer/SearchTask/PostSearchAnalysisTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ private void CalculatePsmAndPeptideFdr(List<SpectralMatch> psms, string analysis
// this could cause weird PSM FDR issues

Status("Estimating PSM FDR...", Parameters.SearchTaskId);
new FdrAnalysisEngine(psms, Parameters.NumNotches, CommonParameters, this.FileSpecificParameters,
new List<string> { Parameters.SearchTaskId }, analysisType: analysisType, doPEP: doPep, outputFolder: Parameters.OutputFolder).Run();
new FdrAnalysisEngine(psms, Parameters.NumNotches, CommonParameters, this.FileSpecificParameters,
new List<string> { Parameters.SearchTaskId }, analysisType: analysisType, doPEP: doPep, outputFolder: Parameters.OutputFolder).Run();

Status("Done estimating PSM FDR!", Parameters.SearchTaskId);
}
Expand Down
2 changes: 1 addition & 1 deletion MetaMorpheus/TaskLayer/TaskLayer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PackageReference Include="Microsoft.ML.CpuMath" Version="3.0.1" />
<PackageReference Include="Microsoft.ML.FastTree" Version="3.0.1" />
<PackageReference Include="Microsoft.NETCore.App" Version="2.2.8" />
<PackageReference Include="mzLib" Version="1.0.551" />
<PackageReference Include="mzLib" Version="1.0.552" />
<PackageReference Include="NetSerializer" Version="4.1.2" />
<PackageReference Include="Nett" Version="0.15.0" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion MetaMorpheus/Test/Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PackageReference Include="Microsoft.ML" Version="3.0.1" />
<PackageReference Include="Microsoft.ML.CpuMath" Version="3.0.1" />
<PackageReference Include="Microsoft.ML.FastTree" Version="3.0.1" />
<PackageReference Include="mzLib" Version="1.0.551" />
<PackageReference Include="mzLib" Version="1.0.552" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
Expand Down
4 changes: 2 additions & 2 deletions MetaMorpheus/Test/XLTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,8 @@ public static void XlTest_MoreComprehensive()
}
}

Assert.AreEqual(47, inter);
Assert.AreEqual(73, intra);
Assert.AreEqual(53, inter);
Assert.AreEqual(81, intra);
Assert.AreEqual(0, unnasignedCrossType);


Expand Down

0 comments on commit 22fb336

Please sign in to comment.