@BeforeTest public void setUp() { builder.setReadLength(READ_LENGTH); // Will be kept when an interval overlaps chromosome 1 in the first 151 // bases. builder.addPair("mapped_pair_chr1", 0, 1, 151); // Will be kept when an interval overlaps chromsome 2 in the first 151 // bases. builder.addPair("mapped_pair_chr2", 1, 1, 151); // The first read should pass and second should not, but both will // be kept in first test. builder.addPair("one_of_pair", 0, 1, 1000); // The second read is unmapped, but both should be kept in an // interval test where the interval includes chromosome four, where // read one will overlap. builder.addPair( "second_mate_unmapped", 3, -1, 1, 1000, false, true, "151M", null, false, false, false, false, -1); // The first read is unmapped but both should be kept in an // interval test where the interval includes chromosome four, where // read two will overlap. builder.addPair( "first_mate_unmapped", -1, 3, 1000, 1, true, false, null, "151M", false, false, false, false, -1); // This pair will overlap any interval that includes chromosome 1:1000 builder.addPair("prove_one_of_pair", 0, 1000, 1000); // These reads are unmapped and will not map to any intervals, so they // are never kept. This is tested below. builder.addPair( "both_unmapped", -1, -1, 1, 1, true, true, null, null, false, false, false, false, -1); // Secondary alignments are never kept by the interval filter. builder.addFrag("mapped_pair_chr1", 0, 1, false, false, "151M", null, -1, true, false); // Supplementary alignment are never kept by the interval filter. builder.addFrag("mapped_pair_chr1", 0, 1, false, false, "151M", null, -1, false, true); }
public void setupTest2( final int ID, final String readGroupId, final SAMReadGroupRecord readGroupRecord, final String sample, final String library, final SAMFileHeader header, final SAMRecordSetBuilder setBuilder) throws IOException { final String separator = ":"; final int contig1 = 0; final int contig2 = 1; final int contig3 = 2; readGroupRecord.setSample(sample); readGroupRecord.setPlatform(platform); readGroupRecord.setLibrary(library); readGroupRecord.setPlatformUnit(readGroupId); setBuilder.setReadGroup(readGroupRecord); setBuilder.setUseNmFlag(true); setBuilder.setHeader(header); final int max = 800; final int min = 1; final Random rg = new Random(5); // add records that align to all 3 chr in reference file for (int i = 0; i < NUM_READS; i++) { final int start = rg.nextInt(max) + min; final String newReadName = READ_NAME + separator + ID + separator + i; if (i <= NUM_READS / 3) { setBuilder.addPair(newReadName, contig1, start + ID, start + ID + LENGTH); } else if (i < (NUM_READS - (NUM_READS / 3))) { setBuilder.addPair(newReadName, contig2, start + ID, start + ID + LENGTH); } else { setBuilder.addPair(newReadName, contig3, start + ID, start + ID + LENGTH); } } }