-
Notifications
You must be signed in to change notification settings - Fork 3
/
process_mESC_data.m
74 lines (66 loc) · 1.95 KB
/
process_mESC_data.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
clc;
clear;
close all;
fileID = fopen('cell_states_conditions.txt');
tline = fgets(fileID);
head = strsplit(tline);
fmt = repmat('%s', 1, 3);
C = textscan(fileID,fmt);
fclose(fileID);
cellName = strrep(C{2},'"','');
tmp = regexp(cellName, '_', 'split');
tmp1 = [];
for i = 1:length(tmp)
tmp1 = [tmp1; {tmp{i}{3} tmp{i}{4} tmp{i}{5}(1:end-7)}];
end
addlabel = [tmp1 strrep(C{3},'"','');];
T = readtable('nCountGenesBatchAdjusted.csv', 'ReadRowNames', 1);
SID = T.Properties.VariableNames';
GID = T.Properties.RowNames;
data = table2array(T);
%%
tmp = regexp(SID, '_', 'split');
tmp1 = [];
for i = 1:length(tmp)
tmp1 = [tmp1; tmp{i}];
end
tmp1 = [tmp1(:,1) tmp1(:,1) tmp1(:,2)];
for i = 1:length(tmp1)
tmp1{i,1} = tmp1{i,1}(1:end-1);
tmp1{i,2} = tmp1{i,2}(end);
end
SID_class_label = zeros(length(tmp1), 3);
%
SID_class_label(1:82, 1) = 1;
SID_class_label(83:141, 1) = 2;
SID_class_label(142:213, 1) = 3;
SID_class_label(214:295, 1) = 4;
SID_class_label(296:388, 1) = 5;
SID_class_label(389:454, 1) = 6;
SID_class_label(455:533, 1) = 7;
SID_class_label(534:623, 1) = 8;
SID_class_label(624:704, 1) = 9;
% cell type
SID_class_label(1:82, 2) = 1;
SID_class_label(83:141, 2) = 1;
SID_class_label(142:213, 2) = 1;
SID_class_label(214:295, 2) = 1;
SID_class_label(296:388, 2) = 2;
SID_class_label(389:454, 2) = 2;
SID_class_label(455:533, 2) = 3;
SID_class_label(534:623, 2) = 3;
SID_class_label(624:704, 2) = 3;
% batch
SID_class_label(1:82, 3) = 2;
SID_class_label(83:141, 3) = 3;
SID_class_label(142:213, 3) = 4;
SID_class_label(214:295, 3) = 4;
SID_class_label(296:388, 3) = 2;
SID_class_label(389:454, 3) = 3;
SID_class_label(455:533, 3) = 3;
SID_class_label(534:623, 3) = 2;
SID_class_label(624:704, 3) = 1;
SID_class_label = [tmp1 num2cell(SID_class_label)];
SID_class_label = [SID_class_label, addlabel([1:454 626:704 536:625 455:535],4)];
%%
save mESC_data data GID SID_class_label cellName;