filename_exp='expressioninfo.txt'; %input expression profile filename_net='networkinfo.txt'; %input network profile filename_sample='sample_group.txt'; %input sample group information filename_gene='gene_weight.txt'; %input gene weight information %read expression and network information expression=importdata(filename_exp); X=expression.data; [ng,ns]=size(X); sample=expression.textdata(1,2:(ns+1)); gene=expression.textdata(2:(ng+1),1); clear expression; network=importdata(filename_net); N=sparse(network); clear network; cluster=importdata(filename_sample); C=cluster.data; cu=unique(C); cn=length(cu); weight=importdata(filename_gene); W=weight.data; n=find(ismember(gene,'ABCC8')); x=find(N(n,:)==1); y=[]; z=[]; for i=1:length(x) y=[y;find(N(:,x(i))==1)]; end z=find(N(:,n)==1); u=unique([x,y',z']); Nn=N(u,u); Xn=X(u,:); Wn=W(u); Wn=Wn/sum(Wn); En=zeros(length(u),cn); for i=1:cn index=find(C==cu(i)); for j=1:length(u) En(j,i)=median(Xn(j,index')); end end i=1; ID=gene(u); bg=biograph(Nn,ID,'ArrowSize',10,'LayoutType','equilibrium','NodeAutoSize','off'); set(bg.nodes,'Shape','circle','TextColor',[0,0,0.75],'FontSize',16,'LineColor',[0,0,0]); set(bg.edges,'LineWidth',1.5); for j=1:length(u) set(bg.nodes(j),'Size',[30*Wn(j)^(1/5),30*Wn(j)^(1/5)]); end scale=1/(1+exp(-2))-0.5; for j=1:length(u) if En(j,i)>=0 if En(j,i)<2 set(bg.nodes(j),'Color',[1,1-(1/(1+exp(-En(j,i)))-0.5)/scale,1-(1/(1+exp(-En(j,i)))-0.5)/scale]); else set(bg.nodes(j),'Color',[1,0,0]); end else if En(j,i)>-2 set(bg.nodes(j),'Color',[1-(1/(1+exp(En(j,i)))-0.5)/scale,1,1-(1/(1+exp(En(j,i)))-0.5)/scale]); else set(bg.nodes(j),'Color',[0,1,0]); end end end view(bg)