org.fhcrc.cpl.toolbox.proteomics.feature
Class FeatureMassCalibrationUtilities

java.lang.Object
  extended by org.fhcrc.cpl.toolbox.proteomics.feature.FeatureMassCalibrationUtilities

public class FeatureMassCalibrationUtilities
extends java.lang.Object

Utilities for recalibrating and characterizing the mass calibration of sets of features, based on an approach that uses theoretical peptide mass clusters. Peptides should have masses with certain predictable qualities. In particular, the distances between masses should cluster around multiples of a certain number, called the "mass wavelength". This number would be 1 (the mass of a proton in a Carbon atom), except that different elements' nucleon masses are different, due to the effect of the mass defect. So the clustering isn't perfect, but it is pretty good. You can determine how the deviation from predicted cluster changes as the distance between masses increases. This deviation can be used to calibrate masses in a given run, and it can be used to toss out wildly deviating masses from runs known to be calibrated correctly. For more information, and for the theoretical basis of pretty much everything in here, check out: "Analytical model of peptide mass cluster centres with applications" Wolski, Farrow, et al. http://www.proteomesci.com/content/4/1/18


Field Summary
protected static org.apache.log4j.Logger _log
           
 
Constructor Summary
FeatureMassCalibrationUtilities()
           
 
Method Summary
static Pair<java.lang.Double,java.lang.Double> calculateWavelengthAndOffset(Feature[] features, int maxPairsForLeverageCalc, double theoreticalMassWavelength)
          Use robust regression techniques to map mass to mass offset from theoretical cluster
static Pair<java.lang.Integer,Pair<java.lang.Double,java.lang.Double>>[] calculateWavelengthsAndOffsetsMultiplePartitions(Feature[] featuresByScan, int maxPairsForLeverageCalc, int numPartitions, double theoreticalMassWavelength, boolean showCharts)
          Returns an array of pairs.
static void calibrateMasses(Feature[] features, int maxPairsForLeverageCalc, int numPartitions, double theoreticalMassWavelength, int initialMassFilterPPM, boolean showCharts)
          master method for mass correction.
static void calibrateMasses(Feature[] featuresByScan, Pair<java.lang.Integer,Pair<java.lang.Double,java.lang.Double>>[] partitionParameters, double theoreticalMassWavelength, boolean showCharts)
           
protected static void calibrateMassesSinglePartition(Feature[] features, int maxPairsForLeverageCalc, double theoreticalMassWavelength)
          Calibrate masses in a single partition.
static Feature[] filterFeaturesByMassDefectDeviation(Feature[] features, double maxDeviationPPM)
          Not the entry point for the --filter command
static Feature[] filterFeaturesByMassDefectDeviation(Feature[] features, double maxDeviationPPM, double theoreticalMassWavelength)
          Not the entry point for the --filter command
static java.util.List<Feature> filterFeaturesByMassDefectDeviation(java.util.List<Feature> featuresList, double maxDeviationPPM)
          Not the entry point for the --filter command
static void filterFeatureSetByMassDefectDeviation(FeatureSet featureSet, double theoreticalMassWavelength)
          Not the entry point for the --filter command
static PanelWithScatterPlot plotMassDefectDeviation(Feature[] features, double theoreticalMassWavelength, boolean shouldDisplayPPMLine, double ppmForLine)
          Convenience method for a single feature set
static PanelWithScatterPlot plotMassDefectDeviation(java.util.List<Feature[]> featureArrays, double theoreticalMassWavelength, boolean shouldDisplayPPMLine, double ppmForLine, boolean useMz)
          Plot the mass defect deviations of multiple featuresets, in different colors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log

protected static org.apache.log4j.Logger _log
Constructor Detail

FeatureMassCalibrationUtilities

public FeatureMassCalibrationUtilities()
Method Detail

plotMassDefectDeviation

public static PanelWithScatterPlot plotMassDefectDeviation(Feature[] features,
                                                           double theoreticalMassWavelength,
                                                           boolean shouldDisplayPPMLine,
                                                           double ppmForLine)
Convenience method for a single feature set

Parameters:
features -
Returns:

plotMassDefectDeviation

public static PanelWithScatterPlot plotMassDefectDeviation(java.util.List<Feature[]> featureArrays,
                                                           double theoreticalMassWavelength,
                                                           boolean shouldDisplayPPMLine,
                                                           double ppmForLine,
                                                           boolean useMz)
Plot the mass defect deviations of multiple featuresets, in different colors. Optionally displays lines indicating deviations of ppmForLine parts per million from theoretical cluster center.

Parameters:
featureArrays -
Returns:

calibrateMasses

public static void calibrateMasses(Feature[] features,
                                   int maxPairsForLeverageCalc,
                                   int numPartitions,
                                   double theoreticalMassWavelength,
                                   int initialMassFilterPPM,
                                   boolean showCharts)
master method for mass correction. Masses can be corrected separately for different ranges of scans within the file, since calibration can drift throughout the run.

Parameters:
features -
maxPairsForLeverageCalc -
numPartitions -
theoreticalMassWavelength -
showCharts -

calibrateMasses

public static void calibrateMasses(Feature[] featuresByScan,
                                   Pair<java.lang.Integer,Pair<java.lang.Double,java.lang.Double>>[] partitionParameters,
                                   double theoreticalMassWavelength,
                                   boolean showCharts)

calculateWavelengthsAndOffsetsMultiplePartitions

public static Pair<java.lang.Integer,Pair<java.lang.Double,java.lang.Double>>[] calculateWavelengthsAndOffsetsMultiplePartitions(Feature[] featuresByScan,
                                                                                                                                 int maxPairsForLeverageCalc,
                                                                                                                                 int numPartitions,
                                                                                                                                 double theoreticalMassWavelength,
                                                                                                                                 boolean showCharts)
Returns an array of pairs. The first item in the pair is a _scan number_ indicating where the region begins. The second item is a Double,Double pair containing the wavelength and intercept to be applied in the region.

Parameters:
featuresByScan -
maxPairsForLeverageCalc -
numPartitions -
theoreticalMassWavelength -
showCharts -
Returns:

calibrateMassesSinglePartition

protected static void calibrateMassesSinglePartition(Feature[] features,
                                                     int maxPairsForLeverageCalc,
                                                     double theoreticalMassWavelength)
Calibrate masses in a single partition. First we calculate the mass wavelength, and the offset from theoretical mass intercept. Then we adjust each mass.

Parameters:
features -
maxPairsForLeverageCalc -
theoreticalMassWavelength -

calculateWavelengthAndOffset

public static Pair<java.lang.Double,java.lang.Double> calculateWavelengthAndOffset(Feature[] features,
                                                                                   int maxPairsForLeverageCalc,
                                                                                   double theoreticalMassWavelength)
Use robust regression techniques to map mass to mass offset from theoretical cluster

Parameters:
features -
maxPairsForLeverageCalc - more is better, but more costs more time
Returns:
a Pair containing slope, intercept of the regression line.

filterFeatureSetByMassDefectDeviation

public static void filterFeatureSetByMassDefectDeviation(FeatureSet featureSet,
                                                         double theoreticalMassWavelength)
Not the entry point for the --filter command

Parameters:
featureSet -

filterFeaturesByMassDefectDeviation

public static java.util.List<Feature> filterFeaturesByMassDefectDeviation(java.util.List<Feature> featuresList,
                                                                          double maxDeviationPPM)
Not the entry point for the --filter command

Parameters:
featuresList -
Returns:

filterFeaturesByMassDefectDeviation

public static Feature[] filterFeaturesByMassDefectDeviation(Feature[] features,
                                                            double maxDeviationPPM)
Not the entry point for the --filter command

Parameters:
features -
Returns:

filterFeaturesByMassDefectDeviation

public static Feature[] filterFeaturesByMassDefectDeviation(Feature[] features,
                                                            double maxDeviationPPM,
                                                            double theoreticalMassWavelength)
Not the entry point for the --filter command

Parameters:
features -
maxDeviationPPM -
Returns:


Fred Hutchinson Cancer Research Center