Examples of UnsignedIntPackedInputStream


Examples of org.broadinstitute.gatk.engine.alignment.reference.packing.UnsignedIntPackedInputStream

    /**
     * Read a BWT from the input stream.
     * @return The BWT stored in the input stream.
     */
    public BWT read() {
        UnsignedIntPackedInputStream uintPackedInputStream = new UnsignedIntPackedInputStream(inputStream, ByteOrder.LITTLE_ENDIAN);
        BasePackedInputStream basePackedInputStream = new BasePackedInputStream<Integer>(Integer.class, inputStream, ByteOrder.LITTLE_ENDIAN);

        long inverseSA0;
        long[] count;
        SequenceBlock[] sequenceBlocks;

        try {
            inverseSA0 = uintPackedInputStream.read();
            count = new long[PackUtils.ALPHABET_SIZE];
            uintPackedInputStream.read(count);

            long bwtSize = count[PackUtils.ALPHABET_SIZE-1];
            sequenceBlocks = new SequenceBlock[PackUtils.numberOfPartitions(bwtSize,BWT.SEQUENCE_BLOCK_SIZE)];
           
            for( int block = 0; block < sequenceBlocks.length; block++ ) {
                int sequenceStart = block* BWT.SEQUENCE_BLOCK_SIZE;
                int sequenceLength = (int)Math.min(BWT.SEQUENCE_BLOCK_SIZE,bwtSize-sequenceStart);

                long[] occurrences = new long[PackUtils.ALPHABET_SIZE];
                byte[] bwt = new byte[sequenceLength];

                uintPackedInputStream.read(occurrences);
                basePackedInputStream.read(bwt);

                sequenceBlocks[block] = new SequenceBlock(sequenceStart,sequenceLength,new Counts(occurrences,false),bwt);
            }
        }
View Full Code Here

Examples of org.broadinstitute.gatk.engine.alignment.reference.packing.UnsignedIntPackedInputStream

    /**
     * Read a suffix array from the input stream.
     * @return The suffix array stored in the input stream.
     */
    public SuffixArray read() {
        UnsignedIntPackedInputStream uintPackedInputStream = new UnsignedIntPackedInputStream(inputStream, ByteOrder.LITTLE_ENDIAN);

        long inverseSA0;
        long[] occurrences;
        long[] suffixArray;
        int suffixArrayInterval;

        try {
            inverseSA0 = uintPackedInputStream.read();
            occurrences = new long[PackUtils.ALPHABET_SIZE];
            uintPackedInputStream.read(occurrences);
            // Throw away the suffix array size in bytes and use the occurrences table directly.
            suffixArrayInterval = (int)uintPackedInputStream.read();
            suffixArray = new long[(int)((occurrences[occurrences.length-1]+suffixArrayInterval-1)/suffixArrayInterval)];
            uintPackedInputStream.read(suffixArray);
        }
        catch( IOException ex ) {
            throw new ReviewedGATKException("Unable to read BWT from input stream.", ex);
        }

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.