pub fn merge_chunks(chunks: &[Chunk]) -> Vec<Chunk>
Expand description
Merges a list of chunks into a list of non-overlapping chunks.
This is the same as calling optimize_chunks
with a min_offset
of 0.
ยงExamples
use noodles_bgzf as bgzf;
use noodles_csi::binning_index::{index::reference_sequence::bin::Chunk, merge_chunks};
let chunks = [
Chunk::new(bgzf::VirtualPosition::from(2), bgzf::VirtualPosition::from(3)),
Chunk::new(bgzf::VirtualPosition::from(5), bgzf::VirtualPosition::from(8)),
Chunk::new(bgzf::VirtualPosition::from(7), bgzf::VirtualPosition::from(13)),
Chunk::new(bgzf::VirtualPosition::from(21), bgzf::VirtualPosition::from(34)),
];
let actual = merge_chunks(&chunks);
let expected = [
Chunk::new(bgzf::VirtualPosition::from(2), bgzf::VirtualPosition::from(3)),
Chunk::new(bgzf::VirtualPosition::from(5), bgzf::VirtualPosition::from(13)),
Chunk::new(bgzf::VirtualPosition::from(21), bgzf::VirtualPosition::from(34)),
];
assert_eq!(actual, expected);