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

Rename to KmerArrays.jl #40

Open
AntonOresten opened this issue May 16, 2024 · 1 comment
Open

Rename to KmerArrays.jl #40

AntonOresten opened this issue May 16, 2024 · 1 comment

Comments

@AntonOresten
Copy link
Owner

This package started out representing K-mer counts in vectors of length $N^K$ where $N$ is the alphabet size. In v0.9 I redesigned it to use arrays of size $(N, N, \dots N, N)$ instead, which allowed for some nice abstractions in regards to indexing. These K-dimensional arrays can still natively be linearly indexed in Julia, and they can efficiently be flattened to vectors with vec(ka.values). So, in a sense, it's still "vectorized" -- it's just reshaped, but perhaps KmerArrays.jl would be more descriptive.

@camilogarciabotero
Copy link

I am very in favor of this renaming. This is working pretty awesome. I just wanted to add some user-side perspectives about the use:

Currently count_kmers(seq, k) returns the K-dimensional array, so I think it is more intuitive to have this function named kmerarray(seq, k) and then use the actual count_kmers for returning the desired value of the index:

function countkmer(kmerseq::SeqOrView{A}, seq::SeqOrView{A}) where {A} # I prefer omitting the underscore, but that is really idiosyncratic 
    ka = kmerarray(seq, length(kmerseq))
    return ka[kmerseq]
end

This can also be extended to have a set/vector of kmers sub-sequences, or maybe the multiple dispatch will simply allow countkmer.(subseqs::Vector{SeqOrView}, seq::SeqOrView)

Or, I don't know what do you think about overloading the Base.count with that interface...

Best.

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

2 participants