- // get header from reader
- string headerText = reader->GetHeaderText();
- if ( headerText.empty() ) continue;
-
- // store header text in lines
- map<string, bool> currentFileReadGroups;
- const vector<string> lines = SplitHeaderText(headerText);
-
- // iterate over header lines
- vector<string>::const_iterator linesIter = lines.begin();
- vector<string>::const_iterator linesEnd = lines.end();
- for ( ; linesIter != linesEnd; ++linesIter ) {
-
- // get next line from header, skip if empty
- const string headerLine = (*linesIter);
- if ( headerLine.empty() ) continue;
-
- // if first file, save HD & SQ entries
- // TODO: what if first file has empty header, should just check for empty 'mergedHeader' instead ?
- if ( readerIter == readerBegin ) {
- if ( headerLine.find("@HD") == 0 || headerLine.find("@SQ") == 0) {
- mergedHeader.append(headerLine.c_str());
- mergedHeader.append(1, '\n');
- }
- }