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

Disallow construction of k-mers from integers #145

Closed
jakobnissen opened this issue Mar 11, 2021 · 1 comment
Closed

Disallow construction of k-mers from integers #145

jakobnissen opened this issue Mar 11, 2021 · 1 comment
Milestone

Comments

@jakobnissen
Copy link
Member

jakobnissen commented Mar 11, 2021

Right now, you can do

julia> DNACodon(11)
DNA 3-mer:
AGT

I don't think you should be able to do that. The fact that the codon is internally represented as UInt(11) is an implementation detail, and should not be part of the API.

I suggest removing it.

Edit: Changed the following:

  • Removed conversion to/from integers/kmers. This is dangerous since conversion can happen implicitly
  • Construction of kmers from integers is still permitted, but now checks for overflow, e.g. DNAMer{2}(0xfffff) throws a DomainError
  • To avoid the check, use the function masked, which instead masks the noncoding bits.
@jakobnissen
Copy link
Member Author

See edited original comment

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

No branches or pull requests

1 participant