|
||||||||||
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 MgfIndex |
getIndexMap(java.io.File mgfFile)
Returns the index of all spectra in the given mgf file |
static MgfIndex |
getIndexMap(java.io.File mgfFile,
javax.swing.JProgressBar progressBar)
Returns the index of all spectra in the given mgf file |
static Precursor |
getPrecursor(java.io.RandomAccessFile randomAccessFile,
java.lang.Long index,
java.lang.String fileName)
Returns the next precursor starting from the given index |
java.util.ArrayList<MSnSpectrum> |
getSpectra(java.io.File aFile)
Reads an mgf file and retrieves a list of spectra. |
static MSnSpectrum |
getSpectrum(java.io.RandomAccessFile randomAccessFile,
long index,
java.lang.String fileName)
Returns the next spectrum starting from the given index. |
static java.util.ArrayList<MgfIndex> |
splitFile(java.io.File mgfFile,
int nSpectra,
javax.swing.JProgressBar progressBar)
Splits an mgf file into smaller ones and returns the indexes of the generated files. |
static void |
writeAplFile(java.io.File mgfFile,
java.io.File aplFile,
java.lang.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 java.util.ArrayList<MSnSpectrum> getSpectra(java.io.File aFile) throws java.io.FileNotFoundException, java.io.IOException, java.lang.IllegalArgumentException
aFile
- the mgf file
java.io.FileNotFoundException
- Exeption thrown if a problem is encountered reading the file
java.io.IOException
- Exception thrown if a problem is encountered reading the file
java.lang.IllegalArgumentException
- thrown when a parameter in the file cannot be parsed correctlypublic static MgfIndex getIndexMap(java.io.File mgfFile) throws java.io.FileNotFoundException, java.io.IOException
mgfFile
- the given mgf file
java.io.FileNotFoundException
- Exception thrown whenever the file is not found
java.io.IOException
- Exception thrown whenever an error occurs while reading the filepublic static MgfIndex getIndexMap(java.io.File mgfFile, javax.swing.JProgressBar progressBar) throws java.io.FileNotFoundException, java.io.IOException
mgfFile
- the given mgf fileprogressBar
- a progress bar showing the progress
java.io.FileNotFoundException
- Exception thrown whenever the file is not found
java.io.IOException
- Exception thrown whenever an error occurs while reading the filepublic static java.util.ArrayList<MgfIndex> splitFile(java.io.File mgfFile, int nSpectra, javax.swing.JProgressBar progressBar) throws java.io.FileNotFoundException, java.io.IOException
mgfFile
- the mgf file to splitnSpectra
- the number of spectra allowed in the smaller filesprogressBar
- the progress bar showing the progress
java.io.FileNotFoundException
- exception thrown whenever a file was not found
java.io.IOException
- exception thrown whenever a problem occurred while reading/writing a filepublic static MSnSpectrum getSpectrum(java.io.RandomAccessFile randomAccessFile, long index, java.lang.String fileName) throws java.io.IOException, java.lang.IllegalArgumentException
randomAccessFile
- The random access file of the inspected mgf fileindex
- The index where to start looking for the spectrumfileName
- The name of the mgf file (@TODO get this from the random access file?)
java.io.IOException
- Exception thrown whenever an error is encountered while reading the spectrum
java.lang.IllegalArgumentException
- Exception thrown whenever the file is not of a compatible formatpublic static Precursor getPrecursor(java.io.RandomAccessFile randomAccessFile, java.lang.Long index, java.lang.String fileName) throws java.io.IOException, java.lang.IllegalArgumentException
randomAccessFile
- The random access file of the inspected mgf fileindex
- The index where to start looking for the spectrumfileName
- The name of the mgf file (@TODO get this from the random access file?)
java.io.IOException
- Exception thrown whenever an error is encountered while reading the spectrum
java.lang.IllegalArgumentException
- Exception thrown whenever the file is not of a compatible formatpublic static void writeAplFile(java.io.File mgfFile, java.io.File aplFile, java.lang.String fragmentation) throws java.io.FileNotFoundException, java.io.IOException, java.lang.IllegalArgumentException
mgfFile
- the mgf fileaplFile
- the target apl filefragmentation
- the fragmentation method used
java.io.FileNotFoundException
- exception thrown whenever a file was not found
java.io.IOException
- exception thrown whenever an error occurred while reading/writing a file
java.lang.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 |