vcfpp
Public Member Functions | Friends | List of all members
vcfpp::BcfHeader Class Reference

Object represents header of the VCF, offering methods to access and modify the tags. More...

#include <vcfpp.h>

Public Member Functions

void addINFO (const std::string &id, const std::string &number, const std::string &type, const std::string &description)
 add INFO field to header More...
 
void addFORMAT (const std::string &id, const std::string &number, const std::string &type, const std::string &description)
 add FORMAT field to header More...
 
void addFILTER (const std::string &id, const std::string &description)
 add one FILTER line to header More...
 
void addContig (const std::string &id)
 add contig to header More...
 
void addLine (const std::string &str)
 add one line to header
 
void addSample (const std::string &sample) const
 add one sample name to header
 
std::string asString () const
 return header as a string
 
std::vector< std::string > getSamples () const
 return all samples in a string vector
 
std::vector< std::string > getSeqnames () const
 return all contig/chromosome names in a string vector
 
int getFormatType (std::string tag) const
 get the type of a given tag More...
 
void removeContig (std::string tag) const
 remove a contig tag from header
 
void removeInfo (std::string tag) const
 remove a INFO tag from header
 
void removeFormat (std::string tag) const
 remove a FORMAT tag from header
 
void removeFilter (std::string tag) const
 remove a FILTER tag from header
 
void updateSamples (const std::string &samples)
 update the sample id in the header More...
 
void setSamples (const std::string &samples) const
 explicitly set samples to be extracted More...
 
void setVersion (const std::string &version) const
 set the VCF version
 
int nSamples () const
 return the number of samples in the VCF
 

Friends

class BcfRecord
 
class BcfReader
 
class BcfWriter
 
std::ostream & operator<< (std::ostream &out, const BcfHeader &h)
 stream out the header
 

Detailed Description

Object represents header of the VCF, offering methods to access and modify the tags.

Note
BcfHeader has 3 friends, BcfReader, BcfWriter and BcfRecord.

Member Function Documentation

◆ addContig()

void vcfpp::BcfHeader::addContig ( const std::string &  id)
inline

add contig to header

Parameters
idcontig or chromosome name

◆ addFILTER()

void vcfpp::BcfHeader::addFILTER ( const std::string &  id,
const std::string &  description 
)
inline

add one FILTER line to header

Parameters
idFILTER name
descriptionDescription of the FILTER

◆ addFORMAT()

void vcfpp::BcfHeader::addFORMAT ( const std::string &  id,
const std::string &  number,
const std::string &  type,
const std::string &  description 
)
inline

add FORMAT field to header

Parameters
idtag name in FORMAT field
numberNumber of elements
typeInteger, Floast or String
descriptionDescription of the tag

◆ addINFO()

void vcfpp::BcfHeader::addINFO ( const std::string &  id,
const std::string &  number,
const std::string &  type,
const std::string &  description 
)
inline

add INFO field to header

Parameters
idtag name in INFO field
numberNumber of elements
typeInteger, Floast or String
descriptionDescription of the tag

◆ getFormatType()

int vcfpp::BcfHeader::getFormatType ( std::string  tag) const
inline

get the type of a given tag

Parameters
tagin the FORMAT
Returns
1: int; 2: float; 3: string; 0: error;

◆ setSamples()

void vcfpp::BcfHeader::setSamples ( const std::string &  samples) const
inline

explicitly set samples to be extracted

Parameters
samplessamples to include or exclude as a comma-separated string

◆ updateSamples()

void vcfpp::BcfHeader::updateSamples ( const std::string &  samples)
inline

update the sample id in the header

Parameters
samplesa comma-separated string for multiple new samples
Note
this only update the samples name in a given sequential order

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