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 Details

    • EMPTY

      public static final int[] EMPTY
      Empty array for no result.
    • ZERO

      public static final int[] ZERO
      Array for N-term.
    • ARRAYS_MAP

      public static final HashMap<Integer,​int[]> ARRAYS_MAP
      Map of arrays for C-term.
  • Constructor Details

  • 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 peptide
      modification - the modification
      sequenceProvider - a protein sequence provider
      sequenceMatchingParameters - 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 sequence
      nTerm - boolean indicating whether the sequence is located at the n-term
      cTerm - boolean indicating whether the sequence is located at the c-term
      modification - the modification
      sequenceMatchingParameters - 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 search
      sequence - the amino acid sequence to annotate
      confidentModificationSites - 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 used
      useShortName - 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 builder
      residue - the residue to tag
      confidentModification - the confident ptm at site
      representativeAmbiguousModification - the representative ptm at site
      secondaryAmbiguousModification - the secondary ptm at site
      fixedModification - the fixed ptm at site
      modificationProfile - the modification profile
      useHtmlColorCoding - if true, color coded HTML is used, otherwise PTM tags, e.g, <mox>, are used
      useShortName - 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 builder
      residue - the residue to tag
      modificationName - the name of the PTM
      modificationProfile - the modification profile
      localizationConfidenceLevel - the localization confidence level
      useHtmlColorCoding - if true, color coded HTML is used, otherwise PTM tags, e.g, <mox>, are used
      useShortName - 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 index
      sequenceLength - 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 peptide
      modificationParameters - the modification parameters
      sequenceProvider - the protein sequence provider
      sequenceMatchingParameters - 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 tag
      modificationParameters - the modification parameters
      sequenceMatchingParameters - 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 mass
      modificationParameters - the modification parameters
      peptide - the peptide where to map the modification
      massTolerance - the mass tolerance to use
      sequenceProvider - a sequence provider
      sequenceMatchingParameters - the sequence matching parameters
      searchParameters - the search parameters
      Returns:
      the expected modifications for a given modification mass indexed by site