libStatGen Software
1
|
This class encapsulates the tag value pairs contained with a SAM Header line with accessors for getting and setting the tags within this header. More...
#include <SamHeaderRecord.h>
Public Types | |
enum | SamHeaderRecordType { HD , SQ , RG , PG } |
Specifies the Type for the sam header record (line). More... | |
Public Member Functions | |
SamHeaderRecord () | |
Constructor. | |
virtual | ~SamHeaderRecord () |
Destructor. | |
virtual SamHeaderRecord * | createCopy () const =0 |
Return a pointer to a newly created header record of the appropriate type that is a copy of this record. More... | |
bool | setFields (const StringArray &tokens) |
Set the fields from the passed in line. More... | |
bool | isValid () |
Check to see if the record is valid. | |
const char * | getTagValue (const char *tag) const |
Return the value associated with the specified tag. More... | |
bool | setTag (const char *tag, const char *value) |
Set the value of the specified tag to the specified value, deletes the tag when value is NULL. More... | |
void | reset () |
Reset this header record to an empty state with no tags. | |
bool | appendString (std::string &header) |
Appends the string representation of this header record to the passed in string. | |
bool | addKey (const char *value) |
Add the key tag with the specified value (not for HD headers). | |
const char * | getKeyValue () const |
Get the value associated with the key tag. Returns "" if it is not set. | |
bool | isActiveHeaderRecord () |
This record is active (true) if there is at least one tag set. | |
const char * | getTypeString () |
Return the type of this header record (HD, SQ, RG, or PG) as a string. | |
SamHeaderRecordType | getType () |
Return the type of this header record (HD, SQ, RG, or PG) as an enum. | |
Protected Member Functions | |
void | addRequiredTag (const char *requiredTag) |
virtual void | internalCopy (SamHeaderRecord &newRec) const |
Protected Attributes | |
std::string | myTypeString |
SamHeaderRecordType | myType |
std::string | myKeyTag |
This class encapsulates the tag value pairs contained with a SAM Header line with accessors for getting and setting the tags within this header.
Definition at line 27 of file SamHeaderRecord.h.
Specifies the Type for the sam header record (line).
Enumerator | |
---|---|
HD | Header. |
SQ | Sequence Dictionary. |
RG | Read Group. |
PG | Program. |
Definition at line 31 of file SamHeaderRecord.h.
|
pure virtual |
Return a pointer to a newly created header record of the appropriate type that is a copy of this record.
The newly created record will not be deleted by this class and it is the responsibility of the calling method to handle the deletion. Returns NULL on failure to copy.
Implemented in SamHeaderSQ, SamHeaderRG, SamHeaderPG, and SamHeaderHD.
Referenced by SamFileHeader::addRecordCopy().
const char * SamHeaderRecord::getTagValue | ( | const char * | tag | ) | const |
Return the value associated with the specified tag.
Returns "" if it is not set.
Definition at line 100 of file SamHeaderRecord.cpp.
Referenced by SamFileHeader::addPG(), SamFileHeader::addRG(), SamFileHeader::addSQ(), SamFileHeader::getHDTagValue(), SamFileHeader::getPGTagValue(), SamFileHeader::getRGTagValue(), and SamFileHeader::getSQTagValue().
bool SamHeaderRecord::setFields | ( | const StringArray & | tokens | ) |
Set the fields from the passed in line.
Return true if successfully set.
Definition at line 38 of file SamHeaderRecord.cpp.
bool SamHeaderRecord::setTag | ( | const char * | tag, |
const char * | value | ||
) |
Set the value of the specified tag to the specified value, deletes the tag when value is NULL.
Returns whether or not it was successful, fails if tag is the key tag and the key tag already exists.
Definition at line 119 of file SamHeaderRecord.cpp.
Referenced by addKey(), setFields(), SamFileHeader::setHDTag(), SamFileHeader::setPGTag(), SamFileHeader::setRGTag(), and SamFileHeader::setSQTag().