com.compomics.util.experiment.biology
Class Peptide

java.lang.Object
  extended by com.compomics.util.experiment.personalization.ExperimentObject
      extended by com.compomics.util.experiment.biology.Peptide
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Peptide
extends ExperimentObject

This class models a peptide.

Author:
Marc Vaudel
See Also:
Serialized Form

Constructor Summary
Peptide()
          Constructor for the peptide.
Peptide(java.lang.String aSequence, java.util.ArrayList<java.lang.String> parentProteins, java.util.ArrayList<ModificationMatch> modifications)
          Constructor for the peptide.
Peptide(java.lang.String aSequence, java.lang.Double mass, java.util.ArrayList<java.lang.String> parentProteins, java.util.ArrayList<ModificationMatch> modifications)
          Constructor for the peptide.
 
Method Summary
 void addModificationMatch(ModificationMatch modificationMatch)
          Adds a modification match.
 void clearModificationMatches()
          Clears the list of imported modification matches.
 java.lang.String getCTerminal()
          Returns the C-terminal of the peptide as a String.
 java.lang.String getKey()
          Returns the index of a peptide.
 java.lang.Double getMass()
          Getter for the mass.
static int getModificationCount(java.lang.String peptideKey, java.lang.String modification)
          Returns how many of the given modification was found in the given peptide.
static java.util.ArrayList<java.lang.String> getModificationFamily(java.lang.String peptideKey)
          Returns a list of names of the variable modifications found in the key of a peptide.
 java.util.ArrayList<ModificationMatch> getModificationMatches()
          Getter for the modifications carried by this peptide.
 java.lang.String getModifiedSequenceAsHtml(java.util.HashMap<java.lang.String,java.awt.Color> colors, boolean includeHtmlStartEndTag)
          Returns the modified sequence as an HTML string with modification color coding.
static java.lang.String getModifiedSequenceAsHtml(java.util.HashMap<java.lang.String,java.awt.Color> colors, boolean includeHtmlStartEndTag, Peptide peptide, java.util.HashMap<java.lang.Integer,java.util.ArrayList<java.lang.String>> mainModificationSites, java.util.HashMap<java.lang.Integer,java.util.ArrayList<java.lang.String>> secondaryModificationSites)
          Returns the modified sequence as an HTML string with potential modification sites color coding.
 java.lang.String getModifiedSequenceAsString(boolean includeTerminals)
          Returns the modified sequence as a string, e.g., NH2-PEPTIDE-COOH.
 int getNMissedCleavages(Enzyme enzyme)
          Returns the amount of missed cleavages using the specified enzyme.
static int getNMissedCleavages(java.lang.String sequence, Enzyme enzyme)
          Returns the amount of missed cleavages using the specified enzyme for the given sequence.
 java.lang.String getNTerminal()
          Returns the N-terminal of the peptide as a String.
 java.util.ArrayList<java.lang.String> getParentProteins()
          Getter for the parent proteins.
static java.util.ArrayList<java.lang.Integer> getPotentialModificationSites(java.lang.String sequence, PTM ptm)
          Returns the potential modification sites as an ordered list of string.
 java.util.HashMap<java.lang.String,java.awt.Color> getPTMShortNameColorMap(java.util.HashMap<java.lang.String,java.awt.Color> ptmColors)
          Returns a map of the ptm short names to the ptm colors.
 java.util.HashMap<java.lang.String,java.lang.String> getPTMShortNameMap()
          Returns a map of the ptm short names to the ptm long names for the modification in this peptide.
 java.lang.String getSequence()
          Getter for the sequence.
static java.lang.String getSequence(java.lang.String peptideKey)
          Returns the sequence of the peptide indexed by the given key.
static boolean isModified(java.lang.String peptideKey)
          Returns a boolean indicating whether the peptide has variable modifications based on its key.
static boolean isModified(java.lang.String peptideKey, java.lang.String modification)
          Returns a boolean indicating whether the peptide has the given variable modification based on its key.
 boolean isSameAs(Peptide anotherPeptide)
          A method which compares to peptides.
 boolean sameModificationsAs(Peptide anotherPeptide)
          Indicates whether another peptide has the same modifications at the same localization as this peptide.
 void setParentProteins(java.util.ArrayList<java.lang.String> parentProteins)
          Sets the parent proteins.
 
Methods inherited from class com.compomics.util.experiment.personalization.ExperimentObject
addUrParam, getParameterKey, getUrParam
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Peptide

public Peptide()
Constructor for the peptide.


Peptide

public Peptide(java.lang.String aSequence,
               java.util.ArrayList<java.lang.String> parentProteins,
               java.util.ArrayList<ModificationMatch> modifications)
        throws java.lang.IllegalArgumentException
Constructor for the peptide.

Parameters:
aSequence - The peptide sequence
parentProteins - The parent proteins
modifications - The PTM of this peptide
Throws:
java.lang.IllegalArgumentException - Thrown if the peptide sequence contains unknown amino acids

Peptide

public Peptide(java.lang.String aSequence,
               java.lang.Double mass,
               java.util.ArrayList<java.lang.String> parentProteins,
               java.util.ArrayList<ModificationMatch> modifications)
Constructor for the peptide.

Parameters:
aSequence - The peptide sequence
mass - The peptide mass
parentProteins - The parent proteins
modifications - The PTM of this peptide
Method Detail

getMass

public java.lang.Double getMass()
Getter for the mass.

Returns:
the peptide mass

getModificationMatches

public java.util.ArrayList<ModificationMatch> getModificationMatches()
Getter for the modifications carried by this peptide.

Returns:
the modifications matches as found by the search engine

clearModificationMatches

public void clearModificationMatches()
Clears the list of imported modification matches.


addModificationMatch

public void addModificationMatch(ModificationMatch modificationMatch)
Adds a modification match.

Parameters:
modificationMatch - the modification match to add

getSequence

public java.lang.String getSequence()
Getter for the sequence.

Returns:
the peptide sequence

getNMissedCleavages

public int getNMissedCleavages(Enzyme enzyme)
Returns the amount of missed cleavages using the specified enzyme.

Parameters:
enzyme - the enzyme used
Returns:
the amount of missed cleavages

getNMissedCleavages

public static int getNMissedCleavages(java.lang.String sequence,
                                      Enzyme enzyme)
Returns the amount of missed cleavages using the specified enzyme for the given sequence.

Parameters:
sequence - the peptide sequence
enzyme - the enzyme used
Returns:
the amount of missed cleavages

getParentProteins

public java.util.ArrayList<java.lang.String> getParentProteins()
Getter for the parent proteins.

Returns:
the parent proteins

setParentProteins

public void setParentProteins(java.util.ArrayList<java.lang.String> parentProteins)
Sets the parent proteins.

Parameters:
parentProteins - the parent proteins as list

getKey

public java.lang.String getKey()
Returns the index of a peptide. index = SEQUENCE_mod1_mod2 with modifications ordered alphabetically.

Returns:
the index of a peptide

isModified

public static boolean isModified(java.lang.String peptideKey)
Returns a boolean indicating whether the peptide has variable modifications based on its key.

Parameters:
peptideKey - the peptide key
Returns:
a boolean indicating whether the peptide has variable modifications

isModified

public static boolean isModified(java.lang.String peptideKey,
                                 java.lang.String modification)
Returns a boolean indicating whether the peptide has the given variable modification based on its key.

Parameters:
peptideKey - the peptide key
modification - the name of the modification
Returns:
a boolean indicating whether the peptide has variable modifications

getModificationCount

public static int getModificationCount(java.lang.String peptideKey,
                                       java.lang.String modification)
Returns how many of the given modification was found in the given peptide.

Parameters:
peptideKey - the peptide key
modification - the name of the modification
Returns:
the amount of modifications

getSequence

public static java.lang.String getSequence(java.lang.String peptideKey)
Returns the sequence of the peptide indexed by the given key.

Parameters:
peptideKey - the peptide key
Returns:
the corresponding sequence

getModificationFamily

public static java.util.ArrayList<java.lang.String> getModificationFamily(java.lang.String peptideKey)
Returns a list of names of the variable modifications found in the key of a peptide.

Parameters:
peptideKey - the key of a peptide
Returns:
a list of names of the variable modifications found in the key

getPotentialModificationSites

public static java.util.ArrayList<java.lang.Integer> getPotentialModificationSites(java.lang.String sequence,
                                                                                   PTM ptm)
Returns the potential modification sites as an ordered list of string. 0 is the first aa.

Parameters:
sequence - the sequence of the peptide of interest
ptm - the PTM considered
Returns:
a list of potential modification sites

isSameAs

public boolean isSameAs(Peptide anotherPeptide)
A method which compares to peptides. Two same peptides present the same sequence and same modifications at the same place.

Parameters:
anotherPeptide - another peptide
Returns:
a boolean indicating if the other peptide is the same.

sameModificationsAs

public boolean sameModificationsAs(Peptide anotherPeptide)
Indicates whether another peptide has the same modifications at the same localization as this peptide. This method comes as a complement of isSameAs which does not account for PTM location.

Parameters:
anotherPeptide - another peptide
Returns:
true if the other peptide has the same positions at the same location as the considered peptide

getNTerminal

public java.lang.String getNTerminal()
Returns the N-terminal of the peptide as a String. Returns "NH3" if the terminal is not modified, otherwise returns the name of the modification. /!\ this method will work only if the ptm found in the peptide are in the PTMFactory.

Returns:
the N-terminal of the peptide as a String, e.g., "NH3"

getCTerminal

public java.lang.String getCTerminal()
Returns the C-terminal of the peptide as a String. Returns "COOH" if the terminal is not modified, otherwise returns the name of the modification. /!\ this method will work only if the ptm found in the peptide are in the PTMFactory.

Returns:
the C-terminal of the peptide as a String, e.g., "COOH"

getModifiedSequenceAsHtml

public static java.lang.String getModifiedSequenceAsHtml(java.util.HashMap<java.lang.String,java.awt.Color> colors,
                                                         boolean includeHtmlStartEndTag,
                                                         Peptide peptide,
                                                         java.util.HashMap<java.lang.Integer,java.util.ArrayList<java.lang.String>> mainModificationSites,
                                                         java.util.HashMap<java.lang.Integer,java.util.ArrayList<java.lang.String>> secondaryModificationSites)
Returns the modified sequence as an HTML string with potential modification sites color coding. /!\ this method will work only if the ptm found in the peptide are in the PTMFactory.

Parameters:
colors - the ptm name to color mapping
includeHtmlStartEndTag - if true, start and end html tags are added
peptide -
mainModificationSites -
secondaryModificationSites -
Returns:
the modified sequence as an HTML string

getModifiedSequenceAsHtml

public java.lang.String getModifiedSequenceAsHtml(java.util.HashMap<java.lang.String,java.awt.Color> colors,
                                                  boolean includeHtmlStartEndTag)
Returns the modified sequence as an HTML string with modification color coding. /!\ this method will work only if the ptm found in the peptide are in the PTMFactory.

Parameters:
colors - the ptm name to color mapping
includeHtmlStartEndTag - if true, start and end html tags are added
Returns:
the modified sequence as an HTML string

getPTMShortNameColorMap

public java.util.HashMap<java.lang.String,java.awt.Color> getPTMShortNameColorMap(java.util.HashMap<java.lang.String,java.awt.Color> ptmColors)
Returns a map of the ptm short names to the ptm colors. E.g., key: , element: oxidation of m.

Parameters:
ptmColors - the ptm color map
Returns:
a map of the ptm short names to the ptm colors

getPTMShortNameMap

public java.util.HashMap<java.lang.String,java.lang.String> getPTMShortNameMap()
Returns a map of the ptm short names to the ptm long names for the modification in this peptide. E.g., key: , element oxidation of m.

Returns:
a map of the ptm short names to the ptm long names

getModifiedSequenceAsString

public java.lang.String getModifiedSequenceAsString(boolean includeTerminals)
Returns the modified sequence as a string, e.g., NH2-PEPTIDE-COOH. /!\ this method will work only if the ptm found in the peptide are in the PTMFactory.

Parameters:
includeTerminals - if true, the terminals are included
Returns:
the modified sequence as a string


Copyright © 2012. All Rights Reserved.