rdr.getFileHeader(), false, new File(outputDirectory + "/" + chr.getSequenceName() + ".bam"));
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");