type ms_script_ultrafnd
type ms_script_atreefnd

ms_script_ultrafnd
ms_script_atreefnd

risk_labels = {'accidental falls','airplane accidents','electrocution',...
    'fire','flood','heart disease','homocide','leukaemia','lightning',...
    'lung cancer','nuclear accident','stomach cancer','stroke',...
    'terrorism','tornados','toxic chemical spill','traffic accidents',...
    'war'};

risk_ultrametric = seqneighjoin(best_risk_ultrametric,'equivar',risk_labels);

risk_additivetree = ...
    seqneighjoin(best_risk_additivetree,'equivar',risk_labels);

whos

view(risk_ultrametric)

view(risk_additivetree)


h_ultrametric = plot(risk_ultrametric,'orient','bottom');
set(h_ultrametric.terminalNodeLabels,'Rotation',-45)



h_additivetree = plot(risk_additivetree,'orient','bottom');
set(h_additivetree.terminalNodeLabels,'Rotation',-45)

figure(3)

imagesc(best_risk_ultrametric)
colormap(bone)
colorbar

figure(4)

imagesc(best_risk_additivetree)
colormap(autumn)
colorbar

plot(risk_additivetree,'branchlabels',true)
sel = getbyname(risk_additivetree,'Branch 7');
new_risk_tree = reroot(risk_additivetree,sel)
plot(new_risk_tree, 'branchlabels',true)

another_risk_tree = reroot(new_risk_tree)
plot(another_risk_tree, 'branchlabels',true)




