From: Erik Garrison Date: Wed, 9 Jun 2010 13:39:07 +0000 (-0400) Subject: fixed potential bug with previous commit X-Git-Url: https://git.donarmstrong.com/?p=bamtools.git;a=commitdiff_plain;h=c1a31e056e6867ada6f18baaff983f932e8f1177 fixed potential bug with previous commit The previous commit made assumptions about the ordering of subtags within @RG header lines. This commit only assumes that the read group ID is specified by "ID", thus following spec. --- diff --git a/BamMultiReader.cpp b/BamMultiReader.cpp index 58d82a2..92911c9 100644 --- a/BamMultiReader.cpp +++ b/BamMultiReader.cpp @@ -237,12 +237,12 @@ const string BamMultiReader::GetHeaderText(void) const { stringstream headerLineSs(headerLine); string part, readGroupPart, readGroup; while(std::getline(headerLineSs, part, '\t')) { - if (part == "@RG") { - std::getline(headerLineSs, readGroupPart, '\t'); - stringstream readGroupPartSs(readGroupPart); - std::getline(readGroupPartSs, readGroup, ':'); - std::getline(readGroupPartSs, readGroup, ':'); - break; + stringstream partSs(part); + string subtag; + std::getline(partSs, subtag, ':'); + if (subtag == "ID") { + std::getline(partSs, readGroup, ':'); + break; } } if (readGroups.find(readGroup) == readGroups.end()) { // prevents duplicate @RG entries