Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Friends | List of all members
gamgee::Variant Class Reference

Utility class to manipulate a Variant record. More...

#include <variant.h>

Public Member Functions

 Variant ()=default
 initializes a null Variant More...
 
 Variant (const std::shared_ptr< bcf_hdr_t > &header, const std::shared_ptr< bcf1_t > &body) noexcept
 creates a Variant given htslib objects. More...
 
 Variant (const Variant &other)
 makes a deep copy of a Variant and it's header. Shared pointers maintain state to all other associated objects correctly. More...
 
 Variant (Variant &&other) noexcept
 moves Variant and it's header accordingly. Shared pointers maintain state to all other associated objects correctly. More...
 
Variantoperator= (const Variant &other)
 deep copy assignment of a Variant and it's header. Shared pointers maintain state to all other associated objects correctly. More...
 
Variantoperator= (Variant &&other) noexcept
 move assignment of a Variant and it's header. Shared pointers maintain state to all other associated objects correctly. More...
 
VariantHeader header () const
 
uint32_t chromosome () const
 returns the integer representation of the chromosome. Notice that chromosomes are listed in index order with regards to the header (so a 0-based number). Similar to Picards getReferenceIndex() More...
 
uint32_t alignment_start () const
 returns a 1-based alignment start position (as you would see in a VCF file). More...
 
uint32_t qual () const
 returns the Phred scaled site qual (probability that the site is not reference). See VCF spec. More...
 
uint32_t n_samples () const
 returns the number of samples in this Variant record More...
 
uint32_t n_alleles () const
 returns the number of alleles in this Variant record More...
 
std::vector< uint8_t > genotype_quals () const
 returns a vector with a copy of all the GQ values for all samples contiguously in memory. More...
 

Friends

class VariantWriter
 

Detailed Description

Utility class to manipulate a Variant record.

Constructor & Destructor Documentation

gamgee::Variant::Variant ( )
default

initializes a null Variant

Note
this is only used internally by the iterators
Warning
if you need to create a Variant from scratch, use the builder instead
gamgee::Variant::Variant ( const std::shared_ptr< bcf_hdr_t > &  header,
const std::shared_ptr< bcf1_t > &  body 
)
explicitnoexcept

creates a Variant given htslib objects.

creates a variant record that points to htslib memory already allocated

Note
used by all iterators
the resulting Variant shares ownership of the pre-allocated memory via shared_ptr reference counting
gamgee::Variant::Variant ( const Variant other)

makes a deep copy of a Variant and it's header. Shared pointers maintain state to all other associated objects correctly.

creates a deep copy of a variant record and header

gamgee::Variant::Variant ( Variant &&  other)
noexcept

moves Variant and it's header accordingly. Shared pointers maintain state to all other associated objects correctly.

moves a variant record and header, transferring ownership of the underlying htslib memory

Member Function Documentation

uint32_t gamgee::Variant::alignment_start ( ) const
inline

returns a 1-based alignment start position (as you would see in a VCF file).

Note
the internal encoding is 0-based to mimic that of the BCF files.
uint32_t gamgee::Variant::chromosome ( ) const
inline

returns the integer representation of the chromosome. Notice that chromosomes are listed in index order with regards to the header (so a 0-based number). Similar to Picards getReferenceIndex()

vector< uint8_t > gamgee::Variant::genotype_quals ( ) const

returns a vector with a copy of all the GQ values for all samples contiguously in memory.

< if the format is missing or the GQ tag is missing, return an empty vector

VariantHeader gamgee::Variant::header ( ) const
inline
uint32_t gamgee::Variant::n_alleles ( ) const
inline

returns the number of alleles in this Variant record

uint32_t gamgee::Variant::n_samples ( ) const
inline

returns the number of samples in this Variant record

Variant & gamgee::Variant::operator= ( const Variant other)

deep copy assignment of a Variant and it's header. Shared pointers maintain state to all other associated objects correctly.

creates a deep copy of a variant record

Parameters
otherthe Variant to be copied
Note
the parameter is passed by copy so we can maintain the strong exception safety guarantee

< shared_ptr assignment will take care of deallocating old record if necessary

< shared_ptr assignment will take care of deallocating old record if necessary

Variant & gamgee::Variant::operator= ( Variant &&  other)
noexcept

move assignment of a Variant and it's header. Shared pointers maintain state to all other associated objects correctly.

moves a variant record, transferring ownership of the underlying htslib memory

uint32_t gamgee::Variant::qual ( ) const
inline

returns the Phred scaled site qual (probability that the site is not reference). See VCF spec.

Friends And Related Function Documentation

friend class VariantWriter
friend

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