Class Spectrum
java.lang.Object
com.compomics.util.experiment.personalization.ExperimentObject
com.compomics.util.experiment.mass_spectrometry.spectra.Spectrum
- All Implemented Interfaces:
Serializable
This class models a spectrum. Note: throughout the code, it is assumed that
the m/z array is sorted by ascending m/z. Only minimal sanity check is
conducted.
- Author:
- Marc Vaudel, Harald Barsnes
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptiondouble[]The array of the intensities of the peaks.double[]The array of the m/z of the peaks.The precursor if any.Fields inherited from class com.compomics.util.experiment.personalization.ExperimentObject
NO_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the max intensity value.doublegetMaxMz()Returns the max mz value.doublegetMinMz()Returns the min mz value.intReturns the number of peaks.Returns the peak list as an array list formatted as text, e.g.Returns the precursor.intReturns the spectrum level.doubleReturns the total intensity of the spectrum.booleanReturns a boolean indicating whether the spectrum is identical to the other spectrum.voidsetSpectrumLevel(int spectrumLevel) Set the spectrum level.toString()Methods inherited from class com.compomics.util.experiment.personalization.ExperimentObject
addUrParam, asLong, clearParametersMap, getId, getUrParam, getUrParams, removeUrParam, setId, setUrParams
-
Field Details
-
precursor
The precursor if any. -
mz
public double[] mzThe array of the m/z of the peaks. Note: throughout the code, it is assumed that the m/z array is sorted by ascending m/z. Only minimal sanity check is conducted. -
intensity
public double[] intensityThe array of the intensities of the peaks.
-
-
Constructor Details
-
Spectrum
public Spectrum()Empty default constructor. -
Spectrum
Constructor.Note: throughout the code, it is assumed that the m/z array is sorted by ascending m/z. Only minimal sanity check is conducted.- Parameters:
precursor- the precursormz- the array of mz of the peaksintensities- the array of intensities of the peaksspectrumLevel- the spectrum level
-
-
Method Details
-
getPeakListAsString
Returns the peak list as an array list formatted as text, e.g. [[303.17334 3181.14],[318.14542 37971.93], ... ].- Returns:
- the peak list as an array list formatted as text
-
getTotalIntensity
public double getTotalIntensity()Returns the total intensity of the spectrum.- Returns:
- the total intensity, 0 if no peak
-
getMaxIntensity
public double getMaxIntensity()Returns the max intensity value.- Returns:
- the max intensity value. 0 if no peak.
-
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
-
getPrecursor
Returns the precursor. Null if none.- Returns:
- the precursor
-
getNPeaks
public int getNPeaks()Returns the number of peaks.- Returns:
- the number of peaks
-
isSameAs
Returns a boolean indicating whether the spectrum is identical to the other spectrum. Precursors are compared using the isSameAs method. M/z and intensities must be in the same order with exact same double values.- Parameters:
otherSpectrum- The other spectrum.- Returns:
- A boolean indicating whether the spectrum is identical to the other spectrum.
-
toString
-
getSpectrumLevel
public int getSpectrumLevel()Returns the spectrum level. Null if not set.- Returns:
- the spectrumLevel
-
setSpectrumLevel
public void setSpectrumLevel(int spectrumLevel) Set the spectrum level.- Parameters:
spectrumLevel- the spectrumLevel to set
-