Search in sources :

Example 6 with KBestHaplotype

use of org.broadinstitute.hellbender.tools.walkers.haplotypecaller.graphs.KBestHaplotype in project gatk-protected by broadinstitute.

the class ReadThreadingAssemblerUnitTest method testSingleIndelAsDoubleIndel3Reads.

@Test
public void testSingleIndelAsDoubleIndel3Reads() {
    final TestAssembler assembler = new TestAssembler(25);
    // The single indel spans two repetitive structures
    final String ref = "GTTTTTCCTAGGCAAATGGTTTCTATAAAATTATGTGTGTGTGTCTCTCTCTGTGTGTGTGTGTGTGTGTGTGTGTATACCTAATCTCACACTCTTTTTTCTGG";
    final String read1 = "GTTTTTCCTAGGCAAATGGTTTCTATAAAATTATGTGTGTGTGTCTCT----------GTGTGTGTGTGTGTGTGTATACCTAATCTCACACTCTTTTTTCTGG";
    final String read2 = "GTTTTTCCTAGGCAAATGGTTTCTATAAAATTATGTGTGTGTGTCTCT----------GTGTGTGTGTGTGTGTGTATACCTAATCTCACACTCTTTTTTCTGG";
    assembler.addSequence(ReadThreadingGraphUnitTest.getBytes(ref), true);
    assembler.addSequence(ReadThreadingGraphUnitTest.getBytes(read1), false);
    assembler.addSequence(ReadThreadingGraphUnitTest.getBytes(read2), false);
    final SeqGraph graph = assembler.assemble();
    final List<KBestHaplotype> paths = new KBestHaplotypeFinder(graph);
    Assert.assertEquals(paths.size(), 2);
    final byte[] refPath = paths.get(0).bases().length == ref.length() ? paths.get(0).bases() : paths.get(1).bases();
    final byte[] altPath = paths.get(0).bases().length == ref.length() ? paths.get(1).bases() : paths.get(0).bases();
    Assert.assertEquals(refPath, ReadThreadingGraphUnitTest.getBytes(ref));
    Assert.assertEquals(altPath, ReadThreadingGraphUnitTest.getBytes(read1));
}
Also used : KBestHaplotype(org.broadinstitute.hellbender.tools.walkers.haplotypecaller.graphs.KBestHaplotype) SeqGraph(org.broadinstitute.hellbender.tools.walkers.haplotypecaller.graphs.SeqGraph) KBestHaplotypeFinder(org.broadinstitute.hellbender.tools.walkers.haplotypecaller.graphs.KBestHaplotypeFinder) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 7 with KBestHaplotype

use of org.broadinstitute.hellbender.tools.walkers.haplotypecaller.graphs.KBestHaplotype in project gatk by broadinstitute.

the class ReadThreadingAssemblerUnitTest method assertSingleBubble.

private void assertSingleBubble(final TestAssembler assembler, final String one, final String two) {
    final SeqGraph graph = assembler.assemble();
    graph.simplifyGraph();
    final List<KBestHaplotype> paths = new KBestHaplotypeFinder(graph);
    Assert.assertEquals(paths.size(), 2);
    final Set<String> expected = new HashSet<>(Arrays.asList(one, two));
    for (final KBestHaplotype path : paths) {
        final String seq = new String(path.bases());
        Assert.assertTrue(expected.contains(seq));
        expected.remove(seq);
    }
}
Also used : KBestHaplotype(org.broadinstitute.hellbender.tools.walkers.haplotypecaller.graphs.KBestHaplotype) SeqGraph(org.broadinstitute.hellbender.tools.walkers.haplotypecaller.graphs.SeqGraph) KBestHaplotypeFinder(org.broadinstitute.hellbender.tools.walkers.haplotypecaller.graphs.KBestHaplotypeFinder)

Example 8 with KBestHaplotype

use of org.broadinstitute.hellbender.tools.walkers.haplotypecaller.graphs.KBestHaplotype in project gatk by broadinstitute.

the class ReadThreadingAssemblerUnitTest method testSingleIndelAsDoubleIndel3Reads.

@Test
public void testSingleIndelAsDoubleIndel3Reads() {
    final TestAssembler assembler = new TestAssembler(25);
    // The single indel spans two repetitive structures
    final String ref = "GTTTTTCCTAGGCAAATGGTTTCTATAAAATTATGTGTGTGTGTCTCTCTCTGTGTGTGTGTGTGTGTGTGTGTGTATACCTAATCTCACACTCTTTTTTCTGG";
    final String read1 = "GTTTTTCCTAGGCAAATGGTTTCTATAAAATTATGTGTGTGTGTCTCT----------GTGTGTGTGTGTGTGTGTATACCTAATCTCACACTCTTTTTTCTGG";
    final String read2 = "GTTTTTCCTAGGCAAATGGTTTCTATAAAATTATGTGTGTGTGTCTCT----------GTGTGTGTGTGTGTGTGTATACCTAATCTCACACTCTTTTTTCTGG";
    assembler.addSequence(ReadThreadingGraphUnitTest.getBytes(ref), true);
    assembler.addSequence(ReadThreadingGraphUnitTest.getBytes(read1), false);
    assembler.addSequence(ReadThreadingGraphUnitTest.getBytes(read2), false);
    final SeqGraph graph = assembler.assemble();
    final List<KBestHaplotype> paths = new KBestHaplotypeFinder(graph);
    Assert.assertEquals(paths.size(), 2);
    final byte[] refPath = paths.get(0).bases().length == ref.length() ? paths.get(0).bases() : paths.get(1).bases();
    final byte[] altPath = paths.get(0).bases().length == ref.length() ? paths.get(1).bases() : paths.get(0).bases();
    Assert.assertEquals(refPath, ReadThreadingGraphUnitTest.getBytes(ref));
    Assert.assertEquals(altPath, ReadThreadingGraphUnitTest.getBytes(read1));
}
Also used : KBestHaplotype(org.broadinstitute.hellbender.tools.walkers.haplotypecaller.graphs.KBestHaplotype) SeqGraph(org.broadinstitute.hellbender.tools.walkers.haplotypecaller.graphs.SeqGraph) KBestHaplotypeFinder(org.broadinstitute.hellbender.tools.walkers.haplotypecaller.graphs.KBestHaplotypeFinder) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Aggregations

KBestHaplotype (org.broadinstitute.hellbender.tools.walkers.haplotypecaller.graphs.KBestHaplotype)8 KBestHaplotypeFinder (org.broadinstitute.hellbender.tools.walkers.haplotypecaller.graphs.KBestHaplotypeFinder)8 SeqGraph (org.broadinstitute.hellbender.tools.walkers.haplotypecaller.graphs.SeqGraph)8 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)6 Test (org.testng.annotations.Test)6 SAMFileHeader (htsjdk.samtools.SAMFileHeader)2 SeqVertex (org.broadinstitute.hellbender.tools.walkers.haplotypecaller.graphs.SeqVertex)2 GATKRead (org.broadinstitute.hellbender.utils.read.GATKRead)2