Package org.broadinstitute.gatk.utils.haplotype

Examples of org.broadinstitute.gatk.utils.haplotype.Haplotype


            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


        return tests.toArray(new Object[][]{});
    }

    @Test(dataProvider = "TrimmingData")
    public void testTrim(final Haplotype full, final GenomeLoc trimTo, final Haplotype expected) {
        final Haplotype actual = full.trim(trimTo);
        if ( expected != null ) {
            Assert.assertEquals(actual.getBases(), expected.getBases());
            Assert.assertEquals(actual.getStartPosition(), trimTo.getStart());
            Assert.assertEquals(actual.getStopPosition(), trimTo.getStop());
            Assert.assertEquals(actual.getCigar(), expected.getCigar());
            Assert.assertEquals(actual.getAlignmentStartHapwrtRef(), expected.getAlignmentStartHapwrtRef());
        } else {
            Assert.assertNull(actual);
        }
    }
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

        hap.trim(new UnvalidatingGenomeLoc("20", 0, 1, 20));
    }

    @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.haplotype.Haplotype

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.