INNER CODE UNIT · Rust

new

google/best · src/bed.rs:37

    pub fn new(bed_path: &str) -> Self {
        let mut intervals = FxHashMap::default();
        let mut features = FxHashSet::default();
        let reader = BufReader::new(File::open(bed_path).expect("BED file not found."));

        for line in reader.lines() {
            let line = line.unwrap();
            let mut fields = line.split('\t');
            let chrom = fields.next().unwrap().to_owned();
            // convert to 1-indexed [start, stop)
            let start = fields.next().unwrap().parse::<usize>().unwrap() + 1;
            let stop = fields.next().unwrap().parse::<usize>().unwrap() + 1;
            let feature = fields.next().unwrap_or("none").to_owned();

            intervals
                .entry(chrom)
                .or_insert_with(|| Vec::<FeatureInterval>::new())
                .push(Interval {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…