forked from balicea/DevoWorm
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgraph-generation-notes.m
More file actions
49 lines (34 loc) · 1.06 KB
/
Copy pathgraph-generation-notes.m
File metadata and controls
49 lines (34 loc) · 1.06 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
%% Polar plot details
%% matrix A contains angles (theta) and Euclidean distance (rho).
A(:,1) = atand(AP/LR);
A(:,2) = sqrt(AP^2+LR^2);
theta = A(:,1);
rho = A(:,2);
polar(theta,rho,'o')
%% 3-D spatial plot.
%% matrix A contains three anatomical axes or two anatomical dimensions plus gene expression/extracted measures.
x = A(:,1);
y = A(:,2);
z = A(:,3);
plot3(x,y,z,'o')
%% Principle Component Analysis for gene expression.
%% matrix A contains gene expression data for each cell (zeroes for missing data). Maximum number of genes assayed x %% Number of cells assayed.
[PC, SCORE, LATENT, TSQUARE] = princomp(A);
a = score(A(:,1));
b = score(A(:,2));
%% variables a and b represent PC1 and PC2.
plot(a,b,'o');
%% 3-D graph plotted as an animation.
%% assume x,y,z have been created from data.
h = plot3(NaN,NaN,NaN);
xlim ([min(x) max(x)])
ylim ([min(y) max(y)])
zlim ([min(z) max(z)])
i = 1:length(x);
for k=i;
plot3(x(k),y(k),z(k),'erase','none','o')
M(k) = getframe
pause(0.01)
end
movie(M)
%% "pause 0.01" is the time interval. Adjust to 0.1 if neccessary.