Represents the SAM-formatted text header that is part of the BAM file header. More...
#include <SamHeader.h>
Public Member Functions | |
SamHeader (const std::string &headerText="") | |
constructor | |
SamHeader (const SamHeader &other) | |
copy constructor | |
~SamHeader (void) | |
destructor | |
void | Clear (void) |
Clears all header contents. | |
std::string | GetErrorString (void) const |
Returns a human-readable description of the last error that occurred. | |
bool | HasError (void) const |
Returns true if header encountered an error. | |
bool | IsValid (bool verbose=false) const |
Checks header contents for required data and proper formatting. | |
void | SetHeaderText (const std::string &headerText) |
Replaces header contents with headerText. | |
std::string | ToString (void) const |
Converts data fields to SAM-formatted text. | |
bool | HasVersion (void) const |
Returns true if header contains @HD ID:<Version> | |
bool | HasSortOrder (void) const |
Returns true if header contains @HD SO:<SortOrder> | |
bool | HasGroupOrder (void) const |
Returns true if header contains @HD GO:<GroupOrder> | |
bool | HasSequences (void) const |
Returns true if header contains any @SQ entries. | |
bool | HasReadGroups (void) const |
Returns true if header contains any @RG entries. | |
bool | HasPrograms (void) const |
Returns true if header contains any @PG entries. | |
bool | HasComments (void) const |
Returns true if header contains any @CO entries. | |
Public Attributes | |
std::string | Version |
corresponds to @HD VN:<Version> | |
std::string | SortOrder |
corresponds to @HD SO:<SortOrder> | |
std::string | GroupOrder |
corresponds to @HD GO:<GroupOrder> | |
SamSequenceDictionary | Sequences |
corresponds to @SQ entries | |
SamReadGroupDictionary | ReadGroups |
corresponds to @RG entries | |
SamProgramChain | Programs |
corresponds to @PG entries | |
std::vector< std::string > | Comments |
corresponds to @CO entries |
Represents the SAM-formatted text header that is part of the BAM file header.
Provides direct read/write access to the SAM header data fields.
SamHeader::SamHeader | ( | const std::string & | headerText = "" |
) |
constructor
SamHeader::SamHeader | ( | const SamHeader & | other | ) |
copy constructor
SamHeader::~SamHeader | ( | void | ) |
destructor
void SamHeader::Clear | ( | void | ) |
Clears all header contents.
std::string SamHeader::GetErrorString | ( | void | ) | const |
Returns a human-readable description of the last error that occurred.
This method allows elimination of STDERR pollution. Developers of client code may choose how the messages are displayed to the user, if at all.
bool SamHeader::HasComments | ( | void | ) | const |
Returns true
if header contains any @CO entries.
bool SamHeader::HasError | ( | void | ) | const |
Returns true
if header encountered an error.
bool SamHeader::HasGroupOrder | ( | void | ) | const |
Returns true
if header contains @HD GO:<GroupOrder>
bool SamHeader::HasPrograms | ( | void | ) | const |
Returns true
if header contains any @PG entries.
bool SamHeader::HasReadGroups | ( | void | ) | const |
Returns true
if header contains any @RG entries.
bool SamHeader::HasSequences | ( | void | ) | const |
Returns true
if header contains any @SQ entries.
bool SamHeader::HasSortOrder | ( | void | ) | const |
Returns true
if header contains @HD SO:<SortOrder>
bool SamHeader::HasVersion | ( | void | ) | const |
Returns true
if header contains @HD ID:<Version>
bool SamHeader::IsValid | ( | bool | verbose = false |
) | const |
Checks header contents for required data and proper formatting.
[in] | verbose | If set to true, validation errors & warnings will be printed to stderr. Otherwise, messages are available through SamHeader::GetErrorString(). |
true
if SAM header is well-formed void SamHeader::SetHeaderText | ( | const std::string & | headerText | ) |
Replaces header contents with headerText.
[in] | headerText | SAM formatted-text that will be parsed into data fields |
string SamHeader::ToString | ( | void | ) | const |
Converts data fields to SAM-formatted text.
Applies any local modifications made since creating this object or calling SetHeaderText().
corresponds to @CO entries
corresponds to @HD GO:<GroupOrder>
corresponds to @PG entries
corresponds to @RG entries
corresponds to @SQ entries
corresponds to @HD SO:<SortOrder>
corresponds to @HD VN:<Version>
Required for valid SAM header, if @HD record is present.