A library for working with phylogenetic and population genetic data.
v0.27.0
consensus.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_SEQUENCE_FUNCTIONS_CONSENSUS_H_
2 #define GENESIS_SEQUENCE_FUNCTIONS_CONSENSUS_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 <string>
35 
36 namespace genesis {
37 namespace sequence {
38 
39 // =================================================================================================
40 // Forwad Declarations
41 // =================================================================================================
42 
43 class Sequence;
44 class SiteCounts;
45 class SequenceSet;
46 
47 // =================================================================================================
48 // Consensus
49 // =================================================================================================
50 
51 // ------------------------------------------------------
52 // Majorities
53 // ------------------------------------------------------
54 
85  SiteCounts const& counts,
86  bool allow_gaps = true,
87  char gap_char = '-'
88 );
89 
105  SequenceSet const& sequences,
106  std::string const& characters,
107  bool allow_gaps = true,
108  char gap_char = '-'
109 );
110 
122  SequenceSet const& sequences,
123  bool allow_gaps = true
124 );
125 
126 // ------------------------------------------------------
127 // Ambiguities
128 // ------------------------------------------------------
129 
173  SiteCounts const& counts,
174  double similarity_factor = 0.9,
175  bool allow_gaps = true
176 );
177 
187  SequenceSet const& sequences,
188  double similarity_factor = 0.9,
189  bool allow_gaps = true
190 );
191 
192 // ------------------------------------------------------
193 // Threshold
194 // ------------------------------------------------------
195 
249  SiteCounts const& counts,
250  double frequency_threshold = 0.6,
251  bool allow_gaps = true,
252  bool use_ambiguities = true
253 );
254 
264  SequenceSet const& sequences,
265  double frequency_threshold = 0.6,
266  bool allow_gaps = true,
267  bool use_ambiguities = true
268 );
269 
270 // ------------------------------------------------------
271 // Cavener
272 // ------------------------------------------------------
273 
306 std::string consensus_sequence_cavener(
307  SiteCounts const& counts,
308  bool allow_gaps = true
309 );
310 
319 std::string consensus_sequence_cavener(
320  SequenceSet const& sequences,
321  bool allow_gaps = true
322 );
323 
324 
325 } // namespace sequence
326 } // namespace genesis
327 
328 #endif // include guard
genesis::sequence::consensus_sequence_cavener
std::string consensus_sequence_cavener(SiteCounts const &counts, bool allow_gaps)
Calculate a consensus sequence using the method by Cavener for nucleic acid codes ACGT and their ambi...
Definition: consensus.cpp:466
genesis::sequence::consensus_sequence_with_majorities
std::string consensus_sequence_with_majorities(SiteCounts const &counts, bool allow_gaps, char gap_char)
Calculate the majority rule consensus sequence by using the most frequent character at each site.
Definition: consensus.cpp:162
genesis
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Definition: placement/formats/edge_color.cpp:42
genesis::sequence::consensus_sequence_with_threshold
std::string consensus_sequence_with_threshold(SiteCounts const &counts, double frequency_threshold, bool allow_gaps, bool use_ambiguities)
Calculate a consensus sequence where the character frequency needs to be above a given threshold,...
Definition: consensus.cpp:352
genesis::sequence::consensus_sequence_with_ambiguities
std::string consensus_sequence_with_ambiguities(SiteCounts const &counts, double similarity_factor, bool allow_gaps)
Calculate a consensus sequence by using the most frequent characters at each site,...
Definition: consensus.cpp:253