A toolkit for working with phylogenetic data.
v0.20.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
signatures.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_SEQUENCE_FUNCTIONS_SIGNATURES_H_
2 #define GENESIS_SEQUENCE_FUNCTIONS_SIGNATURES_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 <iosfwd>
35 #include <string>
36 #include <vector>
37 
38 namespace genesis {
39 namespace sequence {
40 
41 // =================================================================================================
42 // Forwad Declarations
43 // =================================================================================================
44 
45 class SignatureSpecifications;
46 class Sequence;
47 class SequenceSet;
48 
49 // =================================================================================================
50 // Signature Counts and Frequencies
51 // =================================================================================================
52 
59 std::vector<size_t> signature_counts(
60  Sequence const& sequence,
61  SignatureSpecifications const& settings
62 );
63 
70 std::vector<double> signature_frequencies(
71  Sequence const& sequence,
72  SignatureSpecifications const& settings
73 );
74 
75 // =================================================================================================
76 // Signature Symmetrized
77 // =================================================================================================
78 
85 std::vector<size_t> signature_symmetrized_counts(
86  Sequence const& sequence,
87  SignatureSpecifications const& settings
88 );
89 
96 std::vector<double> signature_symmetrized_frequencies(
97  Sequence const& sequence,
98  SignatureSpecifications const& settings
99 );
100 
101 // =================================================================================================
102 // Signature Ranks
103 // =================================================================================================
104 
111 std::vector<size_t> signature_ranks(
112  Sequence const& sequence,
113  SignatureSpecifications const& settings
114 );
115 
122 std::vector<size_t> signature_symmetrized_ranks(
123  Sequence const& sequence,
124  SignatureSpecifications const& settings
125 );
126 
127 // =================================================================================================
128 // Signature Min Max Reverse Complements
129 // =================================================================================================
130 
145  Sequence const& sequence,
146  SignatureSpecifications const& settings
147 );
148 
163  Sequence const& sequence,
164  SignatureSpecifications const& settings
165 );
166 
180 std::vector<double> signature_reverse_identity_frequencies(
181  Sequence const& sequence,
182  SignatureSpecifications const& settings
183 );
184 
185 // =================================================================================================
186 // Signature Misc
187 // =================================================================================================
188 
201 std::vector<double> signature_frequency_ratios_1(
202  Sequence const& sequence,
203  SignatureSpecifications const& settings
204 );
205 
218 std::vector<double> signature_frequency_ratios_2(
219  Sequence const& sequence,
220  SignatureSpecifications const& settings
221 );
222 
240 std::vector<double> signature_jensen_shannon(
241  Sequence const& sequence,
242  SignatureSpecifications const& settings
243 );
244 
245 // =================================================================================================
246 // Kmer Strings
247 // =================================================================================================
248 
266 std::string kmer_string_overlapping(
267  Sequence const& sequence,
268  SignatureSpecifications const& settings
269 );
270 
279  Sequence const& sequence,
280  SignatureSpecifications const& settings,
281  std::ostream& out
282 );
283 
303 std::vector<std::string> kmer_strings_non_overlapping(
304  Sequence const& sequence,
305  SignatureSpecifications const& settings
306 );
307 
317  Sequence const& sequence,
318  SignatureSpecifications const& settings,
319  std::ostream& out
320 );
321 
322 } // namespace sequence
323 } // namespace genesis
324 
325 #endif // include guard
std::vector< std::string > kmer_strings_non_overlapping(Sequence const &sequence, SignatureSpecifications const &settings)
Return the sequence spitted into a set of non-overlapping k-mers.
Definition: signatures.cpp:448
std::vector< size_t > signature_symmetrized_ranks(Sequence const &sequence, SignatureSpecifications const &settings)
Calcuate the symmetrized rank signature of a sequence according to the settings.
Definition: signatures.cpp:192
std::vector< size_t > signature_symmetrized_counts(Sequence const &sequence, SignatureSpecifications const &settings)
Calcuate the symmetrized counts of the sequence according to the settings.
Definition: signatures.cpp:159
std::vector< double > signature_frequencies(Sequence const &sequence, SignatureSpecifications const &settings)
Calculate the frequencies of occurences of k-mers in the sequence according to the settings...
Definition: signatures.cpp:117
std::vector< double > signature_symmetrized_frequencies(Sequence const &sequence, SignatureSpecifications const &settings)
Calcuate the symmetrized counts of the sequence according to the settings.
Definition: signatures.cpp:169
std::vector< double > signature_reverse_identity_frequencies(Sequence const &sequence, SignatureSpecifications const &settings)
Calculate the signature of a sequence that uses only the frequencies of k-mers whose reverse compleme...
Definition: signatures.cpp:270
std::vector< size_t > signature_ranks(Sequence const &sequence, SignatureSpecifications const &settings)
Calcuate the rank signature of a sequence according to the settings.
Definition: signatures.cpp:183
std::vector< double > signature_maximal_complementarity_frequencies(Sequence const &sequence, SignatureSpecifications const &settings)
Calculate the signature of a sequence that uses the maximum frequency of reverse complement k-mers...
Definition: signatures.cpp:257
std::vector< size_t > signature_counts(Sequence const &sequence, SignatureSpecifications const &settings)
Count the occurences of k-mers in the sequence according to the settings.
Definition: signatures.cpp:57
std::vector< double > signature_minimal_complementarity_frequencies(Sequence const &sequence, SignatureSpecifications const &settings)
Calculate the signature of a sequence that uses the minimum frequency of reverse complement k-mers...
Definition: signatures.cpp:244
std::string kmer_string_overlapping(Sequence const &sequence, SignatureSpecifications const &settings)
Return the sequence spitted into overlapping k-mers.
Definition: signatures.cpp:426
std::vector< double > signature_frequency_ratios_2(Sequence const &sequence, SignatureSpecifications const &settings)
Calculate the ratio 2 signature of a sequence.
Definition: signatures.cpp:316
std::vector< double > signature_jensen_shannon(Sequence const &sequence, SignatureSpecifications const &settings)
Calculate the Jensen-Shannon (JS) signature of a sequence.
Definition: signatures.cpp:334
std::vector< double > signature_frequency_ratios_1(Sequence const &sequence, SignatureSpecifications const &settings)
Calculate the ratio 1 signature of a sequence.
Definition: signatures.cpp:296