Package htsjdk.samtools

Examples of htsjdk.samtools.GATKBAMFileSpan


    }

    @Test
    public void testFilePointerCombineDisjoint() {
        FilePointer one = new FilePointer(IntervalMergingRule.ALL, genomeLocParser.createGenomeLoc("chr1",1,5));
        one.addFileSpans(readerID,new GATKBAMFileSpan(new GATKChunk(0,1)));
        FilePointer two = new FilePointer(IntervalMergingRule.ALL, genomeLocParser.createGenomeLoc("chr1",6,10));
        two.addFileSpans(readerID,new GATKBAMFileSpan(new GATKChunk(1,2)));

        FilePointer result = new FilePointer(IntervalMergingRule.ALL, genomeLocParser.createGenomeLoc("chr1",1,10));
        result.addFileSpans(readerID,new GATKBAMFileSpan(new GATKChunk(0,2)));

        Assert.assertEquals(one.combine(genomeLocParser,two),result,"Combination of two file pointers is incorrect");
        Assert.assertEquals(two.combine(genomeLocParser,one),result,"Combination of two file pointers is incorrect");

        //Now test that adjacent (but disjoint) intervals are properly handled with OVERLAPPING_ONLY
        one = new FilePointer(IntervalMergingRule.OVERLAPPING_ONLY, genomeLocParser.createGenomeLoc("chr1",1,5));
        one.addFileSpans(readerID,new GATKBAMFileSpan(new GATKChunk(0,1)));
        two = new FilePointer(IntervalMergingRule.OVERLAPPING_ONLY, genomeLocParser.createGenomeLoc("chr1",6,10));
        two.addFileSpans(readerID,new GATKBAMFileSpan(new GATKChunk(1,2)));

        result = new FilePointer(IntervalMergingRule.OVERLAPPING_ONLY,
                genomeLocParser.createGenomeLoc("chr1",1,5),
                genomeLocParser.createGenomeLoc("chr1",6,10));
        result.addFileSpans(readerID,new GATKBAMFileSpan(new GATKChunk(0,2)));

        Assert.assertEquals(one.combine(genomeLocParser,two),result,"Combination of two file pointers is incorrect");
        Assert.assertEquals(two.combine(genomeLocParser,one),result,"Combination of two file pointers is incorrect");
    }
View Full Code Here


    }

    @Test
    public void testFilePointerCombineJoint() {
        FilePointer one = new FilePointer(IntervalMergingRule.ALL, genomeLocParser.createGenomeLoc("chr1",1,5));
        one.addFileSpans(readerID,new GATKBAMFileSpan(new GATKChunk(0,2)));
        FilePointer two = new FilePointer(IntervalMergingRule.ALL, genomeLocParser.createGenomeLoc("chr1",2,6));
        two.addFileSpans(readerID,new GATKBAMFileSpan(new GATKChunk(1,3)));

        FilePointer result = new FilePointer(IntervalMergingRule.ALL, genomeLocParser.createGenomeLoc("chr1",1,6));
        result.addFileSpans(readerID,new GATKBAMFileSpan(new GATKChunk(0,3)));       

        Assert.assertEquals(one.combine(genomeLocParser,two),result,"Combination of two file pointers is incorrect");
        Assert.assertEquals(two.combine(genomeLocParser,one),result,"Combination of two file pointers is incorrect");

        //Repeat the tests for OVERLAPPING_ONLY
        one = new FilePointer(IntervalMergingRule.OVERLAPPING_ONLY, genomeLocParser.createGenomeLoc("chr1",1,5));
        one.addFileSpans(readerID,new GATKBAMFileSpan(new GATKChunk(0,2)));
        two = new FilePointer(IntervalMergingRule.OVERLAPPING_ONLY, genomeLocParser.createGenomeLoc("chr1",2,6));
        two.addFileSpans(readerID,new GATKBAMFileSpan(new GATKChunk(1,3)));

        result = new FilePointer(IntervalMergingRule.OVERLAPPING_ONLY, genomeLocParser.createGenomeLoc("chr1",1,6));
        result.addFileSpans(readerID,new GATKBAMFileSpan(new GATKChunk(0,3)));

        Assert.assertEquals(one.combine(genomeLocParser,two),result,"Combination of two file pointers is incorrect");
        Assert.assertEquals(two.combine(genomeLocParser,one),result,"Combination of two file pointers is incorrect");
    }
View Full Code Here

    }

    @Test
    public void testFilePointerCombineOneSided() {
        FilePointer filePointer = new FilePointer(IntervalMergingRule.ALL, genomeLocParser.createGenomeLoc("chr1",1,5));
        filePointer.addFileSpans(readerID,new GATKBAMFileSpan(new GATKChunk(0,1)));
        FilePointer empty = new FilePointer(IntervalMergingRule.ALL, genomeLocParser.createGenomeLoc("chr1",6,10));
        // Do not add file spans to empty result

        FilePointer result = new FilePointer(IntervalMergingRule.ALL, genomeLocParser.createGenomeLoc("chr1",1,10));
        result.addFileSpans(readerID,new GATKBAMFileSpan(new GATKChunk(0,1)));
        Assert.assertEquals(filePointer.combine(genomeLocParser,empty),result,"Combination of two file pointers is incorrect");
        Assert.assertEquals(empty.combine(genomeLocParser,filePointer),result,"Combination of two file pointers is incorrect");
    }
View Full Code Here

TOP

Related Classes of htsjdk.samtools.GATKBAMFileSpan

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.