com.compomics.util.experiment.massspectrometry
Class Spectrum

java.lang.Object
  extended by com.compomics.util.experiment.personalization.ExperimentObject
      extended by com.compomics.util.experiment.massspectrometry.Spectrum
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
MS1Spectrum, MSnSpectrum

public abstract class Spectrum
extends ExperimentObject

This class models a spectrum.

Author:
Marc Vaudel, Harald Barsnes
See Also:
Serialized Form

Field Summary
protected  java.lang.String fileName
          Spectrum file name.
protected  int level
          The MS level.
protected  java.util.HashMap<java.lang.Double,Peak> peakList
          Peak list.
protected  java.lang.String scanNumber
          Scan number or range.
protected  double scanStartTime
          The timepoint when the spectrum was recorded (scan start time in mzML files).
static java.lang.String SPECTRUM_KEY_SPLITTER
          The splitter in the key between spectrumFile and spectrumTitle.
protected  java.lang.String spectrumTitle
          Spectrum title.
 
Constructor Summary
Spectrum()
           
 
Method Summary
 void addPeak(Peak aPeak)
          Adds a peak to the spectrum peak list.
 java.lang.String getFileName()
          Returns the file name.
 double getIntensityLimit(double intensityLimit)
          Returns the intensity limit.
 double[] getIntensityValuesAsArray()
          Returns the intensity values as an array.
 double[][] getJFreePeakList()
          Format the peaks so they can be plot in JFreeChart.
 int getLevel()
          Returns at which level the spectrum was recorded.
 double getMaxIntensity()
          Returns the max intensity value.
 double getMaxMz()
          Returns the max mz value.
 double getMinMz()
          Returns the min mz value.
 double[][] getMzAndIntensityAsArray()
          Returns the m/z and intensity values as an array in acending order sorted on m/z value.
 double[] getMzValuesAsArray()
          Returns the mz values as an array.
 java.util.Collection<Peak> getPeakList()
          Returns the peak list.
 java.util.HashMap<java.lang.Double,Peak> getPeakMap()
          Returns a peak map where peaks are indexed by their m/z.
 java.util.ArrayList<java.lang.Double> getPeaksAboveIntensityThreshold(double threshold)
          Returns an array containing the intensity of all peak above the provided threshold.
 java.util.HashMap<java.lang.Double,Peak> getRecalibratedPeakList(java.util.HashMap<java.lang.Double,java.lang.Double> mzCorrections)
          Returns a recalibrated peak list.
 java.lang.String getScanNumber()
          Getter for the scan number.
 double getScanStartTime()
          Returns the scan start time.
static java.lang.String getSpectrumFile(java.lang.String spectrumKey)
          Convenience method to retrieve the name of a file from the spectrum key.
 java.lang.String getSpectrumKey()
          Returns the key of the spectrum.
static java.lang.String getSpectrumKey(java.lang.String spectrumFile, java.lang.String spectrumTitle)
          Convenience method returning the key for a spectrum.
 java.lang.String getSpectrumTitle()
          Returns the spectrum title.
static java.lang.String getSpectrumTitle(java.lang.String spectrumKey)
          Convenience method to retrieve the name of a spectrum from the spectrum key.
 double getTotalIntensity()
          Returns the total intensity of the spectrum.
 void removePeakList()
          This method will remove the peak list in order to reduce memory consumption of the model.
 void setPeakList(java.util.HashMap<java.lang.Double,Peak> peakList)
          Sets the peak list.
 void setScanNumber(java.lang.String scanNumber)
          Setter for the scan number or range.
 void setScanStartTime(double scanStartTime)
          Sets the scan start time.
 
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
 

Field Detail

spectrumTitle

protected java.lang.String spectrumTitle
Spectrum title.


fileName

protected java.lang.String fileName
Spectrum file name.


level

protected int level
The MS level.


peakList

protected java.util.HashMap<java.lang.Double,Peak> peakList
Peak list.


scanNumber

protected java.lang.String scanNumber
Scan number or range.


scanStartTime

protected double scanStartTime
The timepoint when the spectrum was recorded (scan start time in mzML files).


SPECTRUM_KEY_SPLITTER

public static final java.lang.String SPECTRUM_KEY_SPLITTER
The splitter in the key between spectrumFile and spectrumTitle.

See Also:
Constant Field Values
Constructor Detail

Spectrum

public Spectrum()
Method Detail

getSpectrumKey

public static java.lang.String getSpectrumKey(java.lang.String spectrumFile,
                                              java.lang.String spectrumTitle)
Convenience method returning the key for a spectrum.

Parameters:
spectrumFile - The spectrum file
spectrumTitle - The spectrum title
Returns:
the corresponding spectrum key

getSpectrumFile

public static java.lang.String getSpectrumFile(java.lang.String spectrumKey)
Convenience method to retrieve the name of a file from the spectrum key.

Parameters:
spectrumKey - the spectrum key
Returns:
the name of the file containing the spectrum

getSpectrumTitle

public static java.lang.String getSpectrumTitle(java.lang.String spectrumKey)
Convenience method to retrieve the name of a spectrum from the spectrum key.

Parameters:
spectrumKey - the spectrum key
Returns:
the title of the spectrum

getSpectrumKey

public java.lang.String getSpectrumKey()
Returns the key of the spectrum.

Returns:
the key of the spectrum

getSpectrumTitle

public java.lang.String getSpectrumTitle()
Returns the spectrum title.

Returns:
spectrum title

getJFreePeakList

public double[][] getJFreePeakList()
Format the peaks so they can be plot in JFreeChart.

Returns:
a table containing the peaks

getPeakMap

public java.util.HashMap<java.lang.Double,Peak> getPeakMap()
Returns a peak map where peaks are indexed by their m/z.

Returns:
a peak map

addPeak

public void addPeak(Peak aPeak)
Adds a peak to the spectrum peak list.

Parameters:
aPeak - the peak to add

getScanNumber

public java.lang.String getScanNumber()
Getter for the scan number.

Returns:
the spectrum scan number

setScanNumber

public void setScanNumber(java.lang.String scanNumber)
Setter for the scan number or range.

Parameters:
scanNumber - or range

getFileName

public java.lang.String getFileName()
Returns the file name.

Returns:
the file name

getLevel

public int getLevel()
Returns at which level the spectrum was recorded.

Returns:
at which level the spectrum was recorded

getPeakList

public java.util.Collection<Peak> getPeakList()
Returns the peak list.

Returns:
the peak list

setPeakList

public void setPeakList(java.util.HashMap<java.lang.Double,Peak> peakList)
Sets the peak list.

Parameters:
peakList - HashSet of peaks containing the peaks of the spectrum

getScanStartTime

public double getScanStartTime()
Returns the scan start time.

Returns:
the scan start time

setScanStartTime

public void setScanStartTime(double scanStartTime)
Sets the scan start time.

Parameters:
scanStartTime - the timepoint when the spectrum was recorded

removePeakList

public void removePeakList()
This method will remove the peak list in order to reduce memory consumption of the model.


getMzValuesAsArray

public double[] getMzValuesAsArray()
Returns the mz values as an array.

Returns:
the mz values as an array

getIntensityValuesAsArray

public double[] getIntensityValuesAsArray()
Returns the intensity values as an array.

Returns:
the intensity values as an array

getMzAndIntensityAsArray

public double[][] getMzAndIntensityAsArray()
Returns the m/z and intensity values as an array in acending order sorted on m/z value.

Returns:
the m/z and intensity values as an array

getTotalIntensity

public double getTotalIntensity()
Returns the total intensity of the spectrum.

Returns:
the total intensity

getMaxIntensity

public double getMaxIntensity()
Returns the max intensity value.

Returns:
the max intensity value

getMaxMz

public double getMaxMz()
Returns the max mz value.

Returns:
the max mz value

getMinMz

public double getMinMz()
Returns the min mz value.

Returns:
the min mz value

getPeaksAboveIntensityThreshold

public java.util.ArrayList<java.lang.Double> getPeaksAboveIntensityThreshold(double threshold)
Returns an array containing the intensity of all peak above the provided threshold.

Parameters:
threshold - the lower threshold
Returns:
an array containing the intensity of all peak above the provided threshold

getIntensityLimit

public double getIntensityLimit(double intensityLimit)
Returns the intensity limit.

Parameters:
intensityLimit - the intensity limit in percent, e.g., 0.75
Returns:
the intensity limit

getRecalibratedPeakList

public java.util.HashMap<java.lang.Double,Peak> getRecalibratedPeakList(java.util.HashMap<java.lang.Double,java.lang.Double> mzCorrections)
                                                                 throws java.lang.IllegalArgumentException
Returns a recalibrated peak list.

Parameters:
mzCorrections - the m/z corrections to apply
Returns:
the recalibrated list of peaks indexed by m/z
Throws:
java.lang.IllegalArgumentException


Copyright © 2013. All Rights Reserved.