From 5186b827f9c6556eb5b4dc01d59a52bc9335ea2c Mon Sep 17 00:00:00 2001 From: trishorts Date: Tue, 15 Oct 2024 14:09:25 -0500 Subject: [PATCH] add override qValue threshold for unit testing --- .../EngineLayer/FdrAnalysis/FdrAnalysisEngine.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/MetaMorpheus/EngineLayer/FdrAnalysis/FdrAnalysisEngine.cs b/MetaMorpheus/EngineLayer/FdrAnalysis/FdrAnalysisEngine.cs index c8a7cdcd9..576a61bb4 100644 --- a/MetaMorpheus/EngineLayer/FdrAnalysis/FdrAnalysisEngine.cs +++ b/MetaMorpheus/EngineLayer/FdrAnalysis/FdrAnalysisEngine.cs @@ -14,11 +14,12 @@ public class FdrAnalysisEngine : MetaMorpheusEngine private readonly string AnalysisType; private readonly string OutputFolder; // used for storing PEP training models private readonly bool DoPEP; + private readonly bool QvalueThresholdOverride; private readonly int PsmCountThresholdForInvertedQvalue = 1000; public FdrAnalysisEngine(List psms, int massDiffAcceptorNumNotches, CommonParameters commonParameters, List<(string fileName, CommonParameters fileSpecificParameters)> fileSpecificParameters, List nestedIds, string analysisType = "PSM", - bool doPEP = true, string outputFolder = null) : base(commonParameters, fileSpecificParameters, nestedIds) + bool doPEP = true, string outputFolder = null, bool qvalueThresholdOverride = false) : base(commonParameters, fileSpecificParameters, nestedIds) { AllPsms = psms.OrderByDescending(p => p).ToList(); MassDiffAcceptorNumNotches = massDiffAcceptorNumNotches; @@ -28,6 +29,7 @@ public FdrAnalysisEngine(List psms, int massDiffAcceptorNumNotche if (AllPsms.Any()) AddPsmAndPeptideFdrInfoIfNotPresent(); if (fileSpecificParameters == null) throw new ArgumentNullException("file specific parameters cannot be null"); + QvalueThresholdOverride = qvalueThresholdOverride; } private void AddPsmAndPeptideFdrInfoIfNotPresent() @@ -72,10 +74,10 @@ private void DoFalseDiscoveryRateAnalysis(FdrAnalysisResults myAnalysisResults) .Select(b => b.FirstOrDefault()) .ToList(); - if (psms.Count > PsmCountThresholdForInvertedQvalue & DoPEP) + if ((psms.Count > PsmCountThresholdForInvertedQvalue || QvalueThresholdOverride) & DoPEP) { CalculateQValue(psms, peptideLevelCalculation: false, pepCalculation: false); - if (peptides.Count > PsmCountThresholdForInvertedQvalue) + if (peptides.Count > PsmCountThresholdForInvertedQvalue || QvalueThresholdOverride) { CalculateQValue(peptides, peptideLevelCalculation: true, pepCalculation: false); @@ -200,7 +202,7 @@ public void CalculateQValue(List psms, bool peptideLevelCalculati } else { - if(psms.Count < PsmCountThresholdForInvertedQvalue) + if(psms.Count < PsmCountThresholdForInvertedQvalue || QvalueThresholdOverride) { QValueTraditional(psms, peptideLevelAnalysis: peptideLevelCalculation);