A library for working with phylogenetic and population genetic data.
v0.32.0
vcf_common.cpp File Reference

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 SampleCounts 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...
 
void convert_to_variant_as_pool_set_missing_gt_ (VcfRecord const &record, Variant &variant)
 Local helper function that sets the filter status of a Variant and its samples to missing depending on whether the genotypes of the samples are missing or not. More...
 
void convert_to_variant_as_pool_tally_bases_ (VcfRecord const &record, std::pair< std::array< char, 6 >, size_t > const &snp_chars, VcfFormatIteratorInt const &sample_ad, SampleCounts &sample)
 Local helper function to tally up the bases form a VcfRecord into a SampleCounts. More...
 
GenomeLocusSet genome_locus_set_from_vcf_file (std::string const &file)
 Read a VCF file, and use its positions to create a GenomeLocusSet. 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)