BamTools  2.4.0
Public Member Functions | Public Attributes | List of all members
BamTools::SamHeader Struct Reference

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 More...
 
 SamHeader (const SamHeader &other)
 copy constructor More...
 
 ~SamHeader (void)
 destructor More...
 
void Clear (void)
 Clears all header contents. More...
 
std::string GetErrorString (void) const
 Returns a human-readable description of the last error that occurred. More...
 
bool HasError (void) const
 Returns true if header encountered an error. More...
 
bool IsValid (bool verbose=false) const
 Checks header contents for required data and proper formatting. More...
 
void SetHeaderText (const std::string &headerText)
 Replaces header contents with headerText. More...
 
std::string ToString (void) const
 Converts data fields to SAM-formatted text. More...
 
bool HasVersion (void) const
 Returns true if header contains @HD ID:<Version> More...
 
bool HasSortOrder (void) const
 Returns true if header contains @HD SO:<SortOrder> More...
 
bool HasGroupOrder (void) const
 Returns true if header contains @HD GO:<GroupOrder> More...
 
bool HasSequences (void) const
 Returns true if header contains any @SQ entries. More...
 
bool HasReadGroups (void) const
 Returns true if header contains any @RG entries. More...
 
bool HasPrograms (void) const
 Returns true if header contains any @PG entries. More...
 
bool HasComments (void) const
 Returns true if header contains any @CO entries. More...
 

Public Attributes

std::string Version
 corresponds to @HD VN:<Version> More...
 
std::string SortOrder
 corresponds to @HD SO:<SortOrder> More...
 
std::string GroupOrder
 corresponds to @HD GO:<GroupOrder> More...
 
std::vector< CustomHeaderTagCustomTags
 
SamSequenceDictionary Sequences
 corresponds to @SQ entries More...
 
SamReadGroupDictionary ReadGroups
 corresponds to @RG entries More...
 
SamProgramChain Programs
 corresponds to @PG entries More...
 
std::vector< std::string > Comments
 corresponds to @CO entries More...
 

Detailed Description

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.

See also
http://samtools.sourceforge.net/SAM1.pdf

Constructor & Destructor Documentation

SamHeader::SamHeader ( const std::string &  headerText = "")

constructor

SamHeader::SamHeader ( const SamHeader other)

copy constructor

SamHeader::~SamHeader ( void  )

destructor

Member Function Documentation

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.

Returns
error description
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.

Parameters
[in]verboseIf set to true, validation errors & warnings will be printed to stderr. Otherwise, messages are available through SamHeader::GetErrorString().
Returns
true if SAM header is well-formed
void SamHeader::SetHeaderText ( const std::string &  headerText)

Replaces header contents with headerText.

Parameters
[in]headerTextSAM 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().

Returns
SAM-formatted header text

Member Data Documentation

SamHeader::Comments

corresponds to @CO entries

std::vector<CustomHeaderTag> BamTools::SamHeader::CustomTags
SamHeader::GroupOrder

corresponds to @HD GO:<GroupOrder>

SamHeader::Programs

corresponds to @PG entries

See also
SamProgram, SamProgramChain
SamHeader::ReadGroups

corresponds to @RG entries

See also
SamReadGroup, SamReadGroupDictionary
SamHeader::Sequences

corresponds to @SQ entries

See also
SamSequence, SamSequenceDictionary
SamHeader::SortOrder

corresponds to @HD SO:<SortOrder>

SamHeader::Version

corresponds to @HD VN:<Version>

Required for valid SAM header, if @HD record is present.


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