function clasic_and_consense(seqs,scoringmatrix,open_gap,extend_gap,method,method_alg,num_boots)

origdist = seqpdist(seqs,'Method',method,'ScoringMatrix', scoringmatrix,'GapOpen',open_gap,'ExtendGap',extend_gap);
origtree = seqneighjoin(origdist,method_alg,seqs);

num_seq=length(seqs);

%BOOTSTRAPOVY KONSENZUALNI STROM

%%
%vytvoreni bootstrapovych pseudovzorku
for i=1:num_seq                        %pomocna pro multialign..matlab je v tomto divnej
    pom=seqs(i).Sequence;
    Sequences{i}=pom;
end
Sequences=multialign(Sequences,'ScoringMatrix', scoringmatrix,'GapOpen',open_gap,'ExtendGap',extend_gap);

length_seq=length(Sequences);
pseudosamples=cell(1,num_boots);

for n=1:num_boots
    random_reallocate= randsample(length_seq,length_seq,true);
    for i=1:num_seq
        bootseqs(i).Sequence=Sequences(i,random_reallocate);
        bootseqs(i).Sequence=strrep(bootseqs(i).Sequence,'-','');
        bootseqs(i).Header=seqs(i).Header;
    end
    pseudosamples{n}=bootseqs;
end
%%
%vypocet pseudostromu
% tic
parfor (n = 1:num_boots)
    current_boot_distance = seqpdist(pseudosamples{n},'Method',method,'ScoringMatrix', scoringmatrix,'GapOpen',open_gap,'ExtendGap',extend_gap);
    boot_trees{n} = seqneighjoin(current_boot_distance,method_alg,pseudosamples{n});
    boot_distances(n,:)=current_boot_distance;
end
% toc
%%
%tvorba konsenzuálního stromu

pom=sum(boot_distances);                           %vypočítá sumy sloupců matice p distancí
consenzus_distance=pom./num_boots;                 %vydělí je počtem bootsrapových vzorků čímž vytvoří průměrné p distance

consenzus_tree = seqneighjoin(consenzus_distance,method_alg,seqs);    %sestrojí konsenzuální strom


%%
%hledani stejnych stromu

for i = 1:num_seq-1  %pomocné údaje pro originální strom
    branch_pointer = i + num_seq;
    sub_tree = subtree(origtree,branch_pointer);
    orig_pointers{i} = getcanonical(sub_tree);
    orig_species{i} = sort(get(sub_tree,'LeafNames'));
end

for i = 1:num_seq-1  %pomocné údaje pro konsenzuální strom
    branch_pointer = i + num_seq;
    sub_tree = subtree(consenzus_tree,branch_pointer);
    consenzus_pointers{i} = getcanonical(sub_tree);
    consenzus_species{i} = sort(get(sub_tree,'LeafNames'));
end

%pomocné pro bootstrapové stromy
for j = 1:num_boots                            %boostrapove pseudostromy
    for i = 1:num_seq-1                       %sekvence ve stromu (tedy listy stromu)
        branch_ptr = i + num_seq;             %uzly maji idexaci za listy a je jich o 1 mene
        sub_tree = subtree(boot_trees{j},branch_ptr);         %podstomy jednotlivych uzlu pro dany pseudostrom (j)
        clusters_pointers{i,j} = getcanonical(sub_tree);             %normoverze podstomu
        clusters_species{i,j} = sort(get(sub_tree,'LeafNames'));     %nazvy sekvenci podstomu
    end
end


%BP pro originální strom
count = zeros(num_seq-1,1);
for i = 1 : num_seq -1  % for every branch
    for j = 1 : num_boots * (num_seq-1)
        if isequal(orig_pointers{i},clusters_pointers{j})
            if isequal(orig_species{i},clusters_species{j})
                count(i) = count(i) + 1;
            end
        end
    end
end

Pc_orig = count ./ num_boots;   % confidence probability (Pc)


%BP pro konsenzuální strom
count = zeros(num_seq-1,1);
for i = 1 : num_seq -1  % for every branch
    for j = 1 : num_boots * (num_seq-1)
        if isequal(consenzus_pointers{i},clusters_pointers{j})
            if isequal(consenzus_species{i},clusters_species{j})
                count(i) = count(i) + 1;
            end
        end
    end
end

Pc_consenzus = count ./ num_boots;   % confidence probability (Pc)


%%
%zobrazení výsledků do stromů

%pro původní strom
[ptrs dist names] = get(origtree,'POINTERS','DISTANCES','NODENAMES');

for i = 1 : num_seq -1  % for every branch
    branch_ptr = i + num_seq;
    names{branch_ptr} = [num2str(100*Pc_orig(i))];
end


tr_orig = phytree(ptrs,dist,names);
h1=plot(tr_orig, 'LeafLabels','true','TerminalLabels','false', 'BranchLabels','true');
set(gcf,'Name','Klasický fylogram','NumberTitle','off')
set(h1.LeafDots,'Marker','none')
set(h1.BranchDots,'Marker','.')


%pro konsenzuální strom
[ptrs dist names] = get(consenzus_tree,'POINTERS','DISTANCES','NODENAMES');

for i = 1 : num_seq -1  % for every branch
    branch_ptr = i + num_seq;
    names{branch_ptr} = [num2str(100*Pc_consenzus(i))];
end


tr_consenzus = phytree(ptrs,dist,names);
h2=plot(tr_consenzus, 'LeafLabels','true','TerminalLabels','false', 'BranchLabels','true');
set(gcf,'Name', 'Bootstrapový konsenzuální fylogram','NumberTitle','off')
set(h2.LeafDots,'Marker','none')
set(h2.BranchDots,'Marker','.')
