Skip to content

Commit

Permalink
in-line comments for translate
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-eyes committed Apr 13, 2022
1 parent 6f5245b commit 671382b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/core/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,21 @@ impl SeqToHashes {
}
}

/*
Iterator that return a kmer hash for all modes except translate.
In translate mode:
- all the frames are processed at once and converted to hashes.
- all the hashes are stored in `hashes_buffer`
- after processing all the kmers, `translate_iter_step` is incremented
per iteration to iterate over all the indeces of the `hashes_buffer`.
- the iterator will die once `translate_iter_step` == length(hashes_buffer)
More info https://github.com/sourmash-bio/sourmash/pull/1946
*/

impl Iterator for SeqToHashes {
type Item = Result<u64, Error>;

fn next(&mut self) -> Option<Self::Item> {
// TODO: Remove the hashes buffer
// Priority for flushing the hashes buffer

if (self.kmer_index < self.max_index) || !self.hashes_buffer.is_empty() {
// Processing DNA or Translated DNA
if !self.is_protein {
Expand Down Expand Up @@ -294,7 +302,7 @@ impl Iterator for SeqToHashes {
Some(Ok(hash))
} else if self.hashes_buffer.is_empty() && self.translate_iter_step == 0 {
// Processing protein by translating DNA
// TODO: make it a real iterator not a buffer
// TODO: Implement iterator over frames instead of hashes_buffer.

for frame_number in 0..3 {
let substr: Vec<u8> = self
Expand Down

0 comments on commit 671382b

Please sign in to comment.