Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes

ConsensusMap Class Reference
[Kernel]

A container for consensus elements. More...

#include <OpenMS/KERNEL/ConsensusMap.h>

Inheritance diagram for ConsensusMap:
MetaInfoInterface RangeManager< 2 > DocumentIdentifier UniqueIdInterface UniqueIdIndexer< ConsensusMap >

List of all members.

Classes

struct  FileDescription
 Source file description for input files. More...

Public Types

Type definitions

typedef std::vector
< ConsensusFeature
Base
typedef RangeManager< 2 > RangeManagerType
typedef Map< UInt64,
FileDescription
FileDescriptions
typedef std::vector
< ConsensusFeature >::iterator 
Iterator
 Mutable iterator.
typedef std::vector
< ConsensusFeature >
::const_iterator 
ConstIterator
 Non-mutable iterator.
typedef std::vector
< ConsensusFeature >
::reverse_iterator 
ReverseIterator
 Mutable reverse iterator.
typedef std::vector
< ConsensusFeature >
::const_reverse_iterator 
ConstReverseIterator
 Non-mutable reverse iterator.

Public Member Functions

 ConsensusMap ()
 Default constructor.
 ConsensusMap (const ConsensusMap &source)
 Copy constructor.
 ~ConsensusMap ()
 Destructor.
 ConsensusMap (Base::size_type n)
 Creates a ConsensusMap with n elements.
ConsensusMapoperator= (const ConsensusMap &source)
 Assignment operator.
ConsensusMapoperator+= (const ConsensusMap &rhs)
 Add one consensus map to another.
void clear (bool clear_meta_data=true)
 Clears all data and meta data.
const FileDescriptionsgetFileDescriptions () const
 Non-mutable access to the file descriptions.
FileDescriptionsgetFileDescriptions ()
 Mutable access to the file descriptions.
const StringgetExperimentType () const
 Non-mutable access to the experiment type.
void setExperimentType (const String &experiment_type)
 Mutable access to the experiment type.
void updateRanges ()
void swap (ConsensusMap &from)
 Swaps the content of this map with the content of from.
const std::vector
< ProteinIdentification > & 
getProteinIdentifications () const
 non-mutable access to the protein identifications
std::vector
< ProteinIdentification > & 
getProteinIdentifications ()
 mutable access to the protein identifications
void setProteinIdentifications (const std::vector< ProteinIdentification > &protein_identifications)
 sets the protein identifications
const std::vector
< PeptideIdentification > & 
getUnassignedPeptideIdentifications () const
 non-mutable access to the unassigned peptide identifications
std::vector
< PeptideIdentification > & 
getUnassignedPeptideIdentifications ()
 mutable access to the unassigned peptide identifications
void setUnassignedPeptideIdentifications (const std::vector< PeptideIdentification > &unassigned_peptide_identifications)
 sets the unassigned peptide identifications
const std::vector
< DataProcessing > & 
getDataProcessing () const
 returns a const reference to the description of the applied data processing
std::vector< DataProcessing > & getDataProcessing ()
 returns a mutable reference to the description of the applied data processing
void setDataProcessing (const std::vector< DataProcessing > &processing_method)
 sets the description of the applied data processing
bool operator== (const ConsensusMap &rhs) const
 Equality operator.
bool operator!= (const ConsensusMap &rhs) const
 Equality operator.
template<typename Type >
Size applyMemberFunction (Size(Type::*member_function)())
 Applies a member function of Type to the container itself and all consensus features. The returned values are accumulated.
template<typename Type >
Size applyMemberFunction (Size(Type::*member_function)() const) const
 The "const" variant.
Sorting.

These specialized sorting methods are supported in addition to the standard sorting methods of std::vector. All use stable sorting.

void sortByIntensity (bool reverse=false)
 Sorts the peaks according to ascending intensity.
void sortByRT ()
 Sorts the peaks to RT position.
void sortByMZ ()
 Sorts the peaks to m/z position.
void sortByPosition ()
 Lexicographically sorts the peaks by their position (First RT then m/z).
void sortByQuality (bool reverse=false)
 Sorts the peaks according to ascending quality.
void sortBySize ()
 Sorts with respect to the size (number of elements).
void sortByMaps ()
 Sorts with respect to the sets of maps covered by the consensus features (lexicographically).

Static Public Member Functions

template<typename FeatureT >
static void convert (UInt64 const input_map_index, FeatureMap< FeatureT > const &input_map, ConsensusMap &output_map, Size n=-1)
 Convert a FeatureMap (of any feature type) to a ConsensusMap.
static void convert (UInt64 const input_map_index, MSExperiment<> &input_map, ConsensusMap &output_map, Size n=-1)
 Similar to convert for FeatureMaps.
static void convert (UInt64 const input_map_index, std::vector< Peak2D > &input_map, ConsensusMap &output_map, Size n=-1)
 Convert a vector of 2D Peaks (Peak2D) into a ConsensusMap.
template<typename FeatureT >
static void convert (ConsensusMap const &input_map, const bool keep_uids, FeatureMap< FeatureT > &output_map)
 Convert a ConsensusMap to a FeatureMap (of any feature type).

Protected Attributes

FileDescriptions file_description_
 Map from index to file description.
String experiment_type_
 type of experiment (label-free, itraq, ...); see xsd schema
std::vector
< ProteinIdentification
protein_identifications_
 protein identifications
std::vector
< PeptideIdentification
unassigned_peptide_identifications_
 protein identifications
std::vector< DataProcessingdata_processing_
 applied data processing

Detailed Description

A container for consensus elements.

A ConsensusMap is a container holding 2-dimensional consensus elements (ConsensusFeature) which in turn represent combined elements of 2-dimensional experiments. The map is implemented as a vector of elements.

The map indices used in the consensus features should be registered in this class.


Member Typedef Documentation

typedef std::vector<ConsensusFeature> Base
typedef std::vector<ConsensusFeature>::const_iterator ConstIterator

Non-mutable iterator.

typedef std::vector<ConsensusFeature>::const_reverse_iterator ConstReverseIterator

Non-mutable reverse iterator.

typedef std::vector<ConsensusFeature>::iterator Iterator

Mutable iterator.

typedef std::vector<ConsensusFeature>::reverse_iterator ReverseIterator

Mutable reverse iterator.


Constructor & Destructor Documentation

ConsensusMap (  ) 

Default constructor.

ConsensusMap ( const ConsensusMap source  ) 

Copy constructor.

~ConsensusMap (  ) 

Destructor.

ConsensusMap ( Base::size_type  n  )  [explicit]

Creates a ConsensusMap with n elements.


Member Function Documentation

Size applyMemberFunction ( Size(Type::*)()  member_function  )  [inline]

Applies a member function of Type to the container itself and all consensus features. The returned values are accumulated.

Example: The following will print the number of features with invalid unique ids (plus 1 if the container has an invalid UID as well):

      ConsensusMap cm;
      (...)
      std::cout << cm.applyMemberFunction(&UniqueIdInterface::hasInvalidUniqueId) << std::endl;

See e.g. UniqueIdInterface for what else can be done this way.

Size applyMemberFunction ( Size(Type::*)() const   member_function  )  const [inline]

The "const" variant.

void clear ( bool  clear_meta_data = true  ) 

Clears all data and meta data.

Parameters:
clear_meta_data If true, all meta data is cleared in addition to the data.

Referenced by ConsensusMap::convert().

static void convert ( UInt64 const   input_map_index,
MSExperiment<> &  input_map,
ConsensusMap output_map,
Size  n = -1 
) [inline, static]

Similar to convert for FeatureMaps.

Only the n most intense elements are copied.

Currently MSExperiment<> does not have a unique id but ConsensusMap has one, so we assign a new one here.

Parameters:
input_map_index The index of the input map.
input_map The input map to be converted.
output_map The resulting ConsensusMap.
n The maximum number of elements to be copied.

References ConsensusMap::clear(), MSExperiment< PeakT, ChromatogramPeakT >::get2DData(), ConsensusMap::getFileDescriptions(), MSExperiment< PeakT, ChromatogramPeakT >::getSize(), OpenMS::reverseComparator(), UniqueIdInterface::setUniqueId(), ConsensusMap::updateRanges(), and MSExperiment< PeakT, ChromatogramPeakT >::updateRanges().

static void convert ( UInt64 const   input_map_index,
std::vector< Peak2D > &  input_map,
ConsensusMap output_map,
Size  n = -1 
) [inline, static]

Convert a vector of 2D Peaks (Peak2D) into a ConsensusMap.

Only the n most intense elements are copied.

Note: a new unique ID is generated for the consensus map.

Parameters:
input_map_index The index of the input map.
input_map The input map to be converted.
output_map The resulting ConsensusMap.
n The maximum number of elements to be copied.

References ConsensusMap::clear(), ConsensusMap::getFileDescriptions(), OpenMS::reverseComparator(), UniqueIdInterface::setUniqueId(), and ConsensusMap::updateRanges().

static void convert ( ConsensusMap const &  input_map,
const bool  keep_uids,
FeatureMap< FeatureT > &  output_map 
) [inline, static]

Convert a ConsensusMap to a FeatureMap (of any feature type).

The previous content of output_map is cleared. UID's of the elements and the container is copied if the keep_uids flag is set.

Parameters:
input_map The container to be converted.
keep_uids Shall the UID's of the elements and the container be kept or created anew
output_map The resulting ConsensusMap.

References OpenMS::Constants::c, FeatureMap< FeatureT >::clear(), ConsensusMap::getProteinIdentifications(), ConsensusMap::getUnassignedPeptideIdentifications(), FeatureMap< FeatureT >::setProteinIdentifications(), FeatureMap< FeatureT >::setUnassignedPeptideIdentifications(), and UniqueIdInterface::setUniqueId().

static void convert ( UInt64 const   input_map_index,
FeatureMap< FeatureT > const &  input_map,
ConsensusMap output_map,
Size  n = -1 
) [inline, static]

Convert a FeatureMap (of any feature type) to a ConsensusMap.

Each ConsensusFeature contains a map index, so this has to be given as well. The previous content of output_map is cleared. An arguable design decision is that the unique id of the FeatureMap is copied (!) to the ConsensusMap, because that is the way it is meant to be used in the algorithms.

Only the first (!) n elements are copied. (This parameter exists mainly for compatibility with convert for MSExperiments. To use it in a meaningful way, apply one of the sorting methods to input_map beforehand.)

Parameters:
input_map_index The index of the input map.
input_map The container to be converted.
output_map The resulting ConsensusMap.
n The maximum number of elements to be copied.

References ConsensusMap::clear(), ConsensusMap::getFileDescriptions(), FeatureMap< FeatureT >::getProteinIdentifications(), FeatureMap< FeatureT >::getUnassignedPeptideIdentifications(), UniqueIdInterface::getUniqueId(), ConsensusMap::setProteinIdentifications(), ConsensusMap::setUnassignedPeptideIdentifications(), UniqueIdInterface::setUniqueId(), and ConsensusMap::updateRanges().

Referenced by MapAlignmentAlgorithmPoseClustering::setReference().

const std::vector<DataProcessing>& getDataProcessing (  )  const

returns a const reference to the description of the applied data processing

std::vector<DataProcessing>& getDataProcessing (  ) 

returns a mutable reference to the description of the applied data processing

const String& getExperimentType (  )  const

Non-mutable access to the experiment type.

const FileDescriptions& getFileDescriptions (  )  const

Non-mutable access to the file descriptions.

Referenced by ConsensusMap::convert().

FileDescriptions& getFileDescriptions (  ) 

Mutable access to the file descriptions.

const std::vector<ProteinIdentification>& getProteinIdentifications (  )  const

non-mutable access to the protein identifications

Referenced by ConsensusMap::convert().

std::vector<ProteinIdentification>& getProteinIdentifications (  ) 

mutable access to the protein identifications

std::vector<PeptideIdentification>& getUnassignedPeptideIdentifications (  ) 

mutable access to the unassigned peptide identifications

const std::vector<PeptideIdentification>& getUnassignedPeptideIdentifications (  )  const

non-mutable access to the unassigned peptide identifications

Referenced by ConsensusMap::convert().

bool operator!= ( const ConsensusMap rhs  )  const

Equality operator.

ConsensusMap& operator+= ( const ConsensusMap rhs  ) 

Add one consensus map to another.

Consensus elements are merged into one container, simply by appending. ConsensusElementLists are appended. Information on map lists ......

Parameters:
rhs The consensus map.
ConsensusMap& operator= ( const ConsensusMap source  ) 

Assignment operator.

bool operator== ( const ConsensusMap rhs  )  const

Equality operator.

void setDataProcessing ( const std::vector< DataProcessing > &  processing_method  ) 

sets the description of the applied data processing

void setExperimentType ( const String experiment_type  ) 

Mutable access to the experiment type.

void setProteinIdentifications ( const std::vector< ProteinIdentification > &  protein_identifications  ) 

sets the protein identifications

Referenced by ConsensusMap::convert().

void setUnassignedPeptideIdentifications ( const std::vector< PeptideIdentification > &  unassigned_peptide_identifications  ) 

sets the unassigned peptide identifications

Referenced by ConsensusMap::convert().

void sortByIntensity ( bool  reverse = false  ) 

Sorts the peaks according to ascending intensity.

void sortByMaps (  ) 

Sorts with respect to the sets of maps covered by the consensus features (lexicographically).

void sortByMZ (  ) 

Sorts the peaks to m/z position.

void sortByPosition (  ) 

Lexicographically sorts the peaks by their position (First RT then m/z).

void sortByQuality ( bool  reverse = false  ) 

Sorts the peaks according to ascending quality.

void sortByRT (  ) 

Sorts the peaks to RT position.

void sortBySize (  ) 

Sorts with respect to the size (number of elements).

void swap ( ConsensusMap from  ) 

Swaps the content of this map with the content of from.

void updateRanges (  ) 

Referenced by ConsensusMap::convert().


Member Data Documentation

std::vector<DataProcessing> data_processing_ [protected]

applied data processing

String experiment_type_ [protected]

type of experiment (label-free, itraq, ...); see xsd schema

Map from index to file description.

protein identifications

protein identifications


OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:54 using doxygen 1.7.1