Package org.broadinstitute.gatk.engine.contexts

Examples of org.broadinstitute.gatk.engine.contexts.AlignmentContext


        // create the iterator by state with the fake reads and fake records
        li = makeLTBS(reads,readAttributes);

        boolean foundIndel = false;
        while (li.hasNext()) {
            AlignmentContext context = li.next();
            ReadBackedPileup pileup = context.getBasePileup().getBaseFilteredPileup(10);
            for (PileupElement p : pileup) {
                if (p.isBeforeInsertion()) {
                    foundIndel = true;
                    Assert.assertEquals(p.getLengthOfImmediatelyFollowingIndel(), 2, "Wrong event length");
                    Assert.assertEquals(p.getBasesOfImmediatelyFollowingInsertion(), "CT", "Inserted bases are incorrect");
View Full Code Here


        li = makeLTBS(reads, readAttributes);

        // Traditionally, reads that end with indels bleed into the pileup at the following locus.  Verify that the next pileup contains this read
        // and considers it to be an indel-containing read.
        Assert.assertTrue(li.hasNext(),"Should have found a whole-indel read in the normal base pileup without extended events enabled");
        AlignmentContext alignmentContext = li.next();
        Assert.assertEquals(alignmentContext.getLocation().getStart(), firstLocus, "Base pileup is at incorrect location.");
        ReadBackedPileup basePileup = alignmentContext.getBasePileup();
        Assert.assertEquals(basePileup.getReads().size(),1,"Pileup is of incorrect size");
        Assert.assertSame(basePileup.getReads().get(0), indelOnlyRead, "Read in pileup is incorrect");
    }
View Full Code Here

        li = makeLTBS(reads, createTestReadProperties());
        int currentLocus = firstLocus;
        int numAlignmentContextsFound = 0;

        while(li.hasNext()) {
            AlignmentContext alignmentContext = li.next();
            Assert.assertEquals(alignmentContext.getLocation().getStart(),currentLocus,"Current locus returned by alignment context is incorrect");

            if(currentLocus == firstLocus) {
                List<GATKSAMRecord> readsAtLocus = alignmentContext.getBasePileup().getReads();
                Assert.assertEquals(readsAtLocus.size(),1,"Wrong number of reads at locus " + currentLocus);
                Assert.assertSame(readsAtLocus.get(0),leadingRead,"leadingRead absent from pileup at locus " + currentLocus);
            }
            else if(currentLocus == secondLocus) {
                List<GATKSAMRecord> readsAtLocus = alignmentContext.getBasePileup().getReads();
                Assert.assertEquals(readsAtLocus.size(),1,"Wrong number of reads at locus " + currentLocus);
                Assert.assertSame(readsAtLocus.get(0),fullMatchAfterIndel,"fullMatchAfterIndel absent from pileup at locus " + currentLocus);
            }

            currentLocus++;
View Full Code Here

        // create the iterator by state with the fake reads and fake records
        li = makeLTBS(reads, createTestReadProperties());

        while(li.hasNext()) {
            AlignmentContext alignmentContext = li.next();
            ReadBackedPileup p = alignmentContext.getBasePileup();
            Assert.assertTrue(p.getNumberOfElements() == 1);
            // TODO -- fix tests
//            PileupElement pe = p.iterator().next();
//            Assert.assertTrue(pe.isBeforeInsertion());
//            Assert.assertFalse(pe.isAfterInsertion());
//            Assert.assertEquals(pe.getBasesOfImmediatelyFollowingInsertion(), "A");
        }

        GATKSAMRecord read2 = ArtificialSAMUtils.createArtificialRead(header,"read2",0,secondLocus,10);
        read2.setReadBases(Utils.dupBytes((byte) 'A', 10));
        read2.setBaseQualities(Utils.dupBytes((byte) '@', 10));
        read2.setCigarString("10I");

        reads = Arrays.asList(read2);

        // create the iterator by state with the fake reads and fake records
        li = makeLTBS(reads, createTestReadProperties());

        while(li.hasNext()) {
            AlignmentContext alignmentContext = li.next();
            ReadBackedPileup p = alignmentContext.getBasePileup();
            Assert.assertTrue(p.getNumberOfElements() == 1);
            // TODO -- fix tests
//            PileupElement pe = p.iterator().next();
//            Assert.assertTrue(pe.isBeforeInsertion());
//            Assert.assertFalse(pe.isAfterInsertion());
View Full Code Here

        int bpVisited = 0;
        int lastOffset = 0;
        while ( li.hasNext() ) {
            bpVisited++;

            AlignmentContext alignmentContext = li.next();
            ReadBackedPileup p = alignmentContext.getBasePileup();
            Assert.assertEquals(p.getNumberOfElements(), 1);
            PileupElement pe = p.iterator().next();

            Assert.assertEquals(p.getNumberOfDeletions(), pe.isDeletion() ? 1 : 0, "wrong number of deletions in the pileup");
            Assert.assertEquals(p.getNumberOfMappingQualityZeroReads(), pe.getRead().getMappingQuality() == 0 ? 1 : 0, "wront number of mapq reads in the pileup");
View Full Code Here

        final Set<GATKSAMRecord> seenSoFar = new HashSet<GATKSAMRecord>();
        final Set<GATKSAMRecord> keptReads = new HashSet<GATKSAMRecord>();
        int bpVisited = 0;
        while ( li.hasNext() ) {
            bpVisited++;
            final AlignmentContext alignmentContext = li.next();
            final ReadBackedPileup p = alignmentContext.getBasePileup();

            AssertWellOrderedPileup(p);

            if ( downsample ) {
                // just not a safe test
                //Assert.assertTrue(p.getNumberOfElements() <= maxDownsampledCoverage * nSamples, "Too many reads at locus after downsampling");
            } else {
                final int minPileupSize = nReadsPerLocus * nSamples;
                Assert.assertTrue(p.getNumberOfElements() >= minPileupSize);
            }

            // the number of reads starting here
            int nReadsStartingHere = 0;
            for ( final GATKSAMRecord read : p.getReads() )
                if ( read.getAlignmentStart() == alignmentContext.getPosition() )
                    nReadsStartingHere++;

            // we can have no more than maxDownsampledCoverage per sample
            final int maxCoveragePerLocus = downsample ? downsampleTo : nReadsPerLocus;
            Assert.assertTrue(nReadsStartingHere <= maxCoveragePerLocus * nSamples);
 
View Full Code Here

                createTestReadProperties(downsampler, false),
                genomeLocParser,
                samples);

        while ( li.hasNext() ) {
            final AlignmentContext next = li.next();
            Assert.assertTrue(next.getBasePileup().getNumberOfElements() <= downsampleTo, "Too many elements in pileup " + next);
            // TODO -- assert that there are <= X reads in memory after GC for some X
        }
    }
View Full Code Here

                LocusIteratorByState.sampleListForSAMWithoutReadGroups());

        int expectedPos = read.getAlignmentStart() + nClipsOnLeft;
        int nPileups = 0;
        while ( li.hasNext() ) {
            final AlignmentContext next = li.next();
            Assert.assertEquals(next.getLocation().getStart(), expectedPos);
            nPileups++;
            expectedPos++;
        }

        final int nExpectedPileups = nReadContainingPileups;
View Full Code Here

                            LocusIteratorByStateBaseTest.createTestReadProperties(),
                            genomeLocParser,
                            LocusIteratorByState.sampleListForSAMWithoutReadGroups());

            while ( libs.hasNext() ) {
                AlignmentContext context = libs.next();
            }
        }
    }
View Full Code Here

            if( expectedReadsAtSite < 1 )
                continue;

            Assert.assertTrue(coveredLocusView.hasNext(),"Incorrect number of loci in view");

            AlignmentContext locusContext = coveredLocusView.next();
            Assert.assertEquals(locusContext.getLocation(), site, "Target locus context location is incorrect");
            Assert.assertEquals(locusContext.getReads().size(), expectedReadsAtSite, "Found wrong number of reads at site");

            for( GATKSAMRecord read: reads ) {
                if(genomeLocParser.createGenomeLoc(read).containsP(locusContext.getLocation()))
                    Assert.assertTrue(locusContext.getReads().contains(read),"Target locus context does not contain reads");
            }
        }

        Assert.assertFalse(coveredLocusView.hasNext(),"Iterator is not bounded at boundaries of shard");
    }       
View Full Code Here

TOP

Related Classes of org.broadinstitute.gatk.engine.contexts.AlignmentContext

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.