]> git.donarmstrong.com Git - bamtools.git/commitdiff
fixed potential bug with previous commit
authorErik Garrison <erik.garrison@bc.edu>
Wed, 9 Jun 2010 13:39:07 +0000 (09:39 -0400)
committerErik Garrison <erik.garrison@bc.edu>
Wed, 9 Jun 2010 13:39:07 +0000 (09:39 -0400)
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.

BamMultiReader.cpp

index 58d82a2d016b49de532d1ec85be39650a982d915..92911c90da8793a0a86bed63b9ba49ddce137009 100644 (file)
@@ -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