Repository navigation
Expand file tree
/
Copy pathsc_potency.m
More file actions
54 lines (49 loc) · 1.9 KB
/
Copy pathsc_potency.m
File metadata and controls
54 lines (49 loc) · 1.9 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
53
54
function [r] = sc_potency(X, genelist, speciesid)
%Estimate differentiation potency of cells
%without the need to assume prior biological knowledge
%such as marker expression or timepoint.
% CCAT (Correlation of Connectome And Transcriptome)
%https://github.com/aet21/SCENT
%
%see also: run.cytotrace
if nargin < 3, speciesid = 1; end
if ~ ismember(speciesid, [1 2])
error('Invalid SPECIESID');
end
pw1 = fileparts(mfilename('fullpath'));
% pth=fullfile(pw1,'resources/STRING');
dbfile1 = fullfile(pw1, 'resources', 'STRING', 'stringdb_human.mat');
dbfile2 = fullfile(pw1, 'resources', 'STRING', 'stringdb_mouse.mat');
if ~ exist(dbfile1, 'file')
%disp('Downloading ...... stringdb_human.mat')
url = 'https://github.com/jamesjcai/jamesjcai.github.io/raw/master/data/stringdb_human.mat';
% outfilename =
websave(dbfile1, url);
end
if ~ exist(dbfile2, 'file')
%disp('Downloading ...... stringdb_mouse.mat')
url = 'https://github.com/jamesjcai/jamesjcai.github.io/raw/master/data/stringdb_mouse.mat';
%outfilename =
websave(dbfile2, url);
end
genelist = upper(genelist);
if speciesid == 1
ppinetfile = dbfile1; % 'Z:\Cailab\CCC_utilities\STRING\stringdb_human.mat';
disp('Using resources/stringdb_human.mat')
else
ppinetfile = dbfile2; % 'Z:\Cailab\CCC_utilities\STRING\stringdb_mouse.mat';
disp('Using resources/stringdb_mouse.mat')
end
load(ppinetfile, 'G');
G.Edges.Weight = double(G.Edges.Weight > 0);
GNodes = upper(string(table2array(G.Nodes)));
Gdegree = G.degree;
X = log2(X + 1.1);
[~, i, j] = intersect(genelist, GNodes);
if isempty(i)
error(sprintf('No gene is found in STRING PPI data base.\nCheck gene names.'));
end
d = Gdegree(j);
X = X(i, :);
r = corr(X, d); % Correlation of Connectome And Transcriptome
end