use anyhow::Context; use noodles_gff as gff; use crate::{config::Config, positions::GenomeRange}; use super::readers::get_gz_reader; pub fn features_ranges(feature_type: &str, config: &Config) -> anyhow::Result> { let path = &config.refseq_gff; let mut reader = get_gz_reader(path) .map(gff::io::Reader::new) .with_context(|| format!("Error while creating the reader of {path}"))?; let mut res = Vec::new(); for result in reader.record_bufs() { let record = result?; let ty = record.ty(); if ty != feature_type { continue; } res.push(GenomeRange::from_1_inclusive( record.reference_sequence_name(), record.start().get() as u32, record.end().get() as u32, )); } Ok(res) }