51 #include <boost/unordered_set.hpp>
179 current_step_ref_(processing_steps_.end())
188 input_files_(std::move(other.input_files_)),
189 processing_softwares_(std::move(other.processing_softwares_)),
190 processing_steps_(std::move(other.processing_steps_)),
191 db_search_params_(std::move(other.db_search_params_)),
192 db_search_steps_(std::move(other.db_search_steps_)),
193 score_types_(std::move(other.score_types_)),
194 data_queries_(std::move(other.data_queries_)),
195 parent_molecules_(std::move(other.parent_molecules_)),
196 parent_molecule_groupings_(std::move(other.parent_molecule_groupings_)),
197 identified_peptides_(std::move(other.identified_peptides_)),
198 identified_compounds_(std::move(other.identified_compounds_)),
199 identified_oligos_(std::move(other.identified_oligos_)),
200 query_matches_(std::move(other.query_matches_)),
201 query_match_groups_(std::move(other.query_match_groups_)),
202 current_step_ref_(std::move(other.current_step_ref_)),
204 data_query_lookup_(std::move(other.data_query_lookup_)),
205 parent_molecule_lookup_(std::move(other.parent_molecule_lookup_)),
206 identified_peptide_lookup_(std::move(other.identified_peptide_lookup_)),
207 identified_compound_lookup_(std::move(other.identified_compound_lookup_)),
208 identified_oligo_lookup_(std::move(other.identified_oligo_lookup_)),
209 query_match_lookup_(std::move(other.query_match_lookup_))
308 return processing_softwares_;
314 return processing_steps_;
320 return db_search_params_;
326 return db_search_steps_;
338 return data_queries_;
344 return parent_molecules_;
350 return parent_molecule_groupings_;
356 return identified_peptides_;
362 return identified_compounds_;
368 return identified_oligos_;
374 return query_matches_;
380 return query_match_groups_;
433 bool require_identified_sequence =
true,
434 bool require_parent_match =
true,
435 bool require_parent_group =
false,
436 bool require_match_group =
false);
441 if (higher_better)
return first > second;
442 return first < second;
482 steps_and_scores)
const;
493 template <
typename ElementType>
503 element.addProcessingStep(step_ref);
514 template <
typename ElementType>
518 score_type_ref(score_type_ref), value(value)
524 if (element.steps_and_scores.empty())
526 element.addScore(score_type_ref, value);
530 element.addScore(score_type_ref, value,
531 element.steps_and_scores.back().processing_step_opt);
544 template <
typename ElementType>
554 removeFromSetIf_(element.parent_matches,
555 [&](
const ParentMatches::iterator it)
557 return !lookup.count(it->first);
566 template <
typename ContainerType,
typename ElementType>
568 ContainerType& container,
const ElementType& element)
570 checkAppliedProcessingSteps_(element.steps_and_scores);
572 auto result = container.insert(element);
575 container.modify(result.first, [&element](ElementType& existing)
582 if (current_step_ref_ != processing_steps_.end())
585 modifier(current_step_ref_);
586 container.modify(result.first, modifier);
593 template <
typename ContainerType,
typename ElementType>
595 ContainerType& container,
const ElementType& element,
598 typename ContainerType::iterator ref =
599 insertIntoMultiIndex_(container, element);
600 lookup.insert(uintptr_t(&(*ref)));
605 template <
typename RefType,
typename ContainerType>
608 for (
auto it = container.begin(); it != container.end(); ++it)
610 if (ref == it)
return true;
616 template <
typename RefType>
620 return lookup.count(ref);
624 template <
typename ContainerType,
typename PredicateType>
628 for (
auto it = container.begin(); it != container.end(); )
632 it = container.erase(it);
642 template <
typename ContainerType>
646 removeFromSetIf_(container, [&lookup](
typename ContainerType::iterator it)
648 return !lookup.count(uintptr_t(&(*it)));
653 template <
typename ContainerType>
658 lookup.reserve(container.size());
659 for (
const auto& element : container)
661 lookup.insert(uintptr_t(&element));
Collection of functions for filtering peptide and protein identifications.
Definition: IDFilter.h:78
Representation of spectrum identification results and associated data.
Definition: IdentificationData.h:90
ParentMoleculeRef registerParentMolecule(const ParentMolecule &parent)
Register a parent molecule (e.g. protein or intact RNA)
IdentificationDataInternal::PeakAnnotations PeakAnnotations
Definition: IdentificationData.h:150
DBSearchParams db_search_params_
Definition: IdentificationData.h:451
static bool isValidReference_(RefType ref, ContainerType &container)
Check whether a reference points to an element in a container.
Definition: IdentificationData.h:606
IdentificationDataInternal::ParentMatches ParentMatches
Definition: IdentificationData.h:134
void calculateCoverages(bool check_molecule_length=false)
Calculate sequence coverage of parent molecules.
void addScore(QueryMatchRef match_ref, ScoreTypeRef score_ref, double value)
Add a score to a molecule-query match (e.g. PSM)
const DBSearchParams & getDBSearchParams() const
Return the registered database search parameters (immutable)
Definition: IdentificationData.h:318
const ParentMoleculeGroupings & getParentMoleculeGroupings() const
Return the registered parent molecule groupings (immutable)
Definition: IdentificationData.h:348
MatchGroupRef registerQueryMatchGroup(const QueryMatchGroup &group)
Register a group of associated molecule-query matches.
IdentificationDataInternal::DataProcessingSoftwares DataProcessingSoftwares
Definition: IdentificationData.h:103
const ParentMolecules & getParentMolecules() const
Return the registered parent molecules (immutable)
Definition: IdentificationData.h:342
ProcessingStepRef registerDataProcessingStep(const DataProcessingStep &step)
Register a data processing step.
const MoleculeQueryMatches & getMoleculeQueryMatches() const
Return the registered molecule-query matches (immutable)
Definition: IdentificationData.h:372
IdentificationDataInternal::ScoreTypes ScoreTypes
Definition: IdentificationData.h:117
IdentificationData(const IdentificationData &other)=delete
ProcessingSoftwareRef registerDataProcessingSoftware(const DataProcessingSoftware &software)
Register data processing software.
const DataProcessingSteps & getDataProcessingSteps() const
Return the registered data processing steps (immutable)
Definition: IdentificationData.h:312
void registerParentMoleculeGrouping(const ParentMoleculeGrouping &grouping)
Register a grouping of parent molecules (e.g. protein inference result)
ProcessingStepRef registerDataProcessingStep(const DataProcessingStep &step, SearchParamRef search_ref)
Register a database search step with associated parameters.
IdentificationDataInternal::IdentifiedOligos IdentifiedOligos
Definition: IdentificationData.h:147
const InputFiles & getInputFiles() const
Return the registered input files (immutable)
Definition: IdentificationData.h:300
MoleculeQueryMatches query_matches_
Definition: IdentificationData.h:462
AddressLookup identified_oligo_lookup_
Definition: IdentificationData.h:474
IdentifiedOligos identified_oligos_
Definition: IdentificationData.h:461
IdentificationDataInternal::QueryMatchGroups QueryMatchGroups
Definition: IdentificationData.h:162
ParentMoleculeGroupings parent_molecule_groupings_
Definition: IdentificationData.h:458
const IdentifiedCompounds & getIdentifiedCompounds() const
Return the registered compounds (immutable)
Definition: IdentificationData.h:360
const DataQueries & getDataQueries() const
Return the registered data queries (immutable)
Definition: IdentificationData.h:336
IdentifiedCompoundRef registerIdentifiedCompound(const IdentifiedCompound &compound)
Register an identified compound (small molecule)
IdentificationDataInternal::MoleculeQueryMatches MoleculeQueryMatches
Definition: IdentificationData.h:156
IdentifiedOligoRef registerIdentifiedOligo(const IdentifiedOligo &oligo)
Register an identified RNA oligonucleotide.
AddressLookup query_match_lookup_
Definition: IdentificationData.h:475
QueryMatchGroups query_match_groups_
Definition: IdentificationData.h:463
IdentificationDataInternal::DataProcessingSteps DataProcessingSteps
Definition: IdentificationData.h:108
DataQueryRef registerDataQuery(const DataQuery &query)
Register a data query (e.g. MS2 spectrum or feature)
std::vector< QueryMatchRef > getBestMatchPerQuery(ScoreTypeRef score_ref) const
Return the best match for each data query, according to a given score type.
void setCurrentProcessingStep(ProcessingStepRef step_ref)
Set a data processing step that will apply to all subsequent "register..." calls.
static void removeFromSetIf_(ContainerType &container, PredicateType predicate)
Remove elements from a set (or ordered multi_index_container) if they fulfill a predicate.
Definition: IdentificationData.h:626
ScoreTypeRef registerScoreType(const ScoreType &score)
Register a score type.
IdentificationDataInternal::AppliedProcessingSteps AppliedProcessingSteps
Definition: IdentificationData.h:123
const QueryMatchGroups & getQueryMatchGroups() const
Return the registered groups of molecule-query matches (immutable)
Definition: IdentificationData.h:378
IdentificationDataInternal::InputFiles InputFiles
Definition: IdentificationData.h:97
InputFileRef registerInputFile(const String &file)
Register an input file.
IdentificationDataInternal::DBSearchParams DBSearchParams
Definition: IdentificationData.h:112
IdentificationDataInternal::IdentifiedMoleculeRef IdentifiedMoleculeRef
Definition: IdentificationData.h:152
const ScoreTypes & getScoreTypes() const
Return the registered score types (immutable)
Definition: IdentificationData.h:330
IdentificationData()
Default constructor.
Definition: IdentificationData.h:178
IdentifiedCompounds identified_compounds_
Definition: IdentificationData.h:460
const IdentifiedOligos & getIdentifiedOligos() const
Return the registered identified oligonucleotides (immutable)
Definition: IdentificationData.h:366
IdentificationDataInternal::IdentifiedPeptides IdentifiedPeptides
Definition: IdentificationData.h:137
DBSearchSteps db_search_steps_
Definition: IdentificationData.h:454
ProcessingStepRef getCurrentProcessingStep()
void checkParentMatches_(const ParentMatches &matches, MoleculeType expected_type) const
Helper function to check if all parent matches are valid.
IdentificationDataInternal::ParentMoleculeGroups ParentMoleculeGroups
Definition: IdentificationData.h:167
IdentificationDataInternal::DBSearchSteps DBSearchSteps
Definition: IdentificationData.h:114
AddressLookup data_query_lookup_
Definition: IdentificationData.h:469
DataQueries data_queries_
Definition: IdentificationData.h:456
const DBSearchSteps & getDBSearchSteps() const
Return the registered database search steps (immutable)
Definition: IdentificationData.h:324
ScoreTypes score_types_
Definition: IdentificationData.h:455
InputFiles input_files_
Definition: IdentificationData.h:448
const DataProcessingSoftwares & getDataProcessingSoftwares() const
Return the registered data processing software (immutable)
Definition: IdentificationData.h:306
DataProcessingSoftwares processing_softwares_
Definition: IdentificationData.h:449
ContainerType::iterator insertIntoMultiIndex_(ContainerType &container, const ElementType &element)
Helper function for adding entries (derived from ScoredProcessingResult) to a boost::multi_index_cont...
Definition: IdentificationData.h:567
IdentifiedPeptideRef registerIdentifiedPeptide(const IdentifiedPeptide &peptide)
Register an identified peptide.
AddressLookup identified_peptide_lookup_
Definition: IdentificationData.h:472
ContainerType::iterator insertIntoMultiIndex_(ContainerType &container, const ElementType &element, AddressLookup &lookup)
Variant of insertIntoMultiIndex_() that also updates a look-up table of valid references (addresses)
Definition: IdentificationData.h:594
IdentificationDataInternal::DataQueries DataQueries
Definition: IdentificationData.h:126
ProcessingStepRef current_step_ref_
Reference to the current data processing step (see setCurrentProcessingStep())
Definition: IdentificationData.h:466
const IdentifiedPeptides & getIdentifiedPeptides() const
Return the registered identified peptides (immutable)
Definition: IdentificationData.h:354
void clearCurrentProcessingStep()
Cancel the effect of setCurrentProcessingStep().
AddressLookup parent_molecule_lookup_
Definition: IdentificationData.h:470
IdentificationData(IdentificationData &&other)
Move constructor.
Definition: IdentificationData.h:187
static void removeFromSetIfNotHashed_(ContainerType &container, const AddressLookup &lookup)
Remove elements from a set (or ordered multi_index_container) if they don't occur in a look-up table.
Definition: IdentificationData.h:643
SearchParamRef registerDBSearchParam(const DBSearchParam ¶m)
Register database search parameters.
void checkScoreTypes_(const std::map< ScoreTypeRef, double > &scores) const
Helper function to check if all score types are valid.
IdentificationDataInternal::ParentMoleculeGroupings ParentMoleculeGroupings
Definition: IdentificationData.h:172
static bool isValidHashedReference_(RefType ref, const AddressLookup &lookup)
Check validity of a reference based on a look-up table of addresses.
Definition: IdentificationData.h:617
void checkAppliedProcessingSteps_(const AppliedProcessingSteps &steps_and_scores) const
Helper function to check if all applied processing steps are valid.
void cleanup(bool require_query_match=true, bool require_identified_sequence=true, bool require_parent_match=true, bool require_parent_group=false, bool require_match_group=false)
Clean up the data structure after filtering parts of it.
IdentificationDataInternal::ParentMolecules ParentMolecules
Definition: IdentificationData.h:130
AddressLookup identified_compound_lookup_
Definition: IdentificationData.h:473
std::pair< ScoreTypeRef, bool > findScoreType(const String &score_name) const
Look up a score type by name.
IdentificationDataInternal::IdentifiedCompounds IdentifiedCompounds
Definition: IdentificationData.h:142
ParentMolecules parent_molecules_
Definition: IdentificationData.h:457
boost::unordered_set< uintptr_t > AddressLookup
Definition: IdentificationData.h:174
IdentifiedPeptides identified_peptides_
Definition: IdentificationData.h:459
static bool isBetterScore(double first, double second, bool higher_better)
Helper function to compare two scores.
Definition: IdentificationData.h:439
QueryMatchRef registerMoleculeQueryMatch(const MoleculeQueryMatch &match)
Register a molecule-query match (e.g. peptide-spectrum match)
DataProcessingSteps processing_steps_
Definition: IdentificationData.h:450
static void updateAddressLookup_(const ContainerType &container, AddressLookup &lookup)
Recreate the address look-up table for a container.
Definition: IdentificationData.h:654
A more convenient string class.
Definition: String.h:61
std::map< ProcessingStepRef, SearchParamRef > DBSearchSteps
Definition: DBSearchParam.h:128
boost::multi_index_container< ParentMoleculeGroup, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::member< ParentMoleculeGroup, std::set< ParentMoleculeRef >, &ParentMoleculeGroup::parent_molecule_refs > > > > ParentMoleculeGroups
Definition: ParentMoleculeGroup.h:64
IteratorWrapper< DataProcessingSoftwares::iterator > ProcessingSoftwareRef
Definition: DataProcessingSoftware.h:69
IteratorWrapper< IdentifiedCompounds::iterator > IdentifiedCompoundRef
Definition: IdentifiedCompound.h:80
IdentifiedSequence< NASequence > IdentifiedOligo
Definition: IdentifiedSequence.h:107
boost::variant< IdentifiedPeptideRef, IdentifiedCompoundRef, IdentifiedOligoRef > IdentifiedMoleculeRef
Definition: MoleculeQueryMatch.h:57
IteratorWrapper< IdentifiedOligos::iterator > IdentifiedOligoRef
Definition: IdentifiedSequence.h:125
boost::multi_index_container< ParentMolecule, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::member< ParentMolecule, String, &ParentMolecule::accession > > > > ParentMolecules
Definition: ParentMolecule.h:99
std::set< ScoreType > ScoreTypes
Definition: ScoreType.h:85
IteratorWrapper< IdentifiedPeptides::iterator > IdentifiedPeptideRef
Definition: IdentifiedSequence.h:116
std::set< DataQuery > DataQueries
Definition: DataQuery.h:89
IteratorWrapper< ScoreTypes::iterator > ScoreTypeRef
Definition: ScoreType.h:86
boost::multi_index_container< MoleculeQueryMatch, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::composite_key< MoleculeQueryMatch, boost::multi_index::member< MoleculeQueryMatch, DataQueryRef, &MoleculeQueryMatch::data_query_ref >, boost::multi_index::member< MoleculeQueryMatch, IdentifiedMoleculeRef, &MoleculeQueryMatch::identified_molecule_ref > > > > > MoleculeQueryMatches
Definition: MoleculeQueryMatch.h:163
IteratorWrapper< ParentMoleculeGroups::iterator > ParentGroupRef
Definition: ParentMoleculeGroup.h:65
std::set< DBSearchParam > DBSearchParams
Definition: DBSearchParam.h:126
boost::multi_index_container< QueryMatchGroup, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::member< QueryMatchGroup, std::set< QueryMatchRef >, &QueryMatchGroup::query_match_refs > > > > QueryMatchGroups
Definition: QueryMatchGroup.h:99
boost::multi_index_container< IdentifiedPeptide, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::member< IdentifiedPeptide, AASequence, &IdentifiedPeptide::sequence > > > > IdentifiedPeptides
Definition: IdentifiedSequence.h:115
std::set< DataProcessingSoftware > DataProcessingSoftwares
Definition: DataProcessingSoftware.h:68
IteratorWrapper< DBSearchParams::iterator > SearchParamRef
Definition: DBSearchParam.h:127
std::vector< PeptideHit::PeakAnnotation > PeakAnnotations
Definition: MoleculeQueryMatch.h:52
MoleculeType
Definition: MetaData.h:64
boost::multi_index_container< IdentifiedOligo, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::member< IdentifiedOligo, NASequence, &IdentifiedOligo::sequence > > > > IdentifiedOligos
Definition: IdentifiedSequence.h:124
boost::multi_index_container< IdentifiedCompound, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::member< IdentifiedCompound, String, &IdentifiedCompound::identifier > > > > IdentifiedCompounds
Definition: IdentifiedCompound.h:79
IteratorWrapper< MoleculeQueryMatches::iterator > QueryMatchRef
Definition: MoleculeQueryMatch.h:164
std::set< String > InputFiles
Definition: MetaData.h:79
IteratorWrapper< DataQueries::iterator > DataQueryRef
Definition: DataQuery.h:90
std::map< ParentMoleculeRef, std::set< MoleculeParentMatch > > ParentMatches
mapping: parent molecule -> match information
Definition: MoleculeParentMatch.h:101
IteratorWrapper< ParentMolecules::iterator > ParentMoleculeRef
Definition: ParentMolecule.h:100
IteratorWrapper< QueryMatchGroups::iterator > MatchGroupRef
Definition: QueryMatchGroup.h:100
std::vector< ParentMoleculeGrouping > ParentMoleculeGroupings
Definition: ParentMoleculeGroup.h:75
IteratorWrapper< DataProcessingSteps::iterator > ProcessingStepRef
Definition: DataProcessingStep.h:93
IdentifiedSequence< AASequence > IdentifiedPeptide
Definition: IdentifiedSequence.h:106
std::set< DataProcessingStep > DataProcessingSteps
Definition: DataProcessingStep.h:92
IteratorWrapper< InputFiles::iterator > InputFileRef
Definition: MetaData.h:80
MassType
Definition: MetaData.h:73
boost::multi_index_container< AppliedProcessingStep, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::ordered_unique< boost::multi_index::member< AppliedProcessingStep, boost::optional< ProcessingStepRef >, &AppliedProcessingStep::processing_step_opt > > > > AppliedProcessingSteps
Definition: AppliedProcessingStep.h:116
: Group of ambiguously identified parent molecules (e.g. protein group)
Definition: ParentMoleculeGroup.h:51
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
A processing step that was applied to a data item, possibly with associated scores.
Definition: AppliedProcessingStep.h:53
Parameters specific to a database search step.
Definition: DBSearchParam.h:48
Information about software used for data processing.
Definition: DataProcessingSoftware.h:50
Data processing step that is applied to the data (e.g. database search, PEP calculation,...
Definition: DataProcessingStep.h:47
Search query, e.g. spectrum or feature.
Definition: DataQuery.h:48
Definition: IdentifiedCompound.h:48
Identified sequence (peptide or oligonucleotide)
Definition: IdentifiedSequence.h:53
Wrapper that adds operator< to iterators, so they can be used as (part of) keys in maps/sets or multi...
Definition: MetaData.h:44
Meta data for the association between an identified molecule (e.g. peptide) and a parent molecule (e....
Definition: MoleculeParentMatch.h:46
Meta data for a search hit (e.g. peptide-spectrum match).
Definition: MoleculeQueryMatch.h:62
Set of groups of ambiguously identified parent molecules (e.g. results of running a protein inference...
Definition: ParentMoleculeGroup.h:70
Representation of a parent molecule that is identified only indirectly (e.g. a protein).
Definition: ParentMolecule.h:50
: Group of related (co-identified) molecule-query matches
Definition: QueryMatchGroup.h:51
Information about a score type.
Definition: ScoreType.h:46
Helper functor for adding processing steps to elements in a boost::multi_index_container structure.
Definition: IdentificationData.h:495
void operator()(ElementType &element)
Definition: IdentificationData.h:501
ModifyMultiIndexAddProcessingStep(ProcessingStepRef step_ref)
Definition: IdentificationData.h:496
ProcessingStepRef step_ref
Definition: IdentificationData.h:506
Helper functor for adding scores to elements in a boost::multi_index_container structure.
Definition: IdentificationData.h:516
ModifyMultiIndexAddScore(ScoreTypeRef score_type_ref, double value)
Definition: IdentificationData.h:517
void operator()(ElementType &element)
Definition: IdentificationData.h:522
ScoreTypeRef score_type_ref
Definition: IdentificationData.h:535
double value
Definition: IdentificationData.h:536
Helper functor for removing invalid parent matches from elements in a boost::multi_index_container st...
Definition: IdentificationData.h:546
const AddressLookup & lookup
Definition: IdentificationData.h:561
ModifyMultiIndexRemoveParentMatches(const AddressLookup &lookup)
Definition: IdentificationData.h:547
void operator()(ElementType &element)
Definition: IdentificationData.h:552