Push forward some more delicate merging routines.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2016 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2009-11-11 03:07:34 +00:00
parent bae4d3f7ea
commit 499e7d1d75
1 changed files with 14 additions and 7 deletions

View File

@ -235,15 +235,22 @@ public class MergingSamRecordIterator2 implements CloseableIterator<SAMRecord>,
final SAMRecord record = iterator.next();
addIfNotEmpty(iterator);
// Fix the read group if needs be
if (this.samHeaderMerger.hasReadGroupCollisions()) {
final String id = (String) record.getAttribute(ReservedTagConstants.READ_GROUP_ID);
final String newId = this.samHeaderMerger.getReadGroupId(iterator.getReader(), id);
record.setAttribute(ReservedTagConstants.READ_GROUP_ID, newId);
final String oldGroupId = (String) record.getAttribute(ReservedTagConstants.READ_GROUP_ID);
if (oldGroupId != null ) {
final String newGroupId = this.samHeaderMerger.getReadGroupId(iterator.getReader(), oldGroupId);
record.setAttribute(ReservedTagConstants.READ_GROUP_ID, newGroupId);
}
}
final String oldProgramGroupId = (String) record.getAttribute(SAMTag.PG.toString());
if (oldProgramGroupId != null) {
final String newProgramGroupId = this.samHeaderMerger.getProgramGroupId(iterator.getReader(), oldProgramGroupId);
record.setAttribute(SAMTag.PG.toString(), newProgramGroupId);
// Fix the program group if needs be
if (this.samHeaderMerger.hasProgramGroupCollisions()) {
final String oldGroupId = (String) record.getAttribute(ReservedTagConstants.PROGRAM_GROUP_ID);
if (oldGroupId != null ) {
final String newGroupId = this.samHeaderMerger.getProgramGroupId(iterator.getReader(), oldGroupId);
record.setAttribute(ReservedTagConstants.PROGRAM_GROUP_ID, newGroupId);
}
}
// if we don't have a read group, set one correctly