OpenMS
2.8.0
|
Sqlite handler for storing spectra and chromatograms in sqMass format. More...
#include <OpenMS/FORMAT/HANDLERS/MzMLSqliteHandler.h>
Public Member Functions | |
MzMLSqliteHandler (const String &filename, const UInt64 run_id) | |
Constructor of sqMass file. More... | |
Functions for writing files | |
----------------------------------- Writing to SQL file starts here ----------------------------------- | |
String | filename_ |
Int | spec_id_ |
Int | chrom_id_ |
UInt64 | run_id_ |
bool | use_lossy_compression_ |
double | linear_abs_mass_acc_ |
double | write_full_meta_ |
int | sql_batch_size_ |
void | writeExperiment (const MSExperiment &exp) |
Write an experiment to disk. More... | |
void | createTables () |
Create data tables for a new file. More... | |
void | writeSpectra (const std::vector< MSSpectrum > &spectra) |
Writes a set of spectra to disk. More... | |
void | writeChromatograms (const std::vector< MSChromatogram > &chroms) |
Writes a set of chromatograms to disk. More... | |
void | writeRunLevelInformation (const MSExperiment &exp, bool write_full_meta) |
Write the run-level information for an experiment into tables. More... | |
void | createIndices_ () |
Functions for reading files | |
----------------------------------- Reading of SQL file starts here ----------------------------------- | |
void | readExperiment (MSExperiment &exp, bool meta_only=false) const |
Read an experiment into an MSExperiment structure. More... | |
UInt64 | getRunID () const |
void | readSpectra (std::vector< MSSpectrum > &exp, const std::vector< int > &indices, bool meta_only=false) const |
Read an set of spectra (potentially restricted to a subset) More... | |
void | readChromatograms (std::vector< MSChromatogram > &exp, const std::vector< int > &indices, bool meta_only=false) const |
Read an set of chromatograms (potentially restricted to a subset) More... | |
Size | getNrSpectra () const |
Get number of spectra in the file. More... | |
Size | getNrChromatograms () const |
Get number of chromatograms in the file. More... | |
void | setConfig (bool write_full_meta, bool use_lossy_compression, double linear_abs_mass_acc, int sql_batch_size=500) |
Set file configuration. More... | |
std::vector< size_t > | getSpectraIndicesbyRT (double RT, double deltaRT, const std::vector< int > &indices) const |
Get spectral indices around a specific retention time. More... | |
void | populateChromatogramsWithData_ (sqlite3 *db, std::vector< MSChromatogram > &chromatograms) const |
void | populateChromatogramsWithData_ (sqlite3 *db, std::vector< MSChromatogram > &chromatograms, const std::vector< int > &indices) const |
void | populateSpectraWithData_ (sqlite3 *db, std::vector< MSSpectrum > &spectra) const |
void | populateSpectraWithData_ (sqlite3 *db, std::vector< MSSpectrum > &spectra, const std::vector< int > &indices) const |
void | prepareChroms_ (sqlite3 *db, std::vector< MSChromatogram > &chromatograms, const std::vector< int > &indices={}) const |
void | prepareSpectra_ (sqlite3 *db, std::vector< MSSpectrum > &spectra, const std::vector< int > &indices={}) const |
Sqlite handler for storing spectra and chromatograms in sqMass format.
This class also supports writing data using the lossy numpress compression format.
This class contains the internal data structures and SQL statements for communication with the SQLite database
MzMLSqliteHandler | ( | const String & | filename, |
const UInt64 | run_id | ||
) |
Constructor of sqMass file.
filename | The sqMass filename |
run_id | Unique identifier which links the sqMass and OSW file. It is currently only used for storing and ignored when reading an sqMass file. |
|
protected |
void createTables | ( | ) |
Create data tables for a new file.
Size getNrChromatograms | ( | ) | const |
Get number of chromatograms in the file.
Size getNrSpectra | ( | ) | const |
Get number of spectra in the file.
UInt64 getRunID | ( | ) | const |
extract the RUN::ID from the sqMass file
Exception::SqlOperationFailed | more than on run exists |
std::vector<size_t> getSpectraIndicesbyRT | ( | double | RT, |
double | deltaRT, | ||
const std::vector< int > & | indices | ||
) | const |
Get spectral indices around a specific retention time.
RT | The retention time |
deltaRT | Tolerance window around RT (if less or equal than zero, only the first spectrum *after* RT is returned) |
indices | Spectra to consider (if empty, all spectra are considered) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
void readChromatograms | ( | std::vector< MSChromatogram > & | exp, |
const std::vector< int > & | indices, | ||
bool | meta_only = false |
||
) | const |
Read an set of chromatograms (potentially restricted to a subset)
exp | The result |
indices | A list of indices restricting the resulting chromatograms only to those specified here |
meta_only | Only read the meta data |
void readExperiment | ( | MSExperiment & | exp, |
bool | meta_only = false |
||
) | const |
Read an experiment into an MSExperiment structure.
exp | The result data structure |
meta_only | Only read the meta data |
void readSpectra | ( | std::vector< MSSpectrum > & | exp, |
const std::vector< int > & | indices, | ||
bool | meta_only = false |
||
) | const |
Read an set of spectra (potentially restricted to a subset)
exp | The result |
indices | A list of indices restricting the resulting spectra only to those specified here |
meta_only | Only read the meta data |
|
inline |
Set file configuration.
write_full_meta | Whether to write a complete mzML meta data structure into the RUN_EXTRA field (allows complete recovery of the input file) |
use_lossy_compression | Whether to use lossy compression (ms numpress) |
linear_abs_mass_acc | Accepted loss in mass accuracy (absolute m/z, in Th) |
sql_batch_size | Batch size of SQL insert statements |
void writeChromatograms | ( | const std::vector< MSChromatogram > & | chroms | ) |
Writes a set of chromatograms to disk.
chromatograms | The chromatograms to write |
void writeExperiment | ( | const MSExperiment & | exp | ) |
Write an experiment to disk.
exp | The data to write |
void writeRunLevelInformation | ( | const MSExperiment & | exp, |
bool | write_full_meta | ||
) |
Write the run-level information for an experiment into tables.
exp | The result data structure |
meta_only | Only read the meta data |
void writeSpectra | ( | const std::vector< MSSpectrum > & | spectra | ) |
Writes a set of spectra to disk.
spectra | The spectra to write |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |