Class Spectrum
java.lang.Object
com.compomics.util.experiment.personalization.ExperimentObject
com.compomics.util.experiment.mass_spectrometry.spectra.Spectrum
- All Implemented Interfaces:
Serializable
public class Spectrum extends ExperimentObject
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:
- Serialized Form
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description double
getMaxIntensity()
Returns the max intensity value.double
getMaxMz()
Returns the max mz value.double
getMinMz()
Returns the min mz value.int
getNPeaks()
Returns the number of peaks.String
getPeakListAsString()
Returns the peak list as an array list formatted as text, e.g.Precursor
getPrecursor()
Returns the precursor.double
getTotalIntensity()
Returns the total intensity of the spectrum.boolean
isSameAs(Spectrum otherSpectrum)
Returns a boolean indicating whether the spectrum is identical to the other spectrum.String
toString()
Methods inherited from class com.compomics.util.experiment.personalization.ExperimentObject
addUrParam, asLong, clearParametersMap, getId, getUrParam, getUrParams, removeUrParam, setId, setUrParams
-
Field Details
-
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 precursor.mz
- The array of mz of the peaks.intensities
- The array of intensities of the peaks.
-
-
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
-