internal documentation
Documentation for PhyloPlots
's internal functions. Those functions are not exported, but can still be used (like: PhyloPlots.foo()
for a function named foo()
).
index
PhyloPlots.check_nodedataframe
PhyloPlots.edgenode_coordinates
PhyloPlots.prepare_edgedataframe
PhyloPlots.prepare_nodedataframe
PhyloPlots.rexport
functions
PhyloPlots.check_nodedataframe
— Methodcheck_nodedataframe(net, nodelabel)
Check data frame for node annotations:
- check that the data has at least 2 columns (if it has any)
- check that the first column has integers (to serve as node numbers)
- remove rows with no node numbers
- warning if some node numbers in the data are not in the network.
PhyloPlots.edgenode_coordinates
— Methodedgenode_coordinates(net, useedgelength::Bool, useSimpleHybridLines::Bool)
Calculate coordinates for plotting later with Gadfly or RCall.
Actually modifies some (minor) attributes of the network, as it calls directEdges!
and preorder!
.
output: tuple with the following elements, in which the order of nodes corresponds to the order in net.node
, and the order of edges corresponds to that in net.edge
(filtered to minor edges as needed).
edge_xB
: x coordinate for the Beginning and ...edge_xE
: ... End of each edge, in the same order as innet.edge
edge_yB
: y coordinate for edges, Begin ...edge_yE
: ... and End. Each major edge is drawn as a single horizontal line. Minor hybrid edges are drawn as: a single diagonal segment ifuseSimpleHybridLines
is true, or as 2 connected segments otherwise: one horizontal (whose length on the x axis can be used to represent the edge length), and the other diagonal to connect the horizontal segment to the child node.edge_*
contains the coordinates for the horizontal segment only, which is reduced to a single point (Begin = End) when using "SimpleHybridLines".minoredge_*
(see below) contains information for the diagonal segment. Agreed,edge_yB
=edge_yE
always (relic from before v0.3: no minoredge output back then, and simple diagonal lines only)node_x
: x and ...node_y
: ... y coordinate at the middle of the vertical bar that represents a node. The (or each) parent edge of the node connects to this middle point, but the node itself is drawn as a vertical bar connected to all it children edges. order: same as innet.node
node_yB
: y coordinates of the Beginning and the ...node_yE
: ... End of the vertical bar representing each node. The x coordinate (Begin & End) of the end points of the vertical bar is the same as that of the mid-point, given bynode_x
.minoredge_xB
: x coordinate for the Beginning and ...minoredge_xE
: ... End of the diagonal segment of each minor hybrid edge, in the same order as infilter(e -> !e.isMajor, net.edge)
.minoredge_yB
: y coordinate for the beginning and ...minoredge_yE
: ... end of the diagonal segment of each minor hybrid edge.
13-16. xmin
, xmax
, ymin
, ymax
: ranges for the x and y axes.
PhyloPlots.prepare_edgedataframe
— Methodprepare_edgedataframe(net, edgelabel::DataFrame, style::Symbol,
edge_xB, edge_xE, edge_yB, edge_yE,
minoredge_xB, minoredge_xE, minoredge_yB, minoredge_yE)
Check data frame for edge annotation. edge_*
: Float64 vectors giving the coordinates for the beginning and end of edges. Return data frame with columns
- x, y: coordinates on the plots
- len: node name
- gam: gamma (inheritance value)
- num: node number
- lab: node label
- hyb: is hybrid?
- min: is minor?
PhyloPlots.prepare_nodedataframe
— Methodprepare_nodedataframe(net, nodelabel::DataFrame,
shownodenumber::Bool, shownodename::Bool, labelnodes::Bool,
node_x, node_y)
Make data frame for node annotation. node_*
should be Float64 vectors. nodelabel
should have columns as required by check_nodedataframe
. shownodename
is to show the name of internal nodes. Leaf names are always included.
Columns of output data frame:
- x, y: coordinates on the plots (from
node_*
) - name: node name
- num: node number
- lab: node label
- lea: is leaf?
PhyloPlots.rexport
— Methodrexport(net::HybridNetwork; maintree=false, useedgelength=true)
Create an RObject of class phylo
(and evonet
depending on the number of hybridizations) recognized by the ape
library in R (S3 object). This RObject can be evaluated using the tools available in the ape
library in R. For example, we can visualize the network using ape
's plot
function.
not exported: sexp
is the best way to go.
Arguments
- useedgelength: if true, export edge lengths from
net
. - maintree: if true, minor hybrid edges are omitted.
Examples
julia> net = readTopology("(((A,(B)#H1:::0.9),(C,#H1:::0.1)),D);");
julia> phy = PhyloPlots.rexport(net)
RObject{VecSxp}
Evolutionary network with 1 reticulation
--- Base tree ---
Phylogenetic tree with 4 tips and 5 internal nodes.
Tip labels:
A, B, C, D
Rooted; no branch lengths.
julia> using RCall
julia> R"library(ape)";
julia> phy
RObject{VecSxp}
Evolutionary network with 1 reticulation
--- Base tree ---
Phylogenetic tree with 4 tips and 5 internal nodes.
Tip labels:
A, B, C, D
Rooted; no branch lengths.
R> phy
Evolutionary network with 1 reticulation
--- Base tree ---
Phylogenetic tree with 4 tips and 5 internal nodes.
Tip labels:
A, B, C, D
Rooted; no branch lengths.
R> str(phy)
List of 5
$ Nnode : int 5
$ edge : int [1:8, 1:2] 5 5 6 6 7 8 8 9 6 4 ...
$ tip.label : chr [1:4] "A" "B" "C" "D"
$ reticulation : int [1, 1:2] 7 9
$ reticulation.gamma: num 0.1
- attr(*, "class")= chr [1:2] "evonet" "phylo"