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. | |
bool | setFields (const StringArray &tokens) |
Set the fields from the passed in line. | |
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. | |
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. | |
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.
SamHeaderRecord::SamHeaderRecord | ( | ) |
Constructor.
Definition at line 21 of file SamHeaderRecord.cpp.
|
virtual |
Destructor.
Definition at line 30 of file SamHeaderRecord.cpp.
References reset().
bool SamHeaderRecord::addKey | ( | const char * | value | ) |
Add the key tag with the specified value (not for HD headers).
Definition at line 273 of file SamHeaderRecord.cpp.
References setTag().
Referenced by SamFileHeader::setPGTag(), SamFileHeader::setRGTag(), and SamFileHeader::setSQTag().
|
protected |
Definition at line 321 of file SamHeaderRecord.cpp.
bool SamHeaderRecord::appendString | ( | std::string & | header | ) |
Appends the string representation of this header record to the passed in string.
Definition at line 234 of file SamHeaderRecord.cpp.
References isActiveHeaderRecord(), and isValid().
|
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 SamHeaderHD, SamHeaderPG, SamHeaderRG, and SamHeaderSQ.
Referenced by SamFileHeader::addRecordCopy().
const char * SamHeaderRecord::getKeyValue | ( | ) | const |
Get the value associated with the key tag. Returns "" if it is not set.
Definition at line 284 of file SamHeaderRecord.cpp.
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().
SamHeaderRecord::SamHeaderRecordType SamHeaderRecord::getType | ( | ) |
Return the type of this header record (HD, SQ, RG, or PG) as an enum.
Definition at line 315 of file SamHeaderRecord.cpp.
Referenced by SamFileHeader::addRecordCopy(), and SamFileHeader::getNextHeaderRecord().
const char * SamHeaderRecord::getTypeString | ( | ) |
Return the type of this header record (HD, SQ, RG, or PG) as a string.
Definition at line 308 of file SamHeaderRecord.cpp.
|
protectedvirtual |
Definition at line 327 of file SamHeaderRecord.cpp.
bool SamHeaderRecord::isActiveHeaderRecord | ( | ) |
This record is active (true) if there is at least one tag set.
Definition at line 301 of file SamHeaderRecord.cpp.
Referenced by appendString(), SamFileHeader::getNextHeaderRecord(), and SamFileHeader::getNextHeaderRecord().
bool SamHeaderRecord::isValid | ( | ) |
Check to see if the record is valid.
Definition at line 78 of file SamHeaderRecord.cpp.
Referenced by appendString(), and setFields().
void SamHeaderRecord::reset | ( | ) |
Reset this header record to an empty state with no tags.
Definition at line 212 of file SamHeaderRecord.cpp.
Referenced by ~SamHeaderRecord(), SamFileHeader::removeHD(), SamFileHeader::removePG(), SamFileHeader::removeRG(), and SamFileHeader::removeSQ().
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().
|
protected |
Definition at line 105 of file SamHeaderRecord.h.
|
protected |
Definition at line 100 of file SamHeaderRecord.h.
|
protected |
Definition at line 97 of file SamHeaderRecord.h.