static List<CramCompressionRecord> getMultiRefRecords() { final List<CramCompressionRecord> records = new ArrayList<>(); for (int i = 0; i < 10; i++) { final CramCompressionRecord record = createMappedRecord(i); record.sequenceId = i; if (i % 2 == 0) { record.setSegmentUnmapped(true); } records.add(record); } return records; }
static List<CramCompressionRecord> getSingleRefRecords(final int recordCount) { final List<CramCompressionRecord> records = new ArrayList<>(); for (int i = 0; i < recordCount; i++) { final CramCompressionRecord record = createMappedRecord(i); if (i % 2 == 0) { record.setSegmentUnmapped(true); } records.add(record); } return records; }
static List<CramCompressionRecord> getUnmappedNoRefRecords() { final List<CramCompressionRecord> records = new ArrayList<>(); for (int i = 0; i < 10; i++) { final CramCompressionRecord record = createMappedRecord(i); record.setSegmentUnmapped(true); record.sequenceId = SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX; records.add(record); } return records; }
static List<CramCompressionRecord> getUnmappedNoStartRecords() { final List<CramCompressionRecord> records = new ArrayList<>(); for (int i = 0; i < 10; i++) { final CramCompressionRecord record = createMappedRecord(i); record.setSegmentUnmapped(true); record.alignmentStart = SAMRecord.NO_ALIGNMENT_START; record.setLastSegment(true); records.add(record); } return records; }
static List<Container> getMultiRefContainersForStateTest() { final ContainerFactory factory = new ContainerFactory(getSAMFileHeaderForTests(), 10); final List<Container> testContainers = new ArrayList<>(3); final List<CramCompressionRecord> records = new ArrayList<>(); final CramCompressionRecord record0 = createMappedRecord(0); record0.sequenceId = 0; records.add(record0); final Container container0 = factory.buildContainer(records); final CramCompressionRecord record1 = createMappedRecord(1); record1.sequenceId = 1; records.add(record1); final Container container1 = factory.buildContainer(records); final CramCompressionRecord unmapped = createMappedRecord(2); unmapped.alignmentStart = SAMRecord.NO_ALIGNMENT_START; unmapped.sequenceId = SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX; unmapped.setSegmentUnmapped(true); records.add(unmapped); final Container container2 = factory.buildContainer(records); testContainers.add(container0); testContainers.add(container1); testContainers.add(container2); return testContainers; }
@Test public void multiRefWithUnmappedNoStart() { final ContainerFactory factory = new ContainerFactory(getSAMFileHeaderForTests(), 10); final List<CramCompressionRecord> records = new ArrayList<>(); for (int i = 0; i < 10; i++) { final CramCompressionRecord record = createMappedRecord(i); if (i % 2 == 0) { record.setSegmentUnmapped(true); record.alignmentStart = SAMRecord.NO_ALIGNMENT_START; } records.add(record); } final Container container = factory.buildContainer(records); assertContainerState(container, 10, Slice.MULTI_REFERENCE, Slice.NO_ALIGNMENT_START, Slice.NO_ALIGNMENT_SPAN); }
@Test public void multiRefWithUnmappedNoRef() { final ContainerFactory factory = new ContainerFactory(getSAMFileHeaderForTests(), 10); final List<CramCompressionRecord> records = new ArrayList<>(); for (int i = 0; i < 10; i++) { final CramCompressionRecord record = createMappedRecord(i); if (i % 2 == 0) { record.setSegmentUnmapped(true); record.sequenceId = SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX; } records.add(record); } final Container container = factory.buildContainer(records); assertContainerState(container, 10, Slice.MULTI_REFERENCE, Slice.NO_ALIGNMENT_START, Slice.NO_ALIGNMENT_SPAN); }
@Test public void singleRefWithUnmappedNoRef() { final ContainerFactory factory = new ContainerFactory(getSAMFileHeaderForTests(), 10); final List<CramCompressionRecord> records = new ArrayList<>(); for (int i = 0; i < 10; i++) { final CramCompressionRecord record = createMappedRecord(i); if (i % 2 == 0) { record.setSegmentUnmapped(true); record.sequenceId = SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX; } records.add(record); } final Container container = factory.buildContainer(records); assertContainerState(container, 10, Slice.MULTI_REFERENCE, Slice.NO_ALIGNMENT_START, Slice.NO_ALIGNMENT_SPAN); }
@Test public void singleRefWithUnmappedNoStart() { final ContainerFactory factory = new ContainerFactory(getSAMFileHeaderForTests(), 10); final List<CramCompressionRecord> records = new ArrayList<>(); for (int i = 0; i < 10; i++) { final CramCompressionRecord record = createMappedRecord(i); if (i % 2 == 0) { record.setSegmentUnmapped(true); record.alignmentStart = SAMRecord.NO_ALIGNMENT_START; } records.add(record); } final Container container = factory.buildContainer(records); assertContainerState(container, 10, Slice.MULTI_REFERENCE, Slice.NO_ALIGNMENT_START, Slice.NO_ALIGNMENT_SPAN); }