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 Details

    • tolerance

      public final double tolerance
      The mass tolerance.
    • mzArray

      public final double[] mzArray
      The mz array of the spectrum.
    • intensityArray

      public final double[] intensityArray
      The mz array of the spectrum.
    • intensityLimit

      public final double intensityLimit
      The 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 ions
      intensity - array of the intensity of the fragment ions
      intensityLimit - a lower limit for the intensity of the peaks to index
      tolerance - the tolerance to use
      ppm - boolean indicating whether the tolerance is in ppm
  • Method Details

    • getPeaksMap

      public HashMap<Integer,​ArrayList<Integer>> 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

      public ArrayList<Integer> 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

      public Set<Integer> getRawBins()
      Returns the bins in the map as collection of keys from the map.
      Returns:
      the bins in the map
    • getPeaksInBin

      public ArrayList<Integer> getPeaksInBin​(int bin)
      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

      public Integer getBinMax()
      Returns the highest bin.
      Returns:
      binMax the highest bin
    • getBinMin

      public Integer 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

      public void setBinMax​(Integer binMax)
      Sets the highest bin in index.
      Parameters:
      binMax - the highest bin in index
    • setBinMin

      public void setBinMin​(Integer binMin)
      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