File: README.md

package info (click to toggle)
rust-bgzip 0.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 276 kB
  • sloc: makefile: 2
file content (69 lines) | stat: -rw-r--r-- 2,895 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
bgzip-rs
========

[![Build](https://github.com/informationsea/bgzip-rs/actions/workflows/build.yml/badge.svg)](https://github.com/informationsea/bgzip-rs/actions/workflows/build.yml)
[![Crates.io](https://img.shields.io/crates/v/bgzip)](https://crates.io/crates/bgzip)
[![Crates.io](https://img.shields.io/crates/d/bgzip)](https://crates.io/crates/bgzip)
[![Crates.io](https://img.shields.io/crates/l/bgzip)](https://crates.io/crates/bgzip)
[![doc-rs](https://docs.rs/bgzip/badge.svg)](https://docs.rs/bgzip)

Rust implementation of BGZF

Feature flags
-------------

* `rayon`: Enable [rayon](https://github.com/rayon-rs/rayon) based multi-threaded reader/writer. This is default feature.
* `log`: Enable [log](https://github.com/rust-lang/log) crate to log warnings. This is default feature.
* `rust_backend`: use [miniz_oxide](https://crates.io/crates/miniz_oxide) crate for [flate2](https://github.com/rust-lang/flate2-rs) backend. This is default feature.
* `zlib`: use `zlib` for flate2 backend. Please read [flate2](https://github.com/rust-lang/flate2-rs) description for the detail.
* `zlib-ng`: use `zlib-ng` for flate2 backend. Please read [flate2](https://github.com/rust-lang/flate2-rs) description for the detail.
* `zlib-ng-compat`: Please read [flate2](https://github.com/rust-lang/flate2-rs) description for the detail.
* `cloudflare_zlib`: Please read [flate2](https://github.com/rust-lang/flate2-rs) description for the detail.
* `libdeflater`: use [libdeflater](https://github.com/adamkewley/libdeflater) instead of [flate2](https://github.com/rust-lang/flate2-rs) crate.

Write Examples
--------
```rust
use bgzip::{BGZFWriter, BGZFError, Compression};
use std::io::{self, Write};
fn main() -> Result<(), BGZFError> {
    let mut write_buffer = Vec::new();
    let mut writer = BGZFWriter::new(&mut write_buffer, Compression::default());
    writer.write_all(b"##fileformat=VCFv4.2\n")?;
    writer.write_all(b"#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\n")?;
    writer.close()?;
    Ok(())
}
```

Read Examples
--------
```rust
use bgzip::{BGZFReader, BGZFError};
use std::io::{self, BufRead};
use std::fs;
fn main() -> Result<(), BGZFError> {
    let mut reader =
        BGZFReader::new(fs::File::open("testfiles/common_all_20180418_half.vcf.gz")?)?;
    let mut line = String::new();
    reader.read_line(&mut line)?;
    assert_eq!("##fileformat=VCFv4.0\n", line);
    reader.bgzf_seek(4210818610)?;
    line.clear();
    reader.read_line(&mut line)?;
    assert_eq!("1\t72700625\trs12116859\tT\tA,C\t.\t.\tRS=12116859;RSPOS=72700625;dbSNPBuildID=120;SSR=0;SAO=0;VP=0x05010008000517053e000100;GENEINFO=LOC105378798:105378798;WGT=1;VC=SNV;SLO;INT;ASP;VLD;G5A;G5;HD;GNO;KGPhase1;KGPhase3;CAF=0.508,.,0.492;COMMON=1;TOPMED=0.37743692660550458,0.00608435270132517,0.61647872069317023\n", line);

    Ok(())
}
```

Author
------

Yasunobu OKAMURA

License
-------

MIT