Class
BamTagsDict
Indexes start positions of BAM tags in a CharString and provides a dict-like API.
Include Headers
seqan/bam_io.h
Member Functions
Constructor. |
Functions
Build index for a BamTagsDict object. | |
Erase tag from BamTagsDict. | |
Extract and cast "atomic" value from tags string with index | |
Return key of a tag by index. | |
Return the value of a tag by its index in the BamTagsDict. | |
Return | |
The number of items/characters. | |
Set the value of a tag through a BamTagsDict. |
Examples
CharString bamStr;
assignSamToBam(bamStr, samStr);
BamTagsDict tags(bamStr);
std::cerr << length(tags) << std::endl; // #=> "3"
for (unsigned i = 0; i < length(tags); ++i)
{
std::cerr << getTagKey(tags, i) << " -> " << getTagValue(tags, i) << std::endl;
if (getTagValue(tags, i)[0] == 'i') // is 32 bit integer
{
__int32 x = 0;
bool res = extractTagValue(x, tags, i);
SEQAN_ASSERT_MSG(res, "Not a valid integer at pos %u!", i);
std::cerr << " " << x << std::endl;
}
}
// #=> "AA -> Zvalue1"
// #=> "AB -> Zvalue2"
// #-> "AC -> i<binary representation of 30>"
# #-> " 30"
SeqAn - Sequence Analysis Library - www.seqan.de