|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.compomics.util.experiment.io.massspectrometry.MgfReader
public class MgfReader
This class will read an MGF file.
Constructor Summary | |
---|---|
MgfReader()
General constructor for an mgf reader. |
Method Summary | |
---|---|
static void |
fixDuplicateSpectrumTitles(File mgfFile,
WaitingHandler waitingHandler)
Fix duplicate spectrum titles. |
static MgfIndex |
getIndexMap(File mgfFile)
Returns the index of all spectra in the given mgf file. |
static MgfIndex |
getIndexMap(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. |
ArrayList<MSnSpectrum> |
getSpectra(File aFile)
Reads an MGF file and retrieves a list of spectra. |
static MSnSpectrum |
getSpectrum(uk.ac.ebi.pride.tools.braf.BufferedRandomAccessFile bufferedRandomAccessFile,
long index,
String fileName)
Returns the next spectrum starting from the given index. |
ArrayList<MgfIndex> |
splitFile(File mgfFile,
int nSpectra,
WaitingHandler waitingHandler)
Splits an mgf file into smaller ones and returns the indexes of the generated files. |
static String |
validateSpectrumTitles(File mgfFile,
WaitingHandler waitingHandler)
Validates the spectrum titles, i.e., check for duplicate titles. |
static void |
writeAplFile(File mgfFile,
File aplFile,
String fragmentation)
Writes an apl file from an MGF file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MgfReader()
Method Detail |
---|
public ArrayList<MSnSpectrum> getSpectra(File aFile) throws FileNotFoundException, IOException, IllegalArgumentException
aFile
- the mgf file
FileNotFoundException
- Exception thrown if a problem is
encountered reading the file
IOException
- Exception thrown if a problem is encountered reading
the file
IllegalArgumentException
- thrown when a parameter in the file
cannot be parsed correctlypublic static MgfIndex getIndexMap(File mgfFile) throws FileNotFoundException, IOException
mgfFile
- the given mgf file
FileNotFoundException
- Exception thrown whenever the file is not
found
IOException
- Exception thrown whenever an error occurs while
reading the filepublic static MgfIndex getIndexMap(File mgfFile, WaitingHandler waitingHandler) throws FileNotFoundException, IOException
mgfFile
- the given MGF filewaitingHandler
- a waitingHandler showing the progress
FileNotFoundException
- Exception thrown whenever the file is not
found
IOException
- Exception thrown whenever an error occurs while
reading the filepublic static String validateSpectrumTitles(File mgfFile, WaitingHandler waitingHandler) throws FileNotFoundException, IOException
mgfFile
- the MGF file to validatewaitingHandler
- a waitingHandler showing the progress
FileNotFoundException
- Exception thrown whenever the file is not
found
IOException
- Exception thrown whenever an error occurs while
reading the filepublic static void fixDuplicateSpectrumTitles(File mgfFile, WaitingHandler waitingHandler) throws FileNotFoundException, IOException, UnsupportedEncodingException
mgfFile
- the MGF file to validatewaitingHandler
- a waitingHandler showing the progress
FileNotFoundException
- Exception thrown whenever the file is not
found
IOException
- Exception thrown whenever an error occurs while
reading the file
UnsupportedEncodingException
- if the decoding of a spectrum title
failspublic ArrayList<MgfIndex> splitFile(File mgfFile, int nSpectra, WaitingHandler waitingHandler) throws FileNotFoundException, IOException
mgfFile
- the mgf file to splitnSpectra
- the number of spectra allowed in the smaller fileswaitingHandler
- the waitingHandler showing the progress
FileNotFoundException
- exception thrown whenever a file was not
found
IOException
- exception thrown whenever a problem occurred while
reading/writing a filepublic static MSnSpectrum getSpectrum(uk.ac.ebi.pride.tools.braf.BufferedRandomAccessFile bufferedRandomAccessFile, long index, String fileName) throws IOException, IllegalArgumentException
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 (
IOException
- Exception thrown whenever an error is encountered
while reading the spectrum
IllegalArgumentException
- Exception thrown whenever the file is
not of a compatible formatpublic static Precursor getPrecursor(uk.ac.ebi.pride.tools.braf.BufferedRandomAccessFile bufferedRandomAccessFile, Long index, String fileName) throws IOException, IllegalArgumentException
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 (
IOException
- Exception thrown whenever an error is encountered
while reading the spectrum
IllegalArgumentException
- Exception thrown whenever the file is
not of a compatible formatpublic static void writeAplFile(File mgfFile, File aplFile, String fragmentation) throws FileNotFoundException, IOException, IllegalArgumentException
mgfFile
- the mgf fileaplFile
- the target apl filefragmentation
- the fragmentation method used
FileNotFoundException
- exception thrown whenever a file was not
found
IOException
- exception thrown whenever an error occurred while
reading/writing a file
IllegalArgumentException
- exception thrown whenever the mgf file
is truncated in the middle of a spectrum
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |