org.fhcrc.cpl.viewer.amt
Class AmtPeptideEntry

java.lang.Object
  extended by org.fhcrc.cpl.viewer.amt.AmtPeptideEntry

public class AmtPeptideEntry
extends java.lang.Object

Encapsulates everything we need to retrieve from / store into an AMT database. Awfully redundant with the XmlBeans amtXml representation. It's worth it to have a separate class so that we have complete control over the code and can do things like calculate predicted hydrophobicities.


Nested Class Summary
static class AmtPeptideEntry.AmtPeptideModificationStateEntry
          Represents an entry for a specific modification state
static class AmtPeptideEntry.AmtPeptideObservation
          Represents a single peptide observation.
 
Field Summary
protected static double MEAN_HYDRO_UNCALCULATED_SENTINEL
           
protected  double mHydrophobicityStandardDeviation
           
protected  double mMassUsingMonoisotopicMassTable
           
protected  double mMeanObservedHydrophobicity
           
protected  double mMedianObservedHydrophobicity
           
protected  double mMedianPeptideProphet
           
protected  java.util.HashMap<java.lang.String,AmtPeptideEntry.AmtPeptideModificationStateEntry> mModificationStateEntryMap
           
protected  org.fhcrc.cpl.toolbox.proteomics.Peptide mPeptide
           
protected  java.lang.String mPeptideSequence
           
protected  double mPredictedHydrophobicity
           
 
Constructor Summary
AmtPeptideEntry()
           
 
Method Summary
 void addModificationStateEntry(AmtPeptideEntry.AmtPeptideModificationStateEntry newModificationStateEntry)
          Add a modification state entry.
 AmtPeptideEntry.AmtPeptideModificationStateEntry addModificationStateEntry(java.lang.String modifiedPeptideSequence, double modifiedMass, java.util.List<org.fhcrc.cpl.toolbox.proteomics.MS2Modification>[] modifications)
           
 void addObservation(java.lang.String peptide, java.util.List<org.fhcrc.cpl.toolbox.proteomics.MS2Modification>[] modifications, AmtPeptideEntry.AmtPeptideObservation observation)
          Add an observation for this peptide and recalculate the stats
protected  void addObservationNoRecalc(java.lang.String peptide, java.util.List<org.fhcrc.cpl.toolbox.proteomics.MS2Modification>[] modifications, AmtPeptideEntry.AmtPeptideObservation observation)
          Add an observation for this peptide.
 void addObservations(java.lang.String peptide, java.util.List<org.fhcrc.cpl.toolbox.proteomics.MS2Modification>[] modifications, AmtPeptideEntry.AmtPeptideObservation[] observations, double modificationMassRoundingFactor)
          Add a bunch of observations for this peptide, without recalculating stats, then recalculate once.
 float calculateIDProbability()
          Calculate the probability that the ID for this peptide entry is correct.
static AmtPeptideEntry createEntryFromObservation(java.lang.String peptideSequence, java.util.List<org.fhcrc.cpl.toolbox.proteomics.MS2Modification>[] modifications, AmtPeptideEntry.AmtPeptideObservation observation)
           
static AmtPeptideEntry createEntryFromObservation(java.lang.String peptideSequence, java.util.List<org.fhcrc.cpl.toolbox.proteomics.MS2Modification>[] modifications, double predictedHydrophobicity, AmtPeptideEntry.AmtPeptideObservation observation)
          Create a new entry with one observation based on a calculated hydrophobicity and that observation
 double getHydrophobicityStandardDeviation()
           
 double getMass()
          Calculate this on demand only
 double getMass(double[] massTable)
          Assume this is a table other than monoisotopic mass table, actually calculate
 double getMeanObservedHydrophobicity()
          This is not a cost-free getter.
 double getMedianObservedHydrophobicity()
           
 double getMedianPeptideProphet()
           
 AmtPeptideEntry.AmtPeptideModificationStateEntry[] getModificationStateEntries()
           
 AmtPeptideEntry.AmtPeptideModificationStateEntry getModificationStateEntry(java.lang.String modifiedSequence)
           
 int getNumModificationStates()
          how many observations for this peptide entry?
 int getNumObservations()
          how many observations for this peptide entry?
 AmtPeptideEntry.AmtPeptideObservation getObservationForRun(AmtRunEntry runEntry)
          Quick and dirty method to find which observation, if any, came from this run entry.
 AmtPeptideEntry.AmtPeptideObservation[] getObservations()
          This getter is computationally intensive, since observations are stored one level down
 org.fhcrc.cpl.toolbox.proteomics.Peptide getPeptide()
          Build this on demand only
static org.fhcrc.cpl.toolbox.proteomics.Peptide getPeptideForPeptideSequence(java.lang.String peptideSequence)
           
 java.lang.String getPeptideSequence()
           
 double getPredictedHydrophobicity()
           
 int getSpectralCount()
           
static double predictHydrophobicityForPeptideSequence(java.lang.String peptideSequence)
          predict hydrophobicity based on a peptide sequence.
 void recalculateStats()
           
 void recalculateStats(int precision)
          Recalculate the mean observed hydrophobicity and other stats, munging together all observations, giving them equal weight.
 boolean removeObservation(AmtPeptideEntry.AmtPeptideObservation observationToRemove)
          Removes an observation
protected static double roundModifiedMass(double inputMass)
          Round to the nearest multiple of modificationMassRoundingFactor.
 void setHydrophobicityStandardDeviation(double newValue)
           
 void setPeptideSequence(java.lang.String peptideSequence)
           
 void setPredictedHydrophobicity(double predictedHydrophobicity)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mPeptideSequence

protected java.lang.String mPeptideSequence

mPeptide

protected org.fhcrc.cpl.toolbox.proteomics.Peptide mPeptide

mPredictedHydrophobicity

protected double mPredictedHydrophobicity

mMedianObservedHydrophobicity

protected double mMedianObservedHydrophobicity

mMedianPeptideProphet

protected double mMedianPeptideProphet

mHydrophobicityStandardDeviation

protected double mHydrophobicityStandardDeviation

mMassUsingMonoisotopicMassTable

protected double mMassUsingMonoisotopicMassTable

mMeanObservedHydrophobicity

protected double mMeanObservedHydrophobicity

MEAN_HYDRO_UNCALCULATED_SENTINEL

protected static final double MEAN_HYDRO_UNCALCULATED_SENTINEL
See Also:
Constant Field Values

mModificationStateEntryMap

protected java.util.HashMap<java.lang.String,AmtPeptideEntry.AmtPeptideModificationStateEntry> mModificationStateEntryMap
Constructor Detail

AmtPeptideEntry

public AmtPeptideEntry()
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

createEntryFromObservation

public static AmtPeptideEntry createEntryFromObservation(java.lang.String peptideSequence,
                                                         java.util.List<org.fhcrc.cpl.toolbox.proteomics.MS2Modification>[] modifications,
                                                         AmtPeptideEntry.AmtPeptideObservation observation)

createEntryFromObservation

public static AmtPeptideEntry createEntryFromObservation(java.lang.String peptideSequence,
                                                         java.util.List<org.fhcrc.cpl.toolbox.proteomics.MS2Modification>[] modifications,
                                                         double predictedHydrophobicity,
                                                         AmtPeptideEntry.AmtPeptideObservation observation)
Create a new entry with one observation based on a calculated hydrophobicity and that observation

Parameters:
predictedHydrophobicity -
observation -
Returns:

roundModifiedMass

protected static double roundModifiedMass(double inputMass)
Round to the nearest multiple of modificationMassRoundingFactor. Do it by dividing by the factor, rounding to nearest 1, then multiplying by the factor

Parameters:
inputMass -
Returns:

addObservations

public void addObservations(java.lang.String peptide,
                            java.util.List<org.fhcrc.cpl.toolbox.proteomics.MS2Modification>[] modifications,
                            AmtPeptideEntry.AmtPeptideObservation[] observations,
                            double modificationMassRoundingFactor)
Add a bunch of observations for this peptide, without recalculating stats, then recalculate once. Because recalculation is expensive

Parameters:
observations -

addObservation

public void addObservation(java.lang.String peptide,
                           java.util.List<org.fhcrc.cpl.toolbox.proteomics.MS2Modification>[] modifications,
                           AmtPeptideEntry.AmtPeptideObservation observation)
Add an observation for this peptide and recalculate the stats

Parameters:
observation -

addObservationNoRecalc

protected void addObservationNoRecalc(java.lang.String peptide,
                                      java.util.List<org.fhcrc.cpl.toolbox.proteomics.MS2Modification>[] modifications,
                                      AmtPeptideEntry.AmtPeptideObservation observation)
Add an observation for this peptide. Don't recalculate stats

Parameters:
observation -

getPeptide

public org.fhcrc.cpl.toolbox.proteomics.Peptide getPeptide()
Build this on demand only

Returns:

getMass

public double getMass()
Calculate this on demand only

Returns:

getMass

public double getMass(double[] massTable)
Assume this is a table other than monoisotopic mass table, actually calculate

Parameters:
massTable -
Returns:

getPeptideForPeptideSequence

public static org.fhcrc.cpl.toolbox.proteomics.Peptide getPeptideForPeptideSequence(java.lang.String peptideSequence)

predictHydrophobicityForPeptideSequence

public static double predictHydrophobicityForPeptideSequence(java.lang.String peptideSequence)
predict hydrophobicity based on a peptide sequence. This isn't free, so we want to avoid doing it too often, which explains the structure of some of this code

Parameters:
peptideSequence -
Returns:

recalculateStats

public void recalculateStats(int precision)
Recalculate the mean observed hydrophobicity and other stats, munging together all observations, giving them equal weight. Possibly, in the future, if we store probability on observations, weight them


recalculateStats

public void recalculateStats()

calculateIDProbability

public float calculateIDProbability()
Calculate the probability that the ID for this peptide entry is correct. This is calculated simply as: 1 - the product of (1 - each peptide observation's probability)

Returns:

getObservationForRun

public AmtPeptideEntry.AmtPeptideObservation getObservationForRun(AmtRunEntry runEntry)
Quick and dirty method to find which observation, if any, came from this run entry. If nothing, return null. TODO: If this is something we do often, I should build a datastructure for this. TODO: This is totally broken with respect to multiple modification states

Parameters:
runEntry -
Returns:

getNumObservations

public int getNumObservations()
how many observations for this peptide entry?

Returns:

getNumModificationStates

public int getNumModificationStates()
how many observations for this peptide entry?

Returns:

getHydrophobicityStandardDeviation

public double getHydrophobicityStandardDeviation()

setHydrophobicityStandardDeviation

public void setHydrophobicityStandardDeviation(double newValue)

getObservations

public AmtPeptideEntry.AmtPeptideObservation[] getObservations()
This getter is computationally intensive, since observations are stored one level down

Returns:

removeObservation

public boolean removeObservation(AmtPeptideEntry.AmtPeptideObservation observationToRemove)
Removes an observation

Returns:
true if the observation was in this entry already

getModificationStateEntry

public AmtPeptideEntry.AmtPeptideModificationStateEntry getModificationStateEntry(java.lang.String modifiedSequence)

getModificationStateEntries

public AmtPeptideEntry.AmtPeptideModificationStateEntry[] getModificationStateEntries()

addModificationStateEntry

public AmtPeptideEntry.AmtPeptideModificationStateEntry addModificationStateEntry(java.lang.String modifiedPeptideSequence,
                                                                                  double modifiedMass,
                                                                                  java.util.List<org.fhcrc.cpl.toolbox.proteomics.MS2Modification>[] modifications)

addModificationStateEntry

public void addModificationStateEntry(AmtPeptideEntry.AmtPeptideModificationStateEntry newModificationStateEntry)
Add a modification state entry. If we've already got one for this modified peptide (after re-rounding), add all of the new entry's observations to the old entry

Parameters:
newModificationStateEntry -

getPeptideSequence

public java.lang.String getPeptideSequence()

setPeptideSequence

public void setPeptideSequence(java.lang.String peptideSequence)

getPredictedHydrophobicity

public double getPredictedHydrophobicity()

setPredictedHydrophobicity

public void setPredictedHydrophobicity(double predictedHydrophobicity)

getMedianObservedHydrophobicity

public double getMedianObservedHydrophobicity()

getMedianPeptideProphet

public double getMedianPeptideProphet()

getMeanObservedHydrophobicity

public double getMeanObservedHydrophobicity()
This is not a cost-free getter. We store median, not mean, at this level, so if we need the mean we have to calculate it. Once calculated, store it.

Returns:

getSpectralCount

public int getSpectralCount()


Fred Hutchinson Cancer Research Center