29 const std::vector<ProteinIdentification>& proteins,
38 std::vector<ProteinIdentification>& proteins,
40 bool export_ids_wo_scores =
false);
51 const std::set<std::string>& observation_meta_keys = {},
52 const std::set<std::string>& match_meta_keys = {});
56 const std::vector<FASTAFile::FASTAEntry>& fasta,
58 IdentificationData::MoleculeType::PROTEIN,
59 const std::string& decoy_pattern =
"");
99 using StepOpt = std::optional<IdentificationData::ProcessingStepRef>;
107 if (!left)
return bool(right);
108 if (!right)
return false;
109 return **left < **right;
134 else if (right.
hasRT())
151 return right.
hasMZ();
156 template <
typename MzTabSectionRow>
159 std::vector<MzTabSectionRow>& output,
160 std::map<IdentificationData::ScoreTypeRef, Size>& score_map)
165 row.best_search_engine_score, score_map);
171 opt_seq.first =
"opt_sequence";
172 opt_seq.second.set(parent.
sequence);
173 row.opt_.push_back(opt_seq);
175 output.push_back(row);
179 template <
typename MzTabSectionRow,
typename IdentSeq>
181 const IdentSeq& identified, std::vector<MzTabSectionRow>& output,
182 std::map<IdentificationData::ScoreTypeRef, Size>& score_map)
186 row.sequence.set(identified.sequence.toString());
187 exportStepsAndScoresToMzTab_(identified.steps_and_scores,
189 row.best_search_engine_score, score_map);
190 if (identified.parent_matches.empty())
193 output.push_back(row);
198 row.unique.set(identified.parent_matches.size() == 1);
199 for (
const auto& match_pair : identified.parent_matches)
201 row.accession.set(match_pair.first->accession);
205 MzTabSectionRow copy = row;
206 addMzTabMoleculeParentContext_(match, copy);
207 output.push_back(copy);
214 template <
typename MzTabSectionRow>
216 const std::string& sequence,
218 std::vector<MzTabSectionRow>& output,
219 std::map<IdentificationData::ScoreTypeRef, Size>& score_map,
220 std::map<IdentificationData::InputFileRef, Size>& file_map,
221 const std::set<std::string>& observation_meta_keys,
222 const std::set<std::string>& match_meta_keys)
226 xsm.sequence.set(sequence);
228 xsm.search_engine_score, score_map);
230 std::vector<MzTabDouble> rts(1);
231 rts[0].set(query.
rt);
232 xsm.retention_time.set(rts);
233 xsm.charge.set(match.
charge);
234 xsm.exp_mass_to_charge.set(query.
mz);
235 xsm.calc_mass_to_charge.set(calc_mass / abs(match.
charge));
236 xsm.spectra_ref.setMSFile(file_map[query.
input_file]);
237 xsm.spectra_ref.setSpecRef(query.
data_id);
241 std::set<std::string> optional_keys = observation_meta_keys;
242 optional_keys.insert(match_meta_keys.begin(), match_meta_keys.end());
243 for (
const auto& key : observation_meta_keys)
247 for (
const auto& key : match_meta_keys)
253 optional_keys.insert(
"adduct");
256 MzTab::addMetaInfoToOptionalColumns(optional_keys, xsm.opt_,
"global", optional_meta);
259 output.push_back(xsm);
266 std::map<IdentificationData::ScoreTypeRef, Size>& score_map);
270 const std::map<IdentificationData::ScoreTypeRef, Size>& scores,
271 std::map<Size, MzTabParameter>& output);
299 Size& id_counter,
bool clear_original);
A container for consensus elements.
Definition ConsensusMap.h:67
A container for features.
Definition FeatureMap.h:78
An LC-MS feature.
Definition Feature.h:46
Definition IdentificationDataConverter.h:24
static void addMzTabSEScores_(const std::map< IdentificationData::ScoreTypeRef, Size > &scores, std::map< Size, MzTabParameter > &output)
Helper function to add search engine score entries to MzTab's meta data section.
static void exportFeatureIDs(FeatureMap &features, bool clear_original=true)
Convert IDs in a feature map to legacy peptide/protein identifications.
static MzTab exportMzTab(const IdentificationData &id_data, const std::set< std::string > &observation_meta_keys={}, const std::set< std::string > &match_meta_keys={})
Export to mzTab format with caller-selected optional metadata columns.
static void exportObservationMatchToMzTab_(const std::string &sequence, const IdentificationData::ObservationMatch &match, double calc_mass, std::vector< MzTabSectionRow > &output, std::map< IdentificationData::ScoreTypeRef, Size > &score_map, std::map< IdentificationData::InputFileRef, Size > &file_map, const std::set< std::string > &observation_meta_keys, const std::set< std::string > &match_meta_keys)
Export an input match (peptide- or oligonucleotide-spectrum match) to mzTab.
Definition IdentificationDataConverter.h:215
static IdentificationData::SearchParamRef importDBSearchParameters_(const ProteinIdentification::SearchParameters &pisp, IdentificationData &id_data)
Helper function to import DB search parameters from legacy format.
static void addMzTabMoleculeParentContext_(const IdentificationData::ParentMatch &match, MzTabOligonucleotideSectionRow &row)
Helper function for exportPeptideOrOligoToMzTab_() - oligonucleotide variant.
static ProteinIdentification::SearchParameters exportDBSearchParameters_(IdentificationData::SearchParamRef ref)
Helper function to export DB search parameters to legacy format.
static void exportPeptideOrOligoToMzTab_(const IdentSeq &identified, std::vector< MzTabSectionRow > &output, std::map< IdentificationData::ScoreTypeRef, Size > &score_map)
Export an identified sequence (peptide or oligonucleotide, but not small molecule/compound) to mzTab.
Definition IdentificationDataConverter.h:180
static void handleFeatureImport_(Feature &feature, const IntList &indexes, PeptideIdentificationList &peptides, Size &id_counter, bool clear_original)
static void importSequences(IdentificationData &id_data, const std::vector< FASTAFile::FASTAEntry > &fasta, IdentificationData::MoleculeType type=IdentificationData::MoleculeType::PROTEIN, const std::string &decoy_pattern="")
Import FASTA sequences as parent sequences.
static void importIDs(IdentificationData &id_data, const std::vector< ProteinIdentification > &proteins, const PeptideIdentificationList &peptides)
Import from legacy peptide/protein identifications.
static void exportIDs(const IdentificationData &id_data, std::vector< ProteinIdentification > &proteins, PeptideIdentificationList &peptides, bool export_ids_wo_scores=false)
Export to legacy peptide/protein identifications.
static void handleFeatureExport_(Feature &feature, const IntList &indexes, IdentificationData &id_data, Size &id_counter)
std::optional< IdentificationData::ProcessingStepRef > StepOpt
Definition IdentificationDataConverter.h:99
static void exportParentSequenceToMzTab_(const IdentificationData::ParentSequence &parent, std::vector< MzTabSectionRow > &output, std::map< IdentificationData::ScoreTypeRef, Size > &score_map)
Export a parent sequence (protein or nucleic acid) to mzTab.
Definition IdentificationDataConverter.h:157
static void exportStepsAndScoresToMzTab_(const IdentificationData::AppliedProcessingSteps &steps_and_scores, MzTabParameterList &steps_out, std::map< Size, MzTabDouble > &scores_out, std::map< IdentificationData::ScoreTypeRef, Size > &score_map)
Helper function to add processing steps (search engines) and their scores to MzTab.
static void exportMSRunInformation_(IdentificationData::ProcessingStepRef step_ref, ProteinIdentification &protein)
Helper function to export (primary) MS run information to legacy format.
static void importFeatureIDs(FeatureMap &features, bool clear_original=true)
Convert IDs from legacy peptide/protein identifications in a feature map.
static void exportParentMatches(const IdentificationData::ParentMatches &parent_matches, PeptideHit &hit)
Convert parent matches to peptide evidences.
static void exportConsensusIDs(ConsensusMap &consensus, bool clear_original=true)
Convert IDs in a consensus map to legacy peptide/protein identifications.
static void addMzTabMoleculeParentContext_(const IdentificationData::ParentMatch &match, MzTabPeptideSectionRow &row)
Helper function for exportPeptideOrOligoToMzTab_() - peptide variant.
static void importConsensusIDs(ConsensusMap &consensus, bool clear_original=true)
Convert IDs from legacy peptide/protein identifications in a consensus map.
Definition IdentificationData.h:87
IdentificationDataInternal::ParentMatches ParentMatches
Definition IdentificationData.h:138
Definition MzTabBase.h:242
Data model of MzTab files. Please see the official MzTab specification at https://code....
Definition MzTab.h:455
Represents a single spectrum match (candidate) for a specific tandem mass spectrum (MS/MS).
Definition PeptideHit.h:52
Container for peptide identifications from multiple spectra.
Definition PeptideIdentificationList.h:66
Represents the set of candidates (SpectrumMatches) identified for a single precursor spectrum.
Definition PeptideIdentification.h:66
double getRT() const
returns the RT of the MS2 spectrum where the identification occurred
bool hasMZ() const
shortcut for isnan(getRT())
bool hasRT() const
shortcut for isnan(getRT())
double getMZ() const
returns the MZ of the MS2 spectrum
Representation of a protein identification run.
Definition ProteinIdentification.h:55
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
std::vector< Int > IntList
Vector of signed integers.
Definition TypeAliases.h:24
MoleculeType
Definition MetaData.h:40
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
std::pair< std::string, MzTabString > MzTabOptionalColumnEntry
Definition MzTabBase.h:202
OLI - Oligonucleotide section (table-based)
Definition MzTab.h:374
PEP - Peptide section (Table based)
Definition MzTab.h:220
Functor for ordering peptide IDs by RT and m/z (if available)
Definition IdentificationDataConverter.h:115
bool operator()(const PeptideIdentification &left, const PeptideIdentification &right) const
Definition IdentificationDataConverter.h:116
Functor for ordering StepOpt (by date of the steps, if available):
Definition IdentificationDataConverter.h:103
bool operator()(const StepOpt &left, const StepOpt &right) const
Definition IdentificationDataConverter.h:104
Wrapper that adds operator< to iterators, so they can be used as (part of) keys in maps/sets or multi...
Definition MetaData.h:20
Representation of a search hit (e.g. peptide-spectrum match).
Definition ObservationMatch.h:47
AdductOpt adduct_opt
optional reference to adduct
Definition ObservationMatch.h:54
Int charge
Definition ObservationMatch.h:52
ObservationRef observation_ref
Definition ObservationMatch.h:50
Representation of an observation, e.g. a spectrum or feature, in an input data file.
Definition Observation.h:26
double mz
Definition Observation.h:33
std::string data_id
Spectrum or feature ID (from the file referenced by input_file)
Definition Observation.h:28
InputFileRef input_file
Reference to the input file.
Definition Observation.h:31
double rt
Definition Observation.h:33
Meta data for the association between an identified molecule (e.g. peptide) and a parent sequence (e....
Definition ParentMatch.h:20
Representation of a parent sequence that is identified only indirectly (e.g. a protein).
Definition ParentSequence.h:23
std::string description
Definition ParentSequence.h:32
double coverage
sequence coverage as a fraction between 0 and 1
Definition ParentSequence.h:34
std::string sequence
Definition ParentSequence.h:30
std::string accession
Definition ParentSequence.h:24
AppliedProcessingSteps steps_and_scores
Definition ScoredProcessingResult.h:21
Search parameters of the DB search.
Definition ProteinIdentification.h:194