BioJulia / Kmers.jl

In development: Kmer types and methods for julia
MIT License
21 stars 7 forks source link

Kmer Slicing #16

Closed TransGirlCodes closed 2 years ago

TransGirlCodes commented 2 years ago

Types of changes

This PR implements the following changes: (Please tick any or all of the following that are applicable)

:ballot_box_with_check: Checklist

TransGirlCodes commented 2 years ago

@jakobnissen Would you like to have a play with this and check it is performant for your use case?

If it's good I'll include it in the docs and add tests.

codecov[bot] commented 2 years ago

Codecov Report

Merging #16 (dd48785) into master (f8ea398) will increase coverage by 0.34%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #16      +/-   ##
==========================================
+ Coverage   84.79%   85.14%   +0.34%     
==========================================
  Files          12       12              
  Lines         467      478      +11     
==========================================
+ Hits          396      407      +11     
  Misses         71       71              
Flag Coverage Δ
unittests 85.14% <100.00%> (+0.34%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/indexing.jl 94.44% <100.00%> (+8.73%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f8ea398...dd48785. Read the comment docs.

jakobnissen commented 2 years ago

The generated code is beautiful - but the implementation seems wrong.

This doesn't seem to work for larger kmers:

julia> kmer = Kmer("TATAGCGCGGACATAGTCGTCGCTGCTTATATATATGCTGCTCTCGTCGTGTATAGAGAGAGATATCGGATCGATCGCTATGCGGATA")
DNA 88-mer:
TATAGCGCGGACATAGTCGTCGCTGCTTATATATATGCT…TGTATAGAGAGAGATATCGGATCGATCGCTATGCGGATA

julia> kmer[1:2]
ERROR: ArgumentError: itr does not contain enough elements (3 ≠ 2)
Stacktrace:
 [1] DNAKmer{2, 1}(itr::Tuple{UInt64, UInt64, UInt64})
   @ Kmers ~/.julia/packages/Kmers/7SNBQ/src/kmer.jl:139
 [2] getindex(seq::DNAKmer{88, 3}, i::UnitRange{Int64})
   @ Main ./REPL[18]:5
 [3] top-level scope
   @ REPL[40]:1