213 static constexpr
char search_engine_identifier[] =
"AccurateMassSearchEngine";
255 String ion_mode_detect_msg =
"";
258 if (map[0].metaValueExists(
"scan_polarity"))
260 StringList pols = ListUtils::create<String>(
String(map[0].getMetaValue(
"scan_polarity")),
';');
261 if (pols.size() == 1 && !pols[0].empty())
264 if (pols[0] ==
"positive" || pols[0] ==
"negative")
266 ion_mode_internal = pols[0];
267 OPENMS_LOG_INFO <<
"Setting auto ion-mode to '" << ion_mode_internal <<
"' for file " <<
File::basename(map.getLoadedFilePath()) << std::endl;
269 else ion_mode_detect_msg =
String(
"Meta value 'scan_polarity' does not contain unknown ion mode") +
String(map[0].getMetaValue(
"scan_polarity"));
273 ion_mode_detect_msg =
String(
"ambiguous ion mode: ") +
String(map[0].getMetaValue(
"scan_polarity"));
278 ion_mode_detect_msg =
String(
"Meta value 'scan_polarity' not found in (Consensus-)Feature map");
283 OPENMS_LOG_INFO <<
"Meta value 'scan_polarity' cannot be determined since (Consensus-)Feature map is empty!" << std::endl;
286 if (!ion_mode_detect_msg.empty())
288 throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
String(
"Auto ionization mode could not resolve ion mode of data (") + ion_mode_detect_msg +
"!");
291 return ion_mode_internal;
297 void searchMass_(
double neutral_query_mass,
double diff_mass, std::pair<Size, Size>& hit_indices)
const;
308 const std::vector<AccurateMassSearchResult>& amr,
351 template <
typename T1,
typename T2>
354 return asMass(t1) < asMass(t2);
363 bool legacyID_ =
true;
#define OPENMS_LOG_INFO
Macro if a information, e.g. a status should be reported.
Definition: LogStream.h:465
An algorithm to search for exact mass matches from a spectrum against a database (e....
Definition: AccurateMassSearchEngine.h:209
void run(FeatureMap &, MzTabM &) const
void init()
parse database and adduct files
void parseStructMappingFile_(const StringList &)
std::vector< std::vector< String > > MassIDMapping
private member variables
Definition: AccurateMassSearchEngine.h:328
String pos_adducts_fname_
Definition: AccurateMassSearchEngine.h:371
bool keep_unidentified_masses_
Definition: AccurateMassSearchEngine.h:384
double mass
Definition: AccurateMassSearchEngine.h:333
void queryByConsensusFeature(const ConsensusFeature &cfeat, const Size &cf_index, const Size &number_of_maps, const String &ion_mode, std::vector< AccurateMassSearchResult > &results) const
AccurateMassSearchEngine()
Default constructor.
String mass_error_unit_
Definition: AccurateMassSearchEngine.h:367
StringList db_struct_file_
Definition: AccurateMassSearchEngine.h:375
void exportMzTabM_(const FeatureMap &fmap, MzTabM &mztabm_out) const
~AccurateMassSearchEngine() override
Default destructor.
void addMatchesToID_(IdentificationData &id, const std::vector< AccurateMassSearchResult > &amr, const IdentificationData::InputFileRef &file_ref, const IdentificationData::ScoreTypeRef &mass_error_ppm_score_ref, const IdentificationData::ScoreTypeRef &mass_error_Da_score_ref, const IdentificationData::ProcessingStepRef &step_ref, BaseFeature &f) const
Add resulting matches to IdentificationData.
double mass_error_value_
parameter stuff
Definition: AccurateMassSearchEngine.h:366
void run(ConsensusMap &, MzTab &) const
void searchMass_(double neutral_query_mass, double diff_mass, std::pair< Size, Size > &hit_indices) const
void queryByMZ(const double &observed_mz, const Int &observed_charge, const String &ion_mode, std::vector< AccurateMassSearchResult > &results, const EmpiricalFormula &observed_adduct=EmpiricalFormula()) const
search for a specific observed mass by enumerating all possible adducts and search M+X against databa...
std::vector< std::vector< AccurateMassSearchResult > > QueryResultsTable
Definition: AccurateMassSearchEngine.h:321
void annotate_(const std::vector< AccurateMassSearchResult > &, BaseFeature &) const
Add search results to a Consensus/Feature.
bool iso_similarity_
Definition: AccurateMassSearchEngine.h:369
std::vector< AdductInfo > pos_adducts_
Definition: AccurateMassSearchEngine.h:377
String neg_adducts_fname_
Definition: AccurateMassSearchEngine.h:372
HMDBPropsMapping hmdb_properties_mapping_
Definition: AccurateMassSearchEngine.h:359
std::vector< String > massIDs
Definition: AccurateMassSearchEngine.h:334
String ion_mode_
Definition: AccurateMassSearchEngine.h:368
double computeIsotopePatternSimilarity_(const Feature &feat, const EmpiricalFormula &form) const
void parseMappingFile_(const StringList &)
String database_version_
Definition: AccurateMassSearchEngine.h:381
double computeCosineSim_(const std::vector< double > &x, const std::vector< double > &y) const
String database_location_
Definition: AccurateMassSearchEngine.h:382
bool is_initialized_
true if init_() was called without any subsequent param changes
Definition: AccurateMassSearchEngine.h:361
std::vector< AccurateMassSearchResult > extractQueryResults_(const Feature &feature, const Size &feature_index, const String &ion_mode_internal, Size &dummy_count) const
Extract query results from feature.
StringList db_mapping_file_
Definition: AccurateMassSearchEngine.h:374
std::vector< AdductInfo > neg_adducts_
Definition: AccurateMassSearchEngine.h:378
String database_name_
Definition: AccurateMassSearchEngine.h:380
String formula
Definition: AccurateMassSearchEngine.h:335
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
void run(FeatureMap &, MzTab &) const
String resolveAutoMode_(const MAPTYPE &map) const
private member functions
Definition: AccurateMassSearchEngine.h:252
std::map< String, std::vector< String > > HMDBPropsMapping
Definition: AccurateMassSearchEngine.h:329
void exportMzTab_(const QueryResultsTable &overall_results, const Size number_of_maps, MzTab &mztab_out, const std::vector< String > &file_locations) const
void queryByFeature(const Feature &feature, const Size &feature_index, const String &ion_mode, std::vector< AccurateMassSearchResult > &results) const
void parseAdductsFile_(const String &filename, std::vector< AdductInfo > &result)
std::vector< MappingEntry_ > mass_mappings_
Definition: AccurateMassSearchEngine.h:337
Definition: AccurateMassSearchEngine.h:332
Definition: AccurateMassSearchEngine.h:58
const std::vector< String > & getMatchingHMDBids() const
Size getMatchingIndex() const
std::vector< double > mass_trace_intensities_
Definition: AccurateMassSearchEngine.h:169
std::vector< double > getIndividualIntensities() const
get the observed intensities
void setMasstraceIntensities(const std::vector< double > &)
std::vector< String > matching_hmdb_ids_
Definition: AccurateMassSearchEngine.h:167
double getObservedMZ() const
get the m/z of the small molecule + adduct
std::vector< double > individual_intensities_
Definition: AccurateMassSearchEngine.h:161
AccurateMassSearchResult & operator=(const AccurateMassSearchResult &)
assignment operator
double getFoundMass() const
get the mass returned by the query (uncharged small molecule)
void setQueryMass(const double &)
set the mass used to query the database (uncharged small molecule)
const String & getFoundAdduct() const
double observed_intensity_
Definition: AccurateMassSearchEngine.h:160
void setIsotopesSimScore(const double &)
void setSourceFeatureIndex(const Size &)
const String & getFormulaString() const
double searched_mass_
Definition: AccurateMassSearchEngine.h:155
void setFoundMass(const double &)
set the mass returned by the query (uncharged small molecule)
double theoretical_mz_
Definition: AccurateMassSearchEngine.h:154
AccurateMassSearchResult()
Default constructor.
double getMZErrorPPM() const
get the error between observed and theoretical m/z in ppm
double observed_rt_
Definition: AccurateMassSearchEngine.h:159
Int getCharge() const
get the charge
double isotopes_sim_score_
Definition: AccurateMassSearchEngine.h:170
~AccurateMassSearchResult()
Default destructor.
String empirical_formula_
Definition: AccurateMassSearchEngine.h:166
void setCharge(const Int &)
set the charge
friend std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
void setFoundAdduct(const String &)
double getQueryMass() const
get the mass used to query the database (uncharged small molecule)
void setObservedMZ(const double &)
set the m/z of the small molecule + adduct
AccurateMassSearchResult(const AccurateMassSearchResult &)
copy constructor
void setEmpiricalFormula(const String &)
void setMZErrorPPM(const double)
set the error between observed and theoretical m/z in ppm
Size getSourceFeatureIndex() const
double getObservedRT() const
get the observed rt
double getObservedIntensity() const
get the observed intensity
double getIsotopesSimScore() const
String found_adduct_
Definition: AccurateMassSearchEngine.h:165
double observed_mz_
Stored information/results of DB query.
Definition: AccurateMassSearchEngine.h:153
double db_mass_
Definition: AccurateMassSearchEngine.h:156
void setMatchingIndex(const Size &)
Size source_feature_index_
Definition: AccurateMassSearchEngine.h:163
Size matching_index_
Definition: AccurateMassSearchEngine.h:162
void setObservedIntensity(const double &)
set the observed intensity
void setMatchingHMDBids(const std::vector< String > &)
double mz_error_ppm_
Definition: AccurateMassSearchEngine.h:158
const std::vector< double > & getMasstraceIntensities() const
return trace intensities of the underlying feature;
void setObservedRT(const double &rt)
set the observed rt
Int charge_
Definition: AccurateMassSearchEngine.h:157
void setCalculatedMZ(const double &)
set the theoretical m/z of the small molecule + adduct
void setIndividualIntensities(const std::vector< double > &)
set the observed intensities
double getCalculatedMZ() const
get the theoretical m/z of the small molecule + adduct
A basic LC-MS feature.
Definition: BaseFeature.h:59
A consensus feature spanning multiple LC-MS/MS experiments.
Definition: ConsensusFeature.h:71
A container for consensus elements.
Definition: ConsensusMap.h:90
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:93
Exception indicating that an invalid parameter was handed over to an algorithm.
Definition: Exception.h:341
A container for features.
Definition: FeatureMap.h:106
An LC-MS feature.
Definition: Feature.h:72
static String basename(const String &file)
Representation of spectrum identification results and associated data.
Definition: IdentificationData.h:95
Data model of MzTab-M files Please see the MzTab-M specification at https://github....
Definition: MzTabM.h:234
Data model of MzTab files. Please see the official MzTab specification at https://code....
Definition: MzTab.h:478
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:53
A more convenient string class.
Definition: String.h:60
int Int
Signed integer type.
Definition: Types.h:102
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
Definition: AccurateMassSearchEngine.h:340
bool operator()(T1 const &t1, T2 const &t2) const
Definition: AccurateMassSearchEngine.h:352
double asMass(double t) const
Definition: AccurateMassSearchEngine.h:346
double asMass(const MappingEntry_ &v) const
Definition: AccurateMassSearchEngine.h:341