A library for working with phylogenetic data.
v0.25.0
functions/variant.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_POPULATION_FUNCTIONS_VARIANT_H_
2 #define GENESIS_POPULATION_FUNCTIONS_VARIANT_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2021 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 <lczech@carnegiescience.edu>
23  Department of Plant Biology, Carnegie Institution For Science
24  260 Panama Street, Stanford, CA 94305, USA
25 */
26 
36 
37 #ifdef GENESIS_HTSLIB
38 
40 
41 #endif // htslib guard
42 
43 #include <array>
44 #include <iosfwd>
45 #include <utility>
46 
47 namespace genesis {
48 namespace population {
49 
50 // =================================================================================================
51 // Helper Functions
52 // =================================================================================================
53 
54 BaseCounts total_base_counts( Variant const& variant );
55 
56 std::array<std::pair<char, size_t>, 4> sorted_variant_counts(
57  Variant const& variant, bool reference_first
58 );
59 
60 // =================================================================================================
61 // Conversion Functions
62 // =================================================================================================
63 
81 std::ostream& to_sync( Variant const& var, std::ostream& os );
82 
83 Variant convert_to_variant(
84  SimplePileupReader::Record const& record,
85  unsigned char min_phred_score = 0
86 );
87 
88 #ifdef GENESIS_HTSLIB
89 
90 Variant convert_to_variant( VcfRecord const& record );
91 
92 #endif // htslib guard
93 
94 } // namespace population
95 } // namespace genesis
96 
97 #endif // include guard
genesis::population::sorted_variant_counts
std::array< std::pair< char, size_t >, 4 > sorted_variant_counts(Variant const &variant, bool reference_first)
Definition: variant.cpp:59
genesis::population::convert_to_variant
Variant convert_to_variant(SimplePileupReader::Record const &record, unsigned char min_phred_score)
Definition: variant.cpp:158
simple_pileup_reader.hpp
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::population::total_base_counts
BaseCounts total_base_counts(Variant const &variant)
Definition: variant.cpp:54
genesis::population::to_sync
std::ostream & to_sync(BaseCounts const &bs, std::ostream &os)
Output a BaseCounts instance to a stream in the PoPoolation2 sync format.
Definition: base_counts.cpp:352
variant.hpp
vcf_record.hpp