OpenMS
Loading...
Searching...
No Matches
RibonucleotideDB.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
14#include <map>
15#include <memory>
16#include <unordered_map>
17
18namespace OpenMS
19{
27 class OPENMS_DLLAPI RibonucleotideDB final
28 {
29 public:
31
33 typedef std::vector<std::unique_ptr<Ribonucleotide>>::const_iterator ConstIterator;
34
38
40 ~RibonucleotideDB() = default;
41
43 RibonucleotideDB(const RibonucleotideDB& other) = delete;
44
47
49 explicit RibonucleotideDB(std::vector<std::unique_ptr<RibonucleotideDataProvider>> providers);
50
52 inline ConstIterator begin() const
53 {
54 return ribonucleotides_.begin();
55 }
56
58 inline ConstIterator end() const
59 {
60 return ribonucleotides_.end();
61 }
62
68 ConstRibonucleotidePtr getRibonucleotide(const std::string& code) const;
69
75 ConstRibonucleotidePtr getRibonucleotidePrefix(const std::string& seq) const;
76
82 std::pair<ConstRibonucleotidePtr, ConstRibonucleotidePtr> getRibonucleotideAlternatives(const std::string& code) const;
83
84
85 protected:
88
90 std::vector<std::unique_ptr<Ribonucleotide>> ribonucleotides_;
91
93 std::unordered_map<std::string, Size> code_map_;
94
96 std::map<std::string, std::pair<ConstRibonucleotidePtr, ConstRibonucleotidePtr>> ambiguity_map_;
97
99
100 private:
102 void loadFromProviders_(std::vector<std::unique_ptr<RibonucleotideDataProvider>>& providers);
103 };
104}
Database of ribonucleotides (modified and unmodified)
Definition RibonucleotideDB.h:28
RibonucleotideDB()
default constructor
std::vector< std::unique_ptr< Ribonucleotide > > ribonucleotides_
list of known (modified) nucleotides
Definition RibonucleotideDB.h:90
std::vector< std::unique_ptr< Ribonucleotide > >::const_iterator ConstIterator
const iterator type definition
Definition RibonucleotideDB.h:33
static const RibonucleotideDB * getInstance()
RibonucleotideDB(const RibonucleotideDB &other)=delete
copy constructor not available
void loadFromProviders_(std::vector< std::unique_ptr< RibonucleotideDataProvider > > &providers)
load ribonucleotides from the given data providers
ConstIterator end() const
Const iterator to end of database.
Definition RibonucleotideDB.h:58
ConstRibonucleotidePtr getRibonucleotide(const std::string &code) const
Get a ribonucleotide by its code (short name)
ConstRibonucleotidePtr getRibonucleotidePrefix(const std::string &seq) const
Get the ribonucleotide with the longest code that matches a prefix of seq.
std::unordered_map< std::string, Size > code_map_
mapping of codes (short names) to indexes into ribonucleotides_
Definition RibonucleotideDB.h:93
RibonucleotideDB & operator=(const RibonucleotideDB &other)=delete
assignment operator not available
Size max_code_length_
Definition RibonucleotideDB.h:98
ConstIterator begin() const
Const iterator to beginning of database.
Definition RibonucleotideDB.h:52
std::map< std::string, std::pair< ConstRibonucleotidePtr, ConstRibonucleotidePtr > > ambiguity_map_
mapping of ambiguity codes to the alternatives they represent
Definition RibonucleotideDB.h:96
RibonucleotideDB(std::vector< std::unique_ptr< RibonucleotideDataProvider > > providers)
constructor that loads from the given data providers
~RibonucleotideDB()=default
destructor
std::pair< ConstRibonucleotidePtr, ConstRibonucleotidePtr > getRibonucleotideAlternatives(const std::string &code) const
Get the alternatives for an ambiguous modification code.
Representation of a ribonucleotide (modified or unmodified)
Definition Ribonucleotide.h:28
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19