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

Static helpers that convert between FeatureMap and ConsensusMap. More...

#include <OpenMS/KERNEL/ConversionHelper.h>

Static Public Member Functions

static void convert (ConsensusMap const &input_map, const bool keep_uids, FeatureMap &output_map)
 Convert a ConsensusMap to a FeatureMap.
 
static void convert (UInt64 const input_map_index, FeatureMap const &input_map, ConsensusMap &output_map, Size n=-1)
 Convert a FeatureMap to a ConsensusMap.
 

Detailed Description

Static helpers that convert between FeatureMap and ConsensusMap.

There is no conversion from a PeakMap: the handle of a consensus feature built from a peak could only refer to the peak's index, not to an element with a unique id. MapAlignmentAlgorithmPoseClustering selects the peaks it aligns itself.

Each overload replaces the contents of the destination and leaves it in a state where the standard range queries reflect the new contents without further bookkeeping by the caller. The container unique id of the destination is copied from the source or freshly drawn, depending on the overload.

The conversions are not symmetric: which fields are preserved (container / element unique ids, protein and unassigned peptide identifications) depends on the source and target container, so see each overload for the exact contract.

Member Function Documentation

◆ convert() [1/2]

static void convert ( ConsensusMap const &  input_map,
const bool  keep_uids,
FeatureMap &  output_map 
)
static

Convert a ConsensusMap to a FeatureMap.

Every element of input_map is converted to a Feature in output_map (the BaseFeature portion is copied; positional and meta data are preserved). The document identifier and the protein / unassigned peptide identifications are preserved on the output.

Parameters
[in]input_mapSource ConsensusMap.
[in]keep_uidsIf true, the container unique id and every element's unique id are preserved from input_map; otherwise they are replaced with fresh ones.
[out]output_mapResulting FeatureMap; previous contents are replaced.

◆ convert() [2/2]

static void convert ( UInt64 const  input_map_index,
FeatureMap const &  input_map,
ConsensusMap &  output_map,
Size  n = -1 
)
static

Convert a FeatureMap to a ConsensusMap.

The first n features of input_map (in input order; no sorting is performed) are written to output_map as ConsensusFeature entries tagged with input_map_index. The output's container unique id is taken from input_map (an intentional design choice – callers that need a fresh id must overwrite it afterwards). The protein and unassigned peptide identifications are preserved on the output.

Note
Because features are taken in input order, n is mainly useful after pre-sorting input_map (e.g. by intensity).
The column header size for input_map_index is set to input_map.size() – the full input size – even when n truncates the actual copy. Inspect the output container's size for the number of features that were actually written.
Parameters
[in]input_map_indexIndex assigned to the input map in the resulting ConsensusMap column headers.
[in]input_mapSource FeatureMap.
[out]output_mapResulting ConsensusMap; previous contents are replaced.
[in]nMaximum number of features to copy. The default (Size(-1)) keeps all features.