public class Spectrum extends ExperimentObject
Modifier and Type | Field and Description |
---|---|
protected String |
fileName
Spectrum file name.
|
protected HashMap<Double,ArrayList<Peak>> |
intensityPeakMap
Intensity indexed Peak map.
|
protected String |
key
Spectrum key.
|
protected int |
level
The MS level.
|
protected HashMap<Double,Peak> |
peakMap
mz indexed Peak map.
|
protected String |
scanNumber
Scan number or range.
|
protected double |
scanStartTime
The time point 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 and Description |
---|
Spectrum(int level,
Precursor precursor,
String spectrumTitle,
HashMap<Double,Peak> peakMap,
String fileName)
Constructor for the spectrum.
|
Spectrum(int level,
Precursor precursor,
String spectrumTitle,
HashMap<Double,Peak> peakMap,
String fileName,
double scanStartTime)
Constructor for the spectrum.
|
Spectrum(int level,
Precursor precursor,
String spectrumTitle,
String fileName)
Constructor for the spectrum.
|
Modifier and Type | Method and Description |
---|---|
String |
asMgf()
Returns the peak list as an mgf bloc.
|
String |
asMgf(HashMap<String,String> additionalTags)
Returns the peak list as an mgf bloc.
|
HashMap<Double,Peak> |
getDesignaledPeakList(ArrayList<IonMatch> matches)
Returns the peak list of this spectrum without matched peaks.
|
String |
getFileName()
Returns the file name.
|
double |
getIntensityLimit(AnnotationParameters.IntensityThresholdType intensityThresholdType,
double intensityFraction)
Returns the limit in intensity according to the given threshold.
|
SimpleNoiseDistribution |
getIntensityLogDistribution()
Returns the intensity of the log of the peaks intensities.
|
HashMap<Double,ArrayList<Peak>> |
getIntensityMap()
Returns the peak list in a map where peaks are indexed by their
intensity.
|
double[] |
getIntensityValuesAsArray()
Returns the intensity values as an array.
|
double[] |
getIntensityValuesNormalizedAsArray()
Returns the intensity values as an array normalized against the largest
peak.
|
double[][] |
getJFreePeakList()
Format the peaks so that they can be plotted 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 increasing order
sorted on m/z value.
|
int |
getNPeaks()
Returns the number of peaks in the spectrum.
|
double[] |
getOrderedMzValues()
Returns an array of the m/z values sorted in ascending order.
|
Collection<Peak> |
getPeakList()
Returns the peak list.
|
String |
getPeakListAsString()
Returns the peak list as an array list formatted as text, e.g.
|
HashMap<Double,Peak> |
getPeakMap()
Returns a peak map where peaks are indexed by their m/z.
|
java.util.stream.DoubleStream |
getPeaksAboveIntensityThreshold(double threshold)
Returns a DoubleStream of the intensity of all peaks strictly above the
provided threshold.
|
Precursor |
getPrecursor()
Returns the precursor.
|
HashMap<Double,Peak> |
getRecalibratedPeakList(HashMap<Double,Double> mzCorrections)
Returns a recalibrated peak list.
|
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.
|
HashMap<Double,Peak> |
getSubSpectrum(double mzMin,
double mzMax)
Returns the part of the spectrum contained between mzMin (inclusive) and
mzMax (exclusive) as a peak list
|
double |
getTotalIntensity()
Returns the total intensity of the spectrum.
|
boolean |
isEmpty()
Returns a boolean indicating whether the spectrum is empty.
|
void |
setFileName(String fileName)
Sets the file name.
|
void |
setIntensityValuesAsArray(double[] intensityValuesAsArray)
Setter for the intensityValuesAsArray.
|
void |
setPeakMap(HashMap<Double,Peak> peakMap)
Sets the peak map indexed by m/z.
|
void |
setPeaks(ArrayList<Peak> peaks)
Set the peaks.
|
void |
setPrecursor(Precursor precursor)
Set the precursor.
|
void |
setScanNumber(String scanNumber)
Setter for the scan number or range.
|
void |
setScanStartTime(double scanStartTime)
Sets the scan start time.
|
void |
setSpectrumTitle(String spectrumTitle)
Set the spectrum title.
|
String |
toString() |
void |
writeMgf(BufferedWriter writer1)
Writes the spectrum in the mgf format using the given writer.
|
void |
writeMgf(BufferedWriter mgfWriter,
HashMap<String,String> additionalTags)
Writes the spectrum in the mgf format using the given writer.
|
addUrParam, asLong, clearParametersMap, getUrParam, getUrParams, removeUrParam, setUrParams
getFirstLevel, getId, setFirstLevel, setId
jdoZooEvict, jdoZooGetBackup, jdoZooGetClassDef, jdoZooGetContext, jdoZooGetNode, jdoZooGetOid, jdoZooGetTimestamp, jdoZooHasState, jdoZooInit, jdoZooIsDeleted, jdoZooIsDetached, jdoZooIsDirty, jdoZooIsNew, jdoZooIsPersistent, jdoZooIsStateHollow, jdoZooIsTransactional, jdoZooMarkClean, jdoZooMarkDeleted, jdoZooMarkDetached, jdoZooMarkDirty, jdoZooMarkHollow, jdoZooMarkTransient, jdoZooSetOid, jdoZooSetTimestamp, zooActivateRead, zooActivateWrite, zooActivateWrite
protected String spectrumTitle
protected String fileName
protected String key
protected int level
protected HashMap<Double,ArrayList<Peak>> intensityPeakMap
protected String scanNumber
protected double scanStartTime
public static final String SPECTRUM_KEY_SPLITTER
public Spectrum(int level, Precursor precursor, String spectrumTitle, String fileName)
level
- MS levelprecursor
- precursorspectrumTitle
- spectrum titlefileName
- file namepublic Spectrum(int level, Precursor precursor, String spectrumTitle, HashMap<Double,Peak> peakMap, String fileName)
level
- MS levelprecursor
- precursorspectrumTitle
- spectrum titlepeakMap
- set of peaksfileName
- file namepublic Spectrum(int level, Precursor precursor, String spectrumTitle, HashMap<Double,Peak> peakMap, String fileName, double scanStartTime)
level
- MS levelprecursor
- precursorspectrumTitle
- spectrum titlepeakMap
- set of peaksfileName
- file namescanStartTime
- The time point when the spectrum was recordedpublic static String getSpectrumKey(String spectrumFile, String spectrumTitle)
spectrumFile
- the spectrum filespectrumTitle
- the spectrum titlepublic static String getSpectrumFile(String spectrumKey)
spectrumKey
- the spectrum keypublic static String getSpectrumTitle(String spectrumKey)
spectrumKey
- the spectrum keypublic String getSpectrumKey()
public String getFileName()
public void setFileName(String fileName)
fileName
- the file namepublic String getSpectrumTitle()
public void setSpectrumTitle(String spectrumTitle)
spectrumTitle
- the title to setpublic String getScanNumber()
public void setScanNumber(String scanNumber)
scanNumber
- or rangepublic double[][] getJFreePeakList()
public HashMap<Double,Peak> getPeakMap()
public void setPeakMap(HashMap<Double,Peak> peakMap)
peakMap
- the peak mappublic void setPeaks(ArrayList<Peak> peaks)
peaks
- the peaks to setpublic int getLevel()
public Collection<Peak> getPeakList()
public String getPeakListAsString()
public double getScanStartTime()
public void setScanStartTime(double scanStartTime)
scanStartTime
- the time point when the spectrum was recordedpublic double[] getOrderedMzValues()
public void setIntensityValuesAsArray(double[] intensityValuesAsArray)
intensityValuesAsArray
- the intensity values arraypublic double[] getIntensityValuesAsArray()
public double[] getIntensityValuesNormalizedAsArray()
public double[][] getMzAndIntensityAsArray()
public double getTotalIntensity()
public double getMaxIntensity()
public double getMaxMz()
public double getMinMz()
public java.util.stream.DoubleStream getPeaksAboveIntensityThreshold(double threshold)
threshold
- the lower thresholdpublic double getIntensityLimit(AnnotationParameters.IntensityThresholdType intensityThresholdType, double intensityFraction)
intensityThresholdType
- the type of intensity thresholdintensityFraction
- the threshold value.public HashMap<Double,Peak> getRecalibratedPeakList(HashMap<Double,Double> mzCorrections)
mzCorrections
- the m/z corrections to applypublic HashMap<Double,Peak> getDesignaledPeakList(ArrayList<IonMatch> matches)
matches
- the ion matchespublic HashMap<Double,Peak> getSubSpectrum(double mzMin, double mzMax)
mzMin
- the minimum m/z valuemzMax
- the maximum m/z valuepublic HashMap<Double,ArrayList<Peak>> getIntensityMap()
public int getNPeaks()
public boolean isEmpty()
public SimpleNoiseDistribution getIntensityLogDistribution()
public Precursor getPrecursor()
public void setPrecursor(Precursor precursor)
precursor
- the precursor to setpublic String asMgf()
public String asMgf(HashMap<String,String> additionalTags)
additionalTags
- additional tags which will be added after the BEGIN
IONS tag in alphabetic orderpublic void writeMgf(BufferedWriter writer1) throws IOException
writer1
- a buffered writer where the spectrum will be writtenIOException
- if an IOException occurspublic void writeMgf(BufferedWriter mgfWriter, HashMap<String,String> additionalTags) throws IOException
mgfWriter
- a buffered writer where the spectrum will be writtenadditionalTags
- additional tags which will be added after the BEGIN
IONS tag in alphabetic orderIOException
- if an IOException occurspublic String toString()
toString
in class org.zoodb.api.impl.ZooPC
Copyright © 2018. All rights reserved.