clc
clear
close all
load SSpositive.mat;
load SSnegative.mat;
n=size(SSpositive,3);
m=size(SSpositive,1);
window=15;
cnum=zeros(1,m);
hnum=zeros(1,m);
enum=zeros(1,m);
for j=1:m
    for i=1:n
        num=SSpositive(j,:,i);
        ind=find(num(1,:)==max(num));
        if max(num)~=0
            if ind==1
                cnum(1,j)=cnum(1,j)+1;
            end
            if ind==2
                hnum(1,j)=hnum(1,j)+1;
            end
            if ind==3
                enum(1,j)=enum(1,j)+1;
            end
        end
    end
end
figure
colormap(cool);
yg1=[(cnum./n)' (hnum./n)' (enum./n)'];
set(gcf,'color','white')
bar(yg1,'grouped');
set(gca,'XTickLabel',(-window):(window),'xtick',1:31);
set(gca,'LooseInset',get(gca,'TightInset'))
% figure
% x=(-window):window;
% cnum=cnum./n;
% hnum=hnum./n;
% enum=enum./n;
% plot(x,cnum,'ro-','MarkerFaceColor','r','LineWidth',2);
% hold on
% plot(x,hnum,'ks-','MarkerFaceColor','k','LineWidth',2);
% hold off
% hold on
% plot(x,enum,'cd-','MarkerFaceColor','c','LineWidth',2);
xlabel('Site');
ylabel('Percentage');
title('Glycation');
str={'C' 'H' 'E'};
legend(str);
%%%%%%%%%%%%%¸ºÑù±¾%%%%%%%%%%%%%%%%%%
n=size(SSnegative,3);
m=size(SSnegative,1);
window=15;
cnumN=zeros(1,m);
hnumN=zeros(1,m);
enumN=zeros(1,m);
for j=1:m
    for i=1:n
        num=SSnegative(j,:,i);
        ind=find(num(1,:)==max(num));
        if max(num)~=0
            if ind==1
                cnumN(1,j)=cnumN(1,j)+1;
            end
            if ind==2
                hnumN(1,j)=hnumN(1,j)+1;
            end
            if ind==3
                enumN(1,j)=enumN(1,j)+1;
            end
        end
    end
end
figure
colormap(cool);
yg2=[(cnumN./n)' (hnumN./n)' (enumN./n)'];
set(gcf,'color','white')
bar(yg2,'grouped');
set(gca,'XTickLabel',(-window):(window),'xtick',1:31);
set(gca,'LooseInset',get(gca,'TightInset'))
% figure
% x=(-window):window;
% cnumN=cnumN./n;
% hnumN=hnumN./n;
% enumN=enumN./n;
% plot(x,cnumN,'ro-','MarkerFaceColor','r','LineWidth',2);
% hold on
% plot(x,hnumN,'ks-','MarkerFaceColor','k','LineWidth',2);
% hold off
% hold on
% plot(x,enumN,'cd-','MarkerFaceColor','c','LineWidth',2);
xlabel('Site');
ylabel('Percentage');
str={'C' 'H' 'E'};
title('Non-glycation');
legend(str);


% 
% colormap(cool);
figure
colormap(cool);
data=[yg1(:,1) yg2(:,1)];
set(gcf,'color','white')
b=bar(data,'grouped');
% ch=get(b,'children');
% set(ch{1},'facecolor','r');
% set(ch{2},'facecolor','k');
set(gca,'XTickLabel',(-window):(window),'xtick',1:31);
set(gca,'LooseInset',get(gca,'TightInset'))
xlabel('Site');
ylabel('Percentage');
title('Coil');
str={'positive' 'negative'};
legend(str);
figure
colormap(cool);
data=[yg1(:,2) yg2(:,2)];
set(gcf,'color','white')
bar(data,'grouped');
% set(ch{1},'facecolor','r');
% set(ch{2},'facecolor','k');
set(gca,'XTickLabel',(-window):(window),'xtick',1:31);
set(gca,'LooseInset',get(gca,'TightInset'))
xlabel('Site');
ylabel('Percentage');
title('Helix');
str={'positive' 'negative'};
legend(str);
figure
colormap(cool);
data=[yg1(:,3) yg2(:,3)];
set(gcf,'color','white')
bar(data,'grouped');
% set(ch{1},'facecolor','r');
% set(ch{2},'facecolor','k');
set(gca,'XTickLabel',(-window):(window),'xtick',1:31);
set(gca,'LooseInset',get(gca,'TightInset'))
xlabel('Site');
ylabel('Percentage');
title('Sheet');
str={'positive' 'negative'};
legend(str);