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(double intensityFraction)
Returns the intensity limit in intensity from a given percentile.
|
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 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[][] |
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.
|
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 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.
|
void |
removePeakList()
This method will remove the peak list in order to reduce memory
consumption of the model.
|
void |
setIntensityValuesAsArray(double[] intensityValuesAsArray)
Setter for the intensityValuesAsArray.
|
void |
setMzOrdered(boolean mzOrdered)
Setter for the boolean that indicates whether the mzValuesAsArray is
sorted.
|
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, getParameterKey, getUrParam
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()
public 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 int getLevel()
public Collection<Peak> getPeakList()
public void setPeakList(HashMap<Double,Peak> peakList)
peakList
- HashSet of peaks containing the peaks of the spectrumpublic double getScanStartTime()
public void setScanStartTime(double scanStartTime)
scanStartTime
- the time point when the spectrum was recordedpublic void removePeakList()
public double[] getMzValuesAsArray()
public double[] getOrderedMzValues()
public void setMzOrdered(boolean mzOrdered)
mzOrdered
- whether the mzValuesAsArray is sortedpublic 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 ArrayList<Double> getPeaksAboveIntensityThreshold(double threshold)
threshold
- the lower thresholdpublic double getIntensityLimit(double intensityFraction)
intensityFraction
- the fraction of the intensity to use as limit,
e.g., 0.75 for the 75% most intense peaks.public HashMap<Double,Peak> getRecalibratedPeakList(HashMap<Double,Double> mzCorrections) throws IllegalArgumentException
mzCorrections
- the m/z corrections to applyIllegalArgumentException
- if an IllegalArgumentException occurspublic 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()
Copyright © 2016. All rights reserved.