A library for working with phylogenetic and population genetic data.
v0.27.0
vcf_common.cpp File Reference
#include "genesis/population/formats/vcf_common.hpp"
#include "genesis/population/base_counts.hpp"
#include "genesis/population/formats/vcf_input_iterator.hpp"
#include "genesis/population/formats/vcf_record.hpp"
#include "genesis/population/functions/functions.hpp"
#include "genesis/population/variant.hpp"
#include <htslib/hts.h>
#include <htslib/vcf.h>
#include <cassert>
#include <cstring>
#include <stdexcept>

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

Variant convert_to_variant_as_individuals (VcfRecord const &record, bool use_allelic_depth=false)
 Convert a VcfRecord to a Variant, treating each sample as an individual, and combining them all into one BaseCounts sample. More...
 
Variant convert_to_variant_as_pool (VcfRecord const &record)
 Convert a VcfRecord to a Variant, treating each sample column as a pool of individuals. More...
 
GenomeRegionList genome_region_list_from_vcf_file (std::string const &file)
 Read a VCF file, and use its positions to create a GenomeRegionList. More...
 
void genome_region_list_from_vcf_file (std::string const &file, GenomeRegionList &target)
 Read a VCF file, and add its positions to an existing GenomeRegionList. More...
 
std::pair< std::array< char, 6 >, size_t > get_vcf_record_snp_ref_alt_chars_ (VcfRecord const &record)
 Local helper function that returns the REF and ALT chars of a VcfRecord for SNPs. More...
 
std::string vcf_genotype_string (std::vector< VcfGenotype > const &genotypes)
 Return the VCF-like string representation of a set of VcfGenotype entries. More...
 
size_t vcf_genotype_sum (std::vector< VcfGenotype > const &genotypes)
 Return the sum of genotypes for a set of VcfGenotype entries, typically used to construct a genotype matrix with entries 0,1,2. More...
 
std::string vcf_hl_type_to_string (int hl_type)
 Internal helper function to convert htslib-internal BCF_HL_* header line type values to their string representation as used in the VCF header ("FILTER", "INFO", "FORMAT", etc). More...
 
std::string vcf_value_special_to_string (int vl_type_num)
 
std::string vcf_value_special_to_string (VcfValueSpecial vl_type_num)
 
std::string vcf_value_type_to_string (int ht_type)
 
std::string vcf_value_type_to_string (VcfValueType ht_type)