Sequence
Sequences
Moonshine.Sequence
— Typestruct Sequence
Sequence of biallelic genetic markers (haplotype).
Implement the iteration interface as well as standard bitwise operations.
Random constructors sample marker's states via Random.bitrand
.
Fields
data::BitVector
Constructors
Sequence(data)
Sequence(data)
defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:48
.
Sequence()
defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:187
.
Sequence(undef, n)
defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:189
.
Sequence(rng, n)
defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:191
.
Sequence(rng, minlength, maxlength)
defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:193
.
where:
n
: number of markersrng
: random number generatorminLength, maxLength
: bounds for sequence length
Moonshine.cheap_hash
— Functioncheap_hash
Simple (and fast) hash function.
–Internal–
Moonshine.blocksize
— Functionblocksize(::Type{Sequence})
blocksize(::Sequence)
Size (in bits) of the blocks (chunks) of a sequence.
Methods
blocksize(_)
defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:117
.
blocksize(_)
defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:119
.
–Internal–
Moonshine.idxinchunk
— Functionidxinchunk(n, x)
idxinchunk(::Type{Sequence}, x)
idxinchunk(::Sequence, x)
Index of marker x
in its associated chunk.
See also chunkidx
.
–Internal–
Moonshine.chunkidx
— Functionchunkidx(n, x)
chunkidx(::Type{Sequence}, x)
chunkidx(::Sequence, x)
Index of the chunk associated with marker x
.
See also idxinchunk
.
–Internal–
Moonshine.wipe!
— Functionwipe!(h)
Set all markers to wild state (0).
–Internal–
Moonshine.plot_sequence
— Functionplot_sequence(h; nbins, height, kwargs...)
Unicode-graphic representation of an haplotype.
Arguments
nbins
(clamp(length(h), 1, 69)
): number of bins- ̀
height
(7
): number of rows kwargs
: arguments passed directly toUnicodePlots.heatmap
Distances
Moonshine.Distance
— Typeabstract type Distance{T}
Distance between two Sequence
s.
Implementation
The only required method for a distance D<:Distance
to be usable for tree contruction is
distance(::D{T}, ::Sequence, ::Sequence) where T
It is also useful to implement a default constructor. For example, if D
is a discrete distance,
D() = D{Int}()
Moonshine.Hamming
— Typestruct Hamming{T} <: Distance{T}
Hamming distance.
Moonshine.LeftM
— Typestruct LeftM{T} <: Distance{T}
Left marker distance.
This is only the discrete metric for the leftmost marker. Technically not a metric for haplotypes, but widely used.
Moonshine.distance
— Functiondistance(Dist, h1, h2)
distance(Dist, H)
Compute distances between sequences.
Methods
distance(Dist, H)
defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:274
.
distance(_, h1, h2)
defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:298
.
distance(_, h1, h2)
defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:323
.