Package org.broadinstitute.gatk.utils.collections

Examples of org.broadinstitute.gatk.utils.collections.CountSet$MyIterator


        final Set<ReadSegmentCost> readSegmentCosts = new TreeSet<>(ReadSegmentComparator.INSTANCE);

        final int readStart = beforeBlockReadOffset + kmerSize;
        final int readEnd = Math.max(readStart, afterBlockReadOffset + kmerSize - 1);
        final byte[][] pathBases = new byte[acrossBlockPaths.size()][];
        final CountSet pathSizes = new CountSet(acrossBlockPaths.size());
        int nextPath = 0;

        // Complete the read segment cost with the corresponding path bases
        for (final Route<MultiDeBruijnVertex, MultiSampleEdge> p : acrossBlockPaths) {
            final ReadSegmentCost readSegmentCost = new ReadSegmentCost(read, p, 0);
            pathBases[nextPath++] = readSegmentCost.bases = eventBlockPathBases(p, includePathEnds);
            pathSizes.add(readSegmentCost.bases.length);
            readSegmentCosts.add(readSegmentCost);
        }

        // Add the read 'path size'.
        pathSizes.add(readEnd - readStart);

        final byte[] readBases = hmm.getReadBases();

        // Perform right clipping of bases that are common to all paths and read.
        int rightClipping = !doClipping ? 0 : calculateRightClipping(readEnd, pathBases, readBases,pathSizes);
View Full Code Here


     */
    public AssemblyResultSet() {
        assemblyResultByKmerSize = new LinkedHashMap<>(4);
        haplotypes = new LinkedHashSet<>(10);
        assemblyResultByHaplotype = new LinkedHashMap<>(10);
        kmerSizes = new CountSet(4);
    }
View Full Code Here

        int index = currentVertex.getSequence().length - 1;
        nonAnchorableDueToRepeats[index] = !sourceIsAnchorable;


        // We keep record on all alternative path lengths:
        final CountSet pathLengths = new CountSet(haplotypes.size());
        pathLengths.setTo(0);

        // Now we go through the reference path and determine which vertices are not part of event block.
        // We keep track of open divergent paths in expectedRejoins. Thus only those vertices traversed
        // when exptectedRejoins size 0 can be anchorable:
        while (currentVertex != null) {
View Full Code Here

        depths.add(prefixSizes);

        final Set<MultiDeBruijnVertex> visited = new HashSet<>();
        if (!exhaustive) visited.add(startVertex);
        while (!queue.isEmpty()) {
            final CountSet depth = depths.remove();
            final MultiDeBruijnVertex v = queue.remove();
            if (referenceVertices.contains(v)) {
                if (referenceWithinBoundaries.contains(v)) {
                    final CountSet previous = expectedRejoins.get(v);
                    if (previous == null)
                        expectedRejoins.put(v, depth.clone());
                    else
                        previous.addAll(depth);
                }
            } else {
                final CountSet depthPlusOne = depth.clone();
                depthPlusOne.incAll(1);
                final Set<MultiSampleEdge> nextEdges = backwards ? incomingEdgesOf(v) : outgoingEdgesOf(v);
                for (final MultiSampleEdge e : nextEdges) {
                    final MultiDeBruijnVertex w = backwards ? getEdgeSource(e) : getEdgeTarget(e);
                    if (visited.contains(w)) // avoid repetitive work.
                        continue;
View Full Code Here

            final ReadAnchoring anchoring, final boolean backwards,
            final MultiDeBruijnVertex leftVertex, final MultiDeBruijnVertex rightVertex) {

        MultiDeBruijnVertex currentVertex = backwards ? rightVertex : leftVertex;
        boolean foundEvent = false;
        final CountSet pathSizes = new CountSet(10); // typically more than enough.
        pathSizes.setTo(0);

        // Map between reference vertices where there is some expected open alternative path rejoining and the
        // predicted length of paths rejoining at that point counting from the beginning of the block.
        final Map<MultiDeBruijnVertex, CountSet> expectedAlternativePathRejoins = new HashMap<>(4);

        // Keeps record of possible left-clipping veritces; those that are located before any event path furcation
        // has been found. The value indicates the blockLength at the time we traverse that node.
        final Deque<Pair<MultiDeBruijnVertex, Integer>> possibleClippingPoints = new LinkedList<>();

        // We keep the distance from the beggining of the block (leftVertex).
        int blockLength = 0;
        while (currentVertex != null) {
            int openingDegree = backwards ? graph.outDegreeOf(currentVertex) : graph.inDegreeOf(currentVertex);
            if (openingDegree > 1) {
                final CountSet joiningPathLengths = expectedAlternativePathRejoins.remove(currentVertex);
                if (joiningPathLengths != null)
                    pathSizes.addAll(joiningPathLengths);
            }
            final boolean isValidBlockEnd = isValidBlockEnd(anchoring, currentVertex, expectedAlternativePathRejoins);
            if (foundEvent && isValidBlockEnd) // !gotcha we found a valid block end.
View Full Code Here

        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;
    }
View Full Code Here

            final ReadAnchoring anchoring, final boolean backwards,
            final MultiDeBruijnVertex leftVertex, final MultiDeBruijnVertex rightVertex) {

        MultiDeBruijnVertex currentVertex = backwards ? rightVertex : leftVertex;
        boolean foundEvent = false;
        final CountSet pathSizes = new CountSet(10); // typically more than enough.
        pathSizes.setTo(0);

        // Map between reference vertices where there is some expected open alternative path rejoining and the
        // predicted length of paths rejoining at that point counting from the beginning of the block.
        final Map<MultiDeBruijnVertex, CountSet> expectedAlternativePathRejoins = new HashMap<>(4);

        // Keeps record of possible left-clipping veritces; those that are located before any event path furcation
        // has been found. The value indicates the blockLength at the time we traverse that node.
        final Deque<Pair<MultiDeBruijnVertex, Integer>> possibleClippingPoints = new LinkedList<>();

        // We keep the distance from the beggining of the block (leftVertex).
        int blockLength = 0;
        while (currentVertex != null) {
            int openingDegree = backwards ? graph.outDegreeOf(currentVertex) : graph.inDegreeOf(currentVertex);
            if (openingDegree > 1) {
                final CountSet joiningPathLengths = expectedAlternativePathRejoins.remove(currentVertex);
                if (joiningPathLengths != null)
                    pathSizes.addAll(joiningPathLengths);
            }
            final boolean isValidBlockEnd = isValidBlockEnd(anchoring, currentVertex, expectedAlternativePathRejoins);
            if (foundEvent && isValidBlockEnd) // !gotcha we found a valid block end.
View Full Code Here

        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;
    }
View Full Code Here

TOP

Related Classes of org.broadinstitute.gatk.utils.collections.CountSet$MyIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.