Class SpectrumIndex
java.lang.Object
com.compomics.util.experiment.mass_spectrometry.indexes.SpectrumIndex
This map stores the fragment ions indexed by mass.
- Author:
- Marc Vaudel, Harald Barsnes
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal double[]The mz array of the spectrum.final doubleThe intensity limit used for the index.final double[]The mz array of the spectrum.final doubleThe mass tolerance. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for an empty index.SpectrumIndex(double[] mz, double[] intensity, double intensityLimit, double tolerance, boolean ppm) Builds a new index. -
Method Summary
Modifier and TypeMethodDescriptionintgetBin(double mz) Returns the bin corresponding to the given m/z.Returns the highest bin.Returns the lowest bin.getBins()Returns the bins in the map as a list.doublegetMass(int bin) Returns the mass associated with the given bin, the middle of the bin.int[]getMatchingPeaks(double queryMz) Returns the peaks matching the given m/z.getPeaksInBin(int bin) Returns the indexes of the peaks at the given bin indexed by m/z.Returns the peaks map.booleangetPpm()Returns whether the precursor mass tolerance is in ppm.doubleReturns the precursor tolerance.Returns the bins in the map as collection of keys from the map.doubleReturns the scaling factor.doubleReturns the total intensity of the peaks above the intensity threshold.voidSets the highest bin in index.voidSets the lowest bin in index.voidsetPpm(boolean ppm) Sets whether the precursor mass tolerance is in ppm.voidsetScalingFactor(double scalingFactor) Sets the scaling factor.voidsetTotalIntensity(double totalIntensity) Set the total intensity.
-
Field Details
-
tolerance
public final double toleranceThe mass tolerance. -
mzArray
public final double[] mzArrayThe mz array of the spectrum. -
intensityArray
public final double[] intensityArrayThe mz array of the spectrum. -
intensityLimit
public final double intensityLimitThe intensity limit used for the index.
-
-
Constructor Details
-
SpectrumIndex
public SpectrumIndex()Constructor for an empty index. -
SpectrumIndex
public SpectrumIndex(double[] mz, double[] intensity, double intensityLimit, double tolerance, boolean ppm) Builds a new index.- Parameters:
mz- array of the mz of the fragment ionsintensity- array of the intensity of the fragment ionsintensityLimit- a lower limit for the intensity of the peaks to indextolerance- the tolerance to useppm- boolean indicating whether the tolerance is in ppm
-
-
Method Details
-
getPeaksMap
Returns the peaks map.- Returns:
- the peaks map
-
getPpm
public boolean getPpm()Returns whether the precursor mass tolerance is in ppm.- Returns:
- whether the precursor mass tolerance is in ppm
-
getPrecursorToleance
public double getPrecursorToleance()Returns the precursor tolerance.- Returns:
- the precursor tolerance
-
getScalingFactor
public double getScalingFactor()Returns the scaling factor.- Returns:
- the scaling factor
-
getBin
public int getBin(double mz) Returns the bin corresponding to the given m/z.- Parameters:
mz- the m/z- Returns:
- the bin
-
getMatchingPeaks
public int[] getMatchingPeaks(double queryMz) Returns the peaks matching the given m/z. TODO: check only one/two bins when possible.- Parameters:
queryMz- a m/z to query- Returns:
- the index of the peaks matching the given m/z
-
getBins
Returns the bins in the map as a list. The list is created every time me method is called.- Returns:
- the bins in the map
-
getRawBins
Returns the bins in the map as collection of keys from the map.- Returns:
- the bins in the map
-
getPeaksInBin
Returns the indexes of the peaks at the given bin indexed by m/z. Null if none found.- Parameters:
bin- the bin number- Returns:
- the indexes of the peaks at the given bin
-
getMass
public double getMass(int bin) Returns the mass associated with the given bin, the middle of the bin.- Parameters:
bin- the bin number- Returns:
- the mass associated with the given bin
-
getBinMax
Returns the highest bin.- Returns:
- binMax the highest bin
-
getBinMin
Returns the lowest bin.- Returns:
- binMin the lowest bin
-
getTotalIntensity
public double getTotalIntensity()Returns the total intensity of the peaks above the intensity threshold.- Returns:
- the total intensity of the peaks above the intensity threshold
-
setBinMax
Sets the highest bin in index.- Parameters:
binMax- the highest bin in index
-
setBinMin
Sets the lowest bin in index.- Parameters:
binMin- the lowest bin in index
-
setPpm
public void setPpm(boolean ppm) Sets whether the precursor mass tolerance is in ppm.- Parameters:
ppm- whether the precursor mass tolerance is in ppm
-
setScalingFactor
public void setScalingFactor(double scalingFactor) Sets the scaling factor.- Parameters:
scalingFactor- the scaling factor
-
setTotalIntensity
public void setTotalIntensity(double totalIntensity) Set the total intensity.- Parameters:
totalIntensity- the total intensity
-