OpenMS
2.8.0
|
A low-level class to read an indexedmzML file. More...
#include <OpenMS/FORMAT/HANDLERS/IndexedMzMLHandler.h>
Public Member Functions | |
IndexedMzMLHandler () | |
Default constructor. More... | |
IndexedMzMLHandler (const String &filename) | |
Constructor. More... | |
IndexedMzMLHandler (const IndexedMzMLHandler &source) | |
Copy constructor. More... | |
~IndexedMzMLHandler () | |
Destructor. More... | |
void | openFile (const 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... | |
const OpenMS::MSSpectrum | getMSSpectrumById (int id) |
Retrieve the raw data for the spectrum at position "id". More... | |
void | getMSSpectrumByNativeId (std::string id, OpenMS::MSSpectrum &s) |
Retrieve the raw data for the spectrum with native id "id". More... | |
void | getMSSpectrumById (int id, OpenMS::MSSpectrum &s) |
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... | |
const OpenMS::MSChromatogram | getMSChromatogramById (int id) |
Retrieve the raw data for the chromatogram at position "id". More... | |
void | getMSChromatogramByNativeId (const std::string &id, OpenMS::MSChromatogram &c) |
Retrieve the raw data for the chromatogram with native id "id". More... | |
void | getMSChromatogramById (int id, OpenMS::MSChromatogram &c) |
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_ () |
Try to parse the footer of the indexedmzML. More... | |
std::string | getChromatogramById_helper_ (int id) |
std::string | getSpectrumById_helper_ (int id) |
Private Attributes | |
String | filename_ |
Name of the file. More... | |
std::vector< std::streampos > | spectra_offsets_ |
Binary offsets to all spectra. More... | |
std::unordered_map< std::string, Size > | spectra_native_ids_ |
Mapping of spectra native ids to offsets. More... | |
std::vector< std::streampos > | chromatograms_offsets_ |
Binary offsets to all chromatograms. More... | |
std::unordered_map< std::string, Size > | chromatograms_native_ids_ |
Mapping of chromatogram native ids to offsets. 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
Default constructor.
|
explicit |
Constructor.
Tries to parse the file, success can be checked with getParsingSuccess()
IndexedMzMLHandler | ( | const IndexedMzMLHandler & | source | ) |
Copy constructor.
~IndexedMzMLHandler | ( | ) |
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] |
|
private |
const OpenMS::MSChromatogram getMSChromatogramById | ( | 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] |
void getMSChromatogramById | ( | int | id, |
OpenMS::MSChromatogram & | c | ||
) |
Retrieve the raw data for the chromatogram at position "id".
Exception | if getParsingSuccess() returns false |
Exception | if id is not within [0, getNrChromatograms()-1] |
id | The chromatogram id |
c | The chromatogram to be used and filled with data |
void getMSChromatogramByNativeId | ( | const std::string & | id, |
OpenMS::MSChromatogram & | c | ||
) |
Retrieve the raw data for the chromatogram with native id "id".
Exception | if getParsingSuccess() returns false |
Exception | if id cannot be found |
id | The chromatogram native id |
s | The chromatogram to be used and filled with data |
const OpenMS::MSSpectrum getMSSpectrumById | ( | 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] |
void getMSSpectrumById | ( | int | id, |
OpenMS::MSSpectrum & | s | ||
) |
Retrieve the raw data for the spectrum at position "id".
Exception | if getParsingSuccess() returns false |
Exception | if id is not within [0, getNrSpectra()-1] |
id | The spectrum id |
s | The spectrum to be used and filled with data |
void getMSSpectrumByNativeId | ( | std::string | id, |
OpenMS::MSSpectrum & | s | ||
) |
Retrieve the raw data for the spectrum with native id "id".
Exception | if getParsingSuccess() returns false |
Exception | if id cannot be found |
id | The spectrum native id |
s | The spectrum to be used and filled with data |
size_t getNrChromatograms | ( | ) | const |
Returns the number of chromatograms available.
Referenced by TOPPViewBase::addDataFile().
size_t getNrSpectra | ( | ) | const |
Returns the number of spectra available.
Referenced by TOPPViewBase::addDataFile().
bool getParsingSuccess | ( | ) | const |
Returns whether parsing was successful.
Referenced by TOPPViewBase::addDataFile().
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] |
|
private |
void openFile | ( | const String & | filename | ) |
Open a file.
Tries to parse the file, success can be checked with getParsingSuccess()
Referenced by TOPPViewBase::addDataFile().
|
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.
|
private |
Mapping of chromatogram native ids to offsets.
|
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 |
Mapping of spectra native ids to offsets.
|
private |
Binary offsets to all spectra.