INNER CODE UNIT · Rust
read_gtf_impl
abdenlab/oxbow · r-oxbow/src/rust/src/lib.rs:500
pub fn read_gtf_impl(
path: &str,
region: Option<String>,
index: Option<String>,
fields: Option<Vec<String>>,
scan_rows: Option<usize>,
) -> Vec<u8> {
let compressed = path.ends_with(".gz");
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!("{}.tbi", path));
let index = noodles::tabix::fs::read(index_path).expect("Could not read TBI index file.");
let region = Region::parse(®ion, CoordSystem::OneClosed).unwrap();
let bgzf_reader = noodles::bgzf::io::Reader::new(reader);