Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to find canonical substitution of DNA #48

Merged
merged 3 commits into from
Oct 24, 2023

Conversation

swooster
Copy link
Contributor

Intent

Computes canonical substitution of DNA to support combinatorial hashing.

Changes

  • Add DnaSequenceStrict::canonical convenience method.
  • Add quickdna::canonical::{Canonical, ForwardCanonical} iterators.
  • Add canonical benchmarks.

@vgel vgel self-requested a review October 20, 2023 17:29
Copy link
Contributor

@vgel vgel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a couple small things

src/canonical.rs Outdated

impl<I: ExactSizeIterator<Item = Nucleotide>> ExactSizeIterator for ForwardCanonical<I> {}

// Like an allocation-free variant of:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could maybe use some illustrative example code here? Took me a moment to realize what this meant.

@@ -338,6 +339,16 @@ impl<T: NucleotideLike> FromStr for DnaSequence<T> {
}
}

impl DnaSequence<Nucleotide> {
/// Return canonical isomorphic DNA sequence.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also maybe use some example code here as well, again just to illustrate. I tend to prefer having the docs on the method over the iterator type, since the method is mostly what library users interact with.

let canonical2 = canonical.canonical();
canonical2 == canonical
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to quickcheck LexicalMin as well? Could compare it to the allocation version with Vec as a sanity check.

@swooster swooster merged commit a5a4f1f into main Oct 24, 2023
8 checks passed
@swooster swooster deleted the swooster/canonicalizer branch October 24, 2023 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants