Crates.io | nom-gtf |
lib.rs | nom-gtf |
version | 0.1.3 |
source | src |
created_at | 2022-09-23 00:34:28.314021 |
updated_at | 2022-09-23 06:16:00.266545 |
description | A barebones GTF reader written with nom |
homepage | |
repository | https://github.com/noamteyssier/nom-gtf |
max_upload_size | |
id | 672058 |
size | 32,608 |
a parser for gtf built using nom.
This achieves near wc -l
throughput.
This is meant to be used as an iterator and receives any item implementing BufRead
.
use std::{fs::File, io::BufReader};
use nom_gtf::GtfReader;
let handle = File::open("data/example.gtf")
.map(BufReader::new)
.unwrap();
let num_records = GtfReader::from_bufread(handle)
.filter_map(|x| x.ok())
.count();
assert_eq!(num_records, 10);
use std::{fs::File, io::BufReader};
use flate2::read::MultiGzDecoder;
use nom_gtf::GtfReader;
let handle = File::open("data/example.gtf.gz")
.map(MultiGzDecoder::new)
.map(BufReader::new)
.unwrap();
let num_records = GtfReader::from_bufread(handle)
.filter_map(|x| x.ok())
.count();
assert_eq!(num_records, 10);