yat
0.13.2pre
|
Wrapper around bam_hdr_t struct. More...
#include <yat/omic/BamHeader.h>
Public Member Functions | |
BamHeader (void) | |
Default constructor. | |
~BamHeader (void) | |
Destructor. | |
BamHeader (const BamHeader &) | |
Copy constructor. | |
void | parse_region (const std::string ®, int &tid, int &begin, int &end) const |
const std::string & | program_group (const std::string &id, const std::string &key) const |
Access value in @PG lines. More... | |
const std::string & | read_group (const std::string &id, const std::string &key) const |
Access value in @RG lines. More... | |
void | swap (BamHeader &other) |
Exchanges the content in *this and other. More... | |
const char * | target_name (size_t tid) const |
uint32_t | target_length (size_t tid) const |
std::string | text (void) const |
void | text (const std::string &txt) |
set text in header More... | |
int32_t | tid (const std::string &name) const |
inverse of target_name(size_t) More... | |
int32_t | n_targets (void) const |
BamHeader & | operator= (const BamHeader &rhs) |
assignment operator | |
Friends | |
class | InBamFile |
class | OutBamFile |
Related Functions | |
(Note that these are not member functions.) | |
void | swap (BamHeader &lhs, BamHeader &rhs) |
Wrapper around bam_hdr_t struct.
Class is typically created via InBamFile::header().
It is possible to copy and assign a BamHeader, but note that a BamHeader does not own underlying data. The underlying data is owned by the InBamFile and the BamHeader is thus invalid after the corresponding InBamFile has been destroyed.
int32_t theplu::yat::omic::BamHeader::n_targets | ( | void | ) | const |
void theplu::yat::omic::BamHeader::parse_region | ( | const std::string & | reg, |
int & | tid, | ||
int & | begin, | ||
int & | end | ||
) | const |
Parse a region in the format: 'chr2:100,000-200,000 and return values in variables tid, begin and end. reg is 1-based and begin and end are 0-based, i.e., "chr2:100,000-200,000" will set begin = 99999 and end = 200000.
utility::runtime_error | on failure |
const std::string& theplu::yat::omic::BamHeader::program_group | ( | const std::string & | id, |
const std::string & | key | ||
) | const |
Access value in @PG
lines.
A program group line in the header typically looks like
and for this line program_group
("bwa", "VN") returns "0.6.1-r104"
const std::string& theplu::yat::omic::BamHeader::read_group | ( | const std::string & | id, |
const std::string & | key | ||
) | const |
Access value in @RG
lines.
A read group line in the header typically looks like
and for this line read_group
("foo", "SM") returns "Tumour"
void theplu::yat::omic::BamHeader::swap | ( | BamHeader & | other | ) |
Exchanges the content in *this
and other.
uint32_t theplu::yat::omic::BamHeader::target_length | ( | size_t | tid | ) | const |
Length of chromosome with ID tid
const char* theplu::yat::omic::BamHeader::target_name | ( | size_t | tid | ) | const |
Name of chromosome with ID tid
std::string theplu::yat::omic::BamHeader::text | ( | void | ) | const |
void theplu::yat::omic::BamHeader::text | ( | const std::string & | txt | ) |
set text in header
This function parses txt and updates fields.
int32_t theplu::yat::omic::BamHeader::tid | ( | const std::string & | name | ) | const |
inverse of target_name(size_t)
If compiled against libbam and name does not exist, behavious is undefined. If compiled against htslib, a utility::runtime_error is thrown.
Exchanges the content in the headers.