OpenMS
Loading...
Searching...
No Matches
SqMassFile Class Reference

An class that uses on-disk SQLite database to read and write spectra and chromatograms. More...

#include <OpenMS/FORMAT/SqMassFile.h>

Collaboration diagram for SqMassFile:
[legend]

Classes

struct  SqMassConfig
 Configuration class for SqMassFile. More...
 

Public Types

typedef MSExperiment MapType
 

Public Member Functions

Constructors and Destructor
 SqMassFile ()
 Default constructor.
 
 ~SqMassFile ()
 Default destructor.
 

Read / Write a complete mass spectrometric experiment

SqMassConfig config_
 
void load (const String &filename, MapType &map) const
 
void store (const String &filename, const MapType &map) const
 Store an MSExperiment in sqMass format.
 
void transform (const String &filename_in, Interfaces::IMSDataConsumer *consumer, bool skip_full_count=false, bool skip_first_pass=false) const
 
void convertToXICParquet (const String &filename_in, const String &xic_filename, UInt64 run_id=0, const String &source_file="", const OpenSwath::LightTargetedExperiment &transition_exp=OpenSwath::LightTargetedExperiment()) const
 Convert an sqMass file containing chromatogram data to an XIC Parquet file.
 
void setConfig (const SqMassConfig &config)
 

Detailed Description

An class that uses on-disk SQLite database to read and write spectra and chromatograms.

This class provides functions to read and write spectra and chromatograms to disk using a SQLite database and store them in sqMass format. This allows users to access, select and filter spectra and chromatograms on-demand even in a large collection of data.

Spectra and chromatograms with precursor information will additionally load/store the metavalue 'peptide_sequence' from the first precursor (if any).


Class Documentation

◆ OpenMS::SqMassFile::SqMassConfig

struct OpenMS::SqMassFile::SqMassConfig

Configuration class for SqMassFile.

Contains configuration options for SQLite file

Collaboration diagram for SqMassFile::SqMassConfig:
[legend]
Class Members
double linear_fp_mass_acc {-1} desired mass accuracy for numpress linear encoding (-1 no effect, use 0.0001 for 0.2 ppm accuracy @ 500 m/z)
bool use_lossy_numpress {false} use lossy numpress compression
bool write_full_meta {true} write full meta data

Member Typedef Documentation

◆ MapType

Constructor & Destructor Documentation

◆ SqMassFile()

Default constructor.

◆ ~SqMassFile()

~SqMassFile ( )

Default destructor.

Member Function Documentation

◆ convertToXICParquet()

void convertToXICParquet ( const String filename_in,
const String xic_filename,
UInt64  run_id = 0,
const String source_file = "",
const OpenSwath::LightTargetedExperiment transition_exp = OpenSwath::LightTargetedExperiment() 
) const

Convert an sqMass file containing chromatogram data to an XIC Parquet file.

This is a convenience function that will stream chromatograms from the input sqMass file into an OpenMS Parquet writer (MSChromatogramParquetConsumer) and write them to disk.

Note: The transition/precursor metadata passed to the underlying Parquet consumer is optional from the API perspective, but the writer expects chromatogram native IDs to have matching transition/precursor metadata in many cases. If required metadata for a chromatogram (precursor or transition) is missing the writer will throw an exception and the conversion will fail. Therefore it is recommended to provide a populated transition experiment when possible.

Parameters
[in]filename_inPath to the input sqMass file.
[in]xic_filenamePath to the output .xic Parquet file.
[in]run_idRun identifier to store with each chromatogram (default 0).
[in]source_fileSource filename to store in the parquet file (if empty, filename_in is used).
[in]transition_expOptional transition/precursor metadata (LightTargetedExperiment) used to annotate chromatograms. If left empty, no transition metadata will be available to the writer and conversion may fail for chromatograms that require such metadata. Prefer supplying a populated transition experiment when available.
Exceptions
Exception::InvalidValueIf a chromatogram refers to a precursor or transition for which no matching metadata entry exists, or if Arrow/Parquet operations fail while assembling/writing the table.
Exception::FileNotWritableIf the output parquet file cannot be opened for writing.
Exception::NotImplementedIf Parquet support was not compiled in.
Exception::BaseExceptionOther OpenMS exceptions propagated from the writer/encoding layers may also be thrown.

◆ load()

void load ( const String filename,
MapType map 
) const

◆ setConfig()

void setConfig ( const SqMassConfig config)
inline

◆ store()

void store ( const String filename,
const MapType map 
) const

Store an MSExperiment in sqMass format.

If you want a specific RUN::ID in the sqMass file, make sure to populate MSExperiment::setSqlRunID(UInt64 id) before.

◆ transform()

void transform ( const String filename_in,
Interfaces::IMSDataConsumer consumer,
bool  skip_full_count = false,
bool  skip_first_pass = false 
) const

Member Data Documentation

◆ config_

SqMassConfig config_
protected