OpenMS
Loading...
Searching...
No Matches
ParentSequence.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Hendrik Weisser $
6// $Authors: Hendrik Weisser $
7// --------------------------------------------------------------------------
8
9#pragma once
10
12
14
15
16namespace OpenMS
17{
18 namespace IdentificationDataInternal
19 {
23 {
24 std::string accession;
25
27
28 // @TODO: if there are modifications in the sequence, "sequence.size()"
29 // etc. will be misleading!
30 std::string sequence;
31
32 std::string description;
33
34 double coverage;
35
37
49
50 ParentSequence(const ParentSequence&) = default;
51
53 {
55 if (sequence.empty())
56 {
57 sequence = other.sequence;
58 }
59 else if (!other.sequence.empty() && sequence != other.sequence) // differ and none is empty
60 {
61 throw Exception::InvalidValue(__FILE__, __LINE__,
62 OPENMS_PRETTY_FUNCTION,
63 "Trying to overwrite ParentSequence sequence '" + sequence + "' with conflicting value.",
64 other.sequence);
65 }
66
67 if (description.empty())
68 {
70 }
71 else if (!other.description.empty() && description != other.description) // differ and none is empty
72 {
73 throw Exception::InvalidValue(__FILE__, __LINE__,
74 OPENMS_PRETTY_FUNCTION,
75 "Trying to overwrite ParentSequence description '" + description + "' with conflicting value.",
76 other.description);
77 }
78
79 if (!is_decoy) is_decoy = other.is_decoy; // believe it when it's set
80 // @TODO: what about coverage? (not reliable if we're merging data)
81
82 return *this;
83 }
84 };
85
86 // parent sequences indexed by their accessions:
87 // @TODO: allow querying/iterating over proteins and RNAs separately
90
91 }
92}
Invalid value exception.
Definition Exception.h:306
A collection of identification records, unique and ordered by the key formed from the members KeyMemb...
Definition IDDataContainer.h:62
IDSequencedContainer< AppliedProcessingStep, std::optional< ProcessingStepRef >, &AppliedProcessingStep::processing_step_opt > AppliedProcessingSteps
Definition AppliedProcessingStep.h:96
MoleculeType
Definition MetaData.h:40
@ PROTEIN
Definition MetaData.h:41
IteratorWrapper< ParentSequences::iterator > ParentSequenceRef
Definition ParentSequence.h:89
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
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 parent sequence that is identified only indirectly (e.g. a protein).
Definition ParentSequence.h:23
std::string description
Definition ParentSequence.h:32
bool is_decoy
Definition ParentSequence.h:36
ParentSequence(const std::string &accession, MoleculeType molecule_type=MoleculeType::PROTEIN, const std::string &sequence="", const std::string &description="", double coverage=0.0, bool is_decoy=false, const AppliedProcessingSteps &steps_and_scores=AppliedProcessingSteps())
Definition ParentSequence.h:38
ParentSequence & merge(const ParentSequence &other)
Definition ParentSequence.h:52
double coverage
sequence coverage as a fraction between 0 and 1
Definition ParentSequence.h:34
std::string sequence
Definition ParentSequence.h:30
enum MoleculeType molecule_type
Definition ParentSequence.h:26
ParentSequence(const ParentSequence &)=default
std::string accession
Definition ParentSequence.h:24
Base class for ID data with scores and processing steps (and meta info)
Definition ScoredProcessingResult.h:20
AppliedProcessingSteps steps_and_scores
Definition ScoredProcessingResult.h:21
ScoredProcessingResult & merge(const ScoredProcessingResult &other)
Merge in data from another object.
Definition ScoredProcessingResult.h:81