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::VariantHeader Class Reference

Utility class to hold a variant header. More...

#include <variant_header.h>

Public Member Functions

 VariantHeader ()=default
 initializes a null VariantHeader More...
 
 VariantHeader (const std::shared_ptr< bcf_hdr_t > &header)
 creates a VariantHeader given htslib object. More...
 
 VariantHeader (const VariantHeader &other)
 makes a deep copy of a VariantHeader. Shared pointers maintain state to all other associated objects correctly. More...
 
 VariantHeader (VariantHeader &&other) noexcept
 moves VariantHeader accordingly. Shared pointers maintain state to all other associated objects correctly. More...
 
VariantHeaderoperator= (const VariantHeader &other)
 deep copy assignment of a VariantHeader. Shared pointers maintain state to all other associated objects correctly. More...
 
VariantHeaderoperator= (VariantHeader &&other) noexcept
 move assignment of a VariantHeader. Shared pointers maintain state to all other associated objects correctly. More...
 
 ~VariantHeader ()=default
 
uint32_t n_samples () const
 returns the number of samples in the header More...
 
std::vector< std::string > filters () const
 builds a vector with the filters More...
 
std::vector< std::string > samples () const
 builds a vector with the names of the samples More...
 
std::vector< std::string > contigs () const
 builds a vector with the contigs More...
 
std::vector< std::string > info_fields () const
 builds a vector with the info fields More...
 
std::vector< std::string > format_fields () const
 builds a vector with the format fields More...
 
void advanced_merge_header (const VariantHeader &other)
 

Friends

class VariantWriter
 

Detailed Description

Utility class to hold a variant header.

It can be used to read headers from a VCF/BCF file, but to create one from scratch you want to use the VariantHeaderBuilder

Constructor & Destructor Documentation

gamgee::VariantHeader::VariantHeader ( )
default

initializes a null VariantHeader

Warning
if you need to create a VariantHeader from scratch, use the builder instead
gamgee::VariantHeader::VariantHeader ( const std::shared_ptr< bcf_hdr_t > &  header)
inlineexplicit

creates a VariantHeader given htslib object.

Note
used by all iterators
gamgee::VariantHeader::VariantHeader ( const VariantHeader other)

makes a deep copy of a VariantHeader. Shared pointers maintain state to all other associated objects correctly.

gamgee::VariantHeader::VariantHeader ( VariantHeader &&  other)
noexcept

moves VariantHeader accordingly. Shared pointers maintain state to all other associated objects correctly.

gamgee::VariantHeader::~VariantHeader ( )
default

Member Function Documentation

void gamgee::VariantHeader::advanced_merge_header ( const VariantHeader other)
inline
vector< string > gamgee::VariantHeader::contigs ( ) const

builds a vector with the contigs

vector< string > gamgee::VariantHeader::filters ( ) const

builds a vector with the filters

vector< string > gamgee::VariantHeader::format_fields ( ) const

builds a vector with the format fields

vector< string > gamgee::VariantHeader::info_fields ( ) const

builds a vector with the info fields

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

returns the number of samples in the header

Note
much faster than getting the actual list of samples
VariantHeader & gamgee::VariantHeader::operator= ( const VariantHeader other)

deep copy assignment of a VariantHeader. Shared pointers maintain state to all other associated objects correctly.

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

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

move assignment of a VariantHeader. Shared pointers maintain state to all other associated objects correctly.

other is an r-value reference, so it will disappear into the nether right after the swap

vector< string > gamgee::VariantHeader::samples ( ) const

builds a vector with the names of the samples

This implementation is simply transforming the char ** representation of the sample names into a contiguous vector<string>. As efficient as it gets.

Friends And Related Function Documentation

friend class VariantWriter
friend

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