INNER CODE UNIT · Rust

read_fasta_impl

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

fn read_fasta_impl(
    path: &str,
    regions: Option<Vec<String>>,
    index: Option<String>,
    gzi: Option<String>,
    fields: Option<Vec<String>>,
) -> Vec<u8> {
    let compressed = path.ends_with(".gz");
    let reader = std::fs::File::open(path)
        .map(|f| BufReader::with_capacity(BUFFER_SIZE_BYTES, f))
        .unwrap();
    let scanner = FastaScanner::new(resolve_r_fields(fields), CoordSystem::OneClosed).unwrap();

    let ipc = if let Some(regions) = regions {
        let index_path = index.unwrap_or(format!("{}.fai", path));
        let index =
            noodles::fasta::fai::fs::read(index_path).expect("Could not read FASTA index file.");
        let regions: Vec<Region> = regions

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…