Class SpectrumIndex
java.lang.Object
com.compomics.util.experiment.mass_spectrometry.indexes.SpectrumIndex
public class SpectrumIndex extends Object
This map stores the fragment ions indexed by mass.
- Author:
- Marc Vaudel, Harald Barsnes
-
Field Summary
Fields Modifier and Type Field Description double[]
intensityArray
The mz array of the spectrum.double
intensityLimit
The intensity limit used for the index.double[]
mzArray
The mz array of the spectrum.double
tolerance
The mass tolerance. -
Constructor Summary
Constructors Constructor Description SpectrumIndex()
Constructor for an empty index.SpectrumIndex(double[] mz, double[] intensity, double intensityLimit, double tolerance, boolean ppm)
Builds a new index. -
Method Summary
Modifier and Type Method Description int
getBin(double mz)
Returns the bin corresponding to the given m/z.Integer
getBinMax()
Returns the highest bin.Integer
getBinMin()
Returns the lowest bin.ArrayList<Integer>
getBins()
Returns the bins in the map as a list.double
getMass(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.ArrayList<Integer>
getPeaksInBin(int bin)
Returns the indexes of the peaks at the given bin indexed by m/z.HashMap<Integer,ArrayList<Integer>>
getPeaksMap()
Returns the peaks map.boolean
getPpm()
Returns whether the precursor mass tolerance is in ppm.double
getPrecursorToleance()
Returns the precursor tolerance.Set<Integer>
getRawBins()
Returns the bins in the map as collection of keys from the map.double
getScalingFactor()
Returns the scaling factor.double
getTotalIntensity()
Returns the total intensity of the peaks above the intensity threshold.void
setBinMax(Integer binMax)
Sets the highest bin in index.void
setBinMin(Integer binMin)
Sets the lowest bin in index.void
setPpm(boolean ppm)
Sets whether the precursor mass tolerance is in ppm.void
setScalingFactor(double scalingFactor)
Sets the scaling factor.void
setTotalIntensity(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
-