Alignment
Types
PanGraph.Graphs.Align.Clade
— MethodClade(distance, names; algo=:nj)
Generate a tree from a matrix of pairwise distances distance
. The names of leafs are given by an array of strings names
. algo
dictates the algorithm used to transform the distance matrix into a tree. Currently on neighbor joining (:nj) is supported.
PanGraph.Graphs.Align.Clade
— MethodClade(name)
Generate an empty, disconnected clade with name name
.
PanGraph.Graphs.Align.Clade
— MethodClade(left::Clade, right::Clade)
Generate an nameless clade with left
and right
children.
PanGraph.Graphs.Align.Clade
— MethodClade()
Generate an empty, disconnected clade.
PanGraph.Graphs.Align.Message
— Typemutable struct Clade
name :: String
parent :: Union{Clade,Nothing}
left :: Union{Clade,Nothing}
right :: Union{Clade,Nothing}
graph :: Channel{Tuple{Graph,Int}}
end
Clade is a node (internal or leaf) of a binary guide tree used to order pairwise alignments associated to a multiple genome alignment in progress. name
is only non-empty for leaf nodes. parent
is nothing
for the root node. graph
is a 0-sized channel that is used as a message passing primitive in alignment. It contains the graph and an index used to decide the order of items in a pair in pairwise graph merge.
Functions
PanGraph.Graphs.Align.align
— Methodalign(aligner::Function, Gs::Graph...; compare=Mash.distance, energy=(hit)->(-Inf), minblock=100, reference=nothing, maxiter=100, verbose=false, debugdir=nothing)
Aligns a collection of graphs Gs
using the specified aligner
function to recover hits. Graphs are aligned following an internal guide tree, generated using kmer distance.
energy
is to be a function that takes an alignment between two blocks and produces a score. The lower the score, the better the alignment. Only negative energies are considered.
minblock
is the minimum size block that will be produced from the algorithm. maxiter
is maximum number of duplications that will be considered during this alignment.
compare
is the function to be used to generate pairwise distances that generate the internal guide tree.
PanGraph.Graphs.Align.align_pair
— Methodalign_pair(G₁::Graph, G₂::Graph, energy::Function, minblock::Int, verify::Function, verbose::Bool; maxiter=100)
Align graph G₁
to graph G₂
by looking for homology between consensus sequences of blocks. This is a low-level function.
energy
is to be a function that takes an alignment between two blocks and produces a score. The lower the score, the better the alignment. Only negative energies are considered.
minblock
is the minimum size block that will be produced from the algorithm. maxiter
is maximum number of duplications that will be considered during this alignment.
PanGraph.Graphs.Align.align_self
— Methodalign_self(G₁::Graph, energy::Function, minblock::Int, verify::Function, verbose::Bool; maxiter=100)
Align graph G₁
to itself by looking for homology between blocks. This is a low-level function.
energy
is to be a function that takes an alignment between two blocks and produces a score. The lower the score, the better the alignment. Only negative energies are considered.
minblock
is the minimum size block that will be produced from the algorithm. maxiter
is maximum number of duplications that will be considered during this alignment.
PanGraph.Graphs.Align.balance
— Methodbalance(root::Clade)
Rotate a binary tree to a balanced configuration. Preserves the topological ordering of the leaves.
PanGraph.Graphs.Align.isleaf
— Methodisleaf(c::Clade)
Return if Clade c
is a terminal node, i.e. a leaf.
PanGraph.Graphs.Align.leaves
— Methodleaves(root::Clade)
Return all terminal nodes that have root
as their common ancestor.
PanGraph.Graphs.Align.nj
— Methodnj(distance, names)
Lower-level function. Generate a tree from a matrix of pairwise distances distance
. The names of leafs are given by an array of strings names
. Uses neighbor joining.
PanGraph.Graphs.Align.ordering
— Methodordering(compare, Gs...)
Return a guide tree based upon distances computed from a collection of graphs Gs
, using method compare
. The signature of compare
is expected to be compare(G::Graphs....) -> distance, names
. Graphs Gs...
are expected to be singleton graphs.
PanGraph.Graphs.Align.postorder
— Methodpostorder(root::Clade)
Return an postorder iterator over descendents of root
.
PanGraph.Graphs.Align.preorder
— Methodpreorder(root::Clade)
Return an preorder iterator over descendents of root
.