Sequence
Sequences
Moonshine.Sequence — Typestruct SequenceSequence 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:207.
Sequence(undef, n)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:209.
Sequence(rng, n)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:211.
Sequence(rng, minlength, maxlength)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:213.
where:
n: number of markersrng: random number generatorminLength, maxLength: bounds for sequence length
Moonshine.cheap_hash — Functioncheap_hashSimple (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:127.
blocksize(_)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:129.
–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
Moonshine.ancestral_mask! — Functionancestral_mask!(mask, h, idx; wipe = true)
ancestral_mask!(mask, sample, ω; wipe = true)
ancestral_mask!(mask, genealogy, x; wipe = true)&-mask for non-ancestral markers. Construct a mask for a range of markers in a given haplotype.
The first form returns a mask that & markers outside of the range idx to 0 when applied to h.data.chunks. h can either be a sequence or an integer meant to be the number of markers in a sequence. The second forms acts similarly for an interval (or set of intervals). If x is a vertex, the third form returns a mask that & the markers of the associated haplotype not ancestral for it to 0. The ancestral intervals of x is defined as the union of its downstream edges' intervals. Behaviour is similar if x is an edge, but the mask is meant for the intersection of chunks between its adjacent vertices.
If wipe = true, mask is wiped beforehand.
For convenience, each method has an allocating counterpart; see ancestral_mask.
See also wipe!.
Methods
ancestral_mask!(mask, genealogy, e; wipe)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Genealogy.jl:394.
ancestral_mask!(mask, genealogy, v; wipe)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Genealogy.jl:406.
ancestral_mask!(mask, genealogy, x)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Genealogy.jl:422.
ancestral_mask!(mask, sample, ω; wipe)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sample.jl:237.
ancestral_mask!(mask, sample, ωs; wipe)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sample.jl:249.
ancestral_mask!(mask, h, idx; wipe)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:290.
ancestral_mask!(mask, h, idx; wipe)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:343.
–Internal–
Moonshine.ancestral_mask — FunctionAllocating version of ancestral_mask!
Methods
ancestral_mask(genealogy, e)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Genealogy.jl:401.
ancestral_mask(genealogy, v)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Genealogy.jl:417.
ancestral_mask(genealogy, x)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Genealogy.jl:425.
ancestral_mask(sample, ω)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sample.jl:246.
ancestral_mask(sample, ωs)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sample.jl:259.
ancestral_mask(h, idx)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:356.
ancestral_mask(h, idx)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:359.
–Internal–
Distances
Moonshine.Distance — Typeabstract type Distance{T}Distance between two Sequences.
Implementation
The only required method for a distance D<:Distance to be usable for tree contruction is
distance(::D{T}, ::Sequence, ::Sequence) where TIt 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:397.
distance(_, h1, h2)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:421.
distance(_, h1, h2)defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Sequence.jl:450.