BioJulia/BioSequences.jl

Disallow construction of k-mers from integers

jakobnissen opened this issue · 1 comments

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.

See edited original comment