A library for working with phylogenetic and population genetic data.
v0.32.0
function/variant_input_stream.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_POPULATION_FUNCTION_VARIANT_INPUT_STREAM_H_
2 #define GENESIS_POPULATION_FUNCTION_VARIANT_INPUT_STREAM_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2024 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@sund.ku.dk>
23  University of Copenhagen, Globe Institute, Section for GeoGenetics
24  Oster Voldgade 5-7, 1350 Copenhagen K, Denmark
25 */
26 
40 
41 #include <functional>
42 #include <memory>
43 #include <stdexcept>
44 #include <string>
45 #include <vector>
46 
47 namespace genesis {
48 namespace population {
49 
50 // =================================================================================================
51 // Sample Name Filter
52 // =================================================================================================
53 
66 std::vector<bool> make_sample_name_filter(
67  std::vector<std::string> const& sample_names,
68  std::vector<std::string> const& names_filter,
69  bool inverse_filter = false
70 );
71 
86  std::vector<bool> const& sample_filter
87 );
88 
89 // =================================================================================================
90 // Sample Subsetting / Subsampling
91 // =================================================================================================
92 
100 {
104  kSubscale,
105 
110 
115 };
116 
135  size_t max_depth,
137 );
138 
139 // =================================================================================================
140 // Observers
141 // =================================================================================================
142 
203  std::shared_ptr<genesis::sequence::SequenceDict> sequence_dict = {},
204  bool check_sequence_lengths = true
205 );
206 
218  std::shared_ptr<genesis::sequence::SequenceDict> sequence_dict
219 );
220 
221 } // namespace population
222 } // namespace genesis
223 
224 #endif // include guard
genome_locus.hpp
genesis::population::make_variant_input_stream_sequence_order_observer
std::function< void(Variant const &)> make_variant_input_stream_sequence_order_observer(std::shared_ptr< genesis::sequence::SequenceDict > sequence_dict={}, bool check_sequence_lengths=true)
Helper function to check that some Variant input is sorted properly.
Definition: function/variant_input_stream.hpp:202
genesis::population::SubsamplingMethod
SubsamplingMethod
Select which method to use for reducing the max read depth of a SampleCounts sample or a Variant.
Definition: function/variant_input_stream.hpp:99
genome_locus.hpp
genesis::population::SubsamplingMethod::kSubsampleWithReplacement
@ kSubsampleWithReplacement
Use transform_subsample_with_replacement()
genesis::population::make_variant_input_stream_sample_name_filter_transform
std::function< void(Variant &)> make_variant_input_stream_sample_name_filter_transform(std::vector< bool > const &sample_filter)
Helper function to create a Variant transform to filter out samples.
Definition: function/variant_input_stream.hpp:85
genesis::population::SubsamplingMethod::kSubsampleWithoutReplacement
@ kSubsampleWithoutReplacement
Use transform_subsample_without_replacement()
sequence_dict.hpp
genesis::population::Variant
A single variant at a position in a chromosome, along with SampleCounts for a set of samples.
Definition: variant.hpp:65
genesis::population::make_variant_input_stream_sample_subsampling_transform
std::function< void(Variant &)> make_variant_input_stream_sample_subsampling_transform(size_t max_depth, SubsamplingMethod method=SubsamplingMethod::kSubscale)
Create a Variant transformation function that subscales or subsamples the base counts to be below a g...
Definition: function/variant_input_stream.hpp:134
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
variant_input_stream.hpp
dict.hpp
variant.hpp
genesis::population::make_variant_input_stream_sequence_length_observer
std::function< void(Variant const &)> make_variant_input_stream_sequence_length_observer(std::shared_ptr< genesis::sequence::SequenceDict > sequence_dict)
Helper function to check that some Variant input has positions that agree with those reported in a Se...
Definition: function/variant_input_stream.hpp:217
genesis::population::SubsamplingMethod::kSubscale
@ kSubscale
Use transform_subscale()
genesis::population::make_sample_name_filter
std::vector< bool > make_sample_name_filter(std::vector< std::string > const &sample_names, std::vector< std::string > const &names_filter, bool inverse_filter)
Create a filter for samples, indicating which to keep.
Definition: variant_input_stream.cpp:46