@Test public void testMultirefWithStateTransitions() { final List<Container> containers = getMultiRefContainersForStateTest(); // first container is single-ref assertContainerState(containers.get(0), 1, 0, 1, 3); // when other refs are added, subsequent containers are multiref assertContainerState(containers.get(1), 2, Slice.MULTI_REFERENCE, Slice.NO_ALIGNMENT_START, Slice.NO_ALIGNMENT_SPAN); assertContainerState(containers.get(2), 3, Slice.MULTI_REFERENCE, Slice.NO_ALIGNMENT_START, Slice.NO_ALIGNMENT_SPAN); }
@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 testUnmappedNoReferenceId() { final ContainerFactory factory = new ContainerFactory(getSAMFileHeaderForTests(), 10); final Container container = factory.buildContainer(getUnmappedNoRefRecords()); assertContainerState(container, 10, SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX, Slice.NO_ALIGNMENT_START, Slice.NO_ALIGNMENT_SPAN); }
@Test public void testMultiref() { final ContainerFactory factory = new ContainerFactory(getSAMFileHeaderForTests(), 10); final Container container = factory.buildContainer(getMultiRefRecords()); 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 testMapped() { final int recordCount = 10; final int sequenceId = 0; final int alignmentStart = 1; final int alignmentSpan = 12; final ContainerFactory factory = new ContainerFactory(getSAMFileHeaderForTests(), 10); final Container container = factory.buildContainer(getSingleRefRecords(recordCount)); assertContainerState(container, recordCount, sequenceId, alignmentStart, alignmentSpan); }
@Test public void testUnmappedNoAlignmentStart() { final ContainerFactory factory = new ContainerFactory(getSAMFileHeaderForTests(), 10); final Container container = factory.buildContainer(getUnmappedNoStartRecords()); assertContainerState(container, 10, SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX, 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); }