Search in sources :

Example 36 with ReadPileup

use of org.broadinstitute.hellbender.utils.pileup.ReadPileup in project gatk by broadinstitute.

the class LocusIteratorByStateUnitTest method testXandEQOperators.

@Test
public void testXandEQOperators() {
    final byte[] bases1 = { 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A' };
    final byte[] bases2 = { 'A', 'A', 'A', 'C', 'A', 'A', 'A', 'A', 'A', 'C' };
    final GATKRead r1 = ArtificialReadUtils.createArtificialRead(header, "r1", 0, 1, 10);
    r1.setBases(bases1);
    r1.setBaseQualities(new byte[] { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 });
    r1.setCigar("10M");
    final GATKRead r2 = ArtificialReadUtils.createArtificialRead(header, "r2", 0, 1, 10);
    r2.setBases(bases2);
    r2.setBaseQualities(new byte[] { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 });
    r2.setCigar("3=1X5=1X");
    final GATKRead r3 = ArtificialReadUtils.createArtificialRead(header, "r3", 0, 1, 10);
    r3.setBases(bases2);
    r3.setBaseQualities(new byte[] { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 });
    r3.setCigar("3=1X5M1X");
    final GATKRead r4 = ArtificialReadUtils.createArtificialRead(header, "r4", 0, 1, 10);
    r4.setBases(bases2);
    r4.setBaseQualities(new byte[] { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 });
    r4.setCigar("10M");
    final List<GATKRead> reads = Arrays.asList(r1, r2, r3, r4);
    // create the iterator by state with the fake reads and fake records
    final LocusIteratorByState li;
    li = makeLIBS(reads, header);
    while (li.hasNext()) {
        final AlignmentContext context = li.next();
        final ReadPileup pileup = context.getBasePileup();
        Assert.assertEquals(pileup.size(), 4);
    }
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) AlignmentContext(org.broadinstitute.hellbender.engine.AlignmentContext) ReadPileup(org.broadinstitute.hellbender.utils.pileup.ReadPileup) Test(org.testng.annotations.Test)

Aggregations

ReadPileup (org.broadinstitute.hellbender.utils.pileup.ReadPileup)36 GATKRead (org.broadinstitute.hellbender.utils.read.GATKRead)24 Test (org.testng.annotations.Test)19 AlignmentContext (org.broadinstitute.hellbender.engine.AlignmentContext)14 SimpleInterval (org.broadinstitute.hellbender.utils.SimpleInterval)13 SAMFileHeader (htsjdk.samtools.SAMFileHeader)11 Locatable (htsjdk.samtools.util.Locatable)11 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)9 PileupElement (org.broadinstitute.hellbender.utils.pileup.PileupElement)7 java.util (java.util)5 VariantContext (htsjdk.variant.variantcontext.VariantContext)4 Collectors (java.util.stream.Collectors)4 SAMReadGroupRecord (htsjdk.samtools.SAMReadGroupRecord)3 FeatureContext (org.broadinstitute.hellbender.engine.FeatureContext)3 ReferenceContext (org.broadinstitute.hellbender.engine.ReferenceContext)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 CigarOperator (htsjdk.samtools.CigarOperator)2 htsjdk.variant.variantcontext (htsjdk.variant.variantcontext)2 htsjdk.variant.vcf (htsjdk.variant.vcf)2 VCFConstants (htsjdk.variant.vcf.VCFConstants)2