@BeforeTest void setupBuilder() throws IOException { tempSamFileChrM_O = File.createTempFile("CollectGcBias", ".bam", TEST_DIR); tempSamFileAllChr = File.createTempFile("CollectGcBias", ".bam", TEST_DIR); tempSamFileChrM_O.deleteOnExit(); tempSamFileAllChr.deleteOnExit(); final File tempSamFileUnsorted = File.createTempFile("CollectGcBias", ".bam", TEST_DIR); tempSamFileUnsorted.deleteOnExit(); final SAMFileHeader header = new SAMFileHeader(); try { header.setSequenceDictionary(SAMSequenceDictionaryExtractor.extractDictionary(dict)); header.setSortOrder(SAMFileHeader.SortOrder.unsorted); } catch (final SAMException e) { e.printStackTrace(); } // build different levels to put into the same bam file for testing multi level collection setupTest1( 1, readGroupId1, readGroupRecord1, sample1, library1, header, setBuilder1); // Sample 1, Library 1, RG 1 setupTest1( 2, readGroupId2, readGroupRecord2, sample1, library2, header, setBuilder2); // Sample 1, Library 2, RG 2 setupTest1( 3, readGroupId3, readGroupRecord3, sample2, library3, header, setBuilder3); // Sample 2, Library 3, RG 3 // build one last readgroup for comparing that window count stays the same whether you use all // contigs or not setupTest2(1, readGroupId1, readGroupRecord1, sample1, library1, header, setBuilder4); final List<SAMRecordSetBuilder> test1Builders = new ArrayList<SAMRecordSetBuilder>(); test1Builders.add(setBuilder1); test1Builders.add(setBuilder2); test1Builders.add(setBuilder3); final List<SAMRecordSetBuilder> test2Builders = new ArrayList<SAMRecordSetBuilder>(); test2Builders.add(setBuilder4); tempSamFileChrM_O = build(test1Builders, tempSamFileUnsorted, header); tempSamFileAllChr = build(test2Builders, tempSamFileUnsorted, header); }