Sequence

Sequences

Moonshine.Sequence — Type
struct Sequence

Sequence of biallelic genetic markers (haplotype).

Implement the iteration interface as well as standard bitwise operations.

Info

Random constructors sample marker's states via Random.bitrand.

Fields

  • data::BitVector

Constructors

Sequence(data)Sequence(data)

defined at src/Sequence.jl:53.

Sequence()

defined at src/Sequence.jl:224.

Sequence(undef, n)

defined at src/Sequence.jl:226.

Sequence(rng, n)

defined at src/Sequence.jl:228.

Sequence(rng, minlength, maxlength)

defined at src/Sequence.jl:230.

where:

  • n: number of markers
  • rng: random number generator
  • minLength, maxLength: bounds for sequence length
source
Moonshine.plot_sequence — Function
plot_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 to UnicodePlots.heatmap
source
Moonshine.ancestral_mask! — Function
ancestral_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 src/Genealogy.jl:430.

ancestral_mask!(mask, genealogy, v; wipe)

defined at src/Genealogy.jl:443.

ancestral_mask!(mask, genealogy, x)

defined at src/Genealogy.jl:464.

ancestral_mask!(mask, sample, ω; wipe)

defined at src/Sample.jl:331.

ancestral_mask!(mask, sample, ωs; wipe)

defined at src/Sample.jl:343.

ancestral_mask!(mask, idx; wipe)

defined at src/Sequence.jl:308.

ancestral_mask!(mask, h, idx; wipe)

defined at src/Sequence.jl:367.

–Internal–

source
Moonshine.ancestral_mask — Function
ancestral_mask(h, idx)
ancestral_mask(sample, ω)
ancestral_mask(genealogy, x)

Allocating version of ancestral_mask!

Methods

ancestral_mask(genealogy, e)

defined at src/Genealogy.jl:438.

ancestral_mask(genealogy, v)

defined at src/Genealogy.jl:459.

ancestral_mask(genealogy, x)

defined at src/Genealogy.jl:467.

ancestral_mask(sample, ω)

defined at src/Sample.jl:340.

ancestral_mask(sample, ωs)

defined at src/Sample.jl:353.

ancestral_mask(h, idx)

defined at src/Sequence.jl:385.

ancestral_mask(h, idx)

defined at src/Sequence.jl:387.

–Internal–

source

Distances

Moonshine.Distance — Type
abstract 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 T

It is also useful to implement a default constructor. For example, if D is a discrete distance,

D() = D{Int}()
source