// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // ! 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,str_penalextra; float simil,signif; integer subct,collapsed; integer ok,ok2,i; float maxct,ct,penalextra; BRANCH root,root2,bra,bra2,bestbra; 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; } str_penalextra=TempRecall("searchotherclu_penalextra"); if str_penalextra="" then str_penalextra="100"; //prompt user for name of other clustering for i=1 to DbGetExperCount do if DbGetExperName(i)<>expername then { experlist=experlist+DbGetExperName(i)+" "; if expername2="" then expername2=DbGetExperName(i); } DlgAddText(dlg,"Select the experiment where to search for this cluster",15,15,150,25); DlgAddList(dlg,experlist,expername2,15,50,170,150,"LIST"); DlgAddText(dlg,"Extra entries=",15,207,75,15); DlgAddEdit(dlg,str_penalextra,92,205,33,20); DlgAddText(dlg,"% penalty",135,207,60,15); if not(DlgShow(dlg,"Search same cluster in other dendrogram",310,270)) then stop; penalextra=val(str_penalextra)/100.0; for i=1 to CmpGetEntryCount do DbSetSel(CmpGetEntryKey(i),0); CluGetCursor(expername,bra); ok=CluEnumStart(bra,bra2); while ok do { if CluGetEntryNr(bra2)>0 then DbSetSel(CmpGetEntryKey(CluGetEntryNr(bra2)),1); ok=CluEnumNext(bra2); } ok=CluGetRoot(expername2,root2); if (expername2="") or (not(ok)) then { message("Experiment '"+expername2+"' has no clustering"); stop; } setbusy("searching cluster..."); ok=CluEnumStart(root2,bra); maxct=0; while ok do { ok2=CluEnumStart(bra,bra2); ct=0; while ok2 do { if CluGetEntryNr(bra2)>0 then { if DbGetSel(CmpGetEntryKey(CluGetEntryNr(bra2))) then ct=ct+1; else ct=ct-penalextra; } ok2=CluEnumNext(bra2); } if ct>maxct then { maxct=ct; CluEnumStart(bra,bestbra); } ok=CluEnumNext(bra); } setbusy(""); if maxct>0 then { CluSetCurrent(expername2); CluSetCursor(bestbra); } TempStore("searchotherclu_penalextra",str_penalextra);