Skip to content

Commit

Permalink
Borrow sequence records (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
Keats authored Dec 13, 2022
1 parent d0475df commit a316f29
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
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 = { version = "0.4", path = "../lib" }
finch = { version = "0.5", path = "../lib" }
serde_json = "1"
anyhow = "1"

Expand Down
2 changes: 1 addition & 1 deletion lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "finch"
version = "0.4.3"
version = "0.5.0"
authors = ["One Codex <[email protected]>"]
description = "An implementation of min-wise independent permutation locality sensitive hashing ('MinHashing') for genomic data and command-line utility for manipulation."
keywords = ["minhash", "bioinformatics", "sketches"]
Expand Down
2 changes: 1 addition & 1 deletion lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub fn sketch_stream<'a>(
if seq_type.is_none() {
seq_type = Some(seqrec.format());
}
sketcher.process(seqrec);
sketcher.process(&seqrec);
}

// disable filtering for FASTA files unless it was explicitly specified
Expand Down
2 changes: 1 addition & 1 deletion lib/src/sketch_schemes/counts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl AllCountsSketcher {
}

impl SketchScheme for AllCountsSketcher {
fn process(&mut self, seq: SequenceRecord) {
fn process(&mut self, seq: &SequenceRecord) {
for (_, kmer, _) in seq.normalize(false).bit_kmers(self.k, false) {
self.counts[kmer.0 as usize] = self.counts[kmer.0 as usize].saturating_add(1);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/sketch_schemes/mash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl MashSketcher {
}

impl SketchScheme for MashSketcher {
fn process(&mut self, seq: SequenceRecord) {
fn process(&mut self, seq: &SequenceRecord) {
self.total_bases += seq.sequence().len() as u64;
let rc = seq.reverse_complement();
for (_, kmer, is_rev_complement) in
Expand Down
2 changes: 1 addition & 1 deletion lib/src/sketch_schemes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct KmerCount {
}

pub trait SketchScheme {
fn process(&mut self, seq: SequenceRecord);
fn process(&mut self, seq: &SequenceRecord);
fn total_bases_and_kmers(&self) -> (u64, u64);
fn to_vec(&self) -> Vec<KmerCount>;
fn parameters(&self) -> SketchParams;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/sketch_schemes/scaled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl ScaledSketcher {
}

impl SketchScheme for ScaledSketcher {
fn process(&mut self, seq: SequenceRecord) {
fn process(&mut self, seq: &SequenceRecord) {
self.total_bases += seq.sequence().len() as u64;
let rc = seq.reverse_complement();
for (_, kmer, is_rev_complement) in
Expand Down

0 comments on commit a316f29

Please sign in to comment.