Class Tag
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
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Tag()
Constructor for an empty tag.Tag(double nTermGap, AminoAcidSequence sequenceTag, double cTermGap)
Constructor for a tag consisting of a sequence tag between two mass tags.Tag(Tag tag)
Creates a new tag instance based on the given one. -
Method Summary
Modifier and Type Method Description void
addAminoAcidSequence(AminoAcidSequence aminoAcidSequence)
Adds a sequence of amino acids to the tag.void
addMassGap(double massGap)
Adds a mass gap to the tag.String
asSequence()
Returns the tag as intelligible sequence of tag components.boolean
canReverse()
Indicates whether the tag can be reversed (ie if termini are mass gaps with mass ≥ water).ArrayList<TagComponent>
getContent()
Returns the content of this tag as a list.String
getCTerminal(boolean includeTerminalGaps, ModificationParameters modificationParameters, SequenceMatchingParameters modificationsSequenceMatchingParameters)
Returns the C-terminal tag of this tag as a string for sequence display.double
getCTerminalGap()
Returns the C-terminal gap of the tag.int
getLengthInAminoAcid()
Returns the amino acid length of the tag when mass gaps are considered like one amino acidString
getLongestAminoAcidSequence()
Returns the longest amino acid sequence contained in this tag.double
getMass()
Returns the mass of the tag.double
getMass(boolean includeCTermGap, boolean includeNTermGap)
Returns the theoretic mass of the tag, eventually without terminal gaps.String
getNTerminal(boolean includeTerminalGaps, ModificationParameters modificationParameters, SequenceMatchingParameters modificationsSequenceMatchingParameters)
Returns the N-terminal tag of this tag as a string for sequence display.double
getNTerminalGap()
Returns the N-terminal gap of the tag.ArrayList<Integer>
getPotentialModificationSites(Modification modification, SequenceMatchingParameters modificationSequenceMatchingPreferences)
Returns the potential modification sites as an ordered list of string.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>.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>.static String
getTagModificationsAsString(Tag tag)
Returns the tag modifications as a string.boolean
isSameAs(Tag anotherTag, SequenceMatchingParameters sequenceMatchingPreferences)
Indicates whether this tag is the same as another tag.boolean
isSameSequenceAndModificationStatusAs(Tag anotherTag, SequenceMatchingParameters sequenceMatchingPreferences)
Indicates whether this tag is the same as another tag without accounting for modification localization.Tag
reverse(boolean yIon)
Returns a new tag instance which is a reversed version of the current tag.void
setContent(ArrayList<TagComponent> content)
Sets the content for the given tag.String
toString()
Methods inherited from class com.compomics.util.experiment.personalization.ExperimentObject
addUrParam, asLong, clearParametersMap, getId, getUrParam, getUrParams, removeUrParam, setId, setUrParams
-
Constructor Details
-
Tag
public Tag()Constructor for an empty tag. -
Tag
Creates a new tag instance based on the given one.- Parameters:
tag
- the reference tag
-
Tag
Constructor for a tag consisting of a sequence tag between two mass tags.- Parameters:
nTermGap
- the N-term mass gapsequenceTag
- the sequence tag with modificationscTermGap
- the C-term mass gap
-
-
Method Details
-
getContent
Returns the content of this tag as a list.- Returns:
- the content of this tag as a list
-
setContent
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
Adds a sequence of amino acids to the tag.- Parameters:
aminoAcidSequence
- the amino acid sequence with modifications
-
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
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 presentincludeNTermGap
- 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 searchuseHtmlColorCoding
- if true, color coded HTML is used, otherwise modification tags, e.g, <mox>, are usedincludeHtmlStartEndTags
- if true, start and end HTML tags are addeduseShortName
- if true, the short names are used in the tagsincludeTerminalGaps
- if true, the terminal gaps will be displayed on the sequencemodificationsSequenceMatchingParameters
- the sequence matching parameters to use for modificationsdisplayedModifications
- 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 searchtag
- the tagincludeHtmlStartEndTags
- if true, start and end HTML tags are addeduseHtmlColorCoding
- if true, color coded HTML is used, otherwise modification tags, e.g, <mox>, are useduseShortName
- if true, the short names are used in the tagsincludeTerminalGaps
- if true, the terminal gaps will be displayed on the sequencemodificationsSequenceMatchingParameters
- the sequence matching parameters to use for modificationsdisplayedModifications
- 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 includedmodificationParameters
- the modification profile of the searchmodificationsSequenceMatchingParameters
- 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 includedmodificationParameters
- the modification profile of the searchmodificationsSequenceMatchingParameters
- 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 consideredmodificationSequenceMatchingPreferences
- the sequence matching preferences for the modification to amino acid sequence mapping- Returns:
- a list of potential modification sites
-
isSameAs
Indicates whether this tag is the same as another tag. Note: this method accounts for modification localization.- Parameters:
anotherTag
- another tagsequenceMatchingPreferences
- 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 tagsequenceMatchingPreferences
- the sequence matching preferences- Returns:
- a boolean indicating whether the tag is the same as another
-
getTagModificationsAsString
Returns the tag modifications as a string.- Parameters:
tag
- the tag- Returns:
- the peptide modifications as a string
-
reverse
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
-