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

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

public class Spectrum
extends java.lang.Object

User: mbellew Date: Jun 2, 2004 Time: 1:57:21 PM


Nested Class Summary
static class Spectrum.CentroidedPeak
           
static class Spectrum.Peak
           
 
Field Summary
static java.util.Comparator<Feature> compareFeatureLengthDesc
           
static java.util.Comparator<Spectrum.Peak> comparePeakIntensityDesc
           
static java.util.Comparator<Feature> comparePeakMassAsc
           
static java.util.Comparator<Spectrum.Peak> comparePeakMzAsc
           
static java.util.Comparator<Spectrum.Peak> comparePeakScanAsc
           
static float HYDROGEN_ION_MASS
           
static double LN2
           
 
Constructor Summary
Spectrum()
           
 
Method Summary
static int[] calcIdealPeakIntensityOrderDesc(float mass)
          Return the indexes of the peaks in descending order of theoretical intensity.
static int calcMaxIdealPeakIndex(float mass)
          Return the index of the peak that, according to the Poisson distribution for this mass, should be most intense
static float[][] Centroid(float[][] spectrum)
           
static double ChooseThreshold(double[] x, double f)
           
static float[][] CombineRawSpectra(float[] template, java.util.List<float[][]> spectra, FloatRange rangeIN)
           
static void CopyToTSV(float[][] spectrum, java.io.Writer out, boolean useHeader)
           
static double Correlation(float[] X, float[] Y)
           
static float[] FFTsmooth(float[] x, double smoothfactor, boolean cliff)
           
static int[] FindMinimaIndexes(float[] signal)
          find smallest (most negative) values between zero crossings
static float[] GenerateSpectrumTemplate(float[] mzArray, FloatRange r)
          For both micromass and bruker, intervals between readings are proportional to sqrt(mz).
static float[] getRow(float[][] m, int r, float[] out)
           
static double HellingerDistance(float[] p, float[] q)
           
static double KLDistanceSymmetric(float[] signal1, int off1, float[] signal2, int off2, int len)
           
static float KLGayDistance(float m, float[] signal)
           
static float KLPoissonDistance(float mass, float[] q)
           
static float KLPoissonDistanceSymmetric(float mass, float[] signal)
           
static void main(java.lang.String[] args)
           
static double Median(double[] x, int start, int len, boolean fABS, double[] t)
           
static float Median(float[] x, int start, int len, boolean fABS, float[] t)
           
static float Median(float a, float b, float c)
           
static double MedianSampled(double[] x, boolean fABS)
           
static float MedianSampled(float[] x, boolean fABS)
           
static float[] MedianSmooth(float[] x)
           
static float[] MedianSmooth(float[] x, int len)
          Deprecated.  
static float[] MedianSmooth(float[] x, int len, float[] in)
           
static float[] MedianWindow(float[] x, int len, int windowSize, boolean fABS)
           
static float[] MinimaWindow(float[] x, int len, int windowSize, float[] result)
           
static float Noise(float[] signal, int start, int end)
           
static void NormalizeSquares(float[] x)
           
static void NormalizeSum(float[] x)
           
static double[] PadToDouble(float[] x, int pad)
           
static double[] PadToDouble(float[] x, int length, int pad, double[] y)
           
static int[] PickPeakIndexes(float[] signal, double minFilter)
          don't put too much effort in this yet, Are there standard centroiding algorithms? I think Tim Randolph has some ideas
static Spectrum.Peak[] PickPeaks(float[][] spectrum, double minFilter)
           
static float[] Poisson(float m)
           
static double[] realloc(double[] array, int length)
           
static float[] realloc(float[] array, int length)
           
static float[][] RemoveBackground(float[][] spectra)
           
static float[] Resample(float[][] spectrum, FloatRange r, int resolution)
           
static float[][] ResampleSpectrum(float[][] spectrum, FloatRange r, int resolution, boolean zeroCharge)
           
static void Reverse(float[] x, int start, int len)
           
static void Rotate(float[] x, int d)
           
static void setRow(float[][] m, int r, float[] in)
           
static void SmoothALittle(double[] x)
           
static void SmoothALittle(float[] x)
           
static void threshold(double[][] Xin, double[] threshold)
           
static float[][] TranslateZeroCharge(float[][] spectrum, FloatRange r, int charge, int resolution)
          resample and translate to zero charge domain assumes the input is higher resolution than 1/scale*resolution

CONSIDER: There's probably a better, curve estimating/fitting algorithm

static float[] UnpadToFloat(double[] y, int pad, float[] x)
           
static float[] WaveletD3(float[] X, Pair<float[][],float[][]> tmp)
           
static float[] WaveletD4(float[] X)
           
static float[] WaveletFilter(float[] signalF, int K, int L, float[] bg)
          returns reconstruction of last L levels of wavelet decomposition not including the S 'remainder' this is not a real analysis method, just for visual examination
static Spectrum.Peak[] WaveletPeaks(float[][] spectrum)
           
static Spectrum.Peak[] WaveletPeaksD3(float[][] spectrum)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HYDROGEN_ION_MASS

public static final float HYDROGEN_ION_MASS
See Also:
Constant Field Values

LN2

public static final double LN2

comparePeakIntensityDesc

public static java.util.Comparator<Spectrum.Peak> comparePeakIntensityDesc

comparePeakMzAsc

public static java.util.Comparator<Spectrum.Peak> comparePeakMzAsc

comparePeakMassAsc

public static java.util.Comparator<Feature> comparePeakMassAsc

comparePeakScanAsc

public static java.util.Comparator<Spectrum.Peak> comparePeakScanAsc

compareFeatureLengthDesc

public static java.util.Comparator<Feature> compareFeatureLengthDesc
Constructor Detail

Spectrum

public Spectrum()
Method Detail

GenerateSpectrumTemplate

public static float[] GenerateSpectrumTemplate(float[] mzArray,
                                               FloatRange r)
For both micromass and bruker, intervals between readings are proportional to sqrt(mz). This function infers the sampling frequency from a spectrum. r.min should be an actual start value from a real spectrum (e.g. not just 400) This is expensive so it's done once per MSRun, see MSRun.getTemplateSpectrum(). Since we do it once, don't try to optimize too much.


CombineRawSpectra

public static float[][] CombineRawSpectra(float[] template,
                                          java.util.List<float[][]> spectra,
                                          FloatRange rangeIN)

TranslateZeroCharge

public static float[][] TranslateZeroCharge(float[][] spectrum,
                                            FloatRange r,
                                            int charge,
                                            int resolution)
resample and translate to zero charge domain assumes the input is higher resolution than 1/scale*resolution

CONSIDER: There's probably a better, curve estimating/fitting algorithm


ResampleSpectrum

public static float[][] ResampleSpectrum(float[][] spectrum,
                                         FloatRange r,
                                         int resolution,
                                         boolean zeroCharge)

Resample

public static float[] Resample(float[][] spectrum,
                               FloatRange r,
                               int resolution)

PickPeakIndexes

public static int[] PickPeakIndexes(float[] signal,
                                    double minFilter)
don't put too much effort in this yet, Are there standard centroiding algorithms? I think Tim Randolph has some ideas


PickPeaks

public static Spectrum.Peak[] PickPeaks(float[][] spectrum,
                                        double minFilter)

SmoothALittle

public static void SmoothALittle(float[] x)

SmoothALittle

public static void SmoothALittle(double[] x)

FFTsmooth

public static float[] FFTsmooth(float[] x,
                                double smoothfactor,
                                boolean cliff)

HellingerDistance

public static double HellingerDistance(float[] p,
                                       float[] q)

KLPoissonDistance

public static float KLPoissonDistance(float mass,
                                      float[] q)

KLPoissonDistanceSymmetric

public static float KLPoissonDistanceSymmetric(float mass,
                                               float[] signal)

KLDistanceSymmetric

public static double KLDistanceSymmetric(float[] signal1,
                                         int off1,
                                         float[] signal2,
                                         int off2,
                                         int len)

KLGayDistance

public static float KLGayDistance(float m,
                                  float[] signal)

Noise

public static float Noise(float[] signal,
                          int start,
                          int end)

Poisson

public static float[] Poisson(float m)

calcMaxIdealPeakIndex

public static int calcMaxIdealPeakIndex(float mass)
Return the index of the peak that, according to the Poisson distribution for this mass, should be most intense

Parameters:
mass -
Returns:

calcIdealPeakIntensityOrderDesc

public static int[] calcIdealPeakIntensityOrderDesc(float mass)
Return the indexes of the peaks in descending order of theoretical intensity. Relies on no exact ties from Poisson();

Parameters:
mass -
Returns:

Centroid

public static float[][] Centroid(float[][] spectrum)

CopyToTSV

public static void CopyToTSV(float[][] spectrum,
                             java.io.Writer out,
                             boolean useHeader)
                      throws java.io.IOException
Throws:
java.io.IOException

NormalizeSum

public static void NormalizeSum(float[] x)

NormalizeSquares

public static void NormalizeSquares(float[] x)

Correlation

public static double Correlation(float[] X,
                                 float[] Y)

WaveletPeaks

public static Spectrum.Peak[] WaveletPeaks(float[][] spectrum)

WaveletPeaksD3

public static Spectrum.Peak[] WaveletPeaksD3(float[][] spectrum)

FindMinimaIndexes

public static int[] FindMinimaIndexes(float[] signal)
find smallest (most negative) values between zero crossings


Rotate

public static void Rotate(float[] x,
                          int d)

Reverse

public static void Reverse(float[] x,
                           int start,
                           int len)

WaveletFilter

public static float[] WaveletFilter(float[] signalF,
                                    int K,
                                    int L,
                                    float[] bg)
returns reconstruction of last L levels of wavelet decomposition not including the S 'remainder' this is not a real analysis method, just for visual examination


WaveletD3

public static float[] WaveletD3(float[] X,
                                Pair<float[][],float[][]> tmp)

WaveletD4

public static float[] WaveletD4(float[] X)

ChooseThreshold

public static double ChooseThreshold(double[] x,
                                     double f)

Median

public static double Median(double[] x,
                            int start,
                            int len,
                            boolean fABS,
                            double[] t)

Median

public static float Median(float[] x,
                           int start,
                           int len,
                           boolean fABS,
                           float[] t)

Median

public static final float Median(float a,
                                 float b,
                                 float c)

MedianSmooth

public static float[] MedianSmooth(float[] x)

MedianSmooth

public static float[] MedianSmooth(float[] x,
                                   int len)
Deprecated. 


MedianSmooth

public static float[] MedianSmooth(float[] x,
                                   int len,
                                   float[] in)

MinimaWindow

public static float[] MinimaWindow(float[] x,
                                   int len,
                                   int windowSize,
                                   float[] result)

MedianWindow

public static float[] MedianWindow(float[] x,
                                   int len,
                                   int windowSize,
                                   boolean fABS)

MedianSampled

public static double MedianSampled(double[] x,
                                   boolean fABS)

MedianSampled

public static float MedianSampled(float[] x,
                                  boolean fABS)

RemoveBackground

public static float[][] RemoveBackground(float[][] spectra)

threshold

public static void threshold(double[][] Xin,
                             double[] threshold)

PadToDouble

public static double[] PadToDouble(float[] x,
                                   int pad)

PadToDouble

public static double[] PadToDouble(float[] x,
                                   int length,
                                   int pad,
                                   double[] y)

UnpadToFloat

public static float[] UnpadToFloat(double[] y,
                                   int pad,
                                   float[] x)

realloc

public static double[] realloc(double[] array,
                               int length)

realloc

public static float[] realloc(float[] array,
                              int length)

getRow

public static float[] getRow(float[][] m,
                             int r,
                             float[] out)

setRow

public static void setRow(float[][] m,
                          int r,
                          float[] in)

main

public static void main(java.lang.String[] args)


Fred Hutchinson Cancer Research Center