slow5-rs

License Crates.io docs.rs Rust Stability codecov

A library for interacting with SLOW5 files in rust. Not official.

Note: Library design is in flux and care should be taken in upgrading this crate.

Installation

Add the following to your Cargo.toml:

toml [dependencies] slow5 = "0.10"

Note: version does not directly translate to version of slow5lib.

Git

If you'd like to download the git version, use the following command to download the repo

bash git clone --recursive https://github.com/bsaintjo/slow5-rs.git

Getting started

Reading signal from SLOW5 file

```rust use slow5::{FileReader, RecordExt};

fn main() -> Result<(), Box> { let mut slow5 = FileReader::open("examples/example.slow5").unwrap(); for record in slow5.records() { for signal in record?.picoampssignaliter() { // Do stuff } } Ok(()) } ```

Writing a compressed BLOW5 file with attributes

```rust use std::error::Error; use slow5::{FileWriter, SignalCompression, Record};

fn main() -> Result<(), Box> { let tmpdir = std::env::tempdir(); let output = tmpdir.join("test.blow5"); let mut writer = FileWriter::options() .signalcompression(SignalCompression::StreamVByte) .attr("attribute", "value", 0) .create(output)?; let rec = Record::builder() .readid("testid") .readgroup(0) .digitisation(4096.0) .offset(4.0) .range(12.0) .samplingrate(4000.0) .rawsignal(&[0, 1, 2, 3]) .build()?; writer.addrecord(&rec)?; writer.close(); Ok(()) } ```

Feature flags

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.