/** * @param bin Requested bin * @return chunks that represent all bases of requested bin */ private List<Chunk> getBinChunks(Bin bin) { if (bin.containsChunks()) { return bin.getChunkList(); } if (bin.getBinNumber() < SRA_BIN_INDEX_OFFSET) { throw new RuntimeException("SRA only supports bins from the last level"); } int binNumber = bin.getBinNumber() - SRA_BIN_INDEX_OFFSET; long refOffset = recordRangeInfo.getReferenceOffsets().get(bin.getReferenceSequence()); // move requested position MAX_FRAGMENT_OVERLAP bases behind, so that we take all the reads that overlap requested position int firstChunkCorrection = binNumber == 0 ? 0 : -MAX_FRAGMENT_OVERLAP; long binGlobalOffset = binNumber * SRA_BIN_SIZE + refOffset; long firstChunkNumber = (binGlobalOffset + firstChunkCorrection) / SRA_CHUNK_SIZE; long lastChunkNumber = (binGlobalOffset + SRA_BIN_SIZE - 1) / SRA_CHUNK_SIZE; List<Chunk> chunks = new ArrayList<Chunk>(); for (long chunkNumber = firstChunkNumber; chunkNumber <= lastChunkNumber; chunkNumber++) { chunks.add(new Chunk(chunkNumber * SRA_CHUNK_SIZE, (chunkNumber + 1) * SRA_CHUNK_SIZE)); } return chunks; } }
/** * @param bin Requested bin * @return chunks that represent all bases of requested bin */ private List<Chunk> getBinChunks(Bin bin) { if (bin.containsChunks()) { return bin.getChunkList(); } if (bin.getBinNumber() < SRA_BIN_INDEX_OFFSET) { throw new RuntimeException("SRA only supports bins from the last level"); } int binNumber = bin.getBinNumber() - SRA_BIN_INDEX_OFFSET; long refOffset = recordRangeInfo.getReferenceOffsets().get(bin.getReferenceSequence()); // move requested position MAX_FRAGMENT_OVERLAP bases behind, so that we take all the reads that overlap requested position int firstChunkCorrection = binNumber == 0 ? 0 : -MAX_FRAGMENT_OVERLAP; long binGlobalOffset = binNumber * SRA_BIN_SIZE + refOffset; long firstChunkNumber = (binGlobalOffset + firstChunkCorrection) / SRA_CHUNK_SIZE; long lastChunkNumber = (binGlobalOffset + SRA_BIN_SIZE - 1) / SRA_CHUNK_SIZE; List<Chunk> chunks = new ArrayList<Chunk>(); for (long chunkNumber = firstChunkNumber; chunkNumber <= lastChunkNumber; chunkNumber++) { chunks.add(new Chunk(chunkNumber * SRA_CHUNK_SIZE, (chunkNumber + 1) * SRA_CHUNK_SIZE)); } return chunks; } }
if (!bin.containsChunks()) { bin.addInitialChunk(newChunk);
if (!bin.containsChunks()) { bin.addInitialChunk(newChunk);
if (!bin.containsChunks()) { bin.addInitialChunk(newChunk);
if (!bin.containsChunks()) { bin.addInitialChunk(newChunk);
if (!bin.containsChunks()) { bin.addInitialChunk(newChunk);