ppvcf  1.0.0
Library for the parallel parsing of VCF files
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Variant Class Reference

Class for a single variant. More...

#include <ppvcf.hpp>

Public Member Functions

 Variant (const uint32_t _nsamples)
 
 ~Variant ()
 
void update_till_info (bcf_hdr_t *header, bcf1_t *record)
 
void add_genotype (const uint8_t a1, const uint8_t a2, const bool phased)
 
string get_seqname () const
 
int get_pos () const
 
string get_idx () const
 
string get_ref () const
 
vector< string > get_alts () const
 
string get_alt (const int i) const
 
string get_quality () const
 
string get_info (const string &k) const
 

Private Member Functions

void store_filter (bcf_hdr_t *header, bcf1_t *record)
 
void store_info (bcf_hdr_t *header, bcf1_t *record)
 

Private Attributes

string seq_name
 Chromosome.
 
int pos
 Position (0-based)
 
string idx
 Identifier.
 
string ref
 Reference base(s)
 
vector< string > alts
 Alternate base(s)
 
string quality
 Phred-scaled quality score.
 
string filter
 Filter status.
 
map< string, string > info
 Additional information.
 
uint32_t nsamples
 Total number of samples.
 
uint32_t gti
 Genotype counter represeting how many GTs have been stored.
 
vector< GTgenotypes
 Genotype fields.
 

Detailed Description

Class for a single variant.

Single line extracted from a VCF file.

Constructor & Destructor Documentation

◆ Variant()

Variant::Variant ( const uint32_t  _nsamples)
inline

Constructor

Parameters
_nsamplesis the number of samples

◆ ~Variant()

Variant::~Variant ( )
inline

Destructor

Member Function Documentation

◆ add_genotype()

void Variant::add_genotype ( const uint8_t  a1,
const uint8_t  a2,
const bool  phased 
)
inline

Store a single genotype information.

Parameters
a1is the first allele
a2is the second allele
phasedis true if the genotype is phased, false otherwise

◆ get_alt()

string Variant::get_alt ( const int  i) const
inline
Returns
the i-th (1-based) alternate allele

◆ get_alts()

vector<string> Variant::get_alts ( ) const
inline
Returns
the alternate alleles

◆ get_idx()

string Variant::get_idx ( ) const
inline
Returns
the variant identifier

◆ get_info()

string Variant::get_info ( const string &  k) const
inline

Extract the information value associated to a key.

Parameters
kis the key
Returns
the value associated to key k

◆ get_pos()

int Variant::get_pos ( ) const
inline
Returns
the (0-based) position of the variant

◆ get_quality()

string Variant::get_quality ( ) const
inline
Returns
the variant quality

◆ get_ref()

string Variant::get_ref ( ) const
inline
Returns
the reference allele

◆ get_seqname()

string Variant::get_seqname ( ) const
inline
Returns
the chromosome of the variant

◆ store_filter()

void Variant::store_filter ( bcf_hdr_t *  header,
bcf1_t *  record 
)
inlineprivate

Extract the filter field from record and store it as a string.

Parameters
headeris the htslib header
recordis a htslib record

◆ store_info()

void Variant::store_info ( bcf_hdr_t *  header,
bcf1_t *  record 
)
inlineprivate

Extract the additional information from record and store them as a map<string, string>.

Parameters
headeris the htslib header
recordis a htslib record

◆ update_till_info()

void Variant::update_till_info ( bcf_hdr_t *  header,
bcf1_t *  record 
)
inline

Extract and store the first 8 fields of record.

Parameters
headeris the htslib header
recordis a htslib record

The documentation for this class was generated from the following file: