Skip to main content

create_multithreaded_reader

Function create_multithreaded_reader 

Source
pub fn create_multithreaded_reader<P>(
    file_path: P,
    threads: Option<usize>,
) -> Result<Reader<File>, Error>
where P: AsRef<Path>,
Expand description

Creates a multithreaded BGZip reader for compressed files

This function creates a reader optimized for reading BGZip-compressed files using multiple threads for decompression. The thread count is automatically capped at the system’s available parallelism.

§Arguments

  • file_path - Path to the BGZip-compressed file
  • threads - Optional number of threads to use (defaults to 2 if None)

§Returns

  • Ok(bgzf::io::Reader<File>) - A multithreaded BGZip reader
  • Err - If the file cannot be opened

§Examples

use deepbiop_utils::io::create_multithreaded_reader;
use std::path::Path;

let reader = create_multithreaded_reader(Path::new("data.fq.gz"), Some(4)).unwrap();
// Use reader with noodles parsers