Skip to content

Commit

Permalink
Set BioSequences compat
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobnissen committed Dec 22, 2024
1 parent a0ea979 commit 457f632
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ BioSymbols = "3c28c6f8-a34d-59c4-9654-267d177fcfa9"
[extensions]
StringViewsExt = "StringViews"

# Note: We intentionally have strict compat on BioSequences because Kmers
# reaches into the internals of BioSequences.
[compat]
BioSequences = "3.1.3"
BioSequences = "~3.4.1"
Random = "1.10"
julia = "1.10"
StringViews = "1"
Expand Down
6 changes: 5 additions & 1 deletion src/iterators/SpacedKmers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
Iterator of kmers with step size. `J` signifies the step size, `S`
the type of the underlying sequence, and the eltype of the iterator
is `Kmer{A, K, N}` with the appropriate `N`
is `Kmer{A, K, N}` with the appropriate `N`.
For example, a `SpacedKmers{AminoAcidAlphabet, 3, 5, Vector{UInt8}}` sampling
over `seq::Vector{UInt8}` will sample all kmers corresponding to
`seq[1:3], seq[6:8], seq[11:13]` etc.
See also: [`each_codon`](@ref), [`FwKmers`](@ref)
Expand Down
15 changes: 9 additions & 6 deletions src/iterators/UnambiguousKmers.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
"""
UnambiguousKmers{A <: TwoBit, K, S}
Iterator of 2-bit nucleic acid kmers. This differs from `FwKmers` in that any kmers
containing ambiguous nucleotides are skipped, whereas using `FwKmers`, they result
in an error.
Can be constructed more conventiently with the constructors `UnambiguousDNAMers{K}(s)`
and `UnambiguousRNAMers{K}(s)`.
Iterator of `(kmer, index)`, where `kmer` are 2-bit nucleic acid kmers in the
underlying sequence, and `index::Int` the starting position of the kmer in the
sequence.
The extracted kmers differ from those of `FwKmers` in that any kmers
containing ambiguous nucleotides are skipped, whereas using `FwKmers`, encountering
unambiguous nucleotides result in an error.
This iterator can be constructed more conventiently with the constructors
`UnambiguousDNAMers{K}(s)` and `UnambiguousRNAMers{K}(s)`.
!!! note
To obtain canonical unambiguous kmers, simply call `canonical` on each kmer output
Expand Down

0 comments on commit 457f632

Please sign in to comment.