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:
Serializable, 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  String fileName
          spectrum file name
protected  int level
          The MS level
protected  HashSet<Peak> peakList
          peak list
protected  String scanNumber
          scan number or range
protected  double scanStartTime
          The timepoint when the spectrum was recorded (scan start time in mzML files)
static String SPECTRUM_KEY_SPLITTER
          The splitter in the key between spectrumFile and spectrumTitle.
protected  String spectrumTitle
          spectrum title
 
Constructor Summary
Spectrum()
           
 
Method Summary
 String getFileName()
          Returns the file name.
 double getIntensityLimit(boolean annotateMostIntensePeaks)
          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[] getMzValuesAsArray()
          Returns the mz values as an array.
 HashSet<Peak> getPeakList()
          Returns the peak list.
 HashMap<Double,Peak> getPeakMap()
          Returns a peak map.
 ArrayList<Double> getPeaksAboveIntensityThreshold(double threshold)
          Returns an array containing the intensity of all peak above the provided threshold.
 String getScanNumber()
          Getter for the scan number.
 double getScanStartTime()
          Returns the scan start time.
static String getSpectrumFile(String spectrumKey)
          Convenience method to retrieve the name of a file from the spectrum key.
 String getSpectrumKey()
          Returns the key of the spectrum.
static String getSpectrumKey(String spectrumFile, String spectrumTitle)
          Convenience method returning the key for a spectrum.
 String getSpectrumTitle()
          Returns the spectrum title.
static String getSpectrumTitle(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(HashSet<Peak> peakList)
          Sets the peak list
 void setScanNumber(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, getUrParam
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

spectrumTitle

protected String spectrumTitle
spectrum title


fileName

protected String fileName
spectrum file name


level

protected int level
The MS level


peakList

protected HashSet<Peak> peakList
peak list


scanNumber

protected 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 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 String getSpectrumKey(String spectrumFile,
                                    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 String getSpectrumFile(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 String getSpectrumTitle(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 String getSpectrumKey()
Returns the key of the spectrum.

Returns:
the key of the spectrum

getSpectrumTitle

public 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 HashMap<Double,Peak> getPeakMap()
Returns a peak map.

Returns:
a peak map

getScanNumber

public String getScanNumber()
Getter for the scan number.

Returns:
the spectrum scan number

setScanNumber

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

Parameters:
scanNumber - or range

getFileName

public 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 HashSet<Peak> getPeakList()
Returns the peak list.

Returns:
the peak list

setPeakList

public void setPeakList(HashSet<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

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 ArrayList<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(boolean annotateMostIntensePeaks)
Returns the intensity limit. Returns 0 if annotateMostIntensePeaks is set to false.

Parameters:
annotateMostIntensePeaks - returns 0 if set to false
Returns:
the intensity limit


Copyright © 2011. All Rights Reserved.