Search in sources :

Example 16 with PileupElement

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

the class PileupSpark method createVerboseOutput.

private static String createVerboseOutput(final ReadPileup pileup) {
    final StringBuilder sb = new StringBuilder();
    boolean isFirst = true;
    sb.append(pileup.getNumberOfElements(PileupElement::isDeletion));
    sb.append(" ");
    for (final PileupElement p : pileup) {
        if (isFirst) {
            isFirst = false;
        } else {
            sb.append(",");
        }
        sb.append(p.getRead().getName());
        sb.append(VERBOSE_DELIMITER);
        sb.append(p.getOffset());
        sb.append(VERBOSE_DELIMITER);
        sb.append(p.getRead().getLength());
        sb.append(VERBOSE_DELIMITER);
        sb.append(p.getRead().getMappingQuality());
    }
    return sb.toString();
}
Also used : PileupElement(org.broadinstitute.hellbender.utils.pileup.PileupElement)

Example 17 with PileupElement

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

the class LocusIteratorByStateUnitTest method testIndelLengthAndBasesTest.

@Test(enabled = true, dataProvider = "IndelLengthAndBasesTest")
public void testIndelLengthAndBasesTest(final GATKRead read, final CigarOperator op, final int eventSize, final String eventBases) {
    // create the iterator by state with the fake reads and fake records
    final LocusIteratorByState li;
    li = makeLIBS(Arrays.asList(read), null, false, header);
    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");
}
Also used : PileupElement(org.broadinstitute.hellbender.utils.pileup.PileupElement) Test(org.testng.annotations.Test)

Aggregations

PileupElement (org.broadinstitute.hellbender.utils.pileup.PileupElement)17 GATKRead (org.broadinstitute.hellbender.utils.read.GATKRead)10 ReadPileup (org.broadinstitute.hellbender.utils.pileup.ReadPileup)7 Test (org.testng.annotations.Test)7 AlignmentContext (org.broadinstitute.hellbender.engine.AlignmentContext)5 VisibleForTesting (com.google.common.annotations.VisibleForTesting)3 SAMFileHeader (htsjdk.samtools.SAMFileHeader)3 CigarOperator (htsjdk.samtools.CigarOperator)2 Locatable (htsjdk.samtools.util.Locatable)2 SimpleInterval (org.broadinstitute.hellbender.utils.SimpleInterval)2 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)2 SAMReadGroupRecord (htsjdk.samtools.SAMReadGroupRecord)1 java.util (java.util)1 LinkedHashMap (java.util.LinkedHashMap)1 NGSPlatform (org.broadinstitute.hellbender.utils.NGSPlatform)1 QualityUtils (org.broadinstitute.hellbender.utils.QualityUtils)1 Utils (org.broadinstitute.hellbender.utils.Utils)1 DownsampleType (org.broadinstitute.hellbender.utils.downsampling.DownsampleType)1 DownsamplingMethod (org.broadinstitute.hellbender.utils.downsampling.DownsamplingMethod)1 ArtificialBAMBuilder (org.broadinstitute.hellbender.utils.read.ArtificialBAMBuilder)1