A low-level class to read an indexedmzML file. More...
#include <OpenMS/FORMAT/IndexedMzMLFile.h>
Public Member Functions | |
IndexedMzMLFile () | |
Default constructor. More... | |
IndexedMzMLFile (String filename) | |
Constructor. More... | |
IndexedMzMLFile (const IndexedMzMLFile &source) | |
Copy constructor. More... | |
~IndexedMzMLFile () | |
Destructor. More... | |
void | openFile (String filename) |
Open a file. More... | |
bool | getParsingSuccess () const |
Returns whether parsing was successful. More... | |
size_t | getNrSpectra () const |
Returns the number of spectra available. More... | |
size_t | getNrChromatograms () const |
Returns the number of chromatograms available. More... | |
OpenMS::Interfaces::SpectrumPtr | getSpectrumById (int id) |
Retrieve the raw data for the spectrum at position "id". More... | |
OpenMS::Interfaces::ChromatogramPtr | getChromatogramById (int id) |
Retrieve the raw data for the chromatogram at position "id". More... | |
void | setSkipXMLChecks (bool skip) |
Whether to skip some XML checks (removing whitespace from base64 arrays) and be fast instead. More... | |
Private Member Functions | |
void | parseFooter_ (String filename) |
Try to parse the footer of the indexedmzML. More... | |
Private Attributes | |
String | filename_ |
Name of the file. More... | |
std::vector< std::pair< std::string, std::streampos > > | spectra_offsets_ |
Binary offsets to all spectra. More... | |
std::vector< std::pair< std::string, std::streampos > > | chromatograms_offsets_ |
Binary offsets to all chromatograms. More... | |
std::streampos | index_offset_ |
offset to the <indexList> element More... | |
bool | spectra_before_chroms_ |
Whether spectra are written before chromatograms in this file. More... | |
std::ifstream | filestream_ |
The current filestream (opened by openFile) More... | |
bool | parsing_success_ |
Whether parsing the indexedmzML file was successful. More... | |
bool | skip_xml_checks_ |
Whether to skip XML checks. More... | |
A low-level class to read an indexedmzML file.
This class provides low-level access to the underlying data structures, if you simply want to read an indexed mzML file you probably want to use IndexedMzMLFileLoader instead.
This class implements access to an indexedmzML file and the contained spectra and chromatogram data through the getSpectrumById and getChromatogramById functions. It thus allows random access to spectra and chromatograms data without having to read the whole file into memory. It does not provide the same interface as MSExperiment, if this is desired, please use IndexedMzMLFileLoader and OnDiscMSExperiment.
Internally, it uses the IndexedMzMLDecoder for initial parsing and extracting all the offsets of the <chromatogram> and <spectrum> tags. These offsets are stored as members of this class as well as the offset to the <indexList> element
IndexedMzMLFile | ( | ) |
Default constructor.
|
explicit |
Constructor.
Tries to parse the file, success can be checked with getParsingSuccess()
IndexedMzMLFile | ( | const IndexedMzMLFile & | source | ) |
Copy constructor.
~IndexedMzMLFile | ( | ) |
Destructor.
OpenMS::Interfaces::ChromatogramPtr getChromatogramById | ( | int | id | ) |
Retrieve the raw data for the chromatogram at position "id".
Exception | if getParsingSuccess() returns false |
Exception | if id is not within [0, getNrChromatograms()-1] |
Referenced by OnDiscMSExperiment::getChromatogram(), and OnDiscMSExperiment::getChromatogramById().
size_t getNrChromatograms | ( | ) | const |
Returns the number of chromatograms available.
Referenced by OnDiscMSExperiment::getNrChromatograms().
size_t getNrSpectra | ( | ) | const |
Returns the number of spectra available.
Referenced by OnDiscMSExperiment::empty(), and OnDiscMSExperiment::getNrSpectra().
bool getParsingSuccess | ( | ) | const |
Returns whether parsing was successful.
Referenced by OnDiscMSExperiment::openFile().
OpenMS::Interfaces::SpectrumPtr getSpectrumById | ( | int | id | ) |
Retrieve the raw data for the spectrum at position "id".
Exception | if getParsingSuccess() returns false |
Exception | if id is not within [0, getNrSpectra()-1] |
Referenced by OnDiscMSExperiment::getSpectrum(), and OnDiscMSExperiment::getSpectrumById().
void openFile | ( | String | filename | ) |
Open a file.
Tries to parse the file, success can be checked with getParsingSuccess()
Referenced by OnDiscMSExperiment::openFile().
|
private |
Try to parse the footer of the indexedmzML.
Upon success, the chromatogram and spectra offsets will be populated and parsing_success_ will be set to true.
|
inline |
Whether to skip some XML checks (removing whitespace from base64 arrays) and be fast instead.
Referenced by OnDiscMSExperiment::setSkipXMLChecks().
|
private |
Binary offsets to all chromatograms.
|
private |
Name of the file.
|
private |
The current filestream (opened by openFile)
|
private |
offset to the <indexList> element
|
private |
Whether parsing the indexedmzML file was successful.
|
private |
Whether to skip XML checks.
|
private |
Whether spectra are written before chromatograms in this file.
|
private |
Binary offsets to all spectra.
OpenMS / TOPP release 2.3.0 | Documentation generated on Tue Jan 9 2018 18:22:09 using doxygen 1.8.13 |