-
Notifications
You must be signed in to change notification settings - Fork 0
/
Zeisel_geneset.m
58 lines (49 loc) · 2.13 KB
/
Zeisel_geneset.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
function [Zeisel_gene_names,repcells,repcellinds] = Zeisel_geneset(filedir)
%This function generates the unity gene set from the differential
%expression subsetting from Zeisel, et al., 2018 for their correlation
%mapping procedure, and the coronal AGEA ISH atlas.
metacols = h5read([filedir filesep 'l5_all.agg.loom'],'/col_attrs/ClusterName');
load([filedir filesep 'Zeisel_cellIDs.mat'],'cellIncl');
metacols = cellfun(@deblank,metacols,'UniformOutput',false);
[newcellnames,metainds] = sort(metacols);
cellIncl = logical(cellIncl);
inclcols = newcellnames(cellIncl);
exclcols = newcellnames(~cellIncl);
classkey = inclcols;
metacells = h5read([filedir filesep 'l5_all.agg.loom'],'/matrix');
cellcols = h5read([filedir filesep 'l5_all.loom'],'/col_attrs/ClusterName');
cellrows = h5read([filedir filesep 'l5_all.loom'],'/row_attrs/Gene');
newgennames = cellfun(@deblank,cellrows,'UniformOutput',false);
% newcellnames = cellfun(@deblank,cellcols,'UniformOutput',false);
[newgennames,geninds] = sort(newgennames);
metacells = metacells(metainds,geninds);
metacells = metacells(cellIncl,:);
[~,maxgen_percell] = max(metacells,[],2);
unimax = unique(maxgen_percell);
maxgenanmes = newgennames(unimax);
% filedir = '/Users/christophermezias/Documents/MISS_General';
rawdata = readcell([filedir filesep 'mmc4.csv']);
cnames = rawdata(2:4:1058,1);
cnames{39} = 'OBDOP2';
genname_rows = 2:4:1058;
genname_raw = rawdata(genname_rows,3:end);
inclgen = ismember(cnames,classkey);
genname_incl = genname_raw(inclgen,:);
genname_vec = reshape(genname_incl,size(genname_incl,1)*size(genname_incl,2),1);
unigen_spex = unique(genname_vec);
genname_vec = [genname_vec;maxgenanmes];
unigen = unique(genname_vec);
load([filedir filesep 'ISH_gene_names.mat'],'ISH_gene_names');
entrez_inds = ismember(unigen,ISH_gene_names);
entrez_names = unigen(entrez_inds);
criteria = 1;
celltest = ismember(genname_incl,entrez_names);
gensum = sum(celltest,2);
reprows = (gensum>=criteria);
% reprows = unique(reprows);
newcnames = cnames(inclgen);
newcnames = newcnames(reprows);
repcellinds = ismember(classkey,newcnames);
repcells = classkey(repcellinds);
Zeisel_gene_names = entrez_names;
end