Class AminoAcidSequence
java.lang.Object
com.compomics.util.experiment.personalization.ExperimentObject
com.compomics.util.experiment.biology.aminoacids.sequence.AminoAcidSequence
- All Implemented Interfaces:
TagComponent,Serializable
This class represents a series of amino acids with associated modifications.
- Author:
- Marc Vaudel
- See Also:
-
Field Summary
Fields inherited from class com.compomics.util.experiment.personalization.ExperimentObject
NO_KEY -
Constructor Summary
ConstructorsConstructorDescriptionCreates a blank sequence.AminoAcidSequence(AminoAcidSequence sequence) Creates a sequence from another sequence.AminoAcidSequence(String sequence) Constructor taking a sequence of amino acids as input.AminoAcidSequence(String sequence, ModificationMatch[] variableModifications) Constructor taking a sequence of amino acids as input. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddVariableModification(ModificationMatch modificationMatch) Adds a modification to one of the amino acid sequence.voidappendCTerm(AminoAcidSequence otherSequence) Appends another sequence at the end of this sequence.voidappendCTerm(String otherSequence) Appends a series of unmodified amino acids to the sequence.voidappendNTerm(AminoAcidSequence otherSequence) Appends another sequence at the beginning of this sequence keeping the original order.voidappendNTerm(String otherSequence) Appends a series of unmodified amino acids to the beginning sequence keeping the original order.Returns the tag component as String like a peptide sequence.charcharAt(int aa) Returns the amino acid at the given index on the sequence in its single letter code.voidthe sequence is kept in different formats internally.intfirstIndex(String aminoAcidSequence, SequenceMatchingParameters sequenceMatchingPreferences) Returns the first index where the amino acid sequence is found in the given sequence.getAminoAcidAt(int aa) Returns the amino acid at the given index on the sequence.static ArrayList<StringBuilder> getCombinations(String sequence) Returns a list of all combinations which can be created from a sequence when expanding ambiguous amino acids like Xs.String[]getFixedModifications(boolean nTerm, boolean cTerm, ModificationParameters modificationParameters, SequenceMatchingParameters modificationsSequenceMatchingParameters) Returns the fixed modifications for this sequence based on the given modification parameters.String[]Returns the variable modifications indexed by site.doublegetMass()Returns the mass of the tag component.static doublegetMinMass(char[] sequence) Returns the minimal mass that an amino acid sequence can have taking into account ambiguous amino acids.Returns the sequence as String.Getter for the modifications carried by this sequence in a map: aa number > modification matches.static booleanhasCombination(char[] sequence) Indicates whether the given sequence contains an amino acid which is in fact a combination of amino acids.static booleanhasCombination(String sequence) Indicates whether the given sequence contains an amino acid which is in fact a combination of amino acids.static booleanhasCombination(java.util.stream.IntStream sequence) Indicates whether the given sequence contains an amino acid which is in fact a combination of amino acids.voidinsert(int offset, AminoAcidSequence otherSequence) Inserts another sequence in this sequence.voidInserts another sequence in this sequence.booleanisSameAs(AminoAcidSequence anotherSequence, SequenceMatchingParameters sequenceMatchingPreferences) Indicates whether another sequence has a matching sequence.booleanisSameAs(TagComponent anotherCompontent, SequenceMatchingParameters sequenceMatchingPreferences) Indicates whether another component is the same as the component of interest.booleanisSameSequenceAndModificationStatusAs(AminoAcidSequence anotherSequence, SequenceMatchingParameters sequenceMatchingPreferences) Indicates whether another sequence targets the same sequence without accounting for PTM localization.booleanisSameSequenceAndModificationStatusAs(TagComponent anotherCompontent, SequenceMatchingParameters sequenceMatchingPreferences) Indicates whether another component is the same as the component of interest.intlength()Returns the length of the sequence in amino acids.booleanmatches(AminoAcidSequence aminoAcidSequence, SequenceMatchingParameters sequenceMatchingPreferences) Indicates whether the sequence matches the given amino acid sequence in size and according to the given matching preferences.booleanmatches(String aminoAcidSequence, SequenceMatchingParameters sequenceMatchingPreferences) Indicates whether the sequence matches the given amino acid sequence in size and according to the given matching preferences.booleanmatchesIn(AminoAcidSequence aminoAcidSequence, SequenceMatchingParameters sequenceMatchingPreferences) Indicates whether the sequence is found in the given amino acid sequence.booleanmatchesIn(String aminoAcidSequence, SequenceMatchingParameters sequenceMatchingPreferences) Indicates whether the sequence is found in the given amino acid sequence.reverse()Returns an amino acid sequence which is a reversed version of the current pattern.voidsetAaAtIndex(int index, char aa) replaces the amino acid at the given position by the given amino acid represented by its single letter code.voidsetSequence(String aminoAcidSequence) Sets the sequence.voidsetVariableModifications(ModificationMatch[] variableModifications) Sets the variable modifications.toString()Methods inherited from class com.compomics.util.experiment.personalization.ExperimentObject
addUrParam, asLong, clearParametersMap, getId, getUrParam, getUrParams, removeUrParam, setId, setUrParams
-
Constructor Details
-
AminoAcidSequence
public AminoAcidSequence()Creates a blank sequence. All maps are null. -
AminoAcidSequence
Constructor taking a sequence of amino acids as input.- Parameters:
sequence- a sequence of amino acids
-
AminoAcidSequence
Constructor taking a sequence of amino acids as input.- Parameters:
sequence- a sequence of amino acidsvariableModifications- the variable modifications of this sequence
-
AminoAcidSequence
Creates a sequence from another sequence.- Parameters:
sequence- the other sequence
-
-
Method Details
-
getSequence
Returns the sequence as String.- Returns:
- the sequence as String
-
charAt
public char charAt(int aa) Returns the amino acid at the given index on the sequence in its single letter code. 0 is the first amino acid.- Parameters:
aa- the index on the sequence- Returns:
- the amino acid at the given index on the sequence in its single letter code
-
getAminoAcidAt
Returns the amino acid at the given index on the sequence. 0 is the first amino acid.- Parameters:
aa- the index on the sequence- Returns:
- the amino acid at the given index on the sequence
-
setSequence
Sets the sequence.- Parameters:
aminoAcidSequence- the sequence
-
setAaAtIndex
public void setAaAtIndex(int index, char aa) replaces the amino acid at the given position by the given amino acid represented by its single letter code. 0 is the first amino acid.- Parameters:
index- the index where the amino acid should be set.aa- the amino acid to be set
-
emptyInternalCaches
public void emptyInternalCaches()the sequence is kept in different formats internally. Calling this method removes them from the cache. -
matchesIn
public boolean matchesIn(String aminoAcidSequence, SequenceMatchingParameters sequenceMatchingPreferences) Indicates whether the sequence is found in the given amino acid sequence.- Parameters:
aminoAcidSequence- the amino acid sequencesequenceMatchingPreferences- the sequence matching preferences- Returns:
- a boolean indicating whether the sequence is found in the given amino acid sequence
-
matchesIn
public boolean matchesIn(AminoAcidSequence aminoAcidSequence, SequenceMatchingParameters sequenceMatchingPreferences) Indicates whether the sequence is found in the given amino acid sequence.- Parameters:
aminoAcidSequence- the amino acid sequencesequenceMatchingPreferences- the sequence matching preferences- Returns:
- a boolean indicating whether the sequence is found in the given amino acid sequence
-
matches
public boolean matches(String aminoAcidSequence, SequenceMatchingParameters sequenceMatchingPreferences) Indicates whether the sequence matches the given amino acid sequence in size and according to the given matching preferences.- Parameters:
aminoAcidSequence- the amino acid sequencesequenceMatchingPreferences- the sequence matching preferences- Returns:
- a boolean indicating whether the sequence is found in the given amino acid sequence
-
matches
public boolean matches(AminoAcidSequence aminoAcidSequence, SequenceMatchingParameters sequenceMatchingPreferences) Indicates whether the sequence matches the given amino acid sequence in size and according to the given matching preferences.- Parameters:
aminoAcidSequence- the amino acid sequencesequenceMatchingPreferences- the sequence matching preferences- Returns:
- a boolean indicating whether the sequence is found in the given amino acid sequence
-
firstIndex
public int firstIndex(String aminoAcidSequence, SequenceMatchingParameters sequenceMatchingPreferences) Returns the first index where the amino acid sequence is found in the given sequence. -1 if not found. 0 is the first amino acid.- Parameters:
aminoAcidSequence- the amino acid sequence to look intosequenceMatchingPreferences- the sequence matching preferences- Returns:
- the first index where the amino acid sequence is found
-
length
public int length()Returns the length of the sequence in amino acids.- Returns:
- the length of the sequence in amino acids
-
appendCTerm
Appends another sequence at the end of this sequence.- Parameters:
otherSequence- the other sequence to append.
-
appendCTerm
Appends a series of unmodified amino acids to the sequence.- Parameters:
otherSequence- a series of unmodified amino acids represented by their single letter code
-
insert
Inserts another sequence in this sequence.- Parameters:
offset- the index where this sequence should be inserted, 0 is the first amino acid.otherSequence- the other sequence to insert.
-
insert
Inserts another sequence in this sequence.- Parameters:
offset- the index where this sequence should be inserted, 0 is the first amino acid.otherSequence- the other sequence to insert.
-
appendNTerm
Appends another sequence at the beginning of this sequence keeping the original order.- Parameters:
otherSequence- the other sequence to append.
-
appendNTerm
Appends a series of unmodified amino acids to the beginning sequence keeping the original order.- Parameters:
otherSequence- a series of unmodified amino acids represented by their single letter code
-
getVariableModifications
Getter for the modifications carried by this sequence in a map: aa number > modification matches. 1 is the first amino acid.- Returns:
- the modifications matches as found by the search engine
-
getIndexedVariableModifications
Returns the variable modifications indexed by site. Modifications are 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.- Returns:
- the variable modifications indexed by site
-
addVariableModification
Adds a modification to one of the amino acid sequence.- Parameters:
modificationMatch- the modification match
-
setVariableModifications
Sets the variable modifications.- Parameters:
variableModifications- the modifications
-
getFixedModifications
public String[] getFixedModifications(boolean nTerm, boolean cTerm, ModificationParameters modificationParameters, SequenceMatchingParameters modificationsSequenceMatchingParameters) Returns the fixed modifications for this sequence based on the given modification parameters. Modifications are returned as array of modification names as they appear on the sequence. N-term modifications are at index 0, C-term at index sequence length + 1, and other modifications at amino acid index starting from 1. An error is thrown if attempting to stack modifications. Protein modifications are not taken into account.- Parameters:
nTerm- boolean indicating whether the sequence is located at the n-termcTerm- boolean indicating whether the sequence is located at the c-termmodificationParameters- the modification parameters the modification parametersmodificationsSequenceMatchingParameters- the sequence matching parameters to use for modifications- Returns:
- the fixed modifications for this peptide
-
isSameAs
public boolean isSameAs(AminoAcidSequence anotherSequence, SequenceMatchingParameters sequenceMatchingPreferences) Indicates whether another sequence has a matching sequence. Modifications are considered equal when of same mass. Modifications should be loaded in the PTM factory.- Parameters:
anotherSequence- the other AminoAcidPatternsequenceMatchingPreferences- the sequence matching preferences- Returns:
- true if the other AminoAcidPattern targets the same sequence
-
isSameSequenceAndModificationStatusAs
public boolean isSameSequenceAndModificationStatusAs(AminoAcidSequence anotherSequence, SequenceMatchingParameters sequenceMatchingPreferences) Indicates whether another sequence targets the same sequence without accounting for PTM localization. Modifications are considered equal when of same mass. Modifications should be loaded in the PTM factory.- Parameters:
anotherSequence- the other sequencesequenceMatchingPreferences- the sequence matching preferences- Returns:
- true if the other AminoAcidPattern targets the same sequence
-
reverse
Returns an amino acid sequence which is a reversed version of the current pattern.- Returns:
- an amino acid sequence which is a reversed version of the current pattern
-
hasCombination
Indicates whether the given sequence contains an amino acid which is in fact a combination of amino acids.- Parameters:
sequence- the sequence of interest- Returns:
- a boolean indicating whether the given sequence contains an amino acid which is in fact a combination of amino acids
-
hasCombination
public static boolean hasCombination(java.util.stream.IntStream sequence) Indicates whether the given sequence contains an amino acid which is in fact a combination of amino acids.- Parameters:
sequence- the sequence of interest- Returns:
- a boolean indicating whether the given sequence contains an amino acid which is in fact a combination of amino acids
-
hasCombination
public static boolean hasCombination(char[] sequence) Indicates whether the given sequence contains an amino acid which is in fact a combination of amino acids.- Parameters:
sequence- the sequence of interest- Returns:
- a boolean indicating whether the given sequence contains an amino acid which is in fact a combination of amino acids
-
getMinMass
public static double getMinMass(char[] sequence) Returns the minimal mass that an amino acid sequence can have taking into account ambiguous amino acids.- Parameters:
sequence- a sequence of amino acids represented by their single letter code- Returns:
- the minimal mass the sequence can have
-
getCombinations
Returns a list of all combinations which can be created from a sequence when expanding ambiguous amino acids like Xs.- Parameters:
sequence- the sequence of interest- Returns:
- a list of all combinations which can be created from a sequence when expanding ambiguous amino acids like Xs
-
toString
-
asSequence
Description copied from interface:TagComponentReturns the tag component as String like a peptide sequence. Note: this does not include modifications.- Specified by:
asSequencein interfaceTagComponent- Returns:
- the tag component as String like a peptide sequence
-
getMass
public double getMass()Description copied from interface:TagComponentReturns the mass of the tag component.- Specified by:
getMassin interfaceTagComponent- Returns:
- the mass of the tag component
-
isSameAs
public boolean isSameAs(TagComponent anotherCompontent, SequenceMatchingParameters sequenceMatchingPreferences) Description copied from interface:TagComponentIndicates whether another component is the same as the component of interest.- Specified by:
isSameAsin interfaceTagComponent- Parameters:
anotherCompontent- another componentsequenceMatchingPreferences- the sequence matching preferences- Returns:
- a boolean indicating whether the other component is the same as the one of interest
-
isSameSequenceAndModificationStatusAs
public boolean isSameSequenceAndModificationStatusAs(TagComponent anotherCompontent, SequenceMatchingParameters sequenceMatchingPreferences) Description copied from interface:TagComponentIndicates whether another component is the same as the component of interest.- Specified by:
isSameSequenceAndModificationStatusAsin interfaceTagComponent- Parameters:
anotherCompontent- another componentsequenceMatchingPreferences- the sequence matching preferences- Returns:
- a boolean indicating whether the other component is the same as the one of interest
-