%%%%%%%%%第四个文件：计算氨基酸在正负序列片段出现的频率%%%%
clc
clear
close all
load Positive.mat;
load Negative.mat;
window=15;
letter=['A','C','D','E','F','G','H','I','K','L','M','N','P','Q','R','S','T','V','W','Y'];

PM=[];
NM=[];
%%%%%%positive%%%%%%%%%%%%%%%
num=size(positive,2);
m=size(positive,1);
for i=1:num
    temp=[];
    for j=1:length(letter)
        temp=[temp length(find(positive(:,i)==letter(j)))];
    end
    PM=[PM;temp];
end   
% PM=PM/m;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%negative%%%%%%%%%%%%%%%
num=size(negative,2);
m=size(negative,1);
for i=1:num
    temp=[];
    for j=1:length(letter)
        temp=[temp length(find(negative(:,i)==letter(j)))];
    end
    NM=[NM;temp];
end   
% NM=NM/m;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% save('Mpositive.mat','PM');
% save('Mnegative.mat','NM');
%%%%%%%%%%%%%%%
AM=PM+NM;
PM=PM/size(positive,1);
AM=AM/(size(positive,1)+size(negative,1));
[p,k]=signrank(PM,AM)