|
| std::string | formatFloat (float value) |
| | Render one float32 the way Python's repr writes it inside JSON.
|
| |
| std::string | canonical (const std::vector< Value > &values, const std::vector< size_t > &unordered_list_indices={}) |
| | Canonical JSON encoding of an identity composite.
|
| |
| Int64 | deriveId (const std::vector< Value > &values, const std::vector< size_t > &unordered_list_indices={}) |
| | Derive an opaque signed 64-bit identity from a composite.
|
| |
| Int64 | featureId (const std::string &run_file_name, const std::string &peptidoform, Int64 charge, std::optional< float > rt, const std::vector< Int32 > &scan, float observed_mz) |
| | feature_id from a feature row's persisted column values
|
| |
| Int64 | psmId (const std::string &run_file_name, const std::vector< Int32 > &scan, const std::string &peptidoform, Int64 charge) |
| | psm_id from a psm row's persisted column values
|
| |
| Int64 | pgId (const std::vector< std::string > &pg_accessions, const std::vector< std::string > &grouped_runs, const std::optional< std::string > &label) |
| | pg_id from a protein-group row's persisted column values
|
| |
Opaque QPX row identities (feature_id, psm_id, pg_id)
Every QPX view carries a mandatory int64 identity column that is its primary key. The value is opaque – it is not meant to be parsed or reversed, only compared – and is derived deterministically from a footer-declared identity_composite of ordinary columns.
These functions reproduce qpx.core.data.identity byte for byte. That is a hard requirement, not a nicety. qpxc re-derives feature_id for identified rows from the declared composite, but never rewrites the psm.feature_id that points at it. An OpenMS collection whose ids were invented rather than derived would therefore turn into one with dangling cross-references the moment it was converted – which qpx's own dataset validation reports as dangling_feature_id.
The derivation is BLAKE2b truncated to 8 bytes over the canonical JSON encoding of the composite, read as a big-endian signed 64-bit integer. Negative values are normal and carry no meaning.
- Note
- Identity is meaningful within a file only. Two QPX files must not be joined on
feature_id alone, and a test reference must not pin id values across files: the feature composite contains rt and observed_mz, so one ULP of platform drift changes the whole id rather than one digit of it.
- Experimental classes:
- This API is experimental and may change in future versions.
| Int64 featureId |
( |
const std::string & |
run_file_name, |
|
|
const std::string & |
peptidoform, |
|
|
Int64 |
charge, |
|
|
std::optional< float > |
rt, |
|
|
const std::vector< Int32 > & |
scan, |
|
|
float |
observed_mz |
|
) |
| |
feature_id from a feature row's persisted column values
Composite: (run_file_name, peptidoform, charge, rt, scan, observed_mz). The floats are what make an unidentified feature row identifiable at all – such a row has an empty peptidoform and an empty scan, and its run and charge are shared with dozens of others.
- Parameters
-
| [in] | run_file_name | Bare run name (no directory, no extension) |
| [in] | peptidoform | ProForma notation; empty for an unidentified feature |
| [in] | charge | Charge state as persisted (int16) |
| [in] | rt | Retention time in seconds, or nullopt when the column is null |
| [in] | scan | Scan components; empty for an unidentified feature |
| [in] | observed_mz | Experimental m/z |
| std::string formatFloat |
( |
float |
value | ) |
|
Render one float32 the way Python's repr writes it inside JSON.
QPX encodes composites with json.dumps, which formats floats with float.__repr__: the shortest decimal that round-trips, switching to exponential notation when the decimal point would fall at position <= -4 or > 16, and appending ".0" to a value that would otherwise look like an integer. C++'s own general format picks between fixed and scientific by a different rule, so it cannot be used directly.
- Parameters
-
| [in] | value | The value as persisted; it is widened to double first, exactly as Arrow's cast + to_pylist does on the reading side |
- Returns
- e.g.
"0.1", "1000000000000000.0", "1e+16", "9.999e-05", "-0.0"
| Int64 pgId |
( |
const std::vector< std::string > & |
pg_accessions, |
|
|
const std::vector< std::string > & |
grouped_runs, |
|
|
const std::optional< std::string > & |
label |
|
) |
| |
pg_id from a protein-group row's persisted column values
Composite: (pg_accessions, grouped_runs, label). Both lists are treated as sets – deduplicated and sorted by their JSON encoding – because neither the order in which a group lists its members nor the order of the runs aggregated into one quantity is part of the group's identity.
The FULL membership keys the id, not the leading protein alone. Two distinct groups that happen to share a leader (P1;P2 and P1;P3) would otherwise derive the same pg_id, and since the id is this view's primary key, that collision is a refused export rather than a merely inaccurate value.
- Parameters
-
| [in] | pg_accessions | Every accession in the group, in any order |
| [in] | grouped_runs | Raw files of this quantification unit, in any order |
| [in] | label | Channel label, or nullopt for an identification-only group |