27 const std::vector<ProteinIdentification>& proteins,
28 const std::vector<PeptideIdentification>& peptides);
36 std::vector<ProteinIdentification>& proteins,
37 std::vector<PeptideIdentification>& peptides,
38 bool export_ids_wo_scores =
false);
45 const std::vector<FASTAFile::FASTAEntry>& fasta,
48 const String& decoy_pattern =
"");
88 using StepOpt = std::optional<IdentificationData::ProcessingStepRef>;
96 if (!left)
return bool(right);
97 if (!right)
return false;
98 return **left < **right;
123 else if (right.
hasRT())
140 return right.
hasMZ();
145 template <
typename MzTabSectionRow>
148 std::vector<MzTabSectionRow>& output,
149 std::map<IdentificationData::ScoreTypeRef, Size>& score_map)
154 row.best_search_engine_score, score_map);
160 opt_seq.first =
"opt_sequence";
161 opt_seq.second.set(parent.
sequence);
162 row.opt_.push_back(opt_seq);
164 output.push_back(row);
168 template <
typename MzTabSectionRow,
typename IdentSeq>
170 const IdentSeq& identified, std::vector<MzTabSectionRow>& output,
171 std::map<IdentificationData::ScoreTypeRef, Size>& score_map)
175 row.sequence.set(identified.sequence.toString());
176 exportStepsAndScoresToMzTab_(identified.steps_and_scores,
178 row.best_search_engine_score, score_map);
179 if (identified.parent_matches.empty())
182 output.push_back(row);
187 row.unique.set(identified.parent_matches.size() == 1);
188 for (
const auto& match_pair : identified.parent_matches)
190 row.accession.set(match_pair.first->accession);
194 MzTabSectionRow copy = row;
195 addMzTabMoleculeParentContext_(match, copy);
196 output.push_back(copy);
203 template <
typename MzTabSectionRow>
207 std::vector<MzTabSectionRow>& output,
208 std::map<IdentificationData::ScoreTypeRef, Size>& score_map,
209 std::map<IdentificationData::InputFileRef, Size>& file_map)
213 xsm.sequence.set(sequence);
215 xsm.search_engine_score, score_map);
217 std::vector<MzTabDouble> rts(1);
218 rts[0].set(query.
rt);
219 xsm.retention_time.set(rts);
220 xsm.charge.set(match.
charge);
221 xsm.exp_mass_to_charge.set(query.
mz);
222 xsm.calc_mass_to_charge.set(calc_mass / abs(match.
charge));
223 xsm.spectra_ref.setMSFile(file_map[query.
input_file]);
224 xsm.spectra_ref.setSpecRef(query.
data_id);
229 opt_adduct.first =
"opt_adduct";
230 opt_adduct.second.set((*match.
adduct_opt)->getName());
231 xsm.opt_.push_back(opt_adduct);
239 opt_meta.first =
"opt_isotope_offset";
240 opt_meta.second.set(match.
getMetaValue(
"isotope_offset"));
241 xsm.opt_.push_back(opt_meta);
245 output.push_back(xsm);
252 std::map<IdentificationData::ScoreTypeRef, Size>& score_map);
256 const std::map<IdentificationData::ScoreTypeRef, Size>& scores,
257 std::map<Size, MzTabParameter>& output);
284 std::vector<PeptideIdentification>& peptides,
285 Size& id_counter,
bool clear_original);
A container for consensus elements.
Definition: ConsensusMap.h:66
A container for features.
Definition: FeatureMap.h:80
An LC-MS feature.
Definition: Feature.h:46
Definition: IdentificationDataConverter.h:22
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 void importSequences(IdentificationData &id_data, const std::vector< FASTAFile::FASTAEntry > &fasta, IdentificationData::MoleculeType type=IdentificationData::MoleculeType::PROTEIN, const String &decoy_pattern="")
Import FASTA sequences as parent sequences.
static void exportObservationMatchToMzTab_(const 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)
Export an input match (peptide- or oligonucleotide-spectrum match) to mzTab.
Definition: IdentificationDataConverter.h:204
static void exportIDs(const IdentificationData &id_data, std::vector< ProteinIdentification > &proteins, std::vector< PeptideIdentification > &peptides, bool export_ids_wo_scores=false)
Export to legacy peptide/protein identifications.
static void importIDs(IdentificationData &id_data, const std::vector< ProteinIdentification > &proteins, const std::vector< PeptideIdentification > &peptides)
Import from legacy peptide/protein identifications.
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:169
static void handleFeatureImport_(Feature &feature, const IntList &indexes, std::vector< PeptideIdentification > &peptides, Size &id_counter, bool clear_original)
static MzTab exportMzTab(const IdentificationData &id_data)
Export to mzTab format.
static void handleFeatureExport_(Feature &feature, const IntList &indexes, IdentificationData &id_data, Size &id_counter)
std::optional< IdentificationData::ProcessingStepRef > StepOpt
Definition: IdentificationDataConverter.h:88
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:146
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
IdentificationDataInternal::AppliedProcessingSteps AppliedProcessingSteps
Definition: IdentificationData.h:127
Definition: MzTabBase.h:243
Data model of MzTab files. Please see the official MzTab specification at https://code....
Definition: MzTab.h:452
Representation of a peptide hit.
Definition: PeptideHit.h:31
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:39
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:50
A more convenient string class.
Definition: String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
std::vector< Int > IntList
Vector of signed integers.
Definition: ListUtils.h:29
MoleculeType
Definition: MetaData.h:40
@ PROTEIN
Definition: MetaData.h:41
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
std::pair< String, MzTabString > MzTabOptionalColumnEntry
Definition: MzTabBase.h:203
OLI - Oligonucleotide section (table-based)
Definition: MzTab.h:371
PEP - Peptide section (Table based)
Definition: MzTab.h:217
Functor for ordering peptide IDs by RT and m/z (if available)
Definition: IdentificationDataConverter.h:104
bool operator()(const PeptideIdentification &left, const PeptideIdentification &right) const
Definition: IdentificationDataConverter.h:105
Functor for ordering StepOpt (by date of the steps, if available):
Definition: IdentificationDataConverter.h:92
bool operator()(const StepOpt &left, const StepOpt &right) const
Definition: IdentificationDataConverter.h:93
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:48
AdductOpt adduct_opt
optional reference to adduct
Definition: ObservationMatch.h:55
Int charge
Definition: ObservationMatch.h:53
ObservationRef observation_ref
Definition: ObservationMatch.h:51
Representation of an observation, e.g. a spectrum or feature, in an input data file.
Definition: Observation.h:28
double mz
Definition: Observation.h:35
InputFileRef input_file
Reference to the input file.
Definition: Observation.h:33
String data_id
Spectrum or feature ID (from the file referenced by @t input_file)
Definition: Observation.h:30
double rt
Definition: Observation.h:35
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:24
String sequence
Definition: ParentSequence.h:31
String description
Definition: ParentSequence.h:33
double coverage
sequence coverage as a fraction between 0 and 1
Definition: ParentSequence.h:35
String accession
Definition: ParentSequence.h:25
AppliedProcessingSteps steps_and_scores
Definition: ScoredProcessingResult.h:20
Search parameters of the DB search.
Definition: ProteinIdentification.h:247