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

sig{1}=fasta(1:3000);
sig{2}=seqrcomplement(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
xsig{1}=KontigNum{1};%-mean(KontigNum{i,1});
xsig{2}=KontigNum{2};%-mean(KontigNum{i,1});

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

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

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


