Skip to content

Commit

Permalink
undo overwritten method
Browse files Browse the repository at this point in the history
  • Loading branch information
EvoArt committed Jan 7, 2025
1 parent 890d7fb commit c65cfe9
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/utils.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@

function count_kmers!(counts, seq::NucSeq, ::Val{K}) where K
@boundscheck checkbounds(counts, 1:4^K)
K < 33 || error("Currently supports up to K=32 only")
@inbounds for kmer in UnambiguousDNAMers{K}(seq)
counts[kmer[1].data[1] + 1] = 1
end
counts;
end

my_count_kmers(seq::NucSeq, K) = count_kmers!(zeros(UInt32, 4^K), seq, Val(K))
my_count_kmers(seq::NucSeq, K) = count_kmers!(falses(4^K), seq, Val(K))
#### Read in fasta files
"""
get_reference(ref_fasta)
Expand Down Expand Up @@ -62,6 +51,19 @@ end

conditional_prob(m,P,M) = (m+P)/(M+1)

#### Count kmers

function count_kmers!(counts, seq::NucSeq, ::Val{K}) where K
@boundscheck checkbounds(counts, 1:4^K)
K < 33 || error("Currently supports up to K=32 only")
@inbounds for kmer in UnambiguousDNAMers{K}(seq)
counts[kmer[1].data[1] + 1] = 1
end
counts;
end

count_kmers(seq::NucSeq, K) = count_kmers!(falses(4^K), seq, Val(K))

function count_mers(refs, k = 8)
n_refs = length(refs)
mer_vec= [falses(4^k) for _ in 1:n_refs]
Expand All @@ -73,11 +75,11 @@ function count_mers(refs, k = 8)
end

function count_ref_mers!(ref_seq,kmer_array,tot_kmer_array,k = 8)
kmer_array .= my_count_kmers(ref_seq,k)
kmer_array .= count_kmers(ref_seq,k)
tot_kmer_array .+= kmer_array
end

function count_seq_mers(seq,k = 8)
kmer_array = my_count_kmers(seq,k)
kmer_array = count_kmers(seq,k)
return kmer_array
end

0 comments on commit c65cfe9

Please sign in to comment.