Class IndexedMgfReader
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 Summary
Constructors Constructor Description IndexedMgfReader()
General constructor for an mgf reader. -
Method Summary
Modifier and Type Method Description static MgfIndex
getMgfIndex(File mgfFile)
Returns the index of all spectra in the given mgf file.static MgfIndex
getMgfIndex(File mgfFile, WaitingHandler waitingHandler)
Returns the index of all spectra in the given MGF file.static Precursor
getPrecursor(uk.ac.ebi.pride.tools.braf.BufferedRandomAccessFile bufferedRandomAccessFile, long index, String fileName)
Returns the next precursor starting from the given index.static Spectrum
getSpectrum(uk.ac.ebi.pride.tools.braf.BufferedRandomAccessFile bufferedRandomAccessFile, long index, String fileName)
Returns the next spectrum starting from the given index.
-
Constructor Details
-
IndexedMgfReader
public IndexedMgfReader()General constructor for an mgf reader.
-
-
Method Details
-
getMgfIndex
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 foundIOException
- Exception thrown whenever an error occurs while reading the file
-
getMgfIndex
public static MgfIndex getMgfIndex(File mgfFile, WaitingHandler waitingHandler) throws FileNotFoundException, IOExceptionReturns the index of all spectra in the given MGF file.- Parameters:
mgfFile
- the given MGF filewaitingHandler
- a waitingHandler showing the progress- Returns:
- the index of all spectra
- Throws:
FileNotFoundException
- Exception thrown whenever the file is not foundIOException
- 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 IOExceptionReturns the next spectrum starting from the given index.- Parameters:
bufferedRandomAccessFile
- The random access file of the inspected mgf fileindex
- The index where to start looking for the spectrumfileName
- 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 IOExceptionReturns the next precursor starting from the given index.- Parameters:
bufferedRandomAccessFile
- the random access file of the inspected mgf fileindex
- the index where to start looking for the spectrumfileName
- the name of the mgf file- Returns:
- the next spectrum encountered
- Throws:
IOException
- thrown whenever an error is encountered while reading the spectrum
-