| Bioinformatics Toolbox™ | ![]() |
Tree1Reordered = reorder(Tree1, Order)
[Tree1Reordered, OptimalOrder]
= reorder(Tree1, Order,
'Approximate', ApproximateValue)
[Tree1Reordered, OptimalOrder]
= reorder(Tree1, Tree2)
| Tree1, Tree2 | Phytree objects. |
| Order | Vector with position indices for each leaf. |
| ApproximateValue | Controls the use of the optimal leaf-ordering calculation to find the closest order possible to the suggested one without dividing the clades or producing crossing branches. Enter true to use the calculation. Default is false. |
| Tree1Reordered | Phytree object with reordered leaves. |
| OptimalOrder | Vector of position indices for each leaf in Tree1Reordered, determined by the optimal leaf-ordering calculation. |
Tree1Reordered = reorder(Tree1, Order) reorders the leaves of the phylogenetic tree Tree1, without modifying its structure and distances, creating a new phylogenetic tree, Tree1Reordered. Order is a vector of position indices for each leaf. If Order is invalid, that is, if it divides the clades (or produces crossing branches), then reorder returns an error message.
[Tree1Reordered, OptimalOrder] = reorder(Tree1, Order, 'Approximate', ApproximateValue) controls the use of the optimal leaf-ordering calculation, which finds the best approximate order closest to the suggested one, without dividing the clades or producing crossing branches. Enter true to use the calculation and return Tree1Reordered, the reordered tree, and OptimalOrder, a vector of position indices for each leaf in Tree1Reordered, determined by the optimal leaf-ordering calculation. Default is false.
[Tree1Reordered, OptimalOrder] = reorder(Tree1, Tree2) uses the optimal leaf-ordering calculation to reorder the leaves in Tree1 such that it matches the order of leaves in Tree2 as closely as possible, without dividing the clades or producing crossing branches. Tree1Reordered is the reordered tree, and OptimalOrder is a vector of position indices for each leaf in Tree1Reordered, determined by the optimal leaf-ordering calculation
Reordering Leaves Using a Valid Order
Create and view a phylogenetic tree.
b = [1 2; 3 4; 5 6; 7 8; 9 10]; tree = phytree(b) Phylogenetic tree object with 6 leaves (5 branches) view(tree)
Reorder the leaves on the phylogenetic tree, and then view the reordered tree.
treeReordered = reorder(tree, [5, 6, 3, 4, 1, 2]) view(treeReordered)
Finding Best Approximate Order When Using an Invalid Order
Create a phylogenetic tree by reading a Newick-formatted tree file (ASCII text file).
tree = phytreeread('pf00002.tree')
Phylogenetic tree object with 33 leaves (32 branches)Create a row vector of the leaf names in alphabetical order.
[dummy,order] = sort(get(tree,'LeafNames'));
Reorder the phylogenetic tree to match as closely as possible the row vector of alphabetically ordered leaf names, without dividing the clades or having crossing branches.
treeReordered = reorder(tree,order,'approximate',true)
Phylogenetic tree object with 33 leaves (32 branches) View the original and the reordered phylogenetic trees.
view(tree) view(treeReordered)
Reordering Leaves to Match Leaf Order in Another Phylogenetic Tree
Create a phylogenetic tree by reading sequence data from a FASTA file, calculating the pairwise distances between sequences, and then using the neighbor-joining method.
seqs = fastaread('pf00002.fa')
seqs =
33x1 struct array with fields:
Header
Sequence
dist = seqpdist(seqs,'method','jukes-cantor','indels','pair');
NJtree = seqneighjoin(dist,'equivar',seqs)
Phylogenetic tree object with 33 leaves (32 branches)Create another phylogenetic tree from the same sequence data and pairwise distances between sequences, using the single linkage method.
HCtree = seqlinkage(dist,'single',seqs)
Phylogenetic tree object with 33 leaves (32 branches) Use the optimal leaf-ordering calculation to reorder the leaves in HCtree such that it matches the order of leaves in NJtree as closely as possible, without dividing the clades or having crossing branches.
HCtree_reordered = reorder(HCtree,NJtree)
Phylogenetic tree object with 33 leaves (32 branches) View the reordered phylogenetic tree and the tree used to reorder it.
view(HCtree_reordered) view(NJtree)
Bioinformatics Toolbox™ function: phytree (object constructor)
Bioinformatics Toolbox object: phytree object
Bioinformatics Toolbox methods of a phytree object: get, getbyname, prune
![]() | prune (phytree) | reroot (phytree) | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |