outputWriterMap.put(chr.getSequenceName(), writer);
BamSplitterThread thread = new BamSplitterThread(threads, filename, chr.getSequenceName(), writer);
threads.spawnThread(thread);
}
threads.waitForAllThreadsToComplete();
// Now go back and retrieve the unmapped reads.
System.err.println("Processing unmapped reads");
Iterator<SAMRecord> iter = rdr.queryUnmapped();
while (iter.hasNext()) {