clc
clear
close all
window=[15 13 6 12];
load Fp.mat;
load Fn.mat;
load SSpositive.mat;
load SSnegative.mat;
load phychemical.mat;
load label.mat;
load negativeindex.mat;
% load Positive.mat;
% load Snegative.mat;
load gtopfeature.mat;
load feature_ind.mat;
top=30;
center=16;
nn=size(Fp,1);
mm=nn+negativeindex;
d=[];
tlabel=[label(1:nn,:);label(mm,:)];
temp1=[Fp(:,(center-window(1,1)):(center+window(1,1)));Fn(negativeindex,(center-window(1,1)):(center+window(1,1)))];
d=[d size(temp1,2)];
temp2=[];
for i=1:size(SSpositive,3)
    temp2=[temp2;SSpositive((center-window(1,2)):(center+window(1,2)),1,i)' SSpositive((center-window(1,2)):(center+window(1,2)),2,i)' SSpositive((center-window(1,2)):(center+window(1,2)),3,i)'];
end
for i=1:size(negativeindex,2)
    temp2=[temp2;SSnegative((center-window(1,2)):(center+window(1,2)),1,negativeindex(i))' SSnegative((center-window(1,2)):(center+window(1,2)),2,negativeindex(i))' SSnegative((center-window(1,2)):(center+window(1,2)),3,negativeindex(i))'];
end
d=[d size(temp2,2)];
temp3=[];
pindex=1:nn;
pindex=[pindex mm];
m=size(phychemical,3);
m=20;
for i=1:m
    temp3=[temp3 phychemical(pindex,(center-window(1,3)):(center+window(1,3)),i)];
end
d=[d size(temp3,2)];
temp4=[PCKSAAP;NCKSAAP];
d=[d size(temp4,2)];
aar=[temp1 temp2 temp3 temp4];
aar=zscore(aar);
m=size(aar,1);
times=1;
sensitivity=zeros(1,times);
specificity=zeros(1,times);
accuracy=zeros(1,times);
mcc=zeros(1,times);
auc=zeros(1,times);
% for i=1:times
%     RandSeed = round(sum(100*clock));
%     rand('state', RandSeed);
%     rand_ind = randperm(m);
% %     cmd = ['-v ',num2str(10)];
%     cmd = ['-v ',num2str(size(aar,1))];
%     [deci,prelabel,auc(i)] = plotrocs(tlabel, aar(:,feature_ind) ,cmd,rand_ind);
%     
% %     plabel=[];
% %     for j=1:length(deci)
% %         if deci(i)>=0.35
% %            plabel=[plabel;1];
% %         else
% %            plabel=[plabel;-1];
% %         end
% %     end
%     [sensitivity(i),specificity(i),accuracy(i),mcc(i)]=measure(prelabel,tlabel);
% end
save('Svector.mat','aar','tlabel','d');
% save('outresult.mat','sensitivity','specificity','accuracy','auc','mcc');