forked from ofershapira/SVsig
-
Notifications
You must be signed in to change notification settings - Fork 1
/
list_events.m
executable file
·43 lines (37 loc) · 1.7 KB
/
list_events.m
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
function event_list=list_events(events,posi,posj,pad,UTumor, Uevent, Usample, Upatient,filename)
if ~isempty(pad),
posi(2)=posi(2)-pad;
posi(3)=posi(3)+pad;
posj(2)=posj(2)-pad;
posj(3)=posj(3)+pad;
end
if istable(events),
if isempty(posj),
event_list=events( events{:,1}==posi(1)&events{:,2}>=posi(2)&events{:,2}<posi(3)...
| events{:,4}==posi(1)&events{:,5}>=posi(2)&events{:,5}<posi(3) ,:);
else
event_list=events( events{:,1}==posi(1)&events{:,2}>=posi(2)&events{:,2}<posi(3)&events{:,4}==posj(1)&events{:,5}>=posj(2)&events{:,5}<posj(3)...
| events{:,1}==posj(1)&events{:,2}>=posj(2)&events{:,2}<posj(3)&events{:,4}==posi(1)&events{:,5}>=posi(2)&events{:,5}<posi(3) ,:);
end
else
if isempty(posj),
event_list=events( events(:,1)==posi(1)&events(:,2)>=posi(2)&events(:,2)<posi(3)...
| events(:,4)==posi(1)&events(:,5)>=posi(2)&events(:,5)<posi(3) ,:);
else
event_list=events( events(:,1)==posi(1)&events(:,2)>=posi(2)&events(:,2)<posi(3)&events(:,4)==posj(1)&events(:,5)>=posj(2)&events(:,5)<posj(3)...
| events(:,1)==posj(1)&events(:,2)>=posj(2)&events(:,2)<posj(3)&events(:,4)==posi(1)&events(:,5)>=posi(2)&events(:,5)<posi(3) ,:);
end
if ~isempty(filename);
chr_i=[num2str(event_list(:,1))];
pos_i=[num2str(event_list(:,2))];
chr_j=[num2str(event_list(:,4))];
pos_j=[num2str(event_list(:,5))];
tumor=UTumor{event_list(:,7),1};
event=Uevent{event_list(:,8),1};
sample=Usample{event_list(:,9),1};
patient=Upatient{event_list(:,10),1};
T=table(chr_i,pos_i,chr_j,pos_j,tumor,event,sample,patient);
writetable(T,filename);
end
end
return