3 releases

0.0.3 Sep 2, 2018
0.0.2 Sep 2, 2018
0.0.1 Sep 2, 2018

#91 in Compression

Download history 18/week @ 2018-09-02

6 downloads per month

MIT license

7MB
627 lines

bgzip-rs

Build Status Appveyor Creates.io doc-rs

Rust implementation of bgzip

TODO

  • Multi-thread writer

Author

Yasunobu OKAMURA

License

MIT


lib.rs:

Rust implementation of bgzip

Example

Reader example

use bgzip::read::BGzReader;
use std::fs;
use std::io;
use std::io::prelude::*;

# fn main() { let _ = run(); }
# fn run() -> io::Result<()> {
let mut reader = BGzReader::new(fs::File::open("./testfiles/common_all_20180418_half.vcf.gz")?)?;
reader.seek(io::SeekFrom::Start(100))?;
let mut data = [0; 17];
assert_eq!(17, reader.read(&mut data)?);
assert_eq!(b"#phasing=partial\n", &data);
# Ok(())
# }

Writer Example

use bgzip::write::BGzWriter;
use std::fs;
use std::io;
use std::io::prelude::*;

# fn main() { let _ = run(); }
# fn run() -> io::Result<()> {
let data = b"0123456789ABCDEF";
let mut writer = BGzWriter::new(fs::File::create("tmp/test2.gz")?);

for _ in 0..30000 {
    writer.write(&data[..])?;
}
# Ok(())
# }

Dependencies