Package org.broadinstitute.gatk.utils

Examples of org.broadinstitute.gatk.utils.UnvalidatingGenomeLoc


        final Metrics noData = new Metrics(0.5, 0.0, 0.0, 0, 20);
        final Metrics unknown = new Metrics(0.5, 30.0, 120000.0, 2500, 20);

        final Metrics[] array = {unmappable, highGC, lowGC, unsequenceable, noData, unknown};

        final GenomeLoc testInterval = new UnvalidatingGenomeLoc("chr1", 0, 10000, 20000);
        final GenomeLoc smallInterval = new UnvalidatingGenomeLoc("chr1", 0, 1, 4);


        Assert.assertNotEquals(tool.checkMappability(unmappable), "");
        Assert.assertNotEquals(tool.checkGCContent(highGC), "");
        Assert.assertNotEquals(tool.checkGCContent(lowGC), "");
View Full Code Here


            Assert.assertEquals(tool.interpret(m, smallInterval), QualifyMissingIntervals.Interpretation.SMALL_INTERVAL.toString());
    }

    @Test(enabled = true)
    void testGetPositionInTarget () {
        final UnvalidatingGenomeLoc target = new UnvalidatingGenomeLoc("a", 0, 30, 50);
        final List<GenomeLoc> targets = new ObjectArrayList<>(1);
        targets.add(target);

        // left overlap
        UnvalidatingGenomeLoc interval = new UnvalidatingGenomeLoc("a", 0, 10, 50);
        Assert.assertEquals(QualifyMissingIntervals.getPositionInTarget(interval, targets), -20);

        // right overlap
        interval = new UnvalidatingGenomeLoc("a", 0, 40, 60);
        Assert.assertEquals(QualifyMissingIntervals.getPositionInTarget(interval, targets), -10);

        // interval > target with short right tail
        interval = new UnvalidatingGenomeLoc("a", 0, 10, 60);
        Assert.assertEquals(QualifyMissingIntervals.getPositionInTarget(interval, targets), -10);

        // interval > target with short left tail
        interval = new UnvalidatingGenomeLoc("a", 0, 10, 80);
        Assert.assertEquals(QualifyMissingIntervals.getPositionInTarget(interval, targets), -30);

        // interval < target with short right tail
        interval = new UnvalidatingGenomeLoc("a", 0, 32, 40);
        Assert.assertEquals(QualifyMissingIntervals.getPositionInTarget(interval, targets), 2);

        // interval < target with short left tail
        interval = new UnvalidatingGenomeLoc("a", 0, 40, 42);
        Assert.assertEquals(QualifyMissingIntervals.getPositionInTarget(interval, targets), 8);

        // no overlap
        interval = new UnvalidatingGenomeLoc("a", 0, 40, 42);
        Assert.assertEquals(QualifyMissingIntervals.getPositionInTarget(interval, new ObjectArrayList<GenomeLoc>()), Integer.MIN_VALUE);
    }
View Full Code Here

    @Test
    public void trimHaplotypesToNullAlleleTest() {
        // we need a case where start and stop > haplotype coordinates
        final int start = 100, stop = 100;
  final Haplotype h = new Haplotype(new byte[]{(byte)'A'}, new UnvalidatingGenomeLoc("1", 0, 10, 10));
  final Map<Allele, Haplotype> input = new HashMap<Allele, Haplotype>(1);
  input.put(Allele.create("A"), h);

  final Map<Allele, Haplotype> output = PairHMMIndelErrorModel.trimHaplotypes(input, start, stop, null);
        Assert.assertTrue(output.isEmpty());
View Full Code Here

     * Example testng test using MyDataProvider
     */
    @Test(dataProvider = "BlockSubstitutionsData")
    public void testBlockSubstitutionsData(final String refBases, final String haplotypeBases, final String cigar, final VariantContext expectedBlock) {
        final Haplotype hap = new Haplotype(haplotypeBases.getBytes(), false, 0, TextCigarCodec.getSingleton().decode(cigar));
        final GenomeLoc loc = new UnvalidatingGenomeLoc(CHR, 0, 1, refBases.length());
        final EventMap ee = new EventMap(hap, refBases.getBytes(), loc, NAME);
        ee.replaceClumpedEventsWithBlockSubstitutions();
        Assert.assertEquals(ee.getNumberOfEvents(), 1);
        final VariantContext actual = ee.getVariantContexts().iterator().next();
        Assert.assertTrue(GATKVariantContextUtils.equalSites(actual, expectedBlock), "Failed with " + actual);
View Full Code Here

     * Example testng test using MyDataProvider
     */
    @Test(dataProvider = "AdjacentSNPIndelTest")
    public void testAdjacentSNPIndelTest(final String refBases, final String haplotypeBases, final String cigar, final List<List<String>> expectedAlleles) {
        final Haplotype hap = new Haplotype(haplotypeBases.getBytes(), false, 0, TextCigarCodec.getSingleton().decode(cigar));
        final GenomeLoc loc = new UnvalidatingGenomeLoc(CHR, 0, 1, refBases.length());
        final EventMap ee = new EventMap(hap, refBases.getBytes(), loc, NAME);
        ee.replaceClumpedEventsWithBlockSubstitutions();
        Assert.assertEquals(ee.getNumberOfEvents(), expectedAlleles.size());
        final List<VariantContext> actuals = new ArrayList<VariantContext>(ee.getVariantContexts());
        for ( int i = 0; i < ee.getNumberOfEvents(); i++ ) {
View Full Code Here

    @DataProvider(name = "TrimmingData")
    public Object[][] makeTrimmingData() {
        List<Object[]> tests = new ArrayList<Object[]>();

        // this functionality can be adapted to provide input data for whatever you might want in your data
        final GenomeLoc loc = new UnvalidatingGenomeLoc("20", 0, 10, 20);
        final String fullBases = "ACGTAACCGGT";
        for ( int trimStart = loc.getStart(); trimStart < loc.getStop(); trimStart++ ) {
            for ( int trimStop = trimStart; trimStop <= loc.getStop(); trimStop++ ) {
                final int start = trimStart - loc.getStart();
                final int stop = start + (trimStop - trimStart) + 1;
                final GenomeLoc trimmedLoc = new UnvalidatingGenomeLoc("20", 0, start + loc.getStart(), stop + loc.getStart() - 1);
                final String expectedBases = fullBases.substring(start, stop);
                final Haplotype full = new Haplotype(fullBases.getBytes(), loc);
                final Haplotype trimmed = new Haplotype(expectedBases.getBytes(), trimmedLoc);

                final int hapStart = 10;
                full.setAlignmentStartHapwrtRef(hapStart);
                full.setCigar(TextCigarCodec.getSingleton().decode(full.length() + "M"));

                trimmed.setAlignmentStartHapwrtRef(hapStart + start);
                trimmed.setCigar(TextCigarCodec.getSingleton().decode(trimmed.length() + "M"));

                tests.add(new Object[]{full, trimmedLoc, trimmed});
            }
        }

        final Haplotype full = new Haplotype("ACT".getBytes(), new UnvalidatingGenomeLoc("20", 0, 10, 14));
        full.setAlignmentStartHapwrtRef(10);
        full.setCigar(TextCigarCodec.getSingleton().decode("1M2D2M"));
        tests.add(new Object[]{full, new UnvalidatingGenomeLoc("20", 0, 11, 12), null});
        tests.add(new Object[]{full, new UnvalidatingGenomeLoc("20", 0, 10, 12), null});
        tests.add(new Object[]{full, new UnvalidatingGenomeLoc("20", 0, 11, 13), null});

        return tests.toArray(new Object[][]{});
    }
View Full Code Here

        }
    }

    @Test(expectedExceptions = IllegalArgumentException.class)
    public void testBadTrimLoc() {
        final GenomeLoc loc = new UnvalidatingGenomeLoc("20", 0, 10, 20);
        final Haplotype hap = new Haplotype("ACGTAACCGGT".getBytes(), loc);
        hap.trim(new UnvalidatingGenomeLoc("20", 0, 1, 20));
    }
View Full Code Here

    }

    @Test(expectedExceptions = IllegalStateException.class)
    public void testBadTrimNoLoc() {
        final Haplotype hap = new Haplotype("ACGTAACCGGT".getBytes());
        hap.trim(new UnvalidatingGenomeLoc("20", 0, 1, 20));
    }
View Full Code Here

TOP

Related Classes of org.broadinstitute.gatk.utils.UnvalidatingGenomeLoc

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.