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

Test digest two xmls for same protein #824

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions mzLib/Omics/Digestion/DigestionProduct.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Omics.Modifications;
using Omics.Modifications;

namespace Omics.Digestion
{
Expand Down Expand Up @@ -188,7 +182,5 @@ private static Dictionary<int, Modification> GetNewVariableModificationPattern(i

return modification_pattern;
}


}
}
57 changes: 29 additions & 28 deletions mzLib/Proteomics/ProteolyticDigestion/ProteolyticPeptide.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,48 +97,49 @@ internal IEnumerable<PeptideWithSetModifications> GetModifiedPeptides(IEnumerabl
}

// LOCALIZED MODS
foreach (var kvp in Protein.OneBasedPossibleLocalizedModifications)
foreach (var localizedMod in Protein.OneBasedPossibleLocalizedModifications
.SelectMany(kvp => kvp.Value.Select(value => (kvp.Key, value)))
.OrderBy(tuple => tuple.Key)
.ThenBy(tuple => tuple.value.IdWithMotif))
{
bool inBounds = kvp.Key >= OneBasedStartResidue && kvp.Key <= OneBasedEndResidue;
bool inBounds = localizedMod.Key >= OneBasedStartResidue && localizedMod.Key <= OneBasedEndResidue;
if (!inBounds)
{
continue;
}

int locInPeptide = kvp.Key - OneBasedStartResidueInProtein + 1;
foreach (Modification modWithMass in kvp.Value)
int locInPeptide = localizedMod.Key - OneBasedStartResidueInProtein + 1;

if (localizedMod.value is Modification variableModification)
{
if (modWithMass is Modification variableModification)
// Check if can be a n-term mod
if (locInPeptide == 1 && CanBeNTerminalMod(variableModification, peptideLength) && !Protein.IsDecoy)
{
// Check if can be a n-term mod
if (locInPeptide == 1 && CanBeNTerminalMod(variableModification, peptideLength) && !Protein.IsDecoy)
{
pepNTermVariableMods.Add(variableModification);
}
pepNTermVariableMods.Add(variableModification);
}

int r = locInPeptide - 1;
if (r >= 0 && r < peptideLength
&& (Protein.IsDecoy ||
(ModificationLocalization.ModFits(variableModification, Protein.BaseSequence, r + 1, peptideLength, OneBasedStartResidueInProtein + r)
&& variableModification.LocationRestriction == "Anywhere.")))
int r = locInPeptide - 1;
if (r >= 0 && r < peptideLength
&& (Protein.IsDecoy ||
(ModificationLocalization.ModFits(variableModification, Protein.BaseSequence, r + 1, peptideLength, OneBasedStartResidueInProtein + r)
&& variableModification.LocationRestriction == "Anywhere.")))
{
if (!twoBasedPossibleVariableAndLocalizeableModifications.TryGetValue(r + 2, out List<Modification> residueVariableMods))
{
if (!twoBasedPossibleVariableAndLocalizeableModifications.TryGetValue(r + 2, out List<Modification> residueVariableMods))
{
residueVariableMods = new List<Modification> { variableModification };
twoBasedPossibleVariableAndLocalizeableModifications.Add(r + 2, residueVariableMods);
}
else
{
residueVariableMods.Add(variableModification);
}
residueVariableMods = new List<Modification> { variableModification };
twoBasedPossibleVariableAndLocalizeableModifications.Add(r + 2, residueVariableMods);
}

// Check if can be a c-term mod
if (locInPeptide == peptideLength && CanBeCTerminalMod(variableModification, peptideLength) && !Protein.IsDecoy)
else
{
pepCTermVariableMods.Add(variableModification);
residueVariableMods.Add(variableModification);
}
}

// Check if can be a c-term mod
if (locInPeptide == peptideLength && CanBeCTerminalMod(variableModification, peptideLength) && !Protein.IsDecoy)
{
pepCTermVariableMods.Add(variableModification);
}
}
}

Expand Down
Loading
Loading