Construction & conversion

Kmers.KmerMethod
Kmer{A,K,N}(itr) where {A,K,N}

Construct a Kmer{A,K,N} from an iterable.

The most generic constructor.

Currently the iterable must have length & support getindex with integers.

Examples

julia> ntseq = LongSequence("TTAGC") # 4-bit DNA alphabet
5nt DNA Sequence:
TTAGC

julia> DNAKmer{5}(ntseq) # 2-Bit DNA alphabet
DNA 5-mer:
TTAGC
source
Kmer{A,K,N}(seq::BioSequence{A})

Construct a Kmer{A,K,N} from a BioSequence{A}.

This particular method is specialised for BioSequences, and for when the Kmer and BioSequence types used, share the same alphabet, since a lot of encoding / decoding can be skipped, and the problem is mostly one of shunting bits around. In the case where the alphabet of the Kmer and the alphabet of the BioSequence differ, dispatch to the more generic constructor occurs instead.

Examples

julia> ntseq = LongSequence{DNAAlphabet{2}}("TTAGC") # 2-bit DNA alphabet
5nt DNA Sequence:
TTAGC

julia> DNAKmer{5}(ntseq) # 2-Bit DNA alphabet
DNA 5-mer:
TTAGC
source
Kmer{A,K}(itr) where {A,K}

Construct a Kmer{A,K,N} from an iterable.

This is a convenience method which will work out the correct N parameter, for your given choice of A & K.

source
Kmer{A}(itr) where {A}

Construct a Kmer{A,K,N} from an iterable.

This is a convenience method which will work out K from the length of itr, and the correct N parameter, for your given choice of A & K.

Warning

Since this gets K from runtime values, this is gonna be slow!

source
Kmer(nts::Vararg{DNA,K}) where {K}

Construct a Kmer from a variable number K of DNA nucleotides.

Examples

julia> Kmer(DNA_T, DNA_T, DNA_A, DNA_G, DNA_C)
DNA 5-mer:
TTAGC
source
Kmer(nts::Vararg{RNA,K}) where {K}

Construct a Kmer from a variable number K of RNA nucleotides.

Examples

julia> Kmer(RNA_U, RNA_U, RNA_A, RNA_G, RNA_C)
DNA 5-mer:
UUAGC
source