java.lang.Object
com.compomics.util.experiment.io.mass_spectrometry.mgf.IndexedMgfReader

public class IndexedMgfReader
extends Object
Reader for mgf files based on random access.
Author:
Marc Vaudel, Harald Barsnes
  • Constructor Details

    • IndexedMgfReader

      public IndexedMgfReader()
      General constructor for an mgf reader.
  • Method Details

    • getMgfIndex

      public static MgfIndex getMgfIndex​(File mgfFile) throws FileNotFoundException, IOException
      Returns the index of all spectra in the given mgf file.
      Parameters:
      mgfFile - the given mgf file
      Returns:
      the index of all spectra
      Throws:
      FileNotFoundException - Exception thrown whenever the file is not found
      IOException - Exception thrown whenever an error occurs while reading the file
    • getMgfIndex

      public static MgfIndex getMgfIndex​(File mgfFile, WaitingHandler waitingHandler) throws FileNotFoundException, IOException
      Returns the index of all spectra in the given MGF file.
      Parameters:
      mgfFile - the given MGF file
      waitingHandler - a waitingHandler showing the progress
      Returns:
      the index of all spectra
      Throws:
      FileNotFoundException - Exception thrown whenever the file is not found
      IOException - Exception thrown whenever an error occurs while reading the file
    • getSpectrum

      public static Spectrum getSpectrum​(uk.ac.ebi.pride.tools.braf.BufferedRandomAccessFile bufferedRandomAccessFile, long index, String fileName) throws IOException
      Returns the next spectrum starting from the given index.
      Parameters:
      bufferedRandomAccessFile - The random access file of the inspected mgf file
      index - The index where to start looking for the spectrum
      fileName - The name of the MGF file
      Returns:
      The next spectrum encountered
      Throws:
      IOException - Exception thrown whenever an error is encountered while reading the spectrum
    • getPrecursor

      public static Precursor getPrecursor​(uk.ac.ebi.pride.tools.braf.BufferedRandomAccessFile bufferedRandomAccessFile, long index, String fileName) throws IOException
      Returns the next precursor starting from the given index.
      Parameters:
      bufferedRandomAccessFile - the random access file of the inspected mgf file
      index - the index where to start looking for the spectrum
      fileName - the name of the mgf file
      Returns:
      the next spectrum encountered
      Throws:
      IOException - thrown whenever an error is encountered while reading the spectrum