Java Code Examples for htsjdk.samtools.util.BlockCompressedFilePointerUtil#getBlockAddress()
The following examples show how to use
htsjdk.samtools.util.BlockCompressedFilePointerUtil#getBlockAddress() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChunkHttpBuffer.java From hmftools with GNU General Public License v3.0 | 5 votes |
@NotNull private ListenableFuture<byte[]> getBytesForChunk(@NotNull Chunk chunk) { long start = BlockCompressedFilePointerUtil.getBlockAddress(chunk.getChunkStart()); long end = BlockCompressedFilePointerUtil.getBlockAddress(chunk.getChunkEnd()); if (start <= end) { return readUrlBytes(start, end - start); } else { return Futures.immediateFailedFuture(new IllegalArgumentException("start offset is greater than end")); } }
Example 2
Source File: BamSlicerApplication.java From hmftools with GNU General Public License v3.0 | 5 votes |
@NotNull private static List<Chunk> expandChunks(@NotNull List<Chunk> chunks) { List<Chunk> result = Lists.newArrayList(); for (Chunk chunk : chunks) { long chunkEndBlockAddress = BlockCompressedFilePointerUtil.getBlockAddress(chunk.getChunkEnd()); long extendedEndBlockAddress = chunkEndBlockAddress + BlockCompressedStreamConstants.MAX_COMPRESSED_BLOCK_SIZE; long newChunkEnd = Math.min(extendedEndBlockAddress, MAX_BLOCK_ADDRESS); long chunkEndVirtualPointer = newChunkEnd << 16; result.add(new Chunk(chunk.getChunkStart(), chunkEndVirtualPointer)); } return result; }
Example 3
Source File: SAMFileMerger.java From Hadoop-BAM with MIT License | 4 votes |
private static long shiftVirtualFilePointer(long virtualFilePointer, long offset) { long blockAddress = BlockCompressedFilePointerUtil.getBlockAddress(virtualFilePointer); int blockOffset = BlockCompressedFilePointerUtil.getBlockOffset(virtualFilePointer); return (blockAddress + offset) << 16 | (long) blockOffset; }