diff --git a/EngineLayer/EngineLayer.csproj b/EngineLayer/EngineLayer.csproj index c02447048..e6e68946b 100644 --- a/EngineLayer/EngineLayer.csproj +++ b/EngineLayer/EngineLayer.csproj @@ -126,6 +126,8 @@ + + diff --git a/EngineLayer/GlobalEngineLevelSettings.cs b/EngineLayer/GlobalEngineLevelSettings.cs index df1b1984e..904eeb019 100644 --- a/EngineLayer/GlobalEngineLevelSettings.cs +++ b/EngineLayer/GlobalEngineLevelSettings.cs @@ -122,6 +122,8 @@ private static IEnumerable LoadSearchModesFromFile() yield return new IntervalMassDiffAcceptor("2.1aroundZero", new List() { new DoubleRange(-2.1, 2.1) }); yield return new IntervalMassDiffAcceptor("3.5aroundZero", new List() { new DoubleRange(-3.5, 3.5) }); yield return new OpenSearchMode(); + yield return new OpenLowTheoSearchMode(); + yield return new OpenHighTheoSearchMode(); yield return new IntervalMassDiffAcceptor("-187andUp", new List { new DoubleRange(-187, double.PositiveInfinity) }); foreach (var sm in GetResidueInclusionExclusionSearchModes(new DoubleRange(-187, double.PositiveInfinity), 0.0075)) yield return sm; diff --git a/EngineLayer/ModernSearch/ModernSearchEngine.cs b/EngineLayer/ModernSearch/ModernSearchEngine.cs index 2afb6b008..f21547b5c 100644 --- a/EngineLayer/ModernSearch/ModernSearchEngine.cs +++ b/EngineLayer/ModernSearch/ModernSearchEngine.cs @@ -97,25 +97,29 @@ protected override MetaMorpheusEngineResults RunSpecific() { if (fragmentIndex[fragmentBin] != null) { - var peptideIdsInThisBin = fragmentIndex[fragmentBin]; - int l = 0; - int r = peptideIdsInThisBin.Count - 1; - int m = 0; + List peptideIdsInThisBin = fragmentIndex[fragmentBin]; - // binary search in the fragment bin for lowest acceptable precursor mass - while (l <= r) + int m = 0; + if (!Double.IsInfinity(lowestMassPeptideToLookFor)) { - m = l + ((r - l) / 2); - - if (r - l < 2) - break; - if (peptideIndex[peptideIdsInThisBin[m]].MonoisotopicMassIncludingFixedMods < lowestMassPeptideToLookFor) - l = m + 1; - else - r = m - 1; + int l = 0; + int r = peptideIdsInThisBin.Count - 1; + + // binary search in the fragment bin for lowest acceptable precursor mass + while (l <= r) + { + m = l + ((r - l) / 2); + + if (r - l < 2) + break; + if (peptideIndex[peptideIdsInThisBin[m]].MonoisotopicMassIncludingFixedMods < lowestMassPeptideToLookFor) + l = m + 1; + else + r = m - 1; + } + if (m > 0) + m--; } - if (m > 0) - m--; // add +1 score for each peptide candidate in the scoring table up to the maximum allowed precursor mass if (!Double.IsInfinity(highestMassPeptideToLookFor)) @@ -148,7 +152,7 @@ protected override MetaMorpheusEngineResults RunSpecific() scoringTable[id]++; // add possible search results to the hashset of id's - if (scoringTable[id] >= intScoreCutoff) + if (scoringTable[id] == intScoreCutoff) { int notch = massDiffAcceptors.Accepts(scan.PrecursorMass, peptideIndex[id].MonoisotopicMassIncludingFixedMods); diff --git a/EngineLayer/NonSpecificEnzymeSearch/NonSpecificEnzymeSearchEngine.cs b/EngineLayer/NonSpecificEnzymeSearch/NonSpecificEnzymeSearchEngine.cs index 49981d8ed..a67469524 100644 --- a/EngineLayer/NonSpecificEnzymeSearch/NonSpecificEnzymeSearchEngine.cs +++ b/EngineLayer/NonSpecificEnzymeSearch/NonSpecificEnzymeSearchEngine.cs @@ -30,7 +30,7 @@ public NonSpecificEnzymeSearchEngine(Psm[] globalPsms, Ms2ScanWithSpecificMass[] protected override MetaMorpheusEngineResults RunSpecific() { - Status("In nonspecific search engine..." + currentPartition + "/" + CommonParameters.TotalPartitions, nestedIds); + Status("Performing nonspecific search... " + currentPartition + "/" + CommonParameters.TotalPartitions, nestedIds); TerminusType terminusType = ProductTypeMethod.IdentifyTerminusType(lp); var listOfSortedms2ScansLength = listOfSortedms2Scans.Length; diff --git a/EngineLayer/PrecursorSearchModes/HighTheoreticalDiffAcceptor.cs b/EngineLayer/PrecursorSearchModes/HighTheoreticalDiffAcceptor.cs new file mode 100644 index 000000000..f5921f32a --- /dev/null +++ b/EngineLayer/PrecursorSearchModes/HighTheoreticalDiffAcceptor.cs @@ -0,0 +1,46 @@ +using MzLibUtil; +using System; +using System.Collections.Generic; + + +namespace EngineLayer +{ + public class OpenHighTheoSearchMode : MassDiffAcceptor + { + #region Public Constructors + + public OpenHighTheoSearchMode() : base("OpenHigh") + { + } + + #endregion Public Constructors + + #region Public Methods + + public override int Accepts(double scanPrecursorMass, double peptideMass) + { + if (scanPrecursorMass < peptideMass + 1) + return 0; + else + return -1; + } + + public override IEnumerable GetAllowedPrecursorMassIntervals(double peptideMonoisotopicMass) + { + yield return new AllowedIntervalWithNotch(new DoubleRange(peptideMonoisotopicMass-1, Double.PositiveInfinity), 0); + } + + public override string ToProseString() + { + return ("unboundedHigh"); + } + + public override string ToString() + { + return FileNameAddition + " OpenHighSearch"; + } + + #endregion Public Methods + } +} + diff --git a/EngineLayer/PrecursorSearchModes/LowTheoreticalDiffAcceptor.cs b/EngineLayer/PrecursorSearchModes/LowTheoreticalDiffAcceptor.cs new file mode 100644 index 000000000..0416baea3 --- /dev/null +++ b/EngineLayer/PrecursorSearchModes/LowTheoreticalDiffAcceptor.cs @@ -0,0 +1,45 @@ +using MzLibUtil; +using System.Collections.Generic; +using System; + +namespace EngineLayer +{ + public class OpenLowTheoSearchMode : MassDiffAcceptor + { + #region Public Constructors + + public OpenLowTheoSearchMode() : base("OpenLow") + { + } + + #endregion Public Constructors + + #region Public Methods + + public override int Accepts(double scanPrecursorMass, double peptideMass) + { + if (scanPrecursorMass > peptideMass - 1) + return 0; + else + return -1; + } + + public override IEnumerable GetAllowedPrecursorMassIntervals(double peptideMonoisotopicMass) + { + yield return new AllowedIntervalWithNotch(new DoubleRange(Double.NegativeInfinity, peptideMonoisotopicMass + 1), 0); + } + + public override string ToProseString() + { + return ("unboundedHigh"); + } + + public override string ToString() + { + return FileNameAddition + " OpenHighSearch"; + } + + #endregion Public Methods + } +} + diff --git a/EngineLayer/PrecursorSearchModes/OpenMassDiffAcceptor.cs b/EngineLayer/PrecursorSearchModes/OpenMassDiffAcceptor.cs index 43158d2c4..8aabcb08f 100644 --- a/EngineLayer/PrecursorSearchModes/OpenMassDiffAcceptor.cs +++ b/EngineLayer/PrecursorSearchModes/OpenMassDiffAcceptor.cs @@ -1,5 +1,6 @@ using MzLibUtil; using System.Collections.Generic; +using System; namespace EngineLayer { @@ -22,7 +23,7 @@ public override int Accepts(double scanPrecursorMass, double peptideMass) public override IEnumerable GetAllowedPrecursorMassIntervals(double peptideMonoisotopicMass) { - yield return new AllowedIntervalWithNotch(new DoubleRange(double.MinValue, double.MaxValue), 0); + yield return new AllowedIntervalWithNotch(new DoubleRange(Double.NegativeInfinity, Double.PositiveInfinity), 0); } public override string ToProseString() diff --git a/TaskLayer/MetaMorpheusTask.cs b/TaskLayer/MetaMorpheusTask.cs index fec084f34..70a782d5e 100644 --- a/TaskLayer/MetaMorpheusTask.cs +++ b/TaskLayer/MetaMorpheusTask.cs @@ -49,6 +49,9 @@ public abstract class MetaMorpheusTask .ConfigureType(type => type .WithConversionFor(convert => convert .ToToml(custom => custom.ToString()))) + .ConfigureType(type => type + .WithConversionFor(convert => convert + .ToToml(custom => custom.ToString()))) .ConfigureType(type => type .WithConversionFor(convert => convert .ToToml(custom => custom.ToString())))