public Map<Integer, AlignmentSpan> getReferences(final Container container, final ValidationStringency validationStringency) throws IOException { final Map<Integer, AlignmentSpan> containerSpanMap = new HashMap<>(); for (final Slice slice : container.slices) { addAllSpans(containerSpanMap, getReferences(slice, container.header, validationStringency)); } return containerSpanMap; }
public Map<Integer, AlignmentSpan> getReferences(final Container container, final ValidationStringency validationStringency) { final Map<Integer, AlignmentSpan> containerSpanMap = new HashMap<>(); for (final Slice slice : container.slices) { addAllSpans(containerSpanMap, getReferences(slice, container.header, validationStringency)); } return containerSpanMap; }
final Map<Integer, AlignmentSpan> referenceSet0 = parser.getReferences(containers.get(0), ValidationStringency.STRICT); Assert.assertNotNull(referenceSet0); Assert.assertEquals(referenceSet0.size(), 1); final Map<Integer, AlignmentSpan> referenceSet1 = parser.getReferences(containers.get(1), ValidationStringency.STRICT); Assert.assertNotNull(referenceSet1); Assert.assertEquals(referenceSet1.size(), 2); final Map<Integer, AlignmentSpan> referenceSet2 = parser.getReferences(containers.get(2), ValidationStringency.STRICT); Assert.assertNotNull(referenceSet2); Assert.assertEquals(referenceSet2.size(), 3);
@Test(dataProvider = "containersForRefTests") public void paramTest(final List<CramCompressionRecord> records, final Set<Integer> expectedKeys) { final ContainerFactory factory = new ContainerFactory(ContainerFactoryTest.getSAMFileHeaderForTests(), TEST_RECORD_COUNT); final Container container = factory.buildContainer(records); final ContainerParser parser = new ContainerParser(ContainerFactoryTest.getSAMFileHeaderForTests()); final Map<Integer, AlignmentSpan> referenceSet = parser.getReferences(container, ValidationStringency.STRICT); Assert.assertEquals(referenceSet.keySet(), expectedKeys); final List<CramCompressionRecord> roundTripRecords = parser.getRecords(container, null, ValidationStringency.STRICT); // TODO this fails. return to this when refactoring Container and CramCompressionRecord //Assert.assertEquals(roundTripRecords, records); Assert.assertEquals(roundTripRecords.size(), TEST_RECORD_COUNT); }
@Test public void testMultirefContainer() { final Map<Integer, AlignmentSpan> expectedSpans = new HashMap<>(); for (int i = 0; i < 10; i++) { expectedSpans.put(i, new AlignmentSpan(i + 1, 3, 1)); } final ContainerFactory factory = new ContainerFactory(ContainerFactoryTest.getSAMFileHeaderForTests(), TEST_RECORD_COUNT); final Container container = factory.buildContainer(ContainerFactoryTest.getMultiRefRecords()); final ContainerParser parser = new ContainerParser(ContainerFactoryTest.getSAMFileHeaderForTests()); final Map<Integer, AlignmentSpan> referenceSet = parser.getReferences(container, ValidationStringency.STRICT); Assert.assertEquals(referenceSet, expectedSpans); }
if (slice.isMultiref()) { final ContainerParser parser = new ContainerParser(indexBuilder.bamHeader); final Map<Integer, AlignmentSpan> refSet = parser.getReferences(container, validationStringency); final Slice fakeSlice = new Slice(); slice.containerOffset = container.offset;
if (slice.isMultiref()) { final ContainerParser parser = new ContainerParser(indexBuilder.bamHeader); final Map<Integer, AlignmentSpan> refSet = parser.getReferences(container, validationStringency); final Slice fakeSlice = new Slice(); slice.containerOffset = container.offset;
Container secondContainer = it.next(); Assert.assertNotNull(secondContainer); final Map<Integer, AlignmentSpan> references = new ContainerParser(it.getCramHeader().getSamFileHeader()).getReferences(secondContainer, ValidationStringency.STRICT); it.close(); int refId = new TreeSet<Integer>(references.keySet()).iterator().next();
Assert.assertNotNull(secondContainer); final Map<Integer, AlignmentSpan> references = new ContainerParser(it.getCramHeader().getSamFileHeader()).getReferences(secondContainer, ValidationStringency.STRICT); it.close();