A toolkit for working with phylogenetic data.
v0.19.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
codes.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_SEQUENCE_FUNCTIONS_CODES_H_
2 #define GENESIS_SEQUENCE_FUNCTIONS_CODES_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2017 Lucas Czech
7 
8  This program is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 
21  Contact:
22  Lucas Czech <lucas.czech@h-its.org>
23  Exelixis Lab, Heidelberg Institute for Theoretical Studies
24  Schloss-Wolfsbrunnenweg 35, D-69118 Heidelberg, Germany
25 */
26 
34 #include <map>
35 #include <string>
36 
37 // =================================================================================================
38 // Forward Declarations
39 // =================================================================================================
40 
41 namespace genesis {
42 namespace utils {
43 
44  class Color;
45 
46 }
47 }
48 
49 namespace genesis {
50 namespace sequence {
51 
52 // =================================================================================================
53 // Codes
54 // =================================================================================================
55 
56 // ---------------------------------------------------------------------
57 // Nucleic Acids
58 // ---------------------------------------------------------------------
59 
63 std::string nucleic_acid_codes_plain();
64 
68 std::string nucleic_acid_codes_degenerated();
69 
74 
78 std::string nucleic_acid_codes_all();
79 
80 // ---------------------------------------------------------------------
81 // Amino Acids
82 // ---------------------------------------------------------------------
83 
87 std::string amino_acid_codes_plain();
88 
92 std::string amino_acid_codes_degenerated();
93 
97 std::string amino_acid_codes_undetermined();
98 
102 std::string amino_acid_codes_all();
103 
104 // ---------------------------------------------------------------------
105 // Misc
106 // ---------------------------------------------------------------------
107 
115 std::string normalize_code_alphabet( std::string const& alphabet );
116 
130 char normalize_nucleic_acid_code( char code, bool accept_degenerated = true );
131 
145 char normalize_amino_acid_code( char code, bool accept_degenerated = true );
146 
157 std::string reverse_complement( std::string const& sequence, bool accept_degenerated = true );
158 
159 // =================================================================================================
160 // Color Codes
161 // =================================================================================================
162 
169 std::map<char, std::string> nucleic_acid_text_colors();
170 
177 std::map<char, std::string> amino_acid_text_colors();
178 
184 std::map<char, utils::Color> nucleic_acid_colors();
185 
191 std::map<char, utils::Color> amino_acid_colors();
192 
193 // =================================================================================================
194 // Code Names
195 // =================================================================================================
196 
227 std::string nucleic_acid_name( char code );
228 
267 std::string amino_acid_name( char code );
268 
306 std::string nucleic_acid_ambiguities( char code );
307 
339 char nucleic_acid_ambiguity_code( std::string codes );
340 
341 } // namespace sequence
342 } // namespace genesis
343 
344 #endif // include guard
std::string amino_acid_codes_all()
Return all valid amino acid codes. Those are "ACDEFGHIKLMNOPQRSTUVWYBJZX*-?".
Definition: codes.cpp:335
std::string amino_acid_codes_degenerated()
Return all degenerated amino acid codes. Those are "BJZ".
Definition: codes.cpp:325
std::string amino_acid_codes_plain()
Return all plain amino acid codes. Those are "ACDEFGHIKLMNOPQRSTUVWY".
Definition: codes.cpp:320
std::string nucleic_acid_codes_all()
Return all valid nucleic acid codes. Those are "ACGTUWSMKRYBDHVNOX.-?".
Definition: codes.cpp:309
std::string nucleic_acid_name(char code)
Get the name of a nucleic acid given its IUPAC code.
Definition: codes.cpp:586
std::string nucleic_acid_codes_plain()
Return all plain nucleic acid codes. Those are "ACGTU".
Definition: codes.cpp:294
std::string nucleic_acid_codes_degenerated()
Return all degenerated nucleic acid codes. Those are "WSMKRYBDHV".
Definition: codes.cpp:299
std::string nucleic_acid_codes_undetermined()
Return all undetermined nucleic acid codes. Those are "NOX.-?".
Definition: codes.cpp:304
std::string reverse_complement(std::string const &sequence, bool accept_degenerated)
Get the reverse complement of a nucleic acid sequence.
Definition: codes.cpp:487
std::map< char, std::string > nucleic_acid_text_colors()
Return a map of text colors for each nucleic acid code.
Definition: codes.cpp:562
std::string amino_acid_name(char code)
Get the name of a amino acid given its IUPAC code.
Definition: codes.cpp:595
char normalize_amino_acid_code(char code, bool accept_degenerated)
Normalize an amino acid code.
Definition: codes.cpp:414
std::string normalize_code_alphabet(std::string const &alphabet)
Normalize an alphabet set of Sequence codes, i.e., make them upper case, sort them, and remove duplicates.
Definition: codes.cpp:346
std::map< char, utils::Color > amino_acid_colors()
Return a map of Colors for each amino acid code.
Definition: codes.cpp:577
std::map< char, std::string > amino_acid_text_colors()
Return a map of text colors for each amino acid code.
Definition: codes.cpp:567
char normalize_nucleic_acid_code(char code, bool accept_degenerated)
Normalize a nucleic acide code.
Definition: codes.cpp:355
std::string nucleic_acid_ambiguities(char code)
Return the possible ambiguous nucleic acid codes for a given code char.
Definition: codes.cpp:604
std::string amino_acid_codes_undetermined()
Return all undetermined amino acid codes. Those are "X*-?".
Definition: codes.cpp:330
std::map< char, utils::Color > nucleic_acid_colors()
Return a map of Colors for each nucleic acid code.
Definition: codes.cpp:572
char nucleic_acid_ambiguity_code(std::string codes)
Return the nucleic acid code that represents all given codes.
Definition: codes.cpp:613