BamTools::SamHeader Struct Reference

Represents the SAM-formatted text header that is part of the BAM file header. More...

#include <SamHeader.h>

List of all members.

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

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] verbose If 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] 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().

Returns:
SAM-formatted header text

Member Data Documentation

corresponds to @CO entries

corresponds to @HD GO:<GroupOrder>

corresponds to @PG entries

See also:
SamProgram, SamProgramChain

corresponds to @RG entries

See also:
SamReadGroup, SamReadGroupDictionary

corresponds to @SQ entries

See also:
SamSequence, SamSequenceDictionary

corresponds to @HD SO:<SortOrder>

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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Aug 29 17:43:46 2012 for BamTools by  doxygen 1.6.3