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

Whole-collection preflight for the QPX Parquet export (-out_qpx) More...

#include <OpenMS/FORMAT/QPXCollectionExport.h>

Classes

class  Transaction
 Scope guard that leaves no partial QPX collection behind. More...
 

Static Public Member Functions

static bool requireExportable (const ConsensusMap &cmap, const ExperimentalDesign &design)
 Refuse a collection that cannot be written in full, before any file is created.
 

Detailed Description

Whole-collection preflight for the QPX Parquet export (-out_qpx)

A QPX collection is three files written in a fixed order – quantms.feature.parquet, then quantms.psm.parquet, then quantms.pg.parquet. Each view refuses input it cannot represent, but it does so before opening its own file, so a refusal in the second or third view leaves the earlier files on disk: a partial collection that looks like a successful export.

The exporters cannot avoid that themselves. Both streaming paths open the output and emit a valid 0-row file even for empty input, so by the time a view can refuse, its predecessors have already written. Only a check that runs before the first write can leave the output directory untouched.

requireExportable() therefore runs every deterministic refusal of all three views up front. It does not replace the in-exporter checks – those remain the contract for callers using an exporter directly – so a condition is validated twice on the TOPP path. That is deliberate: the preflight must not become the only thing standing between a library user and a malformed table.

Note
Only conditions that are decidable from the input are covered. I/O failures, and anything that can only be discovered while building a row, cannot be. Those are handled from the other side, by Transaction: it removes whatever was written when the export does not run to completion. Use both – the preflight so a refusable input never opens a file, the transaction so anything that slips past it is not left behind.
Experimental classes:
This API is experimental and may change in future versions.

Member Function Documentation

◆ requireExportable()

static bool requireExportable ( const ConsensusMap &  cmap,
const ExperimentalDesign &  design 
)
static

Refuse a collection that cannot be written in full, before any file is created.

Performs, on the same input the three views will see:

  • the feature view's divergent-identification and merge-index refusals,
  • the psm view's merge-index refusal over assigned and unassigned identifications,
  • the channel-label check shared by the feature and pg views,
  • the pg view's protein/group prerequisites and fraction-group checks (invalid sample, inconsistent cell, ragged group, repeated run, or ambiguous/cross-run label),
  • every quantified group's complete parallel (fraction_group, label, abundance) annotation contract and its agreement with the design.
Parameters
[in]cmapThe ConsensusMap about to be exported
[in]designThe experimental design that was used to quantify cmap
Returns
true if all three views can be written; false for the conditions the views report by returning false/nullptr, having logged the reason
Exceptions
Exception::IllegalArgumentif a feature carries divergent peptide annotations
Exception::MissingInformationif an identification of a merged run carries no usable id_merge_index
Exception::InvalidValueif two identification runs share an identifier