Package org.broadinstitute.gatk.utils.pileup

Examples of org.broadinstitute.gatk.utils.pileup.PileupElement


    }

    public ReadBackedPileup createBAQedPileup( final ReadBackedPileup pileup ) {
        final List<PileupElement> BAQedElements = new ArrayList<PileupElement>();
        for( final PileupElement PE : pileup ) {
            final PileupElement newPE = new SNPGenotypeLikelihoodsCalculationModel.BAQedPileupElement( PE );
            BAQedElements.add( newPE );
        }
        return new ReadBackedPileupImpl( pileup.getLocation(), BAQedElements );
    }
View Full Code Here


    }

    public ReadBackedPileup createBAQedPileup( final ReadBackedPileup pileup ) {
        final List<PileupElement> BAQedElements = new ArrayList<PileupElement>();
        for( final PileupElement PE : pileup ) {
            final PileupElement newPE = new BAQedPileupElement( PE );
            BAQedElements.add( newPE );
        }
        return new ReadBackedPileupImpl( pileup.getLocation(), BAQedElements );
    }
View Full Code Here

        return add(obsBase, qual, (byte)0, (byte)0, 1);
    }

    public int add(List<PileupElement> overlappingPair, boolean ignoreBadBases, boolean capBaseQualsAtMappingQual, int minBaseQual) {
        final PileupElement p1 = overlappingPair.get(0);
        final PileupElement p2 = overlappingPair.get(1);

        final byte observedBase1 = p1.getBase();
        final byte qualityScore1 = qualToUse(p1, ignoreBadBases, capBaseQualsAtMappingQual, minBaseQual);
        final byte observedBase2 = p2.getBase();
        final byte qualityScore2 = qualToUse(p2, ignoreBadBases, capBaseQualsAtMappingQual, minBaseQual);

        if ( qualityScore1 == 0 ) {
            if ( qualityScore2 == 0 ) // abort early if we didn't see any good bases
                return 0;
View Full Code Here

    public void testBiasedDownsampling(final SAMFileHeader header, final int originalCount, final int toRemove) {

        final LinkedList<PileupElement> elements = new LinkedList<>();
        for ( int i = 0; i < originalCount; i++ ) {
            final GATKSAMRecord read = ArtificialSAMUtils.createArtificialRead(header, "read", 0, 1, 1);
            elements.add(new PileupElement(read, 0, new CigarElement(1, CigarOperator.M), 0, 0));
        }

        final List<PileupElement> result = AlleleBiasedDownsamplingUtils.downsampleElements(elements, originalCount, toRemove);

        Assert.assertEquals(result.size(), toRemove);
View Full Code Here

                for (PileupElement e : fpile.getSingletonReads())
                    if (countElement(e, minMapQ, maxMapQ, minBaseQ, maxBaseQ))
                        countPileup.add(e);

                for (List<PileupElement> overlappingPair : fpile.getOverlappingPairs()) {
                    PileupElement firstElem = null;
                    PileupElement addElem = null;

                    // iterate over all elements in fragment:
                    for (PileupElement e : overlappingPair) {
                        if (firstElem == null)
                            firstElem = e;
View Full Code Here

        // create the iterator by state with the fake reads and fake records
        li = makeLTBS(Arrays.asList((GATKSAMRecord)read), createTestReadProperties());

        Assert.assertTrue(li.hasNext());

        final PileupElement firstMatch = getFirstPileupElement(li.next());

        Assert.assertEquals(firstMatch.getLengthOfImmediatelyFollowingIndel(), 0, "Length != 0 for site not adjacent to indel");
        Assert.assertEquals(firstMatch.getBasesOfImmediatelyFollowingInsertion(), null, "Getbases of following event should be null at non-adajenct event");

        Assert.assertTrue(li.hasNext());

        final PileupElement pe = getFirstPileupElement(li.next());

        if ( op == CigarOperator.D )
            Assert.assertTrue(pe.isBeforeDeletionStart());
        else
            Assert.assertTrue(pe.isBeforeInsertion());

        Assert.assertEquals(pe.getLengthOfImmediatelyFollowingIndel(), eventSize, "Length of event failed");
        Assert.assertEquals(pe.getBasesOfImmediatelyFollowingInsertion(), eventBases, "Getbases of following event failed");
    }
View Full Code Here

            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");

            tester.stepForwardOnGenome();

            if ( ! hasNeighboringPaddedOps(params.getElements(), pe.getCurrentCigarOffset()) ) {
                Assert.assertEquals(pe.isBeforeDeletionStart(), tester.isBeforeDeletionStart, "before deletion start failure");
                Assert.assertEquals(pe.isAfterDeletionEnd(), tester.isAfterDeletionEnd, "after deletion end failure");
            }

            Assert.assertEquals(pe.isBeforeInsertion(), tester.isBeforeInsertion, "before insertion failure");
            Assert.assertEquals(pe.isAfterInsertion(), tester.isAfterInsertion, "after insertion failure");
            Assert.assertEquals(pe.isNextToSoftClip(), tester.isNextToSoftClip, "next to soft clip failure");

            Assert.assertTrue(pe.getOffset() >= lastOffset, "Somehow read offsets are decreasing: lastOffset " + lastOffset + " current " + pe.getOffset());
            Assert.assertEquals(pe.getOffset(), tester.getCurrentReadOffset(), "Read offsets are wrong at " + bpVisited);

            Assert.assertEquals(pe.getCurrentCigarElement(), read.getCigar().getCigarElement(tester.currentOperatorIndex), "CigarElement index failure");
            Assert.assertEquals(pe.getOffsetInCurrentCigar(), tester.getCurrentPositionOnOperatorBase0(), "CigarElement index failure");

            Assert.assertEquals(read.getCigar().getCigarElement(pe.getCurrentCigarOffset()), pe.getCurrentCigarElement(), "Current cigar element isn't what we'd get from the read itself");

            Assert.assertTrue(pe.getOffsetInCurrentCigar() >= 0, "Offset into current cigar too small");
            Assert.assertTrue(pe.getOffsetInCurrentCigar() < pe.getCurrentCigarElement().getLength(), "Offset into current cigar too big");

            Assert.assertEquals(pe.getOffset(), tester.getCurrentReadOffset(), "Read offset failure");
            lastOffset = pe.getOffset();
        }

        final int expectedBpToVisit = read.getAlignmentEnd() - read.getAlignmentStart() + 1;
        Assert.assertEquals(bpVisited, expectedBpToVisit, "Didn't visit the expected number of bp");
    }
View Full Code Here

     */
    @Ensures("result != null")
    public final PileupElement makePileupElement() {
        if ( isLeftEdge() || isRightEdge() )
            throw new IllegalStateException("Cannot make a pileup element from an edge alignment state");
        return new PileupElement(read,
                getReadOffset(),
                getCurrentCigarElement(),
                getCurrentCigarElementOffset(),
                getOffsetIntoCurrentCigarElement());
    }
View Full Code Here

TOP

Related Classes of org.broadinstitute.gatk.utils.pileup.PileupElement

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.