// Gets chunks for specified ref seq index, start and end co-ordinate this method considers linear index also. private static IList <Chunk> GetChunks(BAMReferenceIndexes refIndex, int start, int end) { var chunks = new List <Chunk>(); var binnumbers = Reg2Bins((uint)start, (uint)end); var bins = refIndex.Bins.Where(B => binnumbers.Contains(B.BinNumber)).ToList(); // consider linear indexing only for the bins less than 4681. foreach (var bin in bins.Where(B => B.BinNumber < 4681)) { chunks.InsertRange(chunks.Count, bin.Chunks); } var index = start / (16 * 1024); // Linear indexing window size is 16K if (refIndex.LinearOffsets.Count > index) { var offset = refIndex.LinearOffsets[index]; chunks = chunks.Where( C => C.ChunkEnd.CompressedBlockOffset > offset.CompressedBlockOffset || (C.ChunkEnd.CompressedBlockOffset == offset.CompressedBlockOffset && C.ChunkEnd.UncompressedBlockOffset > offset.UncompressedBlockOffset)).ToList(); } // add chunks for the bin numbers greater than 4681. foreach (var bin in bins.Where(B => B.BinNumber >= 4681)) { chunks.InsertRange(chunks.Count, bin.Chunks); } return(SortAndMergeChunks(chunks)); }
// Gets all chunks for the specified ref sequence index. private static IList <Chunk> GetChunks(BAMReferenceIndexes refIndex) { var chunks = new List <Chunk>(); foreach (var bin in refIndex.Bins) { chunks.InsertRange(chunks.Count, bin.Chunks); } return(SortAndMergeChunks(chunks)); }