Skip to content

Commit

Permalink
fixed additional locks in PEP
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Sol committed Jan 31, 2025
1 parent 9bef2da commit 2d4a075
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions MetaMorpheus/EngineLayer/FdrAnalysis/PEPAnalysisEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,13 @@ public static string AggregateMetricsForOutput(List<CalibratedBinaryClassificati
}

private readonly object _modelLock = new();
private readonly object _peptideCountLock = new();

public int Compute_PSM_PEP(List<SpectralMatchGroup> peptideGroups,
List<int> peptideGroupIndices,
MLContext mLContext, TransformerChain<BinaryPredictionTransformer<Microsoft.ML.Calibrators.CalibratedModelParametersBase<Microsoft.ML.Trainers.FastTree.FastTreeBinaryModelParameters, Microsoft.ML.Calibrators.PlattCalibrator>>> trainedModel, string searchType, string outputFolder)
{
int maxThreads = FileSpecificParametersDictionary.Values.FirstOrDefault().MaxThreadsToUsePerFile;
object lockObject = new object();
int ambiguousPeptidesResolved = 0;

//the trained model is not threadsafe. Therefore, to use the same model for each thread saved the model to disk. Then each thread reads its own copy of the model back from disk.
Expand Down Expand Up @@ -460,7 +460,7 @@ public int Compute_PSM_PEP(List<SpectralMatchGroup> peptideGroups,
}
}

lock (lockObject)
lock (_peptideCountLock)
{
ambiguousPeptidesResolved += ambigousPeptidesRemovedinThread;
}
Expand Down

0 comments on commit 2d4a075

Please sign in to comment.