A library for working with phylogenetic data.
v0.25.0
afs_estimate.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_POPULATION_FUNCTIONS_AFS_ESTIMATE_H_
2 #define GENESIS_POPULATION_FUNCTIONS_AFS_ESTIMATE_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 
34 // #include "genesis/population/functions/base_counts.hpp"
35 // #include "genesis/population/functions/variant.hpp"
36 // #include "genesis/population/variant.hpp"
37 // #include "genesis/utils/containers/filter_iterator.hpp"
38 // #include "genesis/utils/containers/matrix.hpp"
39 // #include "genesis/utils/containers/transform_iterator.hpp"
40 
42 
43 #include <string>
44 #include <vector>
45 
46 namespace genesis {
47 namespace population {
48 
49 // =================================================================================================
50 // Allele Frequency Spectrum Estimate
51 // =================================================================================================
52 
58 {
59  // std::string chromosome;
60  // size_t position;
61  // char reference_base;
62 
63  // size_t read_coverage = 0;
64  // std::string read_bases;
65 
66  std::vector<bool> alleles;
67  std::vector<unsigned char> phred_scores;
68 
69  // size_t a_count = 0;
70  // size_t c_count = 0;
71  // size_t g_count = 0;
72  // size_t t_count = 0;
73  // size_t n_count = 0;
74  // size_t d_count = 0;
75 };
76 
78 
79 std::vector<double> prob_cond_true_freq(
80  size_t n, // n: number of haplotypes in the pool
81  std::vector<bool> const& alleles, // vo: vector of alleles (1 if derived, 0 otherwise), size r
82  std::vector<unsigned char> const& phred_scores, // SE: vector of sequencing error probabilities, size r
83  bool unfolded // unfolded: 1 if unfolded, 0 else
84 );
85 
86 std::vector<double> prob_cond_true_freq_unfolded(
87  size_t n, // n: number of haplotypes in the pool
88  std::vector<bool> const& alleles, // vo: vector of alleles (1 if derived, 0 otherwise), size r
89  std::vector<unsigned char> const& phred_scores, // SE: vector of sequencing error probabilities, size r
90  bool invert_alleles = false
91 );
92 
99 template<class ForwardIterator>
101  ForwardIterator begin,
102  ForwardIterator end
103 ) {
104 
105 }
106 
107 } // namespace population
108 } // namespace genesis
109 
110 #endif // include guard
genesis::population::AfsPileupRecord::phred_scores
std::vector< unsigned char > phred_scores
Definition: afs_estimate.hpp:67
genesis::population::AfsPileupRecord::alleles
std::vector< bool > alleles
Definition: afs_estimate.hpp:66
genesis::population::convert_to_afs_pileup_record
AfsPileupRecord convert_to_afs_pileup_record(SimplePileupReader::Record const &record)
Definition: afs_estimate.cpp:48
genesis::population::prob_cond_true_freq
std::vector< double > prob_cond_true_freq(size_t n, std::vector< bool > const &alleles, std::vector< unsigned char > const &phred_scores, bool unfolded)
Definition: afs_estimate.cpp:121
genesis::population::SimplePileupReader::Record
Single line/record from a pileup file.
Definition: simple_pileup_reader.hpp:141
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::process_conditional_probability
void process_conditional_probability(ForwardIterator begin, ForwardIterator end)
Compute the conditional probabilities of AFs. This reimplements process_probCond from Boitard et al.
Definition: afs_estimate.hpp:100
genesis::population::AfsPileupRecord
Helper to store the data of one pileup line/record needed for the Boitard et al Allele Frequency Esti...
Definition: afs_estimate.hpp:57
genesis::population::prob_cond_true_freq_unfolded
std::vector< double > prob_cond_true_freq_unfolded(size_t n, std::vector< bool > const &alleles, std::vector< unsigned char > const &phred_scores, bool invert_alleles)
Definition: afs_estimate.cpp:145