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

Writes Mobilograms (ion-mobility traces) to a Parquet file using a PyProphet-compatible-like schema. More...

#include <OpenMS/FORMAT/DATAACCESS/MobilogramParquetConsumer.h>

Collaboration diagram for MobilogramParquetConsumer:
[legend]

Public Member Functions

 MobilogramParquetConsumer (const String &filename, UInt64 run_id, const String &source_file, const OpenSwath::LightTargetedExperiment &transition_exp)
 Construct a parquet consumer for mobilogram export.
 
 ~MobilogramParquetConsumer ()
 Destructor flushes pending data and closes the parquet writer.
 
void consumeMobilogram (const Mobilogram &m, const String &mobilogram_type="", Int64 ms_level=-1, Int64 transition_id=-1, const String &transition_native_id="", double feature_rt=std::numeric_limits< double >::quiet_NaN(), Int64 feature_id=-1)
 Consume a mobilogram and write it to the parquet file.
 
void finalize ()
 Finalize and write the parquet file. Call to surface write errors.
 
void setExpectedSize (Size expectedMobilograms)
 Reserve storage for expected number of mobilograms.
 

Private Attributes

std::unique_ptr< MobilogramParquetConsumerImpl > impl_
 

Detailed Description

Writes Mobilograms (ion-mobility traces) to a Parquet file using a PyProphet-compatible-like schema.

Constructor & Destructor Documentation

◆ MobilogramParquetConsumer()

MobilogramParquetConsumer ( const String filename,
UInt64  run_id,
const String source_file,
const OpenSwath::LightTargetedExperiment transition_exp 
)

Construct a parquet consumer for mobilogram export.

Parameters
[in]filenameOutput parquet filename.
[in]run_idRun identifier to store with each mobilogram.
[in]source_fileSource mzML filename to store with each mobilogram.
[in]transition_expOptional transition experiment used to annotate mobilograms. Note: the signature takes a const reference, so a caller that does not want any transition annotations must pass an empty OpenSwath::LightTargetedExperiment (i.e. one with no compounds/transitions). A null pointer is not accepted.

◆ ~MobilogramParquetConsumer()

Destructor flushes pending data and closes the parquet writer.

Member Function Documentation

◆ consumeMobilogram()

void consumeMobilogram ( const Mobilogram m,
const String mobilogram_type = "",
Int64  ms_level = -1,
Int64  transition_id = -1,
const String transition_native_id = "",
double  feature_rt = std::numeric_limits< double >::quiet_NaN(),
Int64  feature_id = -1 
)

Consume a mobilogram and write it to the parquet file.

Parameters
[in]mThe mobilogram to consume (read-only; the caller retains ownership and the mobilogram is not modified)
[in]mobilogram_typeThe type of the mobilogram (e.g. "precursor" or "fragment")
[in]ms_levelThe MS level of the mobilogram (e.g. 1 for precursor, 2 for fragment)
[in]transition_idThe id of the corresponding transition in the transition experiment (nullable: -1 means not set)
[in]transition_native_idThe native id of the corresponding transition in the transition experiment (nullable: empty string means not set)
[in]feature_rtOptional retention time apex that the mobilogram corresponds to (nullable: NaN means not set)
[in]feature_idOptional feature id associated with the mobilogram (nullable: -1 means not set)

◆ finalize()

void finalize ( )

Finalize and write the parquet file. Call to surface write errors.

◆ setExpectedSize()

void setExpectedSize ( Size  expectedMobilograms)

Reserve storage for expected number of mobilograms.

Must be called before any concurrent consumeMobilogram() calls (e.g. from an OpenMP parallel loop). Calling it after concurrent writes have started is undefined behaviour.

Parameters
[in]expectedMobilogramsThe expected number of mobilograms

Member Data Documentation

◆ impl_

std::unique_ptr<MobilogramParquetConsumerImpl> impl_
private