java.lang.Object
com.compomics.util.experiment.personalization.ExperimentObject
com.compomics.util.experiment.identification.amino_acid_tags.Tag
All Implemented Interfaces:
Serializable

public class Tag
extends ExperimentObject
This class represents a sequence mass tag.
Author:
Marc Vaudel
See Also:
Serialized Form
  • Constructor Details

    • Tag

      public Tag()
      Constructor for an empty tag.
    • Tag

      public Tag​(Tag tag)
      Creates a new tag instance based on the given one.
      Parameters:
      tag - the reference tag
    • Tag

      public Tag​(double nTermGap, AminoAcidSequence sequenceTag, double cTermGap)
      Constructor for a tag consisting of a sequence tag between two mass tags.
      Parameters:
      nTermGap - the N-term mass gap
      sequenceTag - the sequence tag with modifications
      cTermGap - the C-term mass gap
  • Method Details

    • getContent

      public ArrayList<TagComponent> getContent()
      Returns the content of this tag as a list.
      Returns:
      the content of this tag as a list
    • setContent

      public void setContent​(ArrayList<TagComponent> content)
      Sets the content for the given tag.
      Parameters:
      content - an array of tag components
    • addMassGap

      public void addMassGap​(double massGap)
      Adds a mass gap to the tag.
      Parameters:
      massGap - the value of the mass gap
    • addAminoAcidSequence

      public void addAminoAcidSequence​(AminoAcidSequence aminoAcidSequence)
      Adds a sequence of amino acids to the tag.
      Parameters:
      aminoAcidSequence - the amino acid sequence with modifications
    • asSequence

      public String asSequence()
      Returns the tag as intelligible sequence of tag components. For example amino acid tags and mass gaps: <115.2>TAG<110.5>.
      Returns:
      The tag as intelligible sequence for display.
    • getLongestAminoAcidSequence

      public String getLongestAminoAcidSequence()
      Returns the longest amino acid sequence contained in this tag.
      Returns:
      the longest amino acid sequence contained in this tag
    • getMass

      public double getMass()
      Returns the mass of the tag.
      Returns:
      the mass of the tag
    • getMass

      public double getMass​(boolean includeCTermGap, boolean includeNTermGap)
      Returns the theoretic mass of the tag, eventually without terminal gaps.
      Parameters:
      includeCTermGap - if true the C-terminal gap will be added if present
      includeNTermGap - if true the N-terminal gap will be added if present
      Returns:
      the theoretic mass of the tag
    • getNTerminalGap

      public double getNTerminalGap()
      Returns the N-terminal gap of the tag.
      Returns:
      the N-terminal gap of the tag
    • getCTerminalGap

      public double getCTerminalGap()
      Returns the C-terminal gap of the tag.
      Returns:
      the C-terminal gap of the tag
    • getTaggedModifiedSequence

      public String getTaggedModifiedSequence​(ModificationParameters modificationProfile, boolean useHtmlColorCoding, boolean includeHtmlStartEndTags, boolean useShortName, boolean includeTerminalGaps, SequenceMatchingParameters modificationsSequenceMatchingParameters, HashSet<String> displayedModifications)
      Returns the modified sequence as an tagged string with potential modification sites color coded or with modification tags, e.g, <mox>. /!\ this method will work only if the modifications found in the tag components are in the factory. /!\ This method uses the modifications as set in the modification matches of this peptide and displays all of them.
      Parameters:
      modificationProfile - the modification profile of the search
      useHtmlColorCoding - if true, color coded HTML is used, otherwise modification tags, e.g, <mox>, are used
      includeHtmlStartEndTags - if true, start and end HTML tags are added
      useShortName - if true, the short names are used in the tags
      includeTerminalGaps - if true, the terminal gaps will be displayed on the sequence
      modificationsSequenceMatchingParameters - the sequence matching parameters to use for modifications
      displayedModifications - the modifications to display
      Returns:
      the modified sequence as a tagged string
    • getTaggedModifiedSequence

      public static String getTaggedModifiedSequence​(ModificationParameters modificationParameters, Tag tag, boolean useHtmlColorCoding, boolean includeHtmlStartEndTags, boolean useShortName, boolean includeTerminalGaps, SequenceMatchingParameters modificationsSequenceMatchingParameters, HashSet<String> displayedModifications)
      Returns the modified sequence as an tagged string with potential modification sites color coded or with modification tags, e.g, <mox>. /!\ This method will work only if the modification found in the peptide are in the factory. /!\ This method uses the modifications as set in the modification matches of this peptide and displays all of them.
      Parameters:
      modificationParameters - the modification profile of the search
      tag - the tag
      includeHtmlStartEndTags - if true, start and end HTML tags are added
      useHtmlColorCoding - if true, color coded HTML is used, otherwise modification tags, e.g, <mox>, are used
      useShortName - if true, the short names are used in the tags
      includeTerminalGaps - if true, the terminal gaps will be displayed on the sequence
      modificationsSequenceMatchingParameters - the sequence matching parameters to use for modifications
      displayedModifications - the modifications to display
      Returns:
      the tagged modified sequence as a string
    • getNTerminal

      public String getNTerminal​(boolean includeTerminalGaps, ModificationParameters modificationParameters, SequenceMatchingParameters modificationsSequenceMatchingParameters)
      Returns the N-terminal tag of this tag as a string for sequence display.
      Parameters:
      includeTerminalGaps - indicates whether mass gaps shall be included
      modificationParameters - the modification profile of the search
      modificationsSequenceMatchingParameters - the sequence matching parameters to use for modifications
      Returns:
      the N-terminal tag of this tag
    • getCTerminal

      public String getCTerminal​(boolean includeTerminalGaps, ModificationParameters modificationParameters, SequenceMatchingParameters modificationsSequenceMatchingParameters)
      Returns the C-terminal tag of this tag as a string for sequence display.
      Parameters:
      includeTerminalGaps - indicates whether mass gaps shall be included
      modificationParameters - the modification profile of the search
      modificationsSequenceMatchingParameters - the sequence matching parameters to use for modifications
      Returns:
      the C-terminal tag of this tag
    • getLengthInAminoAcid

      public int getLengthInAminoAcid()
      Returns the amino acid length of the tag when mass gaps are considered like one amino acid
      Returns:
      the amino acid length of the tag
    • getPotentialModificationSites

      public ArrayList<Integer> getPotentialModificationSites​(Modification modification, SequenceMatchingParameters modificationSequenceMatchingPreferences)
      Returns the potential modification sites as an ordered list of string. 1 is the first amino acid. An empty list is returned if no possibility was found. This method does not account for protein terminal modifications.
      Parameters:
      modification - the modification considered
      modificationSequenceMatchingPreferences - the sequence matching preferences for the modification to amino acid sequence mapping
      Returns:
      a list of potential modification sites
    • isSameAs

      public boolean isSameAs​(Tag anotherTag, SequenceMatchingParameters sequenceMatchingPreferences)
      Indicates whether this tag is the same as another tag. Note: this method accounts for modification localization.
      Parameters:
      anotherTag - another tag
      sequenceMatchingPreferences - the sequence matching preferences
      Returns:
      a boolean indicating whether the tag is the same as another
    • isSameSequenceAndModificationStatusAs

      public boolean isSameSequenceAndModificationStatusAs​(Tag anotherTag, SequenceMatchingParameters sequenceMatchingPreferences)
      Indicates whether this tag is the same as another tag without accounting for modification localization.
      Parameters:
      anotherTag - another tag
      sequenceMatchingPreferences - the sequence matching preferences
      Returns:
      a boolean indicating whether the tag is the same as another
    • getTagModificationsAsString

      public static String getTagModificationsAsString​(Tag tag)
      Returns the tag modifications as a string.
      Parameters:
      tag - the tag
      Returns:
      the peptide modifications as a string
    • reverse

      public Tag reverse​(boolean yIon)
      Returns a new tag instance which is a reversed version of the current tag.
      Parameters:
      yIon - indicates whether the tag is based on y ions
      Returns:
      a new tag instance which is a reversed version of the current tag
    • canReverse

      public boolean canReverse()
      Indicates whether the tag can be reversed (ie if termini are mass gaps with mass ≥ water).
      Returns:
      whether the tag can be reversed
    • toString

      public String toString()
      Overrides:
      toString in class Object