Skip to content

Commit

Permalink
major backup update
Browse files Browse the repository at this point in the history
  • Loading branch information
kruggles7 committed Apr 23, 2014
1 parent 80f7755 commit b733c2a
Show file tree
Hide file tree
Showing 138 changed files with 11,405 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
44 changes: 44 additions & 0 deletions clustergram/OR_clustergram_KVR_090213.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
%make heatmaps out of the relative risk matrix
xlab={'2001', '2003', '2005', '2007', '2009', '2011'};

indx2=find(strcmp(odds_ratio_cell(:,2),'Q32')~=1 & strcmp(odds_ratio_cell(:,2),'Q16')~=1 & strcmp(odds_ratio_cell(:,2),'Q53')~=1 & strcmp(odds_ratio_cell(:,2),'Q17')~=1 & strcmp(odds_ratio_cell(:,2),'Q22')~=1 & strcmp(odds_ratio_cell(:,2),'Q55')~=1 & strcmp(odds_ratio_cell(:,2),'Q56')~=1 & strcmp(odds_ratio_cell(:,2),'Q68')~=1 & strcmp(odds_ratio_cell(:,2),'Q69')~=1);
odds_ratio_cell=odds_ratio_cell(indx2,:);

indx2=find(strcmp(odds_ratio_cell(:,1),'Q32')~=1 & strcmp(odds_ratio_cell(:,1),'Q16')~=1 & strcmp(odds_ratio_cell(:,1),'Q53')~=1 & strcmp(odds_ratio_cell(:,1),'Q17')~=1 & strcmp(odds_ratio_cell(:,1),'Q22')~=1 & strcmp(odds_ratio_cell(:,1),'Q55')~=1 & strcmp(odds_ratio_cell(:,1),'Q56')~=1 & strcmp(odds_ratio_cell(:,1),'Q68')~=1 & strcmp(odds_ratio_cell(:,1),'Q69')~=1);
odds_ratio_cell=odds_ratio_cell(indx2,:);

for i=1 %1:70
i_char=num2str(i);
q1_=i_char;
num2=i;
if (num2~=32 && num2~=16 && num2~=53 && num2~=17 && num2~=22 && num2~=55 && num2~=56 && num2~=68 && num2~=69);
if length(i_char)<2
i_char=['0' i_char];
end
q1=['Q' i_char];
indx=find (strcmp(odds_ratio_cell(:,1),q1)==1);
if isempty(indx)==0
plot_mat=cell2mat(odds_ratio_cell(indx,3:8));
q2=odds_ratio_cell(indx,2);
q2_=cell(length(q2),1);
for p=1:length(q2)
s=q2{p,1};
q2_{p,1}=s(2:3);
end
indx2=find(isinf(plot_mat)==1);
plot_mat(indx2)=-1;
maxv=max(max(plot_mat));
plot_mat(indx2)=maxv;
log_rel_risk=log2(plot_mat);
indx3=find(log_rel_risk<-100000);
minv=min(min(log_rel_risk));
log_rel_risk(indx3)=minv;
cg=clustergram(log_rel_risk,'RowLabels',q2_, 'ColumnLabels', xlab, 'ColorMap', 'jet');
fig=plot(cg);
tightfig;
print (gcf,'-dmeta',[q1 '_clustermap_OR_090313.emf']);
hm=HeatMap(log_rel_risk,'RowLabels',q2_, 'ColumnLabels', xlab, 'ColorMap', 'jet');
end
end
close
end
52 changes: 52 additions & 0 deletions clustergram/OR_clustergram_KVR_090213_77.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
%make heatmaps out of the relative risk matrix
xlab={'2009', '2011'};
odds_ratio_cell=OR_cell;

indx2=find(strcmp(odds_ratio_cell(:,2),'Q32')~=1 & strcmp(odds_ratio_cell(:,2),'Q16')~=1 & strcmp(odds_ratio_cell(:,2),'Q53')~=1 & strcmp(odds_ratio_cell(:,2),'Q17')~=1 & strcmp(odds_ratio_cell(:,2),'Q22')~=1 & strcmp(odds_ratio_cell(:,2),'Q55')~=1 & strcmp(odds_ratio_cell(:,2),'Q56')~=1 & strcmp(odds_ratio_cell(:,2),'Q68')~=1 & strcmp(odds_ratio_cell(:,2),'Q69')~=1);
odds_ratio_cell=odds_ratio_cell(indx2,:);

indx2=find(strcmp(odds_ratio_cell(:,1),'Q32')~=1 & strcmp(odds_ratio_cell(:,1),'Q16')~=1 & strcmp(odds_ratio_cell(:,1),'Q53')~=1 & strcmp(odds_ratio_cell(:,1),'Q17')~=1 & strcmp(odds_ratio_cell(:,1),'Q22')~=1 & strcmp(odds_ratio_cell(:,1),'Q55')~=1 & strcmp(odds_ratio_cell(:,1),'Q56')~=1 & strcmp(odds_ratio_cell(:,1),'Q68')~=1 & strcmp(odds_ratio_cell(:,1),'Q69')~=1);
odds_ratio_cell=odds_ratio_cell(indx2,:);

for i=77
i_char=num2str(i);
q1_=i_char;
num2=i;
if (num2~=32 && num2~=16 && num2~=53 && num2~=17 && num2~=22 && num2~=55 && num2~=56 && num2~=68 && num2~=69);
if length(i_char)<2
i_char=['0' i_char];
end
q1=['Q' i_char];
indx=find (strcmp(odds_ratio_cell(:,1),q1)==1);
if isempty(indx)==0
plot_mat=cell2mat(odds_ratio_cell(indx,3:4));
q2=odds_ratio_cell(indx,2);
q2_=cell(length(q2),1);
for p=1:length(q2)
s=q2{p,1};
q2_{p,1}=s(2:3);
end
indx2=find(isinf(plot_mat)==1);
plot_mat(indx2)=-1;
maxv=max(max(plot_mat));
plot_mat(indx2)=maxv;
log_rel_risk=log2(plot_mat);
indx3=find(log_rel_risk<-100000);
minv=min(min(log_rel_risk));
log_rel_risk(indx3)=minv;
%cg=clustergram(log_rel_risk,'RowLabels',q2_, 'ColumnLabels', xlab, 'ColorMap', 'jet');
fig=plot(cg);
tightfig;
% print (gcf,'-dmeta',[q1 '_clustermap_OR_090313.emf']);
%cg=clustergram(plot_mat,'RowLabels',q2_, 'ColumnLabels', xlab, 'ColorMap', 'jet');
fig=plot(cg);
tightfig;
%print (gcf,'-dmeta',[q1 '_clustermap_OR_090313_nolog.emf']);
hm=HeatMap(log_rel_risk,'RowLabels',q2_,'ColumnLabels',xlab,'ColorMap','jet');
%print (gcf, '-dmeta',[q1 '_heatmap_OR_090313.emf']);
%hm=HeatMap(plot_mat,'RowLabels',q2_,'ColumnLabels',xlab,'ColorMap','jet');
%print (gcf, '-dmeta',[q1 '_heatmap_OR_090313_nolog.emf']);
end
end
close
end
44 changes: 44 additions & 0 deletions clustergram/OR_clustergram_peryear.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
%make heatmaps out of the relative risk matrix
years={'2001', '2003', '2005', '2007', '2009', '2011'};

indx2=find(strcmp(odds_ratio_cell(:,2),'Q32')~=1 & strcmp(odds_ratio_cell(:,2),'Q16')~=1 & strcmp(odds_ratio_cell(:,2),'Q53')~=1 & strcmp(odds_ratio_cell(:,2),'Q17')~=1 & strcmp(odds_ratio_cell(:,2),'Q22')~=1 & strcmp(odds_ratio_cell(:,2),'Q55')~=1 & strcmp(odds_ratio_cell(:,2),'Q56')~=1 & strcmp(odds_ratio_cell(:,2),'Q68')~=1 & strcmp(odds_ratio_cell(:,2),'Q69')~=1);
odds_ratio_cell=odds_ratio_cell(indx2,:);

indx2=find(strcmp(odds_ratio_cell(:,1),'Q32')~=1 & strcmp(odds_ratio_cell(:,1),'Q16')~=1 & strcmp(odds_ratio_cell(:,1),'Q53')~=1 & strcmp(odds_ratio_cell(:,1),'Q17')~=1 & strcmp(odds_ratio_cell(:,1),'Q22')~=1 & strcmp(odds_ratio_cell(:,1),'Q55')~=1 & strcmp(odds_ratio_cell(:,1),'Q56')~=1 & strcmp(odds_ratio_cell(:,1),'Q68')~=1 & strcmp(odds_ratio_cell(:,1),'Q69')~=1);
odds_ratio_cell=odds_ratio_cell(indx2,:);

%remake cell for each year
q1=odds_ratio_cell(:,1);
q2=odds_ratio_cell(:,2);
q_num=q2(1:52,1);
xlab=q_num;
%rel_risk=zeros(66,66);
rel_risk=double.empty;

for j=6
for i=1:length(q_num)
q_char=(q_num{i}) ;
indx1=find(strcmp(q1(:),q_char)==1);
n=1;
for k=1:length(indx1)
indx=indx1(k);
rel_risk(n,i)=odds_ratio_cell{indx,j+2};
n=n+1;
end
end
rel_risk2=rel_risk;
indx2=find(isinf(rel_risk2)==1);
rel_risk2(indx2)=-1;
maxv=max(max(rel_risk2));
rel_risk2(indx2)=maxv;
log_rel_risk=log2(rel_risk2);
indx3=find(log_rel_risk<-100000);
minv=min(min(log_rel_risk));
log_rel_risk(indx3)=minv;
cg2=clustergram(log_rel_risk,'RowLabels', xlab, 'ColumnLabels',xlab, 'Colormap','jet');
fig2=plot(cg2);
tightfig;
print (gcf, '-dmeta', [years{j} '_clustergram_OR.emf']);
hm=HeatMap(log_rel_risk,'RowLabels',xlab, 'ColumnLabels', xlab, 'ColorMap', 'jet');
%close
end
74 changes: 74 additions & 0 deletions clustergram/OR_clustergram_peryear_RC.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
%make heatmaps out of the relative risk matrix
years={'2001', '2003', '2005', '2007', '2009', '2011'};
cd ..
cd ..
cd matrices
load relative_risk_RC_010414.mat
load q_labels_010414.mat
load order.mat
cd ..

%remake cell for each year
q1=odds_ratio_cell(:,1);
q2=odds_ratio_cell(:,2);
q_num=q2(1:56,1);
xlab=q_num;
rel_risk=double.empty;

for j=6
for i=1:length(q_num)-1
q_char=(q_num{i}) ;
indx1=find(strcmp(q1(:),q_char)==1);
n=1;
for k=1:length(indx1)-1
indx=indx1(k);
rel_risk(n,i)=odds_ratio_cell{indx,j+2};
n=n+1;
end
end
[r,c]=size(rel_risk);
rel_risk2=zeros(r,c);
qlabel2=cell(r,1);
for i=1:length(order);
in=order(i);
rel_risk2(i,:)=rel_risk(in,:); %reorder by group
qlabel2(i,1)=qlabel(in,1);
end
rel_risk3=rel_risk2;
rawOR=flipud(rel_risk3);
% T=rel_risk2;
% indx=find(isinf(T)==1);
% T(indx)=-1;
% maxv=max(max(T));
% rel_risk2(indx)=maxv;
for i=1:r
temp_mat=rel_risk2(i,:);
noinf=temp_mat;
indx=find(isinf(noinf)==1);
noinf(indx)=-1;
maxv=max(noinf);
temp_mat(indx)=maxv;
rel_risk2(i,:)=temp_mat;
end
[r,c]=size(rel_risk2);
for i=1:r
med=median(rel_risk2(i,:));
rel_risk2(i,:)=rel_risk2(i,:)/med;
%indx2=find(isinf(rel_risk2(:,i))==1);
%rel_risk2(indx2,i)=maxv(i);
end
log_rel_risk=log2(rel_risk2);
normOR=flipud(log_rel_risk);
for i=1:r
temp=log_rel_risk(i,:);
minv=min(temp);
indx3=find(log_rel_risk(i,:)<-100000);
log_rel_risk(i,indx3)=minv;
end
%qqplot_figs(mat, [ years{j} '_log.png']);
cg2=clustergram(log_rel_risk,'ColumnLabels',qlabel(:,1),'Cluster',2, 'Colormap','jet', 'DisplayRange',3); %'RowLabels',qlabel2(:,1),
% fig2=plot(cg2);
% %tightfig;
% print (gcf, '-depsc2', [years{j} '_clustergram_OR']);
% cg3=clustergram(rel_risk2, 'ColumnLabels',qlabel(:,1),'Cluster',2, 'Colormap','jet', 'DisplayRange',3, 'Symmetric','true');
end
72 changes: 72 additions & 0 deletions clustergram/OR_clustergram_ques_RC.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
%make heatmaps out of the relative risk matrix

cd ..
cd ..
cd matrices
load rel_risk_RC_010414.mat
load q_labels_010414.mat
cd ..
xlab={'2001', '2003', '2005', '2007', '2009', '2011'};

ques=input ('Enter in the question number you want to use (ex. Q01): ', 's');
for i=1:80
i_char=num2str(i);
q1_=i_char;
num2=i;
if length(i_char)<2
i_char=['0' i_char];
end
q1=['Q' i_char];
if strcmp(q1,ques)==1
indx=find (strcmp(odds_ratio_cell(:,1),q1)==1);
if isempty(indx)==0
plot_mat=cell2mat(odds_ratio_cell(indx,3:8));
q2=odds_ratio_cell(indx,2);
q2_=cell(length(q2)-1,1);
for p=1:length(q2)-1
s=q2{p,1};
q2_{p,1}=s(2:3);
end
plot_mat=plot_mat(1:56,:);
plot_mat=rot90(plot_mat);
[r,c]=size(plot_mat);
plot_mat2=plot_mat;
%qqplot_figs(plot_mat2, [ q1 '_raw']);
for j=1:r
temp_mat=plot_mat(j,:);
noinf=temp_mat;
indx=find(isinf(noinf)==1);
noinf(indx)=-1;
maxv=max(noinf);
temp_mat(indx)=maxv;
plot_mat(j,:)=temp_mat;
end
%median center
med=median(plot_mat,2);
for j=1:r
med=median(plot_mat(j,:));
plot_mat(j,:)=plot_mat(j,:)/med;
end
log_rel_risk=log2(plot_mat);
for j=1:r
temp=log_rel_risk(j,:);
minv=min(temp);
indx3=find(log_rel_risk(j,:)<-100000);
log_rel_risk(j,indx3)=minv;
end
xlab=fliplr(xlab);
%qqplot_figs(log_rel_risk, [ q1 '_log']);
cg=clustergram(log_rel_risk,'RowLabels', xlab, 'ColumnLabels',qlabel(:,1),'Cluster',2, 'Colormap','jet', 'DisplayRange',3, 'Symmetric','true');
fig=plot(cg);
tightfig;
print (gcf,'-dpng',[q1 '_clustermap_OR_RC_LOG.png']);
saveas(gcf,[q1 '_clustermap_OR_RC_LOG.fig']);
% cg=clustergram(plot_mat,'RowLabels',qlabel, 'ColumnLabels', xlab, 'ColorMap', 'jet');
% fig=plot(cg);
% tightfig;
% print (gcf,'-dmeta',[q1 '_clustermap_OR_RC.emf']);
%hm=HeatMap(log_rel_risk,'RowLabels',q2_, 'ColumnLabels', xlab, 'ColorMap', 'jet');
end
%close
end
end
68 changes: 68 additions & 0 deletions clustergram/OR_clustergram_ques_RC_Q79.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
%make heatmaps out of the relative risk matrix

cd matrices
load OR_79_20
load qlabel_031214
cd ..
xlab={ '2009', '2011'};
odds_ratio_cell=OR_79;
ques='Q79';
for i=1:80
i_char=num2str(i);
q1_=i_char;
num2=i;
if length(i_char)<2
i_char=['0' i_char];
end
q1=['Q' i_char];
if strcmp(q1,ques)==1
indx=find (strcmp(odds_ratio_cell(:,1),q1)==1);
if isempty(indx)==0
plot_mat=cell2mat(odds_ratio_cell(indx,3:4));
q2=odds_ratio_cell(indx,2);
q2_=cell(length(q2)-1,1);
for p=1:length(q2)-1
s=q2{p,1};
q2_{p,1}=s(2:3);
end
plot_mat=rot90(plot_mat);
[r,c]=size(plot_mat);
plot_mat2=plot_mat;
%qqplot_figs(plot_mat2, [ q1 '_raw']);
for j=1:r
temp_mat=plot_mat(j,:);
noinf=temp_mat;
indx=find(isinf(noinf)==1);
noinf(indx)=-1;
maxv=max(noinf);
temp_mat(indx)=maxv;
plot_mat(j,:)=temp_mat;
end
%median center
med=median(plot_mat,2);
for j=1:r
med=median(plot_mat(j,:));
plot_mat(j,:)=plot_mat(j,:)/med;
end
log_rel_risk=log2(plot_mat);
for j=1:r
temp=log_rel_risk(j,:);
minv=min(temp);
indx3=find(log_rel_risk(j,:)<-100000);
log_rel_risk(j,indx3)=minv;
end
xlab=fliplr(xlab);
%qqplot_figs(log_rel_risk, [ q1 '_log']);
cg=clustergram(log_rel_risk,'RowLabels', xlab, 'ColumnLabels',qlabel(:,1),'Cluster',2, 'Colormap','jet', 'DisplayRange',3, 'Symmetric','true');
% fig=plot(cg);
% tightfig;
% print (gcf,'-dmeta',[q1 '_clustermap_OR_RC_LOG.emf']);
% cg=clustergram(plot_mat,'RowLabels',qlabel, 'ColumnLabels', xlab, 'ColorMap', 'jet');
% fig=plot(cg);
% tightfig;
% print (gcf,'-dmeta',[q1 '_clustermap_OR_RC.emf']);
%hm=HeatMap(log_rel_risk,'RowLabels',q2_, 'ColumnLabels', xlab, 'ColorMap', 'jet');
end
%close
end
end
Loading

0 comments on commit b733c2a

Please sign in to comment.