A library for working with phylogenetic and population genetic data.
v0.32.0
variant_input_stream_adapters.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_POPULATION_STREAM_VARIANT_INPUT_STREAM_ADAPTERS_H_
2 #define GENESIS_POPULATION_STREAM_VARIANT_INPUT_STREAM_ADAPTERS_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 
44 
45 #include <cassert>
46 #include <functional>
47 #include <stdexcept>
48 #include <string>
49 #include <unordered_map>
50 #include <vector>
51 
52 namespace genesis {
53 namespace population {
54 
55 // =================================================================================================
56 // Variant Parallel Input Stream
57 // =================================================================================================
58 
74  VariantParallelInputStream const& parallel_input,
75  VariantParallelInputStream::JoinedVariantParams const& joined_variant_params = VariantParallelInputStream::JoinedVariantParams{}
76 );
77 
78 // =================================================================================================
79 // Variant Gapless Input Stream
80 // =================================================================================================
81 
88  VariantGaplessInputStream const& gapless_input
89 );
90 
98  VariantInputStream const& input
99 ) {
100  auto gapless_input = VariantGaplessInputStream( input );
102 }
103 
112  VariantInputStream const& input,
113  std::shared_ptr<::genesis::sequence::ReferenceGenome> ref_genome
114 ) {
115  auto gapless_input = VariantGaplessInputStream( input );
116  gapless_input.reference_genome( ref_genome );
118 }
119 
128  VariantInputStream const& input,
129  std::shared_ptr<::genesis::sequence::SequenceDict> seq_dict
130 ) {
131  auto gapless_input = VariantGaplessInputStream( input );
132  gapless_input.sequence_dict( seq_dict );
134 }
135 
144  VariantInputStream const& input,
145  std::shared_ptr<GenomeLocusSet> genome_locus_set
146 ) {
147  auto gapless_input = VariantGaplessInputStream( input );
148  gapless_input.genome_locus_set( genome_locus_set );
150 }
151 
161  VariantInputStream const& input,
162  std::shared_ptr<::genesis::sequence::ReferenceGenome> ref_genome,
163  std::shared_ptr<GenomeLocusSet> genome_locus_set
164 ) {
165  auto gapless_input = VariantGaplessInputStream( input );
166  gapless_input.reference_genome( ref_genome );
167  gapless_input.genome_locus_set( genome_locus_set );
169 }
170 
180  VariantInputStream const& input,
181  std::shared_ptr<::genesis::sequence::SequenceDict> seq_dict,
182  std::shared_ptr<GenomeLocusSet> genome_locus_set
183 ) {
184  auto gapless_input = VariantGaplessInputStream( input );
185  gapless_input.sequence_dict( seq_dict );
186  gapless_input.genome_locus_set( genome_locus_set );
188 }
189 
190 // =================================================================================================
191 // Merging Input Stream
192 // =================================================================================================
193 
206  VariantInputStream const& input,
207  std::unordered_map<std::string, std::string> const& sample_name_to_group,
208  bool allow_ungrouped_samples = false,
210 );
211 
212 } // namespace population
213 } // namespace genesis
214 
215 #endif // include guard
genesis::population::make_variant_input_stream_from_variant_parallel_input_stream
VariantInputStream make_variant_input_stream_from_variant_parallel_input_stream(VariantParallelInputStream const &parallel_input, VariantParallelInputStream::JoinedVariantParams const &joined_variant_params)
Create a VariantInputStream to iterate multiple input sources at once, using a VariantParallelInputSt...
Definition: variant_input_stream_adapters.cpp:55
genesis::population::make_variant_merging_input_stream
VariantInputStream make_variant_merging_input_stream(VariantInputStream const &variant_input, std::unordered_map< std::string, std::string > const &sample_name_to_group, bool allow_ungrouped_samples, SampleCountsFilterPolicy filter_policy)
Create a VariantInputStream that merges samples from its underlying input.
Definition: variant_input_stream_adapters.cpp:276
variant_input_stream_sources.hpp
genesis::population::SampleCountsFilterPolicy
SampleCountsFilterPolicy
Policy helper to decide how to treat filtered SampleCounts.
Definition: sample_counts_filter.hpp:211
sample_counts.hpp
genesis::population::VariantGaplessInputStream
Stream adapter that visits every position in the genome.
Definition: variant_gapless_input_stream.hpp:94
sequence_dict.hpp
generic_input_stream.hpp
reference_genome.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
genome_locus_set.hpp
variant_parallel_input_stream.hpp
genesis::population::SampleCountsFilterPolicy::kOnlyPassing
@ kOnlyPassing
variant_input_stream.hpp
genesis::population::VariantInputStream
utils::GenericInputStream< Variant, VariantInputStreamData > VariantInputStream
Iterate Variants, using a variety of input file formats.
Definition: stream/variant_input_stream.hpp:108
genesis::population::make_variant_input_stream_from_variant_gapless_input_stream
VariantInputStream make_variant_input_stream_from_variant_gapless_input_stream(VariantGaplessInputStream const &gapless_input)
Create a VariantInputStream that wraps a VariantGaplessInputStream.
Definition: variant_input_stream_adapters.cpp:121
variant_gapless_input_stream.hpp
variant.hpp
genesis::population::make_variant_gapless_input_stream
VariantInputStream make_variant_gapless_input_stream(VariantInputStream const &input)
Create a VariantGaplessInputStream from a VariantInputStream input, and wrap it agian in a VariantInp...
Definition: variant_input_stream_adapters.hpp:97
genesis::utils::GenericInputStream
Type erasure for iterators, using std::function to eliminate the underlying input type.
Definition: generic_input_stream.hpp:163