org.fhcrc.cpl.viewer.amt
Class AmtUtilities

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

public class AmtUtilities
extends java.lang.Object

Utilities related to AMT


Field Summary
static java.lang.String HYDROPHOBICITY_ALGORITHM_NAME
           
static double HYDROPHOBICITY_ALGORITHM_VERSION
           
 
Constructor Summary
AmtUtilities()
           
 
Method Summary
static void addHydrophobicityToFeatures(Feature[] features, int scanOrTimeMode, double[] timeToHCoefficients)
          Assumes features have times populated if necessary Given a line that should predict time from hydrophobicity, indicate by how much (in units of scans or seconds) each feature appears to deviate from that line
static float calcModifiedPeptideNeutralMass(java.lang.String peptideSequence, org.fhcrc.cpl.toolbox.proteomics.MS2Modification[] modifications)
          Calculate the neutral mass of a given peptide sequence with the specified STATIC modifications.
static float calculateAbsoluteDeltaMass(float centerMass, float deltaMass, int deltaMassType)
          Utility method to calculate the absolute mass tolerance, given a mass tolerance parameter that may be absolute or relative
static java.util.Map<java.lang.String,java.lang.Double> calculateHydrophobicityScanOrTimeRelationship(Feature[] featuresForRegression, int scanOrTimeMode, boolean robustRegression)
           
static double calculateNormalizedHydrophobicity(Feature feature)
          Warning about this one: if there's more than one peptide associated with the feature, it'll take the first
static double calculateNormalizedHydrophobicity(org.fhcrc.cpl.toolbox.proteomics.Peptide peptide)
           
static double calculateNormalizedHydrophobicity(java.lang.String peptideSequence)
           
static double calculateRawHydrophobicity(org.fhcrc.cpl.toolbox.proteomics.Peptide peptide)
          Cover method for Peptide.getHydrophobicity / getHydrophobicity3.
static double calculateRawHydrophobicity(java.lang.String peptideSequence)
           
static java.util.Map<java.lang.String,java.lang.Double> calculateScanOrTimeHydrophobicityRelationship(Feature[] featuresForRegression, int scanOrTimeMode, boolean robustRegression)
           
static java.util.Map<java.lang.String,java.lang.Double> calculateTimeHydroRelationshipEitherWay(Feature[] featuresForRegression, int scanOrTimeMode, boolean predictTimeFromHydro, boolean robustRegression)
          Workhorse method for relating time to hydrophobicity using linear regression, can be used to relate time in terms of hydrophobicity or vice versa.
static double convertDeltaScanOrTimeToHydro(double slope, double intercept, double deltaScanOrTime)
           
static double convertDeltaScanOrTimeToHydro(java.util.Map<java.lang.String,java.lang.Double> regressionLineMap, double scanOrTimeValueToConvert)
           
static org.fhcrc.cpl.toolbox.proteomics.Peptide createPeptideFromSequence(java.lang.String peptideSequence)
          Create a peptide object from a peptide sequence.
static double getInterceptFromRegressionLine(java.util.Map<java.lang.String,java.lang.Double> regressionLine)
           
static double getSlopeFromRegressionLine(java.util.Map<java.lang.String,java.lang.Double> regressionLine)
           
static double[] getTimesForSortedScanArray(MSRun run, int[] sortedScanArray)
           
static double normalizeHydrophobicity(double inputHydrophobicity)
           
static java.util.ArrayList<org.fhcrc.cpl.toolbox.proteomics.Protein> pickRandomProteins(java.util.ArrayList<org.fhcrc.cpl.toolbox.proteomics.Protein> fullProteinArray, int numProteinsToLoad)
          Pick numProteins proteins at "random" from a specified list of proteins.
static double predictScanOrTime(double slope, double intercept, double hydrophobicity)
          Given a hydrophobicity, and a line describing the relationship between hydrophobicity and scan number, return the predicted scan for a given hydrophobicity.
static double predictScanOrTime(double slope, double intercept, Feature feature)
          Predict the scan or time of a feature (depending on what the regression parameters represent)
protected static double predictScanOrTime(double slope, double intercept, org.fhcrc.cpl.toolbox.proteomics.Peptide peptide)
          Given a peptide, and a line describing the relationship between hydrophobicity and scan number, calculate the hydrophobicity of the peptide and return the predicted scan for that hydrophobicity
static double predictScanOrTime(java.util.Map<java.lang.String,java.lang.Double> regressionLine, Feature feature)
          Predict the scan or time of a feature (depending on what the regression line represents)
static void recordHydrophobicities(FeatureSet featureSet, java.util.Map<java.lang.String,java.lang.Double> regressionLine, int scanOrTimeMode)
           
static void recordMS1Hydrophobicities(FeatureSet featureSet, java.util.Map<java.lang.String,java.lang.Double> regressionLine, int scanOrTimeMode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HYDROPHOBICITY_ALGORITHM_NAME

public static final java.lang.String HYDROPHOBICITY_ALGORITHM_NAME
See Also:
Constant Field Values

HYDROPHOBICITY_ALGORITHM_VERSION

public static final double HYDROPHOBICITY_ALGORITHM_VERSION
See Also:
Constant Field Values
Constructor Detail

AmtUtilities

public AmtUtilities()
Method Detail

recordHydrophobicities

public static void recordHydrophobicities(FeatureSet featureSet,
                                          java.util.Map<java.lang.String,java.lang.Double> regressionLine,
                                          int scanOrTimeMode)

recordMS1Hydrophobicities

public static void recordMS1Hydrophobicities(FeatureSet featureSet,
                                             java.util.Map<java.lang.String,java.lang.Double> regressionLine,
                                             int scanOrTimeMode)

pickRandomProteins

public static java.util.ArrayList<org.fhcrc.cpl.toolbox.proteomics.Protein> pickRandomProteins(java.util.ArrayList<org.fhcrc.cpl.toolbox.proteomics.Protein> fullProteinArray,
                                                                                               int numProteinsToLoad)
Pick numProteins proteins at "random" from a specified list of proteins. It would sure be nice if we didn't have to load all the proteins in order to pick a random sample, but since FastaLoader just provides an iterator, this is about all we've got

Parameters:
fullProteinArray -
numProteinsToLoad -
Returns:

getTimesForSortedScanArray

public static double[] getTimesForSortedScanArray(MSRun run,
                                                  int[] sortedScanArray)

calculateTimeHydroRelationshipEitherWay

public static java.util.Map<java.lang.String,java.lang.Double> calculateTimeHydroRelationshipEitherWay(Feature[] featuresForRegression,
                                                                                                       int scanOrTimeMode,
                                                                                                       boolean predictTimeFromHydro,
                                                                                                       boolean robustRegression)
Workhorse method for relating time to hydrophobicity using linear regression, can be used to relate time in terms of hydrophobicity or vice versa. optionally use robust regression, which takes a lot longer

Returns:
a hashmap containing three elements, whose keys are defined in constants: the slope, intercept and sigma of the regression Note: this regression predicts hydrophobicity in terms of time. This relationship is not reciprocal, due to all sorts of arcane weirdness related to linear regression.

calculateScanOrTimeHydrophobicityRelationship

public static java.util.Map<java.lang.String,java.lang.Double> calculateScanOrTimeHydrophobicityRelationship(Feature[] featuresForRegression,
                                                                                                             int scanOrTimeMode,
                                                                                                             boolean robustRegression)
Returns:
a HashMap containing three elements, whose keys are defined in constants: the slope, intercept and sigma of the regression Note: this regression predicts time in terms of hydrophobicity. This relationship is not reciprocal, due to all sorts of arcane weirdness related to linear regression.

calculateHydrophobicityScanOrTimeRelationship

public static java.util.Map<java.lang.String,java.lang.Double> calculateHydrophobicityScanOrTimeRelationship(Feature[] featuresForRegression,
                                                                                                             int scanOrTimeMode,
                                                                                                             boolean robustRegression)
Returns:
a HashMap containing three elements, whose keys are defined in constants: the slope, intercept and sigma of the regression Note: this regression predicts hydrophobicity in terms of time. This relationship is not reciprocal, due to all sorts of arcane weirdness related to linear regression.

predictScanOrTime

protected static double predictScanOrTime(double slope,
                                          double intercept,
                                          org.fhcrc.cpl.toolbox.proteomics.Peptide peptide)
Given a peptide, and a line describing the relationship between hydrophobicity and scan number, calculate the hydrophobicity of the peptide and return the predicted scan for that hydrophobicity

Parameters:
intercept -
peptide -
Returns:

predictScanOrTime

public static double predictScanOrTime(double slope,
                                       double intercept,
                                       double hydrophobicity)
Given a hydrophobicity, and a line describing the relationship between hydrophobicity and scan number, return the predicted scan for a given hydrophobicity.

Parameters:
slope -
intercept -
hydrophobicity -
Returns:

getSlopeFromRegressionLine

public static double getSlopeFromRegressionLine(java.util.Map<java.lang.String,java.lang.Double> regressionLine)

getInterceptFromRegressionLine

public static double getInterceptFromRegressionLine(java.util.Map<java.lang.String,java.lang.Double> regressionLine)

predictScanOrTime

public static double predictScanOrTime(java.util.Map<java.lang.String,java.lang.Double> regressionLine,
                                       Feature feature)
Predict the scan or time of a feature (depending on what the regression line represents)

Parameters:
regressionLine -
feature -
Returns:

predictScanOrTime

public static double predictScanOrTime(double slope,
                                       double intercept,
                                       Feature feature)
Predict the scan or time of a feature (depending on what the regression parameters represent)

Parameters:
feature -
Returns:

calculateAbsoluteDeltaMass

public static float calculateAbsoluteDeltaMass(float centerMass,
                                               float deltaMass,
                                               int deltaMassType)
Utility method to calculate the absolute mass tolerance, given a mass tolerance parameter that may be absolute or relative

Parameters:
centerMass -
deltaMass -
deltaMassType -
Returns:

convertDeltaScanOrTimeToHydro

public static double convertDeltaScanOrTimeToHydro(java.util.Map<java.lang.String,java.lang.Double> regressionLineMap,
                                                   double scanOrTimeValueToConvert)

convertDeltaScanOrTimeToHydro

public static double convertDeltaScanOrTimeToHydro(double slope,
                                                   double intercept,
                                                   double deltaScanOrTime)

createPeptideFromSequence

public static org.fhcrc.cpl.toolbox.proteomics.Peptide createPeptideFromSequence(java.lang.String peptideSequence)
Create a peptide object from a peptide sequence. Useful for finding mass, etc.

Parameters:
peptideSequence -
Returns:

calculateRawHydrophobicity

public static double calculateRawHydrophobicity(java.lang.String peptideSequence)

calculateRawHydrophobicity

public static double calculateRawHydrophobicity(org.fhcrc.cpl.toolbox.proteomics.Peptide peptide)
Cover method for Peptide.getHydrophobicity / getHydrophobicity3. Use this to switch between versions of the hydrophobicity calculator

Parameters:
peptide -
Returns:

normalizeHydrophobicity

public static double normalizeHydrophobicity(double inputHydrophobicity)

calculateNormalizedHydrophobicity

public static double calculateNormalizedHydrophobicity(org.fhcrc.cpl.toolbox.proteomics.Peptide peptide)

calculateNormalizedHydrophobicity

public static double calculateNormalizedHydrophobicity(java.lang.String peptideSequence)

calculateNormalizedHydrophobicity

public static double calculateNormalizedHydrophobicity(Feature feature)
Warning about this one: if there's more than one peptide associated with the feature, it'll take the first

Parameters:
feature -
Returns:

addHydrophobicityToFeatures

public static void addHydrophobicityToFeatures(Feature[] features,
                                               int scanOrTimeMode,
                                               double[] timeToHCoefficients)
Assumes features have times populated if necessary Given a line that should predict time from hydrophobicity, indicate by how much (in units of scans or seconds) each feature appears to deviate from that line

Parameters:
features -
scanOrTimeMode -

calcModifiedPeptideNeutralMass

public static float calcModifiedPeptideNeutralMass(java.lang.String peptideSequence,
                                                   org.fhcrc.cpl.toolbox.proteomics.MS2Modification[] modifications)
Calculate the neutral mass of a given peptide sequence with the specified STATIC modifications.

Parameters:
peptideSequence -
modifications -


Fred Hutchinson Cancer Research Center