clear all;
[hlavicka,fasta]=fastaread('pokus.fasta');

sig{1}=fasta(1:3000);
sig{2}=sig{1};


% vektory bazí
a=1+1i;c=-1-1i;g=-1+1i;t=1-1i;
for i=1:2
    delka_cteni(i)=length(sig{i});
    zapis=zeros(1,delka_cteni(i),'double');
    zapis(sig{i}=='A')=angle(a);
    zapis(sig{i}=='C')=angle(c);
    zapis(sig{i}=='G')=angle(g);
    zapis(sig{i}=='T')=angle(t);
    KontigNum{i,1}=cumsum(zapis);

end


[XCorelCoef,lag]=xcov( KontigNum{1},KontigNum{2},'coeff');
% [XCorelCoef,lag]=xcorr( KontigNum{1},KontigNum{2},'coeff');
% CorelCoef=min(min(corrcoef(KontigNum{1},KontigNum{2})))

figure
title('')
subplot(1,2,1)
plot(KontigNum{1}),hold all,plot(KontigNum{2}),
xlabel('Pozice [-]')
ylabel('Fáze [rad]')

subplot(1,2,2)
plot(lag,XCorelCoef)
xlabel('Zpoždění [-]')
ylabel('Normalizovaná kovariance')

