A library for working with phylogenetic and population genetic data.
v0.32.0
variant_input_stream_sources.cpp File Reference
#include "genesis/population/stream/variant_input_stream_sources.hpp"
#include "genesis/population/filter/sample_counts_filter.hpp"
#include "genesis/population/filter/variant_filter.hpp"
#include "genesis/population/function/functions.hpp"
#include "genesis/utils/core/fs.hpp"
#include "genesis/utils/core/logging.hpp"
#include "genesis/utils/math/bitvector/helper.hpp"
#include "genesis/utils/text/string.hpp"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <memory>
#include <stdexcept>
#include <unordered_set>
#include <utility>

Go to the source code of this file.

Namespaces

 genesis
 Container namespace for all symbols of genesis in order to keep them separate when used as a library.
 
 genesis::population
 

Functions

template<class T , class R >
std::shared_ptr< T > make_input_stream_with_sample_filter_ (std::string const &filename, R const &reader, std::vector< size_t > const &sample_indices, bool inverse_sample_indices, std::vector< bool > const &sample_filter)
 Local helper function template that takes care of intilizing an input stream, and setting the sample filters, for those streams for which we do not know the number of samples prior to starting the file iteration. More...
 
std::vector< std::string > make_sample_name_list_ (std::string const &source_name, size_t size)
 Local helper to fill the sample names of file formats without sample names. More...
 
VariantInputStream make_variant_input_stream_from_frequency_table_file (std::string const &filename, char separator_char='\t', FrequencyTableInputStream const &reader=FrequencyTableInputStream{})
 Create a VariantInputStream to iterate the contents of a frequency table file as Variants. More...
 
VariantInputStream make_variant_input_stream_from_frequency_table_file (std::string const &filename, std::vector< std::string > const &sample_names_filter, bool inverse_sample_names_filter=false, char separator_char='\t', FrequencyTableInputStream const &reader=FrequencyTableInputStream{})
 Create a VariantInputStream to iterate the contents of a frequency table file as Variants. More...
 
VariantInputStream make_variant_input_stream_from_individual_vcf_file (std::string const &filename, VariantInputStreamFromVcfParams const &params=VariantInputStreamFromVcfParams{}, bool use_allelic_depth=false)
 Create a VariantInputStream to iterate the contents of a VCF file as Variants, treating each sample as an individual, and combining them all into one SampleCounts sample. More...
 
VariantInputStream make_variant_input_stream_from_pileup_file (std::string const &filename, SimplePileupReader const &reader=SimplePileupReader{})
 Create a VariantInputStream to iterate the contents of a (m)pileup file as Variants. More...
 
VariantInputStream make_variant_input_stream_from_pileup_file (std::string const &filename, std::vector< bool > const &sample_filter, SimplePileupReader const &reader=SimplePileupReader{})
 Create a VariantInputStream to iterate the contents of a (m)pileup file as Variants. More...
 
VariantInputStream make_variant_input_stream_from_pileup_file (std::string const &filename, std::vector< size_t > const &sample_indices, bool inverse_sample_indices=false, SimplePileupReader const &reader=SimplePileupReader{})
 Create a VariantInputStream to iterate the contents of a (m)pileup file as Variants. More...
 
VariantInputStream make_variant_input_stream_from_pileup_file_ (std::string const &filename, SimplePileupReader const &reader, std::vector< size_t > const &sample_indices, bool inverse_sample_indices, std::vector< bool > const &sample_filter)
 Local helper function that takes care of the three functions below. More...
 
VariantInputStream make_variant_input_stream_from_pool_vcf_file (std::string const &filename, VariantInputStreamFromVcfParams const &params=VariantInputStreamFromVcfParams{})
 Create a VariantInputStream to iterate the contents of a VCF file as Variants, treating each sample as a pool of individuals. More...
 
VariantInputStream make_variant_input_stream_from_sam_file (std::string const &filename, SamVariantInputStream const &reader=SamVariantInputStream{})
 Create a VariantInputStream to iterate the contents of a SAM/BAM/CRAM file as Variants. More...
 
VariantInputStream make_variant_input_stream_from_sync_file (std::string const &filename)
 Create a VariantInputStream to iterate the contents of a PoPoolation2 sync file as Variants. More...
 
VariantInputStream make_variant_input_stream_from_sync_file (std::string const &filename, std::vector< bool > const &sample_filter)
 Create a VariantInputStream to iterate the contents of a PoPoolation2 sync file as Variants. More...
 
VariantInputStream make_variant_input_stream_from_sync_file (std::string const &filename, std::vector< size_t > const &sample_indices, bool inverse_sample_indices=false)
 Create a VariantInputStream to iterate the contents of a PoPoolation2 sync file as Variants. More...
 
VariantInputStream make_variant_input_stream_from_sync_file_ (std::string const &filename, std::vector< size_t > const &sample_indices, bool inverse_sample_indices, std::vector< bool > const &sample_filter)
 
VariantInputStream make_variant_input_stream_from_vcf_file_ (std::string const &filename, VariantInputStreamFromVcfParams const &params, bool pool_samples, bool use_allelic_depth)
 Local helper function that takes care of both main functions below. More...
 
VariantInputStream make_variant_input_stream_from_vector (std::vector< Variant > const &variants)
 Create a VariantInputStream to iterate the contents of std::vector containing Variants. More...