Examples of GATKChunk


Examples of htsjdk.samtools.GATKChunk

            // Prepare for reading.
            chunkData.flip();

            for(int i = 0; i < numChunks; i++)
                chunks[i] = new GATKChunk(chunkData.getLong(),chunkData.getLong());

            // Prepare chunk buffer for next read.
            chunkData.flip();

            BAMScheduleEntry nextScheduleEntry = new BAMScheduleEntry(start,stop);
View Full Code Here

Examples of htsjdk.samtools.GATKChunk

     * Create a span from the given start point to the end of the file.
     * @param startOfRegion Start of the region, in encoded coordinates (block start << 16 & block offset).
     * @return A file span from the given point to the end of the file.
     */
    private GATKBAMFileSpan createSpanToEndOfFile(final long startOfRegion) {
      return new GATKBAMFileSpan(new GATKChunk(startOfRegion,Long.MAX_VALUE));
    }
View Full Code Here

Examples of htsjdk.samtools.GATKChunk

        // [position,limit), while extra capacity exists in the range [limit,capacity)
        buffer.limit(0);

        this.dispatcher = dispatcher;
        // TODO: Kill the region when all we want to do is start at the beginning of the stream and run to the end of the stream.
        this.accessPlan = new BAMAccessPlan(reader,this,new GATKBAMFileSpan(new GATKChunk(0,Long.MAX_VALUE)));

        // The block offsets / block positions guarantee that the ending offset/position in the data structure maps to
        // the point in the file just following the last read.  These two arrays should never be empty; initializing
        // to 0 to match the position above.
        this.blockOffsets.add(0);
View Full Code Here

Examples of htsjdk.samtools.GATKChunk

            else {
                blockEnd = positionIterator.peek().getBlockEnd();
                blockOffsetEnd = positionIterator.peek().getBlockOffsetEnd();
            }

            GATKChunk newChunk = new GATKChunk(blockAddress,blockOffsetStart,blockEnd,blockOffsetEnd);

            if(newChunk.getChunkStart() <= newChunk.getChunkEnd())
                spansOverlapping.add(new GATKChunk(blockAddress,blockOffsetStart,blockEnd,blockOffsetEnd));

            // If the value currently stored in the position iterator ends past the current block, we must be done.  Abort.
            if(!positionIterator.hasNext() ||  positionIterator.peek().getBlockEnd() > blockAddress)
                break;
View Full Code Here

Examples of htsjdk.samtools.GATKChunk

    }

    @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

Examples of htsjdk.samtools.GATKChunk

    }

    @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

Examples of htsjdk.samtools.GATKChunk

    }

    @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

Examples of htsjdk.samtools.GATKChunk

            List<GATKChunk> chunks = new ArrayList<GATKChunk>(nChunks);
            long[] rawChunkData = readLongs(nChunks*2);
            for (int ci = 0; ci < nChunks; ci++) {
                final long chunkBegin = rawChunkData[ci*2];
                final long chunkEnd = rawChunkData[ci*2+1];
                chunks.add(new GATKChunk(chunkBegin, chunkEnd));
            }
            GATKBin bin = new GATKBin(referenceSequence, indexBin);
            bin.setChunkList(chunks.toArray(new GATKChunk[chunks.size()]));
            while(indexBin >= bins.size())
                bins.add(null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.