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

Collect, serialise and re-register the definitions of tool-defined modifications. More...

#include <OpenMS/FORMAT/ModificationDefinitionIO.h>

Static Public Member Functions

static bool isDefinition (const ResidueModification *mod)
 The selection predicate: a named modification whose definition must travel with the file.
 
static std::map< std::string, std::set< const ResidueModification * > > collect (const std::vector< ProteinIdentification > &protein_ids, const PeptideIdentificationList &peptide_ids)
 Collect, per run identifier, the definitions the identifications reference.
 
static std::map< std::string, std::set< const ResidueModification * > > collect (const FeatureMap &map)
 collect() over a FeatureMap: its runs, the identifications of every feature (subordinates included) and the unassigned ones
 
static std::map< std::string, std::set< const ResidueModification * > > collect (const ConsensusMap &map)
 collect() over a ConsensusMap: its runs, the identifications of every consensus feature and the unassigned ones
 
static std::string encode (const std::set< const ResidueModification * > &defs)
 Serialise defs into one ';'-joined string. Deterministic: records are sorted.
 
static void attach (ProteinIdentification::SearchParameters &sp, const std::set< const ResidueModification * > &defs)
 
static std::map< std::string, std::string > encodeByRun (const std::vector< ProteinIdentification > &protein_ids, const std::map< std::string, std::set< const ResidueModification * > > &defs)
 
static Size registerFrom (const std::string &records)
 
static Size registerFrom (const ProteinIdentification::SearchParameters &sp)
 Convenience: registerFrom() on the meta value of sp, if present.
 

Detailed Description

Collect, serialise and re-register the definitions of tool-defined modifications.

The definitions travel as the Constants::UserParam::MODIFICATION_DEFINITIONS meta value on ProteinIdentification::SearchParameters, which idXML, featureXML, consensusXML and .idparquet all serialise. Writers call collect() + attach(); readers call registerFrom() before parsing any peptide sequence. isDefinition() selects what is serialised: provenance DEFINED and a non-empty Id.

Member Function Documentation

◆ attach()

static void attach ( ProteinIdentification::SearchParameters &  sp,
const std::set< const ResidueModification * > &  defs 
)
static

Store defs on sp under Constants::UserParam::MODIFICATION_DEFINITIONS, unioned with what the meta value already holds. No-op when there is nothing to store.

◆ collect() [1/3]

static std::map< std::string, std::set< const ResidueModification * > > collect ( const ConsensusMap &  map)
static

collect() over a ConsensusMap: its runs, the identifications of every consensus feature and the unassigned ones

◆ collect() [2/3]

static std::map< std::string, std::set< const ResidueModification * > > collect ( const FeatureMap &  map)
static

collect() over a FeatureMap: its runs, the identifications of every feature (subordinates included) and the unassigned ones

◆ collect() [3/3]

static std::map< std::string, std::set< const ResidueModification * > > collect ( const std::vector< ProteinIdentification > &  protein_ids,
const PeptideIdentificationList &  peptide_ids 
)
static

Collect, per run identifier, the definitions the identifications reference.

Covers every hit's terminal and residue modifications plus each run's fixed/variable modification names. Runs referencing no definition do not appear.

◆ encode()

static std::string encode ( const std::set< const ResidueModification * > &  defs)
static

Serialise defs into one ';'-joined string. Deterministic: records are sorted.

◆ encodeByRun()

static std::map< std::string, std::string > encodeByRun ( const std::vector< ProteinIdentification > &  protein_ids,
const std::map< std::string, std::set< const ResidueModification * > > &  defs 
)
static

Per run identifier, the value attach() would store: defs unioned with what the run's SearchParameters already carry. Runs with nothing to store are absent.

◆ isDefinition()

static bool isDefinition ( const ResidueModification *  mod)
static

The selection predicate: a named modification whose definition must travel with the file.

◆ registerFrom() [1/2]

static Size registerFrom ( const ProteinIdentification::SearchParameters &  sp)
static

Convenience: registerFrom() on the meta value of sp, if present.

Returns
records registered.

◆ registerFrom() [2/2]

static Size registerFrom ( const std::string &  records)
static

Register every record in records into ModificationsDB; a malformed record is logged and skipped.

Returns
the number of records registered