BamTools 2.5.2
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=std::string())
 constructor More...
 
void Clear ()
 Clears all header contents. More...
 
std::string GetErrorString () const
 Returns a human-readable description of the last error that occurred. More...
 
bool HasError () 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 () const
 Converts data fields to SAM-formatted text. More...
 
bool HasVersion () const
 Returns true if header contains @HD ID:<Version> More...
 
bool HasSortOrder () const
 Returns true if header contains @HD SO:<SortOrder> More...
 
bool HasGroupOrder () const
 Returns true if header contains @HD GO:<GroupOrder> More...
 
bool HasSequences () const
 Returns true if header contains any @SQ entries. More...
 
bool HasReadGroups () const
 Returns true if header contains any @RG entries. More...
 
bool HasPrograms () const
 Returns true if header contains any @PG entries. More...
 
bool HasComments () 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::SamHeader ( const std::string &  headerText = std::string())

constructor

Member Function Documentation

◆ Clear()

void SamHeader::Clear ( )

Clears all header contents.

◆ GetErrorString()

std::string SamHeader::GetErrorString ( ) 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

◆ HasComments()

bool SamHeader::HasComments ( ) const

Returns true if header contains any @CO entries.

◆ HasError()

bool SamHeader::HasError ( ) const

Returns true if header encountered an error.

◆ HasGroupOrder()

bool SamHeader::HasGroupOrder ( ) const

Returns true if header contains @HD GO:<GroupOrder>

◆ HasPrograms()

bool SamHeader::HasPrograms ( ) const

Returns true if header contains any @PG entries.

◆ HasReadGroups()

bool SamHeader::HasReadGroups ( ) const

Returns true if header contains any @RG entries.

◆ HasSequences()

bool SamHeader::HasSequences ( ) const

Returns true if header contains any @SQ entries.

◆ HasSortOrder()

bool SamHeader::HasSortOrder ( ) const

Returns true if header contains @HD SO:<SortOrder>

◆ HasVersion()

bool SamHeader::HasVersion ( ) const

Returns true if header contains @HD ID:<Version>

◆ IsValid()

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

◆ SetHeaderText()

void SamHeader::SetHeaderText ( const std::string &  headerText)

Replaces header contents with headerText.

Parameters
[in]headerTextSAM formatted-text that will be parsed into data fields

◆ ToString()

std::string SamHeader::ToString ( ) 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

◆ Comments

SamHeader::Comments

corresponds to @CO entries

◆ CustomTags

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

◆ GroupOrder

SamHeader::GroupOrder

corresponds to @HD GO:<GroupOrder>

◆ Programs

SamHeader::Programs

corresponds to @PG entries

See also
SamProgram, SamProgramChain

◆ ReadGroups

SamHeader::ReadGroups

corresponds to @RG entries

See also
SamReadGroup, SamReadGroupDictionary

◆ Sequences

SamHeader::Sequences

corresponds to @SQ entries

See also
SamSequence, SamSequenceDictionary

◆ SortOrder

SamHeader::SortOrder

corresponds to @HD SO:<SortOrder>

◆ Version

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: