INNER CODE UNIT · Rust

read_bam_impl

abdenlab/oxbow · r-oxbow/src/rust/src/lib.rs:180

pub fn read_bam_impl(
    path: &str,
    region: Option<String>,
    index: Option<String>,
    fields: Option<Vec<String>>,
    scan_rows: Option<usize>,
) -> Vec<u8> {
    let compressed = true;
    let scan_rows = Some(scan_rows.unwrap_or(1024));
    let reader = std::fs::File::open(path)
        .map(|f| BufReader::with_capacity(BUFFER_SIZE_BYTES, f))
        .unwrap();

    let ipc = if let Some(region) = region {
        let index_path = index.unwrap_or(format!("{}.bai", path));
        let index =
            noodles::bam::bai::fs::read(index_path).expect("Could not read BAI index file.");
        let region = Region::parse(&region, CoordSystem::OneClosed).unwrap();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…