Examples of SeekableFileStream


Examples of htsjdk.samtools.seekablestream.SeekableFileStream

     *
     * @throws Exception
     */
    @Test
    public void testSeekReadStandard() throws Exception {
        tstSeekRead(expectedBytes, new SeekableFileStream(testFile), 50);
    }
View Full Code Here

Examples of htsjdk.samtools.seekablestream.SeekableFileStream

        bufferedStream.close();
    }


    private IGVSeekableBufferedStream getTestStream(int streamBufferSize) throws FileNotFoundException{
       return new IGVSeekableBufferedStream(new SeekableFileStream(testFile), streamBufferSize);
    }
View Full Code Here

Examples of htsjdk.samtools.seekablestream.SeekableFileStream

        int startPosition = 500000;
        int length = 50000;

        byte[] buffer1 = new byte[length];
        SeekableStream unBufferedStream = new SeekableFileStream(BAM_FILE);
        unBufferedStream.seek(startPosition);
        int bytesRead = unBufferedStream.read(buffer1, 0, length);
        assertEquals(length, bytesRead);

        byte[] buffer2 = new byte[length];
        SeekableStream bufferedStream = new IGVSeekableBufferedStream(new SeekableHTTPStream(new URL(BAM_URL_STRING)));
        bufferedStream.seek(startPosition);
View Full Code Here

Examples of htsjdk.samtools.seekablestream.SeekableFileStream

    @Test
    public void testSkip() throws IOException {
        final int[] BUFFER_SIZES = new int[]{8, 96, 1024, 8*1024, 16*1024, 96*1024, 48*1024};

        for (final int bufferSize : BUFFER_SIZES) {
            final IGVSeekableBufferedStream in1 = new IGVSeekableBufferedStream(new SeekableFileStream(BAM_FILE), bufferSize);
            final IGVSeekableBufferedStream in2 = new IGVSeekableBufferedStream(new SeekableFileStream(BAM_FILE), bufferSize);

            final int SIZE = 10000;
            final byte[] bytes1 = new byte[SIZE];
            final byte[] bytes2 = new byte[SIZE];

View Full Code Here

Examples of htsjdk.samtools.seekablestream.SeekableFileStream

    private void testReadsLength(final int length) throws IOException {

        final int BUFFERED_STREAM_BUFFER_SIZE = 100;
        final byte buffer[]=new byte[BUFFERED_STREAM_BUFFER_SIZE*10];
        final SeekableFileStream fileStream = new SeekableFileStream(megabyteZerosFile);
        final IGVSeekableBufferedStream  bufferedStream = new IGVSeekableBufferedStream(fileStream,BUFFERED_STREAM_BUFFER_SIZE);

        for( int i=0; i<10*BUFFERED_STREAM_BUFFER_SIZE/length ; ++i ){
            assertEquals(bufferedStream.read(buffer, 0, length), length);
        }
View Full Code Here

Examples of htsjdk.samtools.seekablestream.SeekableFileStream

    @Test
    public void testSeek() throws Exception {
        String expectedLine = "chr22\t14000000\t15000000\trecombRate\t0.182272\t0.20444\t0.160104\t0\t0\t0\t0\t0\t0";
        File testFile = new File(TestUtils.DATA_DIR + "igv/recombRate.igv.txt");
        SeekableFileStream is = new SeekableFileStream(testFile);
        is.seek(149247);
        AsciiLineReader reader = new AsciiLineReader(is);
        String nextLine = reader.readLine();
        assertEquals(expectedLine, nextLine);
    }
View Full Code Here

Examples of htsjdk.samtools.seekablestream.SeekableFileStream

                }
            } else if (path.toLowerCase().startsWith("ftp:")) {
                final URL url = new URL(path);
                is = new IGVSeekableFTPStream(url);
            } else {
                is = new SeekableFileStream(new File(path));
            }
            return is;
        }
    }
View Full Code Here

Examples of htsjdk.samtools.seekablestream.SeekableFileStream


    private void testReadsLength(int length) throws IOException {
        final int READ_SIZE=100000; //file is 10^6, so make this smaller to be safe.

        SeekableFileStream fileStream = new SeekableFileStream(InputFile);
        SeekableBufferedStream bufferedStream = new SeekableBufferedStream(fileStream, BUFFERED_STREAM_BUFFER_SIZE);

        for (int i = 0; i < READ_SIZE / length; ++i) {
            Assert.assertEquals(bufferedStream.read(buffer, 0, length), length);
        }
View Full Code Here

Examples of htsjdk.samtools.seekablestream.SeekableFileStream



    private void openIndexFile() {
        try {
            fileStream = new SeekableFileStream(mFile);
            bufferedStream = new SeekableBufferedStream(fileStream,BUFFERED_STREAM_BUFFER_SIZE);
            fileLength=bufferedStream.length();
        }
        catch (IOException exc) {
            throw new ReviewedGATKException("Unable to open index file (" + exc.getMessage() +")" + mFile, exc);
View Full Code Here

Examples of net.sf.samtools.util.SeekableFileStream

          SAMFileReader reader = new SAMFileReader(file);
          source.reader = reader;
          if (query == null)
            source.it = reader.iterator();
          else {
            SeekableFileStream is = new SeekableFileStream(file);

            FileInputStream fis = new FileInputStream(index);
            GZIPInputStream gis = new GZIPInputStream(
                new BufferedInputStream(fis));
            BufferedInputStream bis = new BufferedInputStream(gis);
            List<CramIndex.Entry> full = CramIndex.readIndex(gis);

            List<CramIndex.Entry> entries = new LinkedList<CramIndex.Entry>();
            SAMSequenceRecord sequence = reader.getFileHeader()
                .getSequence(query.sequence);
            if (sequence == null)
              throw new RuntimeException("Sequence not found: "
                  + query.sequence);

            entries.addAll(CramIndex.find(full,
                sequence.getSequenceIndex(), query.start,
                query.end - query.start));

            bis.close();

            SAMIterator it = new SAMIterator(is, refFile);
            is.seek(entries.get(0).containerStartOffset);
            BAMQueryFilteringIterator bit = new BAMQueryFilteringIterator(
                it, query.sequence, query.start, query.end,
                BAMQueryFilteringIterator.QueryType.CONTAINED,
                reader.getFileHeader());
            source.it = bit;
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.