% Get set of non redundant windows from seqs 1 & 2 
% instead of localalignmentfull this version retrieves the nonredundat
% windows and compare them to all the sequences...

function [WindowsNRD,WindowsSeqpdist,WindowsOrSignal,beta]=Createwindowsforprogresive(seq,alpha,beta)
%% Variable definition
% full=number of non redundant windows 
% part=number of redundant windows
% increase=Shifting steps in the wavelet comparison
% limitWC=limit of significance in similarity/difference Wave Compare
% limitHG=2;    
n=2;

%% Signal Transformation
% Transform Sequences by MT
% changed to delete beginning and end "zeros" change: (TMlengt(i)/full);
% for (TMlengt(i)-alpha/full)
for i=1:n
        SeqTM{i}=DNAMeltingArbitrary(seq{i},alpha);
        TMlength(i)=length(SeqTM{i});
%        beta(i)=floor((TMlength(i)-alpha)/full);
        full(i)=floor((TMlength(i)-alpha)/beta);
end
% parche
% beta=min(beta);
full=min(full);
if full==0
    full=1;
end
MaxTMlength=max(TMlength);

for j=1:n
    Signalpretreat{j}=Signalpretreatment(SeqTM{j});
end
%% Create DotDistance Vectors, (x=y(i)-y(y+1)

for i=1:n
    for j=1:TMlength(i)-1
%        Dotdistance{i}(j)=SeqTM{i}(j)-SeqTM{i}(j+1);
         Dotdistance{i}(j)=Signalpretreat{i}(j)-Signalpretreat{i}(j+1);
    end
    Dotdistance{i}(j+1)=0;
end
MaxTMlength=max(TMlength);

%% Create Windows not redundant DotDistance (this windows are next dot
 % distance comparison and need to be compared against DotDistance signals)
 % changed to delete beginning and end "zeros" change: c=1; for c=alpha
 % changed (c:c+beta(i)-1) for (c:c+beta-1)
 
c=1;
for i=1:n
    for j=1:full
       WindowsNRD{i,j}=Dotdistance{i}(c+alpha:c+beta+(alpha)-1);
       WindowsSeqpdist{i,j}=seq{i}(c+alpha:c+beta+(alpha)-1);
       WindowsOrSignal{i,j}=SeqTM{i}(c+alpha:c+beta+(alpha)-1);
       c=c+beta;
       if c>TMlength
          c=TMlength(i)-beta(i)-1;
      end
    end
    c=1;
end

%% Eliminate redundant windows 
[WindowsNRD,WindowsSeqpdist,WindowsOrSignal]=delrepeatwinincluded(WindowsNRD,WindowsSeqpdist,WindowsOrSignal);

end