A library for working with phylogenetic and population genetic data.
v0.27.0
vcf_common.hpp File Reference
#include <cstdint>
#include <string>
#include <vector>
#include "genesis/population/genome_region.hpp"
#include "genesis/population/genome_region_list.hpp"

Go to the source code of this file.

Classes

class  VcfGenotype
 Simple wrapper class for one genotype field for a sample. More...
 
struct  VcfSpecification
 Collect the four required keys that describe an INFO or FORMAT sub-field of VCF/BCF files. More...
 

Namespaces

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

Enumerations

enum  VcfHeaderLine : int {
  kFilter = 0, kInfo = 1, kFormat = 2, kContig = 3,
  kStructured = 4, kGeneric = 5
}
 Specification for the values determining header line types of VCF/BCF files. More...
 
enum  VcfValueSpecial : int {
  kFixed = 0, kVariable = 1, kAllele = 2, kGenotype = 3,
  kReference = 4
}
 Specification for special markers for the number of values expected for key-value-pairs of VCF/BCF files. More...
 
enum  VcfValueType : int { kFlag = 0, kInteger = 1, kFloat = 2, kString = 3 }
 Specification for the data type of the values expected in key-value-pairs of VCF/BCF files. More...
 

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::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)