Package com.compomics.util.protein
Class AASequenceImpl
java.lang.Object
com.compomics.util.protein.AASequenceImpl
- All Implemented Interfaces:
Sequence
public class AASequenceImpl extends Object implements Sequence
This class represents a sequence for a protein or peptide.
- Author:
- Lennart Martens
- See Also:
Sequence
-
Constructor Summary
Constructors Constructor Description AASequenceImpl(String aSequence)
Constructor that allows the initialization of the sequence with a String variable representing that sequence.AASequenceImpl(String aSequence, Vector aMods)
Constructor that allows the initialization of the sequence with a String variable representing that sequence and a Vector of Modification instances. -
Method Summary
Modifier and Type Method Description void
addModification(Modification aModification)
This method adds a modification to the list of modifications.boolean
contains(String aSequence)
This method reports whether a certain residu (or fixed sequence String) is found in the current sequence.AASequenceImpl
getCTermTruncatedSequence(int aTruncationSize)
This method will return an AASequenceImpl that represents a C-terminal truncation of the current sequence.double
getGravy()
This method gets the GRAVY score (Kyte & Doolittle) from the cache, or, if it isn't cached, reconstructs it.IsotopicDistribution
getIsotopicDistribution()
This method gives the IsotopicDistribution for the sequenceint
getLength()
This method reports on the length of the current sequence.double
getMass()
This method calculates the mass for the current sequence.double
getMeek()
This method will return an estimated 'net' HPLC retention time for the sequence based on the table by Meek.
It does NOT take a t0 value, specific to a setup, into account.Vector
getModifications()
Simple getter for the modifications.String
getModifiedSequence()
This method will return the sequence with annotated modifications.MolecularFormula
getMolecularFormula()
This method calculates the molecular formula based on the sequencedouble
getMz(int charge)
This method calculates the mass over charge ratio for a given charge for the current sequence.AASequenceImpl
getNTermTruncatedSequence(int aTruncationSize)
This method will return an AASequenceImpl that represents an N-terminal truncation of the current sequence.String
getSequence()
Simple getter for the sequence.AASequenceImpl
getTruncatedSequence(int aStart, int aEnd)
This method will return an AASequenceImpl that represents an internal truncation of the current sequence.static AASequenceImpl
parsePeptideFromAnnotatedSequence(String aAnnotatedSequence)
This method allows the construction of an AASequenceImpl object, complete with modifications from an annotated sequence String (eg., something like: 'NH2-YS<P>FVATER-COOH' or 'Ace-MATHM<Mox>PIR-COOH').protected void
parseSequenceAndModificationsFromString(String aStringWithModificiations)
This method is designed to load a sequence and it's set of modifications from a String which holds the sequence, annotated with all the modifications applied to it.void
setModifications(Vector aMods)
Simple setter for the modifications.void
setSequence(String aSequence)
Simple setter for the sequence.
-
Constructor Details
-
AASequenceImpl
Constructor that allows the initialization of the sequence with a String variable representing that sequence.- Parameters:
aSequence
- String with the sequence.
-
AASequenceImpl
Constructor that allows the initialization of the sequence with a String variable representing that sequence and a Vector of Modification instances.- Parameters:
aSequence
- String with the sequence.aMods
- Vector with Modification instances.
-
-
Method Details
-
setSequence
Simple setter for the sequence. It also clears the mass cache.- Specified by:
setSequence
in interfaceSequence
- Parameters:
aSequence
- String with the sequence to be set.
-
getSequence
Simple getter for the sequence.- Specified by:
getSequence
in interfaceSequence
- Returns:
- String the sequence.
-
setModifications
Simple setter for the modifications.- Parameters:
aMods
- Vector with the modifications.
-
getModifications
Simple getter for the modifications.- Returns:
- Vector with the modifications.
-
getMz
public double getMz(int charge)This method calculates the mass over charge ratio for a given charge for the current sequence. Returns -1, if the mass could not be calculated.- Parameters:
charge
- the charge to use for the m/z ratio calculation- Returns:
- double with the m/z ratio for this sequence with the given charge, -1 if the mass could not be calculated.
-
getMass
public double getMass()This method calculates the mass for the current sequence.
Mass cached lazily, so after the first calculation it comes from memory. -
parsePeptideFromAnnotatedSequence
This method allows the construction of an AASequenceImpl object, complete with modifications from an annotated sequence String (eg., something like: 'NH2-YS<P>FVATER-COOH' or 'Ace-MATHM<Mox>PIR-COOH').- Parameters:
aAnnotatedSequence
- String with the annotated sequence (eg., something like: 'NH2-YS<P>FVATER-COOH' or 'Ace-MATHM<Mox>PIR-COOH')- Returns:
- AASequenceImpl with the sequence and annotated modifications.
-
parseSequenceAndModificationsFromString
This method is designed to load a sequence and it's set of modifications from a String which holds the sequence, annotated with all the modifications applied to it.
Typically, the String parsed should be derived from the 'String getModifiedSequence()' method (see documentation there).- Parameters:
aStringWithModificiations
- String with annotated modifications.- See Also:
Modification
-
getLength
public int getLength()This method reports on the length of the current sequence. -
getGravy
public double getGravy()This method gets the GRAVY score (Kyte & Doolittle) from the cache, or, if it isn't cached, reconstructs it.- Returns:
- double with the GRAVY coefficient.
-
getMeek
public double getMeek()This method will return an estimated 'net' HPLC retention time for the sequence based on the table by Meek.
It does NOT take a t0 value, specific to a setup, into account.- Returns:
- double with the 'net' HPLC retention time as calculated from Meek's table.
-
getModifiedSequence
This method will return the sequence with annotated modifications. For this annotation the key of the modifications will be used. If the key is a formula, it will be enclosed in '<>' as well.- Returns:
- String with the annotated sequence (i.e.: containing the modifications.
-
getNTermTruncatedSequence
This method will return an AASequenceImpl that represents an N-terminal truncation of the current sequence.
Note that the applicable modifications (those within the truncation size) are also represented in the truncated sequence!- Parameters:
aTruncationSize
- int with the amount of N-terminal residues the truncated sequence should have.- Returns:
- AASEquenceImpl with the N-terminal truncated sequence (including modifications).
-
getCTermTruncatedSequence
This method will return an AASequenceImpl that represents a C-terminal truncation of the current sequence.
Note that the applicable modifications (those within the truncation size) are also represented in the truncated sequence!- Parameters:
aTruncationSize
- int with the amount of C-terminal residues the truncated sequence should have.- Returns:
- AASEquenceImpl with the C-terminal truncated sequence (including modifications).
-
getTruncatedSequence
This method will return an AASequenceImpl that represents an internal truncation of the current sequence.
Note that the applicable modifications (those within the truncation size) are also represented in the resulting truncated sequence!- Parameters:
aStart
- int with the start (N-terminal) residue for the truncation. The first residue is number '1'.aEnd
- int with the end residue (C-terminal; NOT included) for the truncation.- Returns:
- AASEquenceImpl with the C-terminal truncated sequence (including modifications).
-
contains
This method reports whether a certain residu (or fixed sequence String) is found in the current sequence.- Parameters:
aSequence
- with the residu (or fixed sequence of residus) to find in the current sequence.- Returns:
- boolean that indicates whether the sequence contains the indicated residu (or sequence).
-
addModification
This method adds a modification to the list of modifications.- Parameters:
aModification
- Modification instance to add to the modifications list.
-
getMolecularFormula
This method calculates the molecular formula based on the sequence- Returns:
- MolecularFormula
-
getIsotopicDistribution
This method gives the IsotopicDistribution for the sequence- Returns:
- IsotopicDistribution
-