Class
BamTagsDict
Indexes start positions of BAM tags in a CharString and provides a dict-like API.
BamTagsDict
Include Headers
seqan/bam_io.h
Member Functions

BamTagsDict | Constructor.

Functions

buildIndex | Build index for a BamTagsDict object.
eraseTag | Erase tag from BamTagsDict.
extractTagValue | Extract and cast "atomic" value from tags string with index idx.
getTagKey | Return key of a tag by index.
getTagValue | Return the value of a tag by its index in the BamTagsDict.
hasIndex | Return true if BamTagsDict has an index.
length | The number of items/characters.
setTagValue | Set the value of a tag through a BamTagsDict.

Examples
CharString samStr = "AA:Z:value1\tAB:Z:value2\tAC:i:30";
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

Page built @2014/10/13 16:12:56