Class ModificationUtils
java.lang.Object
com.compomics.util.experiment.identification.utils.ModificationUtils
public class ModificationUtils extends Object
This class groups functions that can be used to work with modifications.
- Author:
- Marc Vaudel, Harald Barsnes
-
Field Summary
Fields Modifier and Type Field Description static HashMap<Integer,int[]>
ARRAYS_MAP
Map of arrays for C-term.static int[]
EMPTY
Empty array for no result.static int[]
ZERO
Array for N-term. -
Constructor Summary
Constructors Constructor Description ModificationUtils()
Empty default constructor. -
Method Summary
Modifier and Type Method Description static void
appendTaggedResidue(StringBuilder stringBuilder, char residue, String modificationName, ModificationParameters modificationProfile, int localizationConfidenceLevel, boolean useHtmlColorCoding, boolean useShortName)
Appends the single residue as a tagged string (HTML color or PTM tag).static void
appendTaggedResidue(StringBuilder stringBuilder, char residue, String confidentModification, String representativeAmbiguousModification, String secondaryAmbiguousModification, String fixedModification, ModificationParameters modificationProfile, boolean useHtmlColorCoding, boolean useShortName)
Returns the single residue as a tagged string (HTML color or PTM tag).static HashSet<String>
getAllModifications(Peptide peptide, ModificationParameters modificationParameters, SequenceProvider sequenceProvider, SequenceMatchingParameters sequenceMatchingParameters)
Returns a set of the names of all modifications found on a peptide.static HashSet<String>
getAllModifications(Tag tag, ModificationParameters modificationParameters, SequenceMatchingParameters sequenceMatchingParameters)
Returns a set of the names of all modifications found on a tag.static int[]
getArray(int index)
Returns an array containing only the given index.static HashMap<Integer,HashSet<String>>
getExpectedModifications(double modMass, ModificationParameters modificationParameters, Peptide peptide, double massTolerance, SequenceProvider sequenceProvider, SequenceMatchingParameters sequenceMatchingParameters, SearchParameters searchParameters)
Returns the expected modifications for a given modification mass indexed by site.static int[]
getPossibleModificationSites(AminoAcidSequence aminoAcidSequence, boolean nTerm, boolean cTerm, Modification modification, SequenceMatchingParameters sequenceMatchingParameters)
Returns an array of the possible modification sites for the given modification on the given peptide.static int[]
getPossibleModificationSites(Peptide peptide, Modification modification, SequenceProvider sequenceProvider, SequenceMatchingParameters sequenceMatchingParameters)
Returns an array of the possible modification sites for the given modification on the given peptide.static int
getSite(int index, int sequenceLength)
Returns the 1-based index on the peptide.static String
getTaggedModifiedSequence(ModificationParameters modificationProfile, String sequence, String[] confidentModificationSites, String[] representativeAmbiguousModificationSites, String[] secondaryAmbiguousModificationSites, String[] fixedModificationSites, boolean useHtmlColorCoding, boolean useShortName)
Returns the modified sequence as a tagged string with potential modification sites color coded or with PTM tags, e.g, <mox>.
-
Field Details
-
EMPTY
public static final int[] EMPTYEmpty array for no result. -
ZERO
public static final int[] ZEROArray for N-term. -
ARRAYS_MAP
Map of arrays for C-term.
-
-
Constructor Details
-
ModificationUtils
public ModificationUtils()Empty default constructor.
-
-
Method Details
-
getArray
public static int[] getArray(int index)Returns an array containing only the given index.- Parameters:
index
- the index- Returns:
- an array containing only the given index
-
getPossibleModificationSites
public static int[] getPossibleModificationSites(Peptide peptide, Modification modification, SequenceProvider sequenceProvider, SequenceMatchingParameters sequenceMatchingParameters)Returns an array of the possible modification sites for the given modification on the given peptide. N-term modifications are at index 0, C-term at sequence length + 1, and amino acid at 1-based index on the sequence.- Parameters:
peptide
- the peptidemodification
- the modificationsequenceProvider
- a protein sequence providersequenceMatchingParameters
- the sequence matching parameters- Returns:
- an array of the possible modification sites
-
getPossibleModificationSites
public static int[] getPossibleModificationSites(AminoAcidSequence aminoAcidSequence, boolean nTerm, boolean cTerm, Modification modification, SequenceMatchingParameters sequenceMatchingParameters)Returns an array of the possible modification sites for the given modification on the given peptide. N-term modifications are at index 0, C-term at sequence length + 1, and amino acid at 1-based index on the sequence. Protein modifications are not taken into account.- Parameters:
aminoAcidSequence
- the amino acid sequencenTerm
- boolean indicating whether the sequence is located at the n-termcTerm
- boolean indicating whether the sequence is located at the c-termmodification
- the modificationsequenceMatchingParameters
- the sequence matching parameters- Returns:
- an array of the possible modification sites
-
getTaggedModifiedSequence
public static String getTaggedModifiedSequence(ModificationParameters modificationProfile, String sequence, String[] confidentModificationSites, String[] representativeAmbiguousModificationSites, String[] secondaryAmbiguousModificationSites, String[] fixedModificationSites, boolean useHtmlColorCoding, boolean useShortName)Returns the modified sequence as a tagged string with potential modification sites color coded or with PTM tags, e.g, <mox>. /!\ This method will work only if the PTM found in the peptide are in the PTMFactory. Modifications should be provided indexed by site as follows: N-term modifications are at index 0, C-term at sequence length + 1, and amino acid at 1-based index on the sequence.- Parameters:
modificationProfile
- the modification profile of the searchsequence
- the amino acid sequence to annotateconfidentModificationSites
- the confidently localized variable modification sites in a map: aa number > list of modifications (1 is the first AA) (can be null)representativeAmbiguousModificationSites
- the representative site of the ambiguously localized variable modifications in a map: aa number > list of modifications (1 is the first AA) (can be null)secondaryAmbiguousModificationSites
- the secondary sites of the ambiguously localized variable modifications in a map: aa number > list of modifications (1 is the first AA) (can be null)fixedModificationSites
- the fixed modification sites in a map: aa number > list of modifications (1 is the first AA) (can be null)useHtmlColorCoding
- if true, color coded HTML is used, otherwise PTM tags, e.g, <mox>, are useduseShortName
- if true the short names are used in the tags- Returns:
- the tagged modified sequence as a string
-
appendTaggedResidue
public static void appendTaggedResidue(StringBuilder stringBuilder, char residue, String confidentModification, String representativeAmbiguousModification, String secondaryAmbiguousModification, String fixedModification, ModificationParameters modificationProfile, boolean useHtmlColorCoding, boolean useShortName)Returns the single residue as a tagged string (HTML color or PTM tag). Modified sites are color coded according to three levels: 1- black foreground, colored background 2- colored foreground, white background 3- colored foreground- Parameters:
stringBuilder
- the string builderresidue
- the residue to tagconfidentModification
- the confident ptm at siterepresentativeAmbiguousModification
- the representative ptm at sitesecondaryAmbiguousModification
- the secondary ptm at sitefixedModification
- the fixed ptm at sitemodificationProfile
- the modification profileuseHtmlColorCoding
- if true, color coded HTML is used, otherwise PTM tags, e.g, <mox>, are useduseShortName
- if true the short names are used in the tags
-
appendTaggedResidue
public static void appendTaggedResidue(StringBuilder stringBuilder, char residue, String modificationName, ModificationParameters modificationProfile, int localizationConfidenceLevel, boolean useHtmlColorCoding, boolean useShortName)Appends the single residue as a tagged string (HTML color or PTM tag). Modified sites are color coded according to three levels: 1- black foreground, colored background 2- colored foreground, white background 3- colored foreground- Parameters:
stringBuilder
- the string builderresidue
- the residue to tagmodificationName
- the name of the PTMmodificationProfile
- the modification profilelocalizationConfidenceLevel
- the localization confidence leveluseHtmlColorCoding
- if true, color coded HTML is used, otherwise PTM tags, e.g, <mox>, are useduseShortName
- if true the short names are used in the tags
-
getSite
public static int getSite(int index, int sequenceLength)Returns the 1-based index on the peptide.- Parameters:
index
- the modification indexsequenceLength
- the sequence length- Returns:
- the 1-based index on the sequence
-
getAllModifications
public static HashSet<String> getAllModifications(Peptide peptide, ModificationParameters modificationParameters, SequenceProvider sequenceProvider, SequenceMatchingParameters sequenceMatchingParameters)Returns a set of the names of all modifications found on a peptide.- Parameters:
peptide
- the peptidemodificationParameters
- the modification parameterssequenceProvider
- the protein sequence providersequenceMatchingParameters
- the sequence matching parameters- Returns:
- a set of the names of all modifications found on a peptide
-
getAllModifications
public static HashSet<String> getAllModifications(Tag tag, ModificationParameters modificationParameters, SequenceMatchingParameters sequenceMatchingParameters)Returns a set of the names of all modifications found on a tag.- Parameters:
tag
- the tagmodificationParameters
- the modification parameterssequenceMatchingParameters
- the sequence matching parameters- Returns:
- a set of the names of all modifications found on a tag
-
getExpectedModifications
public static HashMap<Integer,HashSet<String>> getExpectedModifications(double modMass, ModificationParameters modificationParameters, Peptide peptide, double massTolerance, SequenceProvider sequenceProvider, SequenceMatchingParameters sequenceMatchingParameters, SearchParameters searchParameters)Returns the expected modifications for a given modification mass indexed by site.- Parameters:
modMass
- the modification massmodificationParameters
- the modification parameterspeptide
- the peptide where to map the modificationmassTolerance
- the mass tolerance to usesequenceProvider
- a sequence providersequenceMatchingParameters
- the sequence matching parameterssearchParameters
- the search parameters- Returns:
- the expected modifications for a given modification mass indexed by site
-