| Bioinformatics Toolbox | ![]() |
Drawing a phylogenetic tree using sequence data is helpful when you are trying to visualize the evolutionary relationships between species. The sequences can be multiply aligned or a set of nonaligned sequences, you can select a method for calculating pairwise distances between sequences, and you can select a method for calculating the hierarchical clustering distances used to build a tree.
After locating the GenBank accession codes for the sequences you are interested in studying, you can create a phylogenetic tree with the data. For information on locating accession codes, see Searching NCBI for Phylogenetic Data.
Create a MATLAB structure with information about the sequences. This step uses the accession codes for the mitochondrial D-loop sequences isolated from different hominid species.
data = {'German_Neanderthal' 'AF011222';
'Russian_Neanderthal' 'AF254446';
'European_Human' 'X90314' ;
'Mountain_Gorilla_Rwanda' 'AF089820';
'Chimp_Troglodytes' 'AF176766';
};
Get sequence data from the GenBank database and copy into MATLAB.
for ind = 1:5
seqs(ind).Header = data{ind,1};
seqs(ind).Sequence = getgenbank(data{ind,2},
'sequenceonly', true);
end
Calculate pairwise distances and create a phytree object. For example, compute the pairwise distances using the Jukes-Cantor distance method and build a phylogenetic tree using the UPGMA linkage method. Since the sequences are not prealigned, seqpdist pairwise aligns them before computing the distances.
distances = seqpdist(seqs,'Method','Jukes-Cantor','Alphabet','DNA');
tree = seqlinkage(distances,'UPGMA',seqs)
MATLAB displays information about the phytree object. The function seqpdist calculates the pairwise distances between pairs of sequences while the function seqlinkage uses the distances to build a hierarchical cluster tree. First, the most similar sequences are grouped together, and then sequences are added to the tree in decending order of similarity.
Phylogenetic tree object with 5 leaves (4 branches)
Draw a phylogenetic tree.
h = plot(tree,'orient','bottom');
ylabel('Evolutionary distance')
set(h.terminalNodeLabels,'Rotation',-45)
MATLAB draws a phylogenetic tree in a figure window. In the figure below, the hypothesized evolutionary relationships between the species. is shown by the location of species on the branches shows the The horizontal distances do not have any biological significance.

| Searching NCBI for Phylogenetic Data | Creating a Phylogenetic Tree for Twelve Species | ![]() |
© 1994-2005 The MathWorks, Inc.