final CountSet previous = expectedRejoins.get(v); if (previous == null) expectedRejoins.put(v, depth.clone()); else previous.addAll(depth); final CountSet depthPlusOne = depth.clone(); depthPlusOne.incAll(1); final Set<MultiSampleEdge> nextEdges = backwards ? incomingEdgesOf(v) : outgoingEdgesOf(v);
/** * Move on vertex along the reference path checking for the presence of new opening alternative paths. * * @param anchoring anchoring information on the targeted read. * @param backwards whether we are extending the block backwards or forwards. * @param currentVertex the current vertex. * @param pathSizes current block path sizes. * @param expectedAlternativePathRejoins information about location of vertices along the reference path where open alternative paths will rejoin. * @return the next current-vertex, never {@code null} unless there is a bug. */ private MultiDeBruijnVertex advanceOnReferencePath(final ReadAnchoring anchoring, final boolean backwards, final MultiDeBruijnVertex currentVertex, final CountSet pathSizes, final Map<MultiDeBruijnVertex, CountSet> expectedAlternativePathRejoins) { final Set<MultiSampleEdge> nextEdges = backwards ? graph.incomingEdgesOf(currentVertex) : graph.outgoingEdgesOf(currentVertex); MultiDeBruijnVertex nextReferenceVertex = null; for (final MultiSampleEdge e : nextEdges) { final MultiDeBruijnVertex nextVertex = backwards ? graph.getEdgeSource(e) : graph.getEdgeTarget(e); if (e.isRef()) nextReferenceVertex = nextVertex; else { final CountSet pathSizesPlusOne = pathSizes.clone(); pathSizesPlusOne.incAll(1); graph.calculateRejoins(nextVertex, expectedAlternativePathRejoins, anchoring.referenceWithinAnchorsMap.keySet(), pathSizesPlusOne, true, backwards); } } return nextReferenceVertex; }