public abstract 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 int |
level
The MS level.
|
protected HashMap<Double,Peak> |
peakList
mz indexed Peak list.
|
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() |
Modifier and Type | Method and Description |
---|---|
void |
addPeak(Peak aPeak)
Adds a peak to the spectrum peak list.
|
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(AnnotationSettings.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.
|
double[] |
getMzValuesAsArray()
Returns the mz values as an array.
|
int |
getNPeaks()
Returns the number of peaks in the spectrum.
|
double[] |
getOrderedMzValues()
Returns a list 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.
|
ArrayList<Double> |
getPeaksAboveIntensityThreshold(double threshold)
Returns an array containing the intensity of all peaks strictly above the
provided threshold.
|
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 |
removePeakList()
This method will remove the peak list in order to reduce memory
consumption of the model.
|
void |
setFileName(String fileName)
Sets the file name.
|
void |
setIntensityValuesAsArray(double[] intensityValuesAsArray)
Setter for the intensityValuesAsArray.
|
void |
setPeakList(HashMap<Double,Peak> peakList)
Sets the peak list.
|
void |
setPeaks(ArrayList<Peak> peaks)
Set the peaks.
|
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.
|
addUrParam, clearParametersMap, getUrParam, removeUrParam
protected String spectrumTitle
protected String fileName
protected int level
protected HashMap<Double,ArrayList<Peak>> intensityPeakMap
protected String scanNumber
protected double scanStartTime
public static final String SPECTRUM_KEY_SPLITTER
public 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 void setSpectrumTitle(String spectrumTitle)
spectrumTitle
- the title to setpublic String getSpectrumKey()
public String getSpectrumTitle()
public double[][] getJFreePeakList() throws InterruptedException
InterruptedException
- exception thrown if the thread is
interruptedpublic HashMap<Double,Peak> getPeakMap()
public void addPeak(Peak aPeak)
aPeak
- the peak to addpublic void setPeaks(ArrayList<Peak> peaks)
peaks
- the peaks to setpublic String getScanNumber()
public void setScanNumber(String scanNumber)
scanNumber
- or rangepublic String getFileName()
public void setFileName(String fileName)
fileName
- the file namepublic int getLevel()
public Collection<Peak> getPeakList()
public void setPeakList(HashMap<Double,Peak> peakList)
peakList
- HashSet of peaks containing the peaks of the spectrumpublic String getPeakListAsString() throws InterruptedException
InterruptedException
- thrown if the thread is
interruptedpublic double getScanStartTime()
public void setScanStartTime(double scanStartTime)
scanStartTime
- the time point when the spectrum was recordedpublic void removePeakList()
public double[] getMzValuesAsArray() throws InterruptedException
InterruptedException
- exception thrown if the thread is
interruptedpublic double[] getOrderedMzValues() throws InterruptedException
InterruptedException
- thrown if the thread is
interruptedpublic void setIntensityValuesAsArray(double[] intensityValuesAsArray)
intensityValuesAsArray
- the intensity values arraypublic double[] getIntensityValuesAsArray() throws InterruptedException
InterruptedException
- exception thrown if the thread is
interruptedpublic double[] getIntensityValuesNormalizedAsArray() throws InterruptedException
InterruptedException
- exception thrown if the thread is
interruptedpublic double[][] getMzAndIntensityAsArray() throws InterruptedException
InterruptedException
- exception thrown if the thread is
interruptedpublic double getTotalIntensity() throws InterruptedException
InterruptedException
- exception thrown if the thread is
interruptedpublic double getMaxIntensity() throws InterruptedException
InterruptedException
- exception thrown if the thread is
interruptedpublic double getMaxMz() throws InterruptedException
InterruptedException
- exception thrown if the thread is
interruptedpublic double getMinMz() throws InterruptedException
InterruptedException
- exception thrown if the thread is
interruptedpublic ArrayList<Double> getPeaksAboveIntensityThreshold(double threshold)
threshold
- the lower thresholdpublic double getIntensityLimit(AnnotationSettings.IntensityThresholdType intensityThresholdType, double intensityFraction) throws InterruptedException, org.apache.commons.math.MathException
intensityThresholdType
- the type of intensity thresholdintensityFraction
- the threshold value.InterruptedException
- exception thrown if a threading
error occurred when estimating the noise levelorg.apache.commons.math.MathException
- exception thrown if a math
exception occurred when estimating the noise levelpublic 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) throws InterruptedException
mzMin
- the minimum m/z valuemzMax
- the maximum m/z valueInterruptedException
- exception thrown if the thread is
interruptedpublic HashMap<Double,ArrayList<Peak>> getIntensityMap() throws InterruptedException
InterruptedException
- exception thrown if the thread is
interruptedpublic int getNPeaks()
public boolean isEmpty()
public SimpleNoiseDistribution getIntensityLogDistribution() throws InterruptedException, org.apache.commons.math.MathException
InterruptedException
- exception thrown if a threading
issue occursorg.apache.commons.math.MathException
- exception thrown whenever
an error occurred while estimating probabilities.Copyright © 2019. All rights reserved.