Tree & ARG

Tree

Moonshine.TreeType
struct Tree <: AbstractGenealogy

Coalescent tree.

See also Arg.

Fields

  • graph::Graphs.SimpleGraphs.SimpleDiGraph{Int32}: Tree's topology

  • latitudes::Vector{Float64}: Vertices' latitudes

  • sequences::Vector{Sequence}: Vertices' haplotypes

  • sample::Sample: Associated Sample

  • logdensity::Base.RefValue{DoubleFloats.Double64}: Log-value of the associated pdf

Constructors

Info

Random constructor calls Sample's random constructor.

Warning

These do not actually build the tree. For that, see build!(rng, tree).

Tree(graph, latitudes, sequences, sample, logdensity)
Tree(graph, latitudes, sequences, sample, logdensity)

defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Tree.jl:42.

Tree(sample)

defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Tree.jl:54.

Tree(rng, n, μ, ρ, Ne, sequence_length)

defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Tree.jl:66.

Arguments

Arguments are the same as for Sample.

source

Arg

Moonshine.ArgType
struct Arg <: AbstractGenealogy

Ancestral recombination graph.

See also Tree.

Fields

  • graph::Graphs.SimpleGraphs.SimpleDiGraph{Int32}: Graph's topology

  • latitudes::Vector{Float64}: Vertices' latitudes

  • recombination_mask::Vector{AncestralIntervals{Vector{IntervalSets.Interval{:closed, :open, Float64}}}}: ∩-mask for ancestral intervals

  • mrca::Base.RefValue{Int32}: Arg's grand MRCA

  • sequences::Vector{Sequence}: Vertices' haplotypes

  • ancestral_intervals::Dict{Graphs.SimpleGraphs.SimpleEdge{Int32}, AncestralIntervals{Vector{IntervalSets.Interval{:closed, :open, Float64}}}}: Edges' ancestral intervals

  • sample::Sample: Associated Sample

  • logdensity::Base.RefValue{DoubleFloats.Double64}: Log-value of the associated pdf

Constructors

Info

Random constructor calls Sample's random constructor.

Warning

These do not actually build the arg. For that, see build!(rng, arg).

Arg(
    graph,
    latitudes,
    recombination_mask,
    mrca,
    sequences,
    ancestral_intervals,
    sample,
    logdensity
)
Arg(
    graph,
    latitudes,
    recombination_mask,
    mrca,
    sequences,
    ancestral_intervals,
    sample,
    logdensity
)

defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Arg/Arg.jl:43.

Arg(tree)

defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Arg/Arg.jl:61.

Arg(rng, n, μ, ρ, Ne, sequence_length)

defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Arg/Arg.jl:77.

Arguments

  • tree: coalescent Tree
  • other arguments are identical to Sample
source
Moonshine.plot_breakpointsFunction
plot_breakpoints(arg; nbins, height, kwargs...)

Heatmap of recombination events' positions.

See also breakpoints

Keywords

  • nbins (clamp(nrecombinations(arg) ÷ 100, 1, 69)): number of bins. Its default maximum value of 69 produces a nice 80 columns wide plot.
  • height (7): height of the plot.
  • kwargs...: additional keywords arguments are passed directly to UnicodePlots.histogram.
source
Moonshine.rlat_minFunction
rlat_min(arg, e, nextidx)

Compute the minimum latitude for a recombination event rooted on e.

Internal

source

MMN

Moonshine.next_inconsistent_idxFunction
next_inconsistent_idx(
    arg,
    idx,
    stack;
    mutations_edges,
    buffer
)

Index of the next inconsistent marker, that is the next which mutates more than once in a given ancestral recombination graph.

stack must be of type CheapStack{Edge{VertexType}} (see CheapStack).

source

Common

Moonshine.build!Function
build!(rng, genealogy; kwargs...)

Build a genealogy.

Methods

build!(rng, arg; winwidth, buffer, noprogress)

defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Arg/Recombination.jl:697.

build!(rng, tree; Dist, bias0, threshold_prop)

defined at /home/runner/work/Moonshine.jl/Moonshine.jl/src/Tree.jl:243.

Arguments

  • winwidth (): width of the window of positions to consider
  • noprogress (false): hide progress bar
  • Dist (Hamming{Int}()): distance used to compute coalescence probabilities
  • bias0 (10): distance multiplier: higher values favour coalescence events between similar haplotypes
  • threshold_prop (1): proportion of events to consider when sampling
source