Paths
Types
PanGraph.Graphs.Paths.Link
— TypeLink = NamedTuple{(:block, :strand), Tuple{Block, Bool}}
A shorthand wrapper for an abstract Node object.
PanGraph.Graphs.Paths.Path
— Typemutable struct Path
name :: String
node :: Array{Node{Block}}
offset :: Union{Int,Nothing}
circular :: Bool
position :: Array{Int}
end
Path is a single genome entry within the pangraph. name
stores the unique identifier of the genome. node
is an array of Nodes. The concatenation of all Nodes recapitulates the original sequence. offset
is the circular shift that must be applied to the concatenation to retain the original starting positition. It is nothing if the Path is linear. circular
is true only if the path should be considered circular, i.e. the last node is implictly connected to the first node. position
represents the array of breakpoints each node corresponds to.
PanGraph.Graphs.Paths.Path
— MethodPath(name::String,node::Node{Block};circular::Bool=false)
Return a new Path structure obtained from a single node
and name name
. By default will be interpreted as a linear path.
Functions
Base.length
— Methodlength(p::Path)
Return the number of nodes associated to Path p
.
Base.replace!
— Methodreplace!(p::Path, old::Array{Link}, new::Block)
Replace all instances of oriented Block list old
with the single block new
. Operates on Path p
in place.
Base.replace!
— Methodreplace!(p::Path, old::Block, new::Array{Block}, orientation::Bool)
Replace all instances of Block old
with the array of blocks new
. Operates on Path p
in place. orientation
is the relative orientation assumed between old
and new
, i.e. if it is false, new
is assumed to be the reverse complement of old
.
PanGraph.Graphs.Paths.count_isolates
— Methodcount_isolates(paths)
Return the number of times each isolate within paths
appears in each block.
PanGraph.Graphs.Paths.positions!
— Methodpositions!(p::Path)
Compute the positions of each breakpoint represented by a node in Path p
. Modifies p
in place.
PanGraph.Graphs.sequence
— Methodsequence(p::Path; shift=true)
Return the reconstructed sequence of Path p
. If shift is false, the circular offset will be ignored.