Split-Weight Embedding of Phylogenetic trees

Our package provides functions to convert phylogenetic trees from Newick format to Bipartition format, which are then embedded in Euclidean space via Split-Weight Embedding.

Check our paper for more details.

PhyloClustering.num_bipartitionsFunction
num_bipartitions(n::Int64)

Get the number of bipartitions for a given number of taxa.

Arguments

  • n: the number of taxa.

Output:

The number of bipartition corresponding to the number of taxa.

source
PhyloClustering.show_bipartitionsFunction
show_bipartitions(n::Int64; start::Int64 = 0, stop::Int64=-1)

Show the bipartitions between certain indices for a given number of taxa.

Arguments

  • n: the number of taxa
  • start(defaults to 0): the starting index.
  • stop(defaults to -1): the ending index.

Output

The bipartiions of trees with n taxa between start index and stop index.

Example

julia> show_bipartitions(4,stop = 4)
idx	partition
0	1 | 2 3 4 
1	2 | 1 3 4 
2	3 | 1 2 4 
3	4 | 1 2 3 
4	1 2 | 3 4 
source
PhyloClustering.show_bipartitionFunction
show_bipartition(n::Int64, idx::Int64)

Show the bipartition with a given index for a given number of taxa.

Arguments

  • n: the number of taxa.
  • idx: the bipartition to show.

Output

The idx-th bipartiion of trees with n taxa.

Example:

julia> show_bipartition(4, 3)
idx	partition
3	4 | 1 2 3 
source
PhyloClustering.get_bipartitionFunction
get_bipartition(tree::HybridNetwork, n::Int64)

Get the bipartition format of a phylogenetic tree.

Arguments

  • tree: a HybridNetwork object that reperents the tree.
  • n: the number of taxa of the tree.

Output

A Vector of pairs shows the tree in bipartiton format.

Example

julia> get_bipartition(readTopology("(4:4.249,(1:2.457,(2:2.064,3:2.064):0.393):1.793);"), 4)
6-element Vector{Any}:
 3 => 4.249
 0 => 2.457
 1 => 2.064
 2 => 2.064
 6 => 0.393
 3 => 1.793
source
PhyloClustering.split_weightFunction
split_weight(trees::Vector{HybridNetwork}, n::Int64)

Split-weight embedding of phylogenetic trees in a Vector{HybridNetwork}. Note that all taxa will be replaced by numbers. Use the function num_to_name to get a Dictionary containing the name of the taxon corresponding to the number.

Arguments

  • trees: a Vector of HybridNetwork objects that contains trees
  • n: the number of taxa of the trees

Output

A Matrix{Float64} shows the trees in bipartiton format

Example

julia> split_weight([readTopology("(4:4.249,(1:2.457,(2:2.064,3:2.064):0.393):1.793);"), readTopology("(4:4.308,(2:1.634,(1:1.588,3:1.588):0.046):2.674);")], 4)
2×7 Matrix{Float64}:
 2.457  2.064  2.064  6.042  0.0  0.0    0.393
 1.588  1.634  1.588  6.982  0.0  0.046  0.0
source
PhyloClustering.num_to_nameFunction
num_to_name(tree::HybridNetwork)

Obtain a table that contains taxon numbers and their names for a given tree.

Arguments

  • tree: a HybridNetwork objects that contains trees

Output

A Dict{Int64, Any} shows taxon numbers and their names

Example

julia> num_to_name(readTopology("(O:3.866,(HYB:1.593,(P1:1.208,P2:1.208):0.386):2.273);"))
Dict{Int64, Any} with 4 entries:
  4 => "P2"
  2 => "O"
  3 => "P1"
  1 => "HYB"
source