Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
AccurateMassSearchEngine Class Reference

An algorithm to search for exact mass matches from a spectrum against a database (e.g. HMDB). More...

#include <OpenMS/ANALYSIS/ID/AccurateMassSearchEngine.h>

Inheritance diagram for AccurateMassSearchEngine:
DefaultParamHandler ProgressLogger

Classes

struct  CompareEntryAndMass_
 
struct  MappingEntry_
 

Public Member Functions

 AccurateMassSearchEngine ()
 Default constructor. More...
 
virtual ~AccurateMassSearchEngine ()
 Default destructor. More...
 
void queryByMZ (const double &observed_mz, const Int &observed_charge, const String &ion_mode, std::vector< AccurateMassSearchResult > &results) const
 search for a specific observed mass by enumerating all possible adducts and search M+X against database More...
 
void queryByFeature (const Feature &feature, const Size &feature_index, const String &ion_mode, std::vector< AccurateMassSearchResult > &results) const
 
void queryByConsensusFeature (const ConsensusFeature &cfeat, const Size &cf_index, const Size &number_of_maps, const String &ion_mode, std::vector< AccurateMassSearchResult > &results) const
 
void run (FeatureMap &, MzTab &) const
 
void run (ConsensusMap &, MzTab &) const
 
void init ()
 parse database and adduct files More...
 
- Public Member Functions inherited from DefaultParamHandler
 DefaultParamHandler (const String &name)
 Constructor with name that is displayed in error messages. More...
 
 DefaultParamHandler (const DefaultParamHandler &rhs)
 Copy constructor. More...
 
virtual ~DefaultParamHandler ()
 Destructor. More...
 
virtual DefaultParamHandleroperator= (const DefaultParamHandler &rhs)
 Assignment operator. More...
 
virtual bool operator== (const DefaultParamHandler &rhs) const
 Equality operator. More...
 
void setParameters (const Param &param)
 Sets the parameters. More...
 
const ParamgetParameters () const
 Non-mutable access to the parameters. More...
 
const ParamgetDefaults () const
 Non-mutable access to the default parameters. More...
 
const StringgetName () const
 Non-mutable access to the name. More...
 
void setName (const String &name)
 Mutable access to the name. More...
 
const std::vector< String > & getSubsections () const
 Non-mutable access to the registered subsections. More...
 
- Public Member Functions inherited from ProgressLogger
 ProgressLogger ()
 Constructor. More...
 
 ~ProgressLogger ()
 Destructor. More...
 
 ProgressLogger (const ProgressLogger &other)
 Copy constructor. More...
 
ProgressLoggeroperator= (const ProgressLogger &other)
 Assignment Operator. More...
 
void setLogType (LogType type) const
 Sets the progress log that should be used. The default type is NONE! More...
 
LogType getLogType () const
 Returns the type of progress log being used. More...
 
void startProgress (SignedSize begin, SignedSize end, const String &label) const
 Initializes the progress display. More...
 
void setProgress (SignedSize value) const
 Sets the current progress. More...
 
void endProgress () const
 Ends the progress display. More...
 

Protected Member Functions

virtual void updateMembers_ ()
 This method is used to update extra member variables at the end of the setParameters() method. More...
 
- Protected Member Functions inherited from DefaultParamHandler
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor. More...
 

Private Types

typedef std::vector< std::vector< AccurateMassSearchResult > > QueryResultsTable
 
typedef std::vector< std::vector< String > > MassIDMapping
 private member variables More...
 
typedef std::map< String, std::vector< String > > HMDBPropsMapping
 

Private Member Functions

template<typename MAPTYPE >
String resolveAutoMode_ (const MAPTYPE &map) const
 private member functions More...
 
void parseMappingFile_ (const String &)
 
void parseStructMappingFile_ (const String &)
 
void parseAdductsFile_ (const String &filename, std::vector< AdductInfo > &result)
 
void searchMass_ (double neutral_query_mass, double diff_mass, std::pair< Size, Size > &hit_indices) const
 
void annotate_ (const std::vector< AccurateMassSearchResult > &, BaseFeature &) const
 add search results to a Consensus/Feature More...
 
double computeCosineSim_ (const std::vector< double > &x, const std::vector< double > &y) const
 
double computeEuclideanDist_ (const std::vector< double > &x, const std::vector< double > &y) const
 
double computeIsotopePatternSimilarity_ (const Feature &feat, const EmpiricalFormula &form) const
 
void exportMzTab_ (const QueryResultsTable &overall_results, MzTab &mztab_out) const
 

Private Attributes

std::vector< MappingEntry_mass_mappings_
 
HMDBPropsMapping hmdb_properties_mapping_
 
bool is_initialized_
 
double mass_error_value_
 parameter stuff More...
 
String mass_error_unit_
 
String ion_mode_
 
bool iso_similarity_
 
String pos_adducts_fname_
 
String neg_adducts_fname_
 
String db_mapping_file_
 
String db_struct_file_
 
std::vector< AdductInfopos_adducts_
 
std::vector< AdductInfoneg_adducts_
 
String database_name_
 
String database_version_
 
bool keep_unidentified_masses_
 

Additional Inherited Members

- Public Types inherited from ProgressLogger
enum  LogType { CMD, GUI, NONE }
 Possible log types. More...
 
- Static Protected Member Functions inherited from ProgressLogger
static String logTypeToFactoryName_ (LogType type)
 Return the name of the factory product used for this log type. More...
 
- Protected Attributes inherited from DefaultParamHandler
Param param_
 Container for current parameters. More...
 
Param defaults_
 Container for default parameters. This member should be filled in the constructor of derived classes! More...
 
std::vector< Stringsubsections_
 Container for registered subsections. This member should be filled in the constructor of derived classes! More...
 
String error_name_
 Name that is displayed in error messages during the parameter checking. More...
 
bool check_defaults_
 If this member is set to false no checking if parameters in done;. More...
 
bool warn_empty_defaults_
 If this member is set to false no warning is emitted when defaults are empty;. More...
 
- Protected Attributes inherited from ProgressLogger
LogType type_
 
time_t last_invoke_
 
ProgressLoggerImplcurrent_logger_
 
- Static Protected Attributes inherited from ProgressLogger
static int recursion_depth_
 

Detailed Description

An algorithm to search for exact mass matches from a spectrum against a database (e.g. HMDB).

For each peak, neutral masses are reconstructed from observed (spectrum) m/z values by enumerating all possible adducts with matching charge. The resulting neutral masses (can be more than one, depending on list of possible adducts) are matched against masses from a database within a certain mass error (Da or ppm).

Supports any database which contains an identifier, chemical sum formula and (optional) mass. If masses in the database are not given (= set to 0), they are computed from sum formulas.

Both positive and negative ion mode is supported. Charge for (Consensus-)Features can be either positive or negative, but only the absolute value is used since many FeatureFinders will only report positive charges even in negative ion mode. Entities with charge=0 are treated as "unknown charge" and are tested with all potential adducts and subsequently matched against the database.

A list of potential adducts can be given for each mode separately.

Ionization mode of the observed m/z values can be determined automatically if the input map (either FeatureMap or ConsensusMap) is annotated with a meta value, as done by FeatureFinderMetabo.

Member Typedef Documentation

typedef std::map<String, std::vector<String> > HMDBPropsMapping
private
typedef std::vector<std::vector<String> > MassIDMapping
private

private member variables

typedef std::vector<std::vector<AccurateMassSearchResult> > QueryResultsTable
private

Constructor & Destructor Documentation

Default constructor.

virtual ~AccurateMassSearchEngine ( )
virtual

Default destructor.

Member Function Documentation

void annotate_ ( const std::vector< AccurateMassSearchResult > &  ,
BaseFeature  
) const
private

add search results to a Consensus/Feature

double computeCosineSim_ ( const std::vector< double > &  x,
const std::vector< double > &  y 
) const
private
double computeEuclideanDist_ ( const std::vector< double > &  x,
const std::vector< double > &  y 
) const
private
double computeIsotopePatternSimilarity_ ( const Feature feat,
const EmpiricalFormula form 
) const
private
void exportMzTab_ ( const QueryResultsTable overall_results,
MzTab mztab_out 
) const
private
void init ( )

parse database and adduct files

void parseAdductsFile_ ( const String filename,
std::vector< AdductInfo > &  result 
)
private
void parseMappingFile_ ( const String )
private
void parseStructMappingFile_ ( const String )
private
void queryByConsensusFeature ( const ConsensusFeature cfeat,
const Size cf_index,
const Size number_of_maps,
const String ion_mode,
std::vector< AccurateMassSearchResult > &  results 
) const
void queryByFeature ( const Feature feature,
const Size feature_index,
const String ion_mode,
std::vector< AccurateMassSearchResult > &  results 
) const
void queryByMZ ( const double observed_mz,
const Int observed_charge,
const String ion_mode,
std::vector< AccurateMassSearchResult > &  results 
) const

search for a specific observed mass by enumerating all possible adducts and search M+X against database

String resolveAutoMode_ ( const MAPTYPE &  map) const
inlineprivate

private member functions

if ion-mode is auto, this will set the internal mode according to input data

Exceptions
InvalidParameterif ion mode cannot be resolved

References File::basename(), LOG_INFO, and String::toLower().

void run ( FeatureMap ,
MzTab  
) const

main method of AccurateMassSearchEngine input map is not const, since it will get annotated with results

void run ( ConsensusMap ,
MzTab  
) const

main method of AccurateMassSearchEngine input map is not const, since it will get annotated with results

Note
Call init() before calling run!
void searchMass_ ( double  neutral_query_mass,
double  diff_mass,
std::pair< Size, Size > &  hit_indices 
) const
private
virtual void updateMembers_ ( )
protectedvirtual

This method is used to update extra member variables at the end of the setParameters() method.

Also call it at the end of the derived classes' copy constructor and assignment operator.

The default implementation is empty.

Reimplemented from DefaultParamHandler.

Member Data Documentation

String database_name_
private
String database_version_
private
String db_mapping_file_
private
String db_struct_file_
private
HMDBPropsMapping hmdb_properties_mapping_
private
String ion_mode_
private
bool is_initialized_
private
bool iso_similarity_
private
bool keep_unidentified_masses_
private
String mass_error_unit_
private
double mass_error_value_
private

parameter stuff

std::vector<MappingEntry_> mass_mappings_
private
std::vector<AdductInfo> neg_adducts_
private
String neg_adducts_fname_
private
std::vector<AdductInfo> pos_adducts_
private
String pos_adducts_fname_
private

OpenMS / TOPP release 2.0.0 Documentation generated on Sat May 16 2015 16:13:44 using doxygen 1.8.9.1