// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // ! This script is provided "as is" by Applied Maths. ! // ! You are free to use and modify this script for your own needs. ! // ! Redistribution or reproduction of the script is prohibited. ! // ! DISCLAIMER: ! // ! Improper use of scripts may corrupt your database. ! // ! Running this script is entirely at your own responsibility. ! // ! Applied Maths accepts no lialibility for any consequences ! // ! resulting from its use. ! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //$DISPLAY_COMPWIN DIALOG dlg; string experlist; string expername,expername2; float simil,signif; integer subct,collapsed; integer ok,ok2,i,ordering[],ct,sm1,sm2; BRANCH root,root2,bra,bral,bra2,bra3; if not(CmpIsPresent) then CmpAttach; if not(CmpIsPresent) then { message("Unable to attach a comparison to this script"); stop; } expername=CluGetCurrent; ok=CluGetRoot(expername,root); if (expername="") or (not(ok)) then { message("There is currently no clustering displayed"); stop; } //prompt user for name of "reference" experiment; for i=1 to DbGetExperCount do if DbGetExperName(i)<>expername then { experlist=experlist+DbGetExperName(i)+" "; if expername2="" then expername2=DbGetExperName(i); } DlgAddText(dlg,"Select experiment that serves as standard",15,15,150,25); DlgAddList(dlg,experlist,expername2,15,50,150,150,"LIST"); if not(DlgShow(dlg,"Re-arrage dendrogram",300,300)) then stop; //make a list with the entry ordering by expername2; if not(CluGetRoot(expername2,root2)) then { message("ERROR: The experiment '"+expername2+"' has no clustering"); stop; } i=0; ok=CluEnumStart(root2,bra); while ok do { if CluGetEntryNr(bra)>0 then { i=i+1; ordering[CluGetEntryNr(bra)]=i; } ok=CluEnumNext(bra); } setbusy("re-arranging ordering..."); ok=CluEnumStart(root,bra); while ok do { if CluGetEntryNr(bra)=0 then { CluEnumStart(bra,bra2);CluEnumNext(bra2); //now at left sub ct=0;sm1=0; ok2=CluEnumStart(bra2,bra3); while ok2 do { if CluGetEntryNr(bra3)>0 then { ct=ct+1; sm1=sm1+ordering[CluGetEntryNr(bra3)]; } ok2=CluEnumNext(bra3); } if ct>0 then sm1=sm1/ct; CluEnumSkip(bra2);CluEnumNext(bra2); //now at right sub ct=0;sm2=0; ok2=CluEnumStart(bra2,bra3); while ok2 do { if CluGetEntryNr(bra3)>0 then { ct=ct+1; sm2=sm2+ordering[CluGetEntryNr(bra3)]; } ok2=CluEnumNext(bra3); } if ct>0 then sm2=sm2/ct; if sm2