-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphylogeneticTree.m
More file actions
53 lines (43 loc) · 1.27 KB
/
phylogeneticTree.m
File metadata and controls
53 lines (43 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function [ UPGMAtree ] = phylogeneticTree(data)
% Computate the UPGMA phylogenetic tree
% Inputs: Gene data cell containing sequence and its header.
% Output: UPGMA tree
%
% Citation
% Yin, C., & Yau, S. S. T. (2015). An improved model for whole genome phylogenetic analysis by Fourier transform. Journal of Theoretical Biology.
%
% Changchuan Yin
% University of Illinois at Chicago
% Email: cyinbox@gmail.com
% Last update 06/18/2015
L=zeros(1,length(data));
for k = 1:length(data)
name=data{k,2};
seq=getgenbank(data{k,1},'sequenceonly','true');
L(k)=length(seq);
Genes(k).Header = name;
Genes(k).Sequence = seq;
end
maxL=max(L)
N=length(Genes);
distM=zeros(N,N);
for i=1:N
seq1=Genes(i).Sequence;
for j=i:N
seq2=Genes(j).Sequence;
option=get2DMappingOption(seq1,seq2);
distM(i,j)= getDistanceFFTSpace_ES2D(seq1,seq2,maxL,option)
end
end
maxDist=max(max(distM));
dM=distM/maxDist;
dz=[];
for k=2:N
dm=dM(k-1,k:N)';
dz=[dz;dm];
end
UPGMAtree = seqlinkage(dz,'UPGMA',Genes);
hTree = plot(UPGMAtree,'orient','left');
xlabel('Similarity distance', 'FontName', 'AvantGarde','FontSize', 10,'FontWeight','bold')
title('UPGMA phylogenetic tree', 'FontName', 'AvantGarde','FontSize', 10,'FontWeight','bold')
end