function [aar,testlabel,ind]=testExtract(test,nnn)

% test(1,1).sequence='MRSLLILVLCFLPLAALGKVFGRCELAAAMKRHGLDNYRGYSLGNWVCAAKFESNFNTQATNRNTDGSTDYGILQINSRWWCNDGRTPGSRNLCNIPCSALLSSDITASVNCAKKIVSDGNGMNAWVAWRNRCKGTDVQAWIRGCRL';
% test(1,1).p=[19 31 51 114 115 134];
% test(1,1).SS;
% test(2,1).sequence='QVQLVQSGAEVKKPGSSVKVSCKASGGTFSRSAIIWVRQAPGQGLEWMGGIVPMFGPPNYAQKFQGRVTITADESTNTAYMELSSLRSEDTAFYFCAGGYGIYSPEEYNGGLVTVSS';
% test(2,1).SS=;
% test(2,1).p=[19];
window=15;
flagment=[];
SStest=[];
ct=1;
testlabel=[];
SSdata=[];
Pids=[];
for j=1:window
   Pids =[Pids 'X'];
   SSdata=[SSdata; 0 0 0];
end
Pids=[Pids test(nnn,1).Sequence];
SSdata=[SSdata; test(nnn,1).SS];
for j=1:window
    Pids=[Pids 'X'];
    SSdata=[SSdata; 0 0 0];
end
p=test(nnn,1).Position+window;
ind=find(Pids(1,:)=='K');
for j=1:length(ind)
    flagment=[flagment;Pids((ind(j)-window):(ind(j)+window))];
    if ~isempty(find(p==ind(j)))
        testlabel=[testlabel;1];
    else
        testlabel=[testlabel;-1];
    end
    SStest(:,:,ct)=SSdata((ind(j)-window):(ind(j)+window),:);
    ct=ct+1;
end
%%%%%%%%%提取F特征%%%%%%%%%%%
load Pp.mat;
load Mn.mat;
load Mp.mat;
p0=0.05;
letter=['A','C','D','E','F','G','H','I','K','L','M','N','P','Q','R','S','T','V','W','Y'];
Ftest=[];
num=size(flagment,2);
n=size(flagment,1);
for i=1:n
    cout=[];
    for j=1:num
        index=find(letter(1,:)==flagment(i,j));
        if ~isempty(index)
            temp=log((Pp(j,index)/p0))*(Mp(j)-Mn(j));
            cout=[cout temp];
        else
            cout=[cout 0];
        end
    end
    Ftest=[Ftest;cout];
end
%%%%%%%%%提取SS特征%%%%%%%%%%

%%%%%%%%%提取理化属性%%%%%%%%
load phyindex.mat;
load aaindex2.mat;
top=20;
letter=['A','R','N','D','C','Q','E','G','H','I','L','K','M','F','P','S','T','W','Y','V'];
testphychemical=[];
num=size(flagment,1);
D=size(flagment,2);
for i=1:top
    aar=[];
    for j=1:num
        temp=[];
        for k=1:D
            index=find(letter(1,:)==flagment(j,k));
            if ~isempty(index)
                temp=[temp aaindex1(phy(1,i),index)];
            else
                temp=[temp 0];
            end
        end
        aar=[aar;temp];
    end
    testphychemical(:,:,i)=aar;
end
%%%%%%%%%提取CKSAAP特征%%%%%
n=size(flagment,1);
m=size(flagment,2);
load gtopfeature.mat;
twindow=15;
letter=['A','R','N','D','C','Q','E','G','H','I','L','K','M','F','P','S','T','W','Y','V','X'];
CKSAAPtest=zeros(n,length(gtopfeature));
for i=1:n
    center=(m-1)/2+1;
    schar=flagment(i,(center-twindow):(center+twindow));
    D=length(schar);
    for j=1:length(gtopfeature)
        temp=gtopfeature(j,:);
        mmm=str2num(temp(3));
        for k=1:(D-mmm-1)
           if schar(1,k)==temp(1)&&schar(1,k+mmm+1)==temp(2)
               CKSAAPtest(i,j)=CKSAAPtest(i,j)+1;
           end
        end
    end
end
%%%%%%%%%%%%%%%%%%%%生成测试集%%%%%%%%
window=[15 13 6 12];
center=16;
temp1=Ftest(:,(center-window(1,1)):(center+window(1,1)));
temp2=[];
for i=1:size(SStest,3)
    temp2=[temp2;SStest((center-window(1,2)):(center+window(1,2)),1,i)' SStest((center-window(1,2)):(center+window(1,2)),2,i)' SStest((center-window(1,2)):(center+window(1,2)),3,i)'];
end
temp3=[];
m=size(testphychemical,3);
for i=1:m
    temp3=[temp3 testphychemical(:,(center-window(1,3)):(center+window(1,3)),i)];
end
temp4=CKSAAPtest;
aar=[temp1 temp2 temp3 temp4];
aar=zscore(aar);
end