Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small edits #683

Merged
merged 13 commits into from
Sep 25, 2017
2 changes: 2 additions & 0 deletions EngineLayer/EngineLayer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@
<Compile Include="Localization\LocalizationEngineResults.cs" />
<Compile Include="ModificationAnalysis\ModificationAnalysisEngine.cs" />
<Compile Include="ModificationAnalysis\ModificationAnalysisResults.cs" />
<Compile Include="PrecursorSearchModes\HighTheoreticalDiffAcceptor.cs" />
<Compile Include="PrecursorSearchModes\LowTheoreticalDiffAcceptor.cs" />
<Compile Include="ProteinParsimony\ProteinGroup.cs" />
<Compile Include="ProteinParsimony\ProteinParsimonyEngine.cs" />
<Compile Include="ProteinParsimony\ProteinParsimonyResults.cs" />
Expand Down
2 changes: 2 additions & 0 deletions EngineLayer/GlobalEngineLevelSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ private static IEnumerable<MassDiffAcceptor> LoadSearchModesFromFile()
yield return new IntervalMassDiffAcceptor("2.1aroundZero", new List<DoubleRange>() { new DoubleRange(-2.1, 2.1) });
yield return new IntervalMassDiffAcceptor("3.5aroundZero", new List<DoubleRange>() { 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<DoubleRange> { new DoubleRange(-187, double.PositiveInfinity) });
foreach (var sm in GetResidueInclusionExclusionSearchModes(new DoubleRange(-187, double.PositiveInfinity), 0.0075))
yield return sm;
Expand Down
38 changes: 21 additions & 17 deletions EngineLayer/ModernSearch/ModernSearchEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> 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))
Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
46 changes: 46 additions & 0 deletions EngineLayer/PrecursorSearchModes/HighTheoreticalDiffAcceptor.cs
Original file line number Diff line number Diff line change
@@ -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<AllowedIntervalWithNotch> 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
}
}

45 changes: 45 additions & 0 deletions EngineLayer/PrecursorSearchModes/LowTheoreticalDiffAcceptor.cs
Original file line number Diff line number Diff line change
@@ -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<AllowedIntervalWithNotch> 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
}
}

3 changes: 2 additions & 1 deletion EngineLayer/PrecursorSearchModes/OpenMassDiffAcceptor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using MzLibUtil;
using System.Collections.Generic;
using System;

namespace EngineLayer
{
Expand All @@ -22,7 +23,7 @@ public override int Accepts(double scanPrecursorMass, double peptideMass)

public override IEnumerable<AllowedIntervalWithNotch> 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()
Expand Down
3 changes: 3 additions & 0 deletions TaskLayer/MetaMorpheusTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public abstract class MetaMorpheusTask
.ConfigureType<OpenSearchMode>(type => type
.WithConversionFor<TomlString>(convert => convert
.ToToml(custom => custom.ToString())))
.ConfigureType<OpenHighTheoSearchMode>(type => type
.WithConversionFor<TomlString>(convert => convert
.ToToml(custom => custom.ToString())))
.ConfigureType<SingleAbsoluteAroundZeroSearchMode>(type => type
.WithConversionFor<TomlString>(convert => convert
.ToToml(custom => custom.ToString())))
Expand Down