Examples of Kmer


Examples of org.broadinstitute.gatk.tools.walkers.haplotypecaller.Kmer

        assembler.addSequence("anonymous", getBytes(ref), true);
        assembler.addSequence("anonymous", getBytes(alt), false);
        assembler.buildGraphIfNecessary();
        Assert.assertNotEquals(ref.length() - 11 + 1,assembler.vertexSet().size(),"the number of vertex in the graph is the same as if there was no alternative sequence");
        Assert.assertEquals(ref.length() - 11 + 1 + 11,assembler.vertexSet().size(),"the number of vertex in the graph is not the same as if there is an alternative sequence");
        MultiDeBruijnVertex startAlt = assembler.findKmer(new Kmer(alt.getBytes(),20,11));
        Assert.assertNotNull(startAlt);
    }
View Full Code Here

Examples of org.broadinstitute.gatk.tools.walkers.haplotypecaller.Kmer

        parentVertices.addAll(incomingVerticesOf(vertexToKeep));
        for (final MultiDeBruijnVertex p : parentVertices)
            if (--pendingChildrenCounts[indexByVertex.get(p)] == 0)
                ready.add(p);

        final Kmer mergedKmer = new Kmer(sequence);
        if (uniqueKmers.containsKey(mergedKmer)) {
            uniqueKmersToUpdate.add(new Kmer(mergedKmer.bases().clone()));
            uniqueKmers.remove(mergedKmer);
        }
        boolean foundMergedVertex = false;
        for (final MultiDeBruijnVertex v : vertices)
            if (v == vertexToKeep)
                foundMergedVertex = true;
            else {
                final byte[] seq = v.getSequence();
                final Kmer kmer = new Kmer(seq);
                if (uniqueKmers.containsKey(kmer)) {
                    uniqueKmersToUpdate.add(kmer);
                    uniqueKmers.remove(kmer);
                }
                if (sequence.length != seq.length) throw new IllegalArgumentException("mismatched sizes " + sequence.length + " != "
View Full Code Here

Examples of org.broadinstitute.gatk.tools.walkers.haplotypecaller.Kmer

        if ( debugGraphTransformations ) startingVertex.addRead(seqForKmers.name);

        // keep track of information about the reference source
        if ( seqForKmers.isRef ) {
            if ( refSource != null ) throw new IllegalStateException("Found two refSources! prev: " + refSource + ", new: " + startingVertex);
            refSource = new Kmer(seqForKmers.sequence, seqForKmers.start, kmerSize);
        }

        // loop over all of the bases in sequence, extending the graph by one base at each point, as appropriate
        MultiDeBruijnVertex vertex = startingVertex;
        for ( int i = uniqueStartPos + 1; i <= seqForKmers.stop - kmerSize; i++ ) {
View Full Code Here

Examples of org.broadinstitute.gatk.tools.walkers.haplotypecaller.Kmer

    protected int findStart(final SequenceForKmers seqForKmers) {
        if ( seqForKmers.isRef )
            return 0;

        for ( int i = seqForKmers.start; i < seqForKmers.stop - kmerSize; i++ ) {
            final Kmer kmer1 = new Kmer(seqForKmers.sequence, i, kmerSize);
            if ( isThreadingStart(kmer1) )
                return i;
        }

        return -1;
View Full Code Here

Examples of org.broadinstitute.gatk.tools.walkers.haplotypecaller.Kmer

    @Override
    public boolean removeVertex(MultiDeBruijnVertex V) {
        final boolean result = super.removeVertex(V);
        if (result) {
            final byte[] sequence = V.getSequence();
            final Kmer kmer = new Kmer(sequence);
            uniqueKmers.remove(kmer);
        }
        return result;
    }
View Full Code Here

Examples of org.broadinstitute.gatk.tools.walkers.haplotypecaller.Kmer

    static protected Collection<Kmer> determineNonUniqueKmers(final SequenceForKmers seqForKmers, final int kmerSize) {
        // count up occurrences of kmers within each read
        final KMerCounter counter = new KMerCounter(kmerSize);
        final int stopPosition = seqForKmers.stop - kmerSize;
        for ( int i = 0; i <= stopPosition; i++ ) {
            final Kmer kmer = new Kmer(seqForKmers.sequence, i, kmerSize);
            counter.addKmer(kmer, 1);
        }

        return counter.getKmersWithCountsAtLeast(2);
    }
View Full Code Here

Examples of org.broadinstitute.gatk.tools.walkers.haplotypecaller.Kmer

     * @param sequence the sequence
     * @param start the position of the kmer start
     * @return a non-null vertex
     */
    private MultiDeBruijnVertex getOrCreateKmerVertex(final byte[] sequence, final int start) {
        final Kmer kmer = new Kmer(sequence, start, kmerSize);
        final MultiDeBruijnVertex vertex = getUniqueKmerVertex(kmer, true);
        return ( vertex != null ) ? vertex : createVertex(kmer);
    }
View Full Code Here

Examples of org.broadinstitute.gatk.tools.walkers.haplotypecaller.Kmer

                return target;
            }
        }

        // none of our outgoing edges had our unique suffix base, so we check for an opportunity to merge back in
        final Kmer kmer = new Kmer(sequence, kmerStart, kmerSize);
        final MultiDeBruijnVertex uniqueMergeVertex = getUniqueKmerVertex(kmer, false);

        if ( isRef && uniqueMergeVertex != null )
            throw new IllegalStateException("Found a unique vertex to merge into the reference graph " + prevVertex + " -> " + uniqueMergeVertex);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.