Skip to content

Commit

Permalink
Merge branch 'kyclark' of github.com:TravisWheelerLab/tallyman into k…
Browse files Browse the repository at this point in the history
…yclark
  • Loading branch information
kyclark committed Jun 24, 2024
2 parents 4e6bc85 + 038d55c commit 55ad048
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 25 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FIXTURES := fixtures/test-rna.fasta fixtures/test-dna.fasta
REL_EXE := target/release/tallyman
RNA50 = tests/inputs/rna-50k.fasta
RNA100 = tests/inputs/rna-100k.fasta
DNA_FA = tests/inputs/dna.fasta
DNA_FQ = tests/inputs/dna.fastq
BIG_DNA = fixtures/test-dna.fasta
Expand All @@ -9,6 +10,9 @@ BIG_RNA = fixtures/test-rna.fasta
fitty:
cargo run -- -r $(RNA50) -d $(DNA_FA) -o -

hunna:
cargo run -- -r $(RNA100) -d $(DNA_FA) -o -

big:
cargo run -- -v -r $(BIG_RNA) -d $(BIG_DNA) -o /dev/null

Expand Down
55 changes: 30 additions & 25 deletions src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ impl Search {
}
}

// Nothing seems to use the search results (which uses the id)
pub fn search(
&mut self,
sequence: &str,
Expand Down Expand Up @@ -107,34 +108,38 @@ impl Search {
// results.push(result);
//}

dbg!(&self.haystack_window);
if let Some(index) = self.needles.find_inc(self.haystack_window) {
dbg!(index);
//self.needles.inc_at(index);
//let result = SearchResult {
// haystack: id.to_string(),
// needle: self.haystack_window,
// offset: self.haystack_index - 32,
// index,
//};
//results.push(result);
}
//dbg!(&self.haystack_window);
self.needles.inc_hits(self.haystack_window);
//if let Some(index) = self.needles.find_inc(self.haystack_window) {
// dbg!(index);
// self.needles.inc_at(index);
// let result = SearchResult {
// haystack: id.to_string(),
// needle: self.haystack_window,
// offset: self.haystack_index - 32,
// index,
// };
// results.push(result);
//}

dbg!(&self.rev_haystack);
if let Some(index) = self.needles.find_inc(self.rev_haystack) {
dbg!(index);
//self.needles.inc_at(index);
//let result = SearchResult {
// haystack: id.to_string(),
// needle: self.rev_haystack,
// offset: self.haystack_index - 32,
// index,
//};
//results.push(result);
}
//dbg!(&self.rev_haystack);
self.needles.inc_hits(self.rev_haystack);
//if let Some(index) = self.needles.find_inc(self.rev_haystack) {
// dbg!(index);
// self.needles.inc_at(index);
// let result = SearchResult {
// haystack: id.to_string(),
// needle: self.rev_haystack,
// offset: self.haystack_index - 32,
// index,
// };
// results.push(result);
//}
}
}

// An attempt to remove mutable access to self to use in parallel
// But uses DashMap to update hits and I'm not positive this is great
pub fn pure_search(
&self,
needles: &Hash,
Expand Down Expand Up @@ -182,7 +187,7 @@ impl Search {
if let Some(_index) = needles.find(*val) {
//let index = index as u64;
dbg!(val);
if let Some(mut count) = hits.get_mut(&val) {
if let Some(mut count) = hits.get_mut(val) {
*count += 1;
} else {
hits.insert(*val, 1);
Expand Down

0 comments on commit 55ad048

Please sign in to comment.