Skip to content

Commit

Permalink
Increase capnproto size limit
Browse files Browse the repository at this point in the history
Bump limit for Mash

Make Clippy happy

Fix comment. Decrease limit
  • Loading branch information
audy committed Jan 6, 2024
1 parent fc85af0 commit 6717466
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,17 @@ This repository provides a library and command-line interface that reimplements
You may build Finch from source, which requires Rust >= `1.49`. Rust's Cargo package manager (see [rustup](https://www.rustup.rs) for Cargo installation instructions) can automatically build and install Finch with `cargo install finch_cli`.
If you require python bindings, you must take extra steps (see [python support](#python-support)). Alternatively, [download a prebuilt binary](https://github.com/onecodex/finch-rs/releases) or install from [PyPi](https://pypi.org/project/finch-sketch/) `pip install finch-sketch`.

### Building ###

To compile from source:

```sh
# from finch-rs
cargo +nightly-2023-06-28 build --release
```

### Example Usage ###

To get started, we first compute sketches for several FASTA or FASTQ files. These sketches are compact, sampled representations of the underlying genomic data, and what allow `finch` to rapidly estimate distances between datasets. Sketching files uses the `finch sketch` command:

```
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ path = "src/main.rs"

[dependencies]
clap = "2.33.0"
finch = "0.6"
finch = { path = "../lib" }
serde_json = "1"
anyhow = "1"

Expand Down
1 change: 0 additions & 1 deletion lib/src/serialization/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use serde::{Deserialize, Serialize};
use crate::bail;
use crate::errors::FinchResult;
use crate::filtering::FilterParams;
pub use crate::serialization::mash::{read_mash_file, write_mash_file};
use crate::serialization::Sketch;
use crate::sketch_schemes::{KmerCount, SketchParams};

Expand Down
6 changes: 5 additions & 1 deletion lib/src/serialization/mash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ pub fn write_mash_file(file: &mut dyn Write, sketches: &[Sketch]) -> FinchResult
}

pub fn read_mash_file(file: &mut dyn BufRead) -> FinchResult<Vec<Sketch>> {
let options = *message::ReaderOptions::new().traversal_limit_in_words(Some(1024 * 1024 * 1024));
let options = *message::ReaderOptions::new().traversal_limit_in_words(
// measured in words
// 1 word = 8 bytes
Some(2 * 1024 * 1024 * 1024),
);
let reader = capnp_serialize::read_message(file, options)?;
let mash_data: min_hash::Reader = reader.get_root::<min_hash::Reader>()?;

Expand Down
6 changes: 5 additions & 1 deletion lib/src/serialization/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ pub fn write_finch_file(file: &mut dyn Write, sketches: &[Sketch]) -> FinchResul
}

pub fn read_finch_file(file: &mut dyn BufRead) -> FinchResult<Vec<Sketch>> {
let options = *message::ReaderOptions::new().traversal_limit_in_words(Some(1024 * 1024 * 1024));
let options = *message::ReaderOptions::new().traversal_limit_in_words(
// measured in words
// 1 word = 8 bytes
Some(2 * 1024 * 1024 * 1024),
);
let reader = capnp_serialize::read_message(file, options)?;
let cap_data: multisketch::Reader = reader.get_root::<multisketch::Reader>()?;
let cap_sketches = cap_data.get_sketches()?;
Expand Down

0 comments on commit 6717466

Please sign in to comment.