Code
-- Mutators Collection.
-- MurloW
-- functions sort(part) and allByOne() written mostly by skillful Team AD scripters who wish to remain anonymous.
-- idea for similar mutator (and AAphilic/phobic lists) from KarenCH: Simulated Annealing 3.0
-- 18-05-2014 : cleanup and public release.
-- 19-01-2015 : added a mutator; updated wiggle and dialog functions with filter disabling.
-- 30-06-2015 : added a mutator; minor testing algorithm changes; filter handling; dialog changes.
IterationMultiplier = 1.1 -- 2.5 -- 1.4
ItMu = IterationMultiplier
normal = true
cival=behavior.GetClashImportance()
nSegs=structure.GetCount()
p=print
function Seed() -- REALLY good seed by Rav3n_pl
seed=os.time()/math.abs(current.GetEnergyScore())
seed=seed%0.001
seed=1/seed
while seed<10000000 do seed=seed*10 end
seed=seed-seed%1
--p("Seed is: "..seed)
math.randomseed(seed)
end
Seed()
function score()
local s=0
if normal then
s=current.GetScore()
else
s=current.GetEnergyScore()
end
return s
end
function wig(how, it, iters, minppi)
if how==nil then how="wa" end
if minppi==nil then minppi=2 end
if iters==nil then iters=2 end
if it==nil then it=10*ItMu end
it=math.ceil(it)
if iters>0 then
iters=iters-1
local sp=score()
if how == "s" then structure.ShakeSidechainsAll(1)
elseif how == "wb" then structure.WiggleAll(it,true,false)
elseif how == "ws" then structure.WiggleAll(it,false,true)
elseif how == "wa" then structure.WiggleAll(it)
end
if score()-sp > minppi and how ~= "s" then return wig(how, it, iters, minppi) end
end
end
function qStab()
Check()
setF()
setCI(cival/2)
wig("wa",5) Check(true)
setCI(cival)
wig("s") Check(true)
wig() Check(true)
setCI(cival/2)
wig("wa",5) Check(true)
setCI(cival)
wig() Check(true)
setF(true)
end
function Fuze()
Check()
setF()
setCI(.05)
wig("s") Check(true)
setCI(cival)
wig() Check(true)
setCI(cival/3)
wig("wa",5) Check(true)
if Sf == false then
setCI(.07)
wig("s") Check(true)
setCI(cival)
wig() Check(true)
setCI(cival/3)
wig("wa",5) Check(true)
end
setCI(cival)
wig("s") Check(true)
wig() Check(true)
setF(true)
end
function selectsphere(seg, radius)
if seg>nSegs then seg = nSegs end
if seg<1 then seg = 1 end
for y=1, nSegs do
if structure.GetDistance(seg,y) <= radius then
if y >= 1 and y <= nSegs then
selection.Select(y)
end
end
end
end
function cut(x)
return x-x%0.001
end
function setCI(ci)
return behavior.SetClashImportance(ci)
end
function setF( toggle ) -- true for enable, empty for disable
if toggle==nil then toggle=false end
if toggle and FilC() then behavior.SetSlowFiltersDisabled(false)
elseif toggle==false then behavior.SetSlowFiltersDisabled(true) end
end
function FilC()
return behavior.GetSlowFiltersDisabled() end
function nomuta()
p("")
p(" No mutable residues. ")
end
function End(errmsg)
p("")
if string.find(errmsg,"Cancelled") then
p(" User cancel.")
p("")
Result()
else
p("")
p(errmsg)
p("")
Result()
end
return errmsg
end
function Result()
Check()
recentbest.Restore() Check()
save.Quickload(93)
setCI(cival)
Tgain = bestscore - startscore
if Tgain>0.002 then
p(" score: "..cut(score()))
p(" gained: "..cut(Tgain))
else
p(" No change :/ ")
end
behavior.SetSlowFiltersDisabled(false)
end
function Check( filt ) -- if true then enable filters
if filt==nil then filt=false end
if filt and FilC() then setF(true) end
if (bestscore < score()) then
gain = score() - bestscore
bestscore = score()
save.Quicksave(1)
save.Quicksave(93)
else
gain = 0
end
if gain>0.002 then
p(" ",cut(gain),"pts.") end
if filt then setF() end
end
function sort(part)
Mseg = {}
for i = 1, nSegs do
Mseg[i] = {}
if part ~= 'total' then
Mseg[i][1] = current.GetSegmentEnergySubscore(i, part)
else
Mseg[i][1] = current.GetSegmentEnergyScore(i)
end
Mseg[i][2] = i
end
sW = 1
while sW ~= 0 do
sW=0
if WF==true then
for i=1, nSegs-1 do
if Mseg[i][1] > Mseg[i+1][1] then
Mseg[i][1],Mseg[i+1][1]=Mseg[i+1][1],Mseg[i][1]
Mseg[i][2],Mseg[i+1][2]=Mseg[i+1][2],Mseg[i][2]
sW = sW +1
end
end
else
for i=1, nSegs-1 do
if Mseg[i][1] < Mseg[i+1][1] then
Mseg[i][1],Mseg[i+1][1]=Mseg[i+1][1],Mseg[i][1]
Mseg[i][2],Mseg[i+1][2]=Mseg[i+1][2],Mseg[i][2]
sW = sW +1
end
end
end -- WF
end -- sW
return Mseg
end
function AAphilic(idx)
-- hydrophilics
if idx == 1 then return "r"
elseif idx == 2 then return "s"
elseif idx == 3 then return "t"
elseif idx == 4 then return "n"
elseif idx == 5 then return "d"
elseif idx == 6 then return "q"
elseif idx == 7 then return "e"
elseif idx == 8 then return "h"
else return "k" -- idx == 9
end
end
function AAphobic(idx)
-- hydrophobics
if idx == 1 then return "g"
elseif idx == 2 then return "a"
elseif idx == 3 then return "c"
elseif idx == 4 then return "v"
elseif idx == 5 then return "l"
elseif idx == 6 then return "i"
elseif idx == 7 then return "m"
elseif idx == 8 then return "p"
elseif idx == 9 then return "f"
elseif idx == 10 then return "y"
else return "w" -- idx == 11
end
end
AAs={"d", "e","h","k","n","q", "r", "s", "t","y"}
selection.DeselectAll()
startscore = score()
bestscore = startscore
-----------------------------------
-- bruteforce
function AllSorted()
sort(part)
for y=1, loops do
save.Quickload(93)
lscore=score()
p(" ",cut(lscore))
p("")
local nr=0
for i=1, nSegs do
if structure.IsMutable(Mseg[i][2]) then
nr=nr+1
save.Quickload(93)
Tempscore=score()
orig_aa = structure.GetAminoAcid(Mseg[i][2])
for j=1, #AAs do
if structure.CanMutate(Mseg[i][2], AAs[j]) then
structure.SetAminoAcid(Mseg[i][2], AAs[j]) Check()
if qAd==2 then
selectsphere(Mseg[i][2],6)
setCI(cival)
structure.ShakeSidechainsSelected(1) Check()
selection.DeselectAll()
elseif qAd==3 then
selectsphere(Mseg[i][2],6)
setCI(cival)
structure.ShakeSidechainsSelected(1) Check()
structure.WiggleSelected(10, false, true) Check()
structure.ShakeSidechainsSelected(1) Check()
structure.WiggleSelected(10, false, true) Check()
selection.DeselectAll()
end
if qSt == true then qStab() end
if Fuzz == true then Fuze() else
if fzt>=0 then
if score()>(Tempscore-fzt) then
Fuze()
end
else
if score()>=(Tempscore+FFzt) then
Fuze()
end end end
end end
save.Quickload(93)
new_aa = structure.GetAminoAcid(Mseg[i][2])
if new_aa ~= orig_aa then
print("Residue "..Mseg[i][2].." changed from "..orig_aa.." to "..new_aa)
else
print("Residue "..Mseg[i][2].." unchanged from "..orig_aa)
end
end
end
if loops>1 then if score()>lscore then
p(" Loop gain:", cut(score()-lscore)) end end
end-- loops
end
function allByOne()
for c=1, loops do
save.Quickload(93)
lscore=score()
p(" ",cut(lscore))
p("")
if inRevers == true then
beginS=nSegs
endS=1
step=(-1)
else
beginS=1
endS=nSegs
step=1
end
for i=beginS, endS, step do
if structure.IsMutable(i) then
Tempscore=score()
orig_aa = structure.GetAminoAcid(i)
for j=1, #AAs do
if structure.CanMutate(i, AAs[j]) then
structure.SetAminoAcid(i, AAs[j]) Check()
if qAd==2 then
selectsphere(i,6)
structure.ShakeSidechainsSelected(1) Check()
selection.DeselectAll()
elseif qAd==3 then
selectsphere(i,6)
structure.ShakeSidechainsSelected(1) Check()
structure.WiggleSelected(10, false, true) Check()
structure.ShakeSidechainsSelected(1) Check()
structure.WiggleSelected(10, false, true) Check()
selection.DeselectAll()
end
if qSt == true then qStab() end
if Fuzz == true then Fuze() else
if fzt>=0 then
if score()>(Tempscore-fzt) then
Fuze()
end
else
if score()>=(Tempscore+FFzt) then
Fuze()
end end end
end end
save.Quickload(93)
new_aa = structure.GetAminoAcid(i)
if new_aa ~= orig_aa then
print("Residue "..i.." changed from "..orig_aa.." to "..new_aa)
else
print("Residue "..i.." unchanged from "..orig_aa)
end
end
end
if loops>1 then if score()>lscore then
p(" Loop gain:", cut(score()-lscore)) end end
end -- loops
end
function allWalk()
for c=1, loops do
save.Quickload(93)
lscore=score()
p(" ",cut(lscore))
p("")
if inRevers == true then
beginS=nSegs
endS=1
step=(-1)
else
beginS=1
endS=nSegs
step=1
end
for j=1, #AAs do
for i=beginS, endS, step do
Tempscore=score()
origA = structure.GetAminoAcid(i)
if structure.CanMutate(i, AAs[j]) then
structure.SetAminoAcid(i, AAs[j]) Check()
if qAd==2 then
selectsphere(i,6)
structure.ShakeSidechainsSelected(1) Check()
selection.DeselectAll()
elseif qAd==3 then
selectsphere(i,6)
structure.ShakeSidechainsSelected(1) Check()
structure.WiggleSelected(10, false, true) Check()
structure.ShakeSidechainsSelected(1) Check()
structure.WiggleSelected(10, false, true) Check()
selection.DeselectAll()
end
if qSt == true then qStab() end
if Fuzz == true then Fuze() else
if fzt>=0 then
if score()>(Tempscore-fzt) then
Fuze()
end
else
if score()>=(Tempscore+FFzt) then
Fuze()
end end end
save.Quickload(93)
newA = structure.GetAminoAcid(i)
if newA ~= origA then
p("Residue "..i.." changed from "..origA.." to "..newA)
end
end end
end -- aa
if loops>1 then if score()>lscore then
p(" Loop gain:", cut(score()-lscore)) end end
end -- loops
end
function BruteForceSimilar()
for i=1, loops do
lscore=score()
p(" ",cut(lscore))
p("")
if inRevers == true then
beginS=nSegs
endS=1
step=(-1)
else
beginS=1
endS=nSegs
step=1
end
for Ns=beginS, endS, step do
local Tsc=score()
local aa=structure.GetAminoAcid( Ns )
if structure.IsHydrophobic( Ns ) then
for i=1, 11 do
aanew = AAphobic( i )
if structure.CanMutate( Ns, aanew ) then
structure.SetAminoAcid( Ns, aanew ) Check()
if qAd==3 then
selectsphere(Ns,10)
structure.WiggleSelected(10, false, true) Check()
structure.ShakeSidechainsSelected(1) Check()
structure.WiggleSelected(10, false, true) Check()
selection.DeselectAll()
elseif qAd==2 then
selectsphere(Ns,10)
structure.ShakeSidechainsSelected(1) Check()
selection.DeselectAll()
end
if qSt == true then qStab() end
if Fuzz == true then Fuze() else
if fzt>=0 then
if score()>(Tsc-fzt) then
Fuze()
end
else
if score()>=(Tsc+FFzt) then
Fuze()
end end end
end end
else
for i=1, 9 do
aanew = AAphilic( i )
if structure.CanMutate( Ns, aanew ) then
structure.SetAminoAcid( Ns, aanew ) Check()
if qAd==3 then
selectsphere(Ns,10)
structure.WiggleSelected(10, false, true) Check()
structure.ShakeSidechainsSelected(1) Check()
structure.WiggleSelected(10, false, true) Check()
selection.DeselectAll()
elseif qAd==2 then
selectsphere(Ns,10)
structure.ShakeSidechainsSelected(1) Check()
selection.DeselectAll()
end
if qSt == true then qStab() end
if Fuzz == true then Fuze() else
if fzt>=0 then
if score()>(Tsc-fzt) then
Fuze()
end
else
if score()>=(Tsc+FFzt) then
Fuze()
end end end
end end
end
save.Quickload(93)
newaa=structure.GetAminoAcid(Ns)
if newaa~=aa then
p("Residue "..Ns.." changed from "..aa.." to "..newaa) end
end -- run
if loops>1 then if score()>lscore then
p(" Loop gain:", cut(score()-lscore)) end end
end --loops
end
-----------------------------------
-- random mutate
function mutateR()
for y=1, loops do
save.Quickload(93)
lscore=score()
p(" ",cut(lscore))
p("")
local nr=0
if inRevers == true then
beginS=nSegs
endS=1
step=(-1)
else
beginS=1
endS=nSegs
step=1
end
for i=beginS, endS, step do
if structure.IsMutable(i) then
nr=nr+1
local segA=structure.GetAminoAcid(i)
save.Quickload(93)
Tempscore=score()
selection.Select(i)
ranci=(math.random(minCI*100, maxCI*100)/100)
setCI(ranci)
p(" #"..nr,"ci: "..ranci)
structure.MutateSidechainsSelected(1) Check()
setCI(cival)
if qAd==2 then
selectsphere(i, 6)
structure.ShakeSidechainsSelected(1) Check()
elseif qAd==3 then
selectsphere(i, 6)
structure.ShakeSidechainsSelected(1) Check()
structure.WiggleSelected(10, false, true) Check()
structure.ShakeSidechainsSelected(1) Check()
structure.WiggleSelected(10, false, true) Check()
end
selection.DeselectAll()
if (gain>0) or (structure.GetAminoAcid(i)~=segA) then
if qSt == true then qStab() end
if Fuzz == true then Fuze() else
if fzt>=0 then
if score()>(Tempscore-fzt) then
Fuze()
end
else
if score()>=(Tempscore+FFzt) then
Fuze()
end
end
end end
end end
if loops>1 then if score()>lscore then
p(" Loop gain:", cut(score()-lscore)) end end
end
end
function mutate()
sort(part)
for y=1, loops do
save.Quickload(93)
lscore=score()
p(" ",cut(lscore))
p("")
local nr=0
for i=1, nSegs do
if structure.IsMutable(Mseg[i][2]) then
nr=nr+1
local segA=structure.GetAminoAcid(Mseg[i][2])
save.Quickload(93)
Tempscore=score()
selection.Select(Mseg[i][2])
ranci=(math.random(minCI*100, maxCI*100)/100)
setCI(ranci)
p(" #"..nr.." seg: "..Mseg[i][2],"ci: "..ranci)
structure.MutateSidechainsSelected(1) Check()
setCI(cival)
if qAd==2 then
selectsphere(Mseg[i][2], 6)
structure.ShakeSidechainsSelected(1) Check()
elseif qAd==3 then
selectsphere(Mseg[i][2], 6)
structure.ShakeSidechainsSelected(1) Check()
structure.WiggleSelected(10, false, true) Check()
structure.ShakeSidechainsSelected(1) Check()
structure.WiggleSelected(10, false, true) Check()
end
selection.DeselectAll()
if (gain>0) or (structure.GetAminoAcid(Mseg[i][2])~=segA) then
if qSt == true then qStab() end
if Fuzz == true then Fuze() else
if fzt>=0 then
if score()>(Tempscore-fzt) then
Fuze()
end
else
if score()>=(Tempscore+FFzt) then
Fuze()
end
end
end end
end end
if loops>1 then if score()>lscore then
p(" Loop gain:", cut(score()-lscore)) end end
end end
-----------------------------------
-- dialog
function dia()
-- puz def
for i=1, nSegs-1 do
if structure.IsMutable(i) == true then
MM = true
break
end
end
for d=1, nSegs/2 do
if current.GetSegmentEnergySubscore(d, 'density') ~= -0 then
EDpuzzle = true
break
end
end
-- /puzdef
if not MM then return nomuta() end
p(" Mutator slider:")
p(" 1 = walk mutating with random CI ") -- mutateR
p(" 2 = walk testing all AAs on segment, then next segment ") -- allbyone
p(" 3 = walk testing AA on every segment, then next AA ") -- allwalk
p(" 4 = mutate worst or best first according to (sub)score ") -- mutateS
p(" 5 = bruteforce worst or best first according to (sub)score ") -- AllSorted
p(" 6 = walk testing similar AAs; phobic vs philic distribution remains same ")
opt=dialog.CreateDialog("Choose mutator.")
opt.a=dialog.AddLabel(" See recipe output. ")
opt.Mr=dialog.AddSlider("",1,1,6,0)
opt.ok=dialog.AddButton("Go go!", 1)
dialog.Show(opt)
if opt.Mr.value==1 then RanMut=true
elseif opt.Mr.value==2 then allone=true
elseif opt.Mr.value==3 then allwalk=true
elseif opt.Mr.value==4 then mutateS=true
elseif opt.Mr.value==5 then AllSort=true
elseif opt.Mr.value==6 then BFsim=true
end
end
function partDialog()
opt=dialog.CreateDialog("Choose One.")
opt.cl=dialog.AddCheckbox("clashing", false)
opt.p=dialog.AddCheckbox("packing", false)
opt.bo=dialog.AddCheckbox("bonding", false)
if EDpuzzle == true then
opt.d=dialog.AddCheckbox("density", false)
end
opt.ok=dialog.AddButton("Go go!", 1)
dialog.Show(opt)
if opt.bo.value == true then part="bonding" end
if opt.cl.value == true then part="clashing" end
if opt.p.value == true then part="packing" end
if EDpuzzle == true then
if opt.d.value == true then part="density" end
end
if part == nil then return Sdialog() end
end
function allbyoneD()
opt=dialog.CreateDialog("Options")
opt.lo=dialog.AddSlider("Loops: ", 1, 1, 100, 0)
opt.inR=dialog.AddCheckbox(" In reverse, start from end and work to seg #1 ", false)
opt.qd=dialog.AddSlider("After Mutate:", 1, 1, 3, 0)
opt.q=dialog.AddLabel("1 = no interactions, 2 = shake only, 3 = shake & wiggle")
opt.qst=dialog.AddCheckbox("qStab after mutate",false)
opt.fz=dialog.AddCheckbox("always fuze after mutate",false)
opt.fzt=dialog.AddSlider(" or use threshold: ", -100, -500, 50, 1)
opt.sf=dialog.AddCheckbox("Short fuze",false)
opt.ok=dialog.AddButton("Go go!", 1)
dialog.Show(opt)
inRevers=opt.inR.value
qAd=opt.qd.value
fzt = opt.fzt.value
FFzt = (-1*fzt)
Fuzz = opt.fz.value
Sf = opt.sf.value
qSt = opt.qst.value
loops=opt.lo.value
end
function allwalkD()
opt=dialog.CreateDialog("Options")
opt.lo=dialog.AddSlider("Loops: ", 1, 1, 100, 0)
opt.inR=dialog.AddCheckbox(" In reverse, start from end and work to seg #1 ", false)
opt.qd=dialog.AddSlider("After Mutate:", 1, 1, 3, 0)
opt.q=dialog.AddLabel("1 = no interactions, 2 = shake only, 3 = shake & wiggle")
opt.qst=dialog.AddCheckbox("qStab after mutate",false)
opt.fz=dialog.AddCheckbox("always fuze after mutate",false)
opt.fzt=dialog.AddSlider(" or use threshold: ", -100, -500, 50, 1)
opt.sf=dialog.AddCheckbox("Short fuze",false)
opt.ok=dialog.AddButton("Go go!", 1)
dialog.Show(opt)
inRevers=opt.inR.value
qAd=opt.qd.value
fzt = opt.fzt.value
FFzt = (-1*fzt)
Fuzz = opt.fz.value
Sf = opt.sf.value
qSt = opt.qst.value
loops=opt.lo.value
end
function Sdialog()
opt=dialog.CreateDialog("Options")
opt.wf=dialog.AddCheckbox("Worst first; uncheck is best scoring first.",true)
opt.lo=dialog.AddSlider("Loops: ", 2, 1, 100, 0)
opt.sc=dialog.AddLabel(" Choose one scorepart")
opt.s=dialog.AddCheckbox("sidechain", true)
opt.h=dialog.AddCheckbox("hiding", false)
opt.to=dialog.AddCheckbox("total",false)
opt.o=dialog.AddCheckbox("other",false)
opt.aa=dialog.AddLabel(" Minimum and Maximum mutate CI:")
opt.mic=dialog.AddSlider("minCI :", 0.01, 0.00001, 1, 3)
opt.mac=dialog.AddSlider("maxCI :", 0.94, 0.1, 1, 3)
opt.qd=dialog.AddSlider("After Mutate:", 1, 1, 3, 0)
opt.q=dialog.AddLabel("1 = no interactions, 2 = shake only, 3 = shake & wiggle")
opt.qst=dialog.AddCheckbox("qStab after mutate",false)
opt.fz=dialog.AddCheckbox("always fuze after mutate",false)
opt.fzt=dialog.AddSlider(" or use threshold: ", -100, -500, 50, 1)
opt.sf=dialog.AddCheckbox("Short fuze",false)
opt.ok=dialog.AddButton("Go go!", 1)
dialog.Show(opt)
if opt.to.value == true then part='total' end
if opt.h.value == true then part="hiding" end
if opt.s.value == true then part='sidechain' end
qAd=opt.qd.value
loops=opt.lo.value
WF=opt.wf.value
minCI = opt.mic.value
maxCI = opt.mac.value
fzt = opt.fzt.value
FFzt = (-1*fzt)
Fuzz = opt.fz.value
Sf = opt.sf.value
qSt = opt.qst.value
if opt.o.value == true then partDialog() end
if part == nil then return Sdialog() end
end
function Rdialog()
opt=dialog.CreateDialog("Options.")
opt.rl=dialog.AddSlider("Loops: ", 2, 1, 100, 0)
opt.inR=dialog.AddCheckbox(" In reverse, start from end and work to seg #1 ", false)
opt.aa=dialog.AddLabel(" Minimum and Maximum mutate CI:")
opt.mic=dialog.AddSlider("minCI :", 0.01, 0.00001, 1, 3)
opt.mac=dialog.AddSlider("maxCI :", 0.94, 0.1, 1, 3)
opt.qd=dialog.AddSlider("After Mutate:", 1, 1, 3, 0)
opt.q=dialog.AddLabel("1 = no interactions, 2 = shake only, 3 = shake & wiggle")
opt.qst=dialog.AddCheckbox("qStab after mutate",false)
opt.fz=dialog.AddCheckbox("always fuze after mutate",false)
opt.fzt=dialog.AddSlider(" or use threshold: ", -100, -500, 50, 1)
opt.sf=dialog.AddCheckbox("Short fuze",false)
opt.ok=dialog.AddButton("Go go!", 1)
dialog.Show(opt)
minCI = opt.mic.value
maxCI = opt.mac.value
inRevers=opt.inR.value
qAd=opt.qd.value
fzt = opt.fzt.value
FFzt = (-1*fzt)
Fuzz = opt.fz.value
Sf = opt.sf.value
qSt = opt.qst.value
loops = opt.rl.value
end
function AllSoDia()
opt=dialog.CreateDialog("Options")
opt.wf=dialog.AddCheckbox("Worst first; uncheck is best scoring first.",true)
opt.lo=dialog.AddSlider("Loops: ", 2, 1, 100, 0)
opt.sc=dialog.AddLabel(" Choose one scorepart")
opt.s=dialog.AddCheckbox("sidechain", true)
opt.h=dialog.AddCheckbox("hiding", false)
opt.to=dialog.AddCheckbox("total",false)
opt.o=dialog.AddCheckbox("other",false)
opt.qd=dialog.AddSlider("After Mutate:", 1, 1, 3, 0)
opt.q=dialog.AddLabel("1 = no interactions, 2 = shake only, 3 = shake & wiggle")
opt.qst=dialog.AddCheckbox("qStab after mutate",false)
opt.fz=dialog.AddCheckbox("always fuze after mutate",false)
opt.fzt=dialog.AddSlider(" or use threshold: ", -100, -500, 50, 1)
opt.sf=dialog.AddCheckbox("Short fuze",false)
opt.ok=dialog.AddButton("Go go!", 1)
dialog.Show(opt)
if opt.to.value == true then part='total' end
if opt.h.value == true then part="hiding" end
if opt.s.value == true then part='sidechain' end
qAd=opt.qd.value
fzt = opt.fzt.value
FFzt = (-1*fzt)
Fuzz = opt.fz.value
Sf = opt.sf.value
qSt = opt.qst.value
loops=opt.lo.value
WF=opt.wf.value
if opt.o.value == true then partDialog() end
if part == nil then return Sdialog() end
end
function BFdia()
opt=dialog.CreateDialog("Options")
opt.lo=dialog.AddSlider("Loops: ", 1, 1, 100, 0)
opt.inR=dialog.AddCheckbox(" In reverse, start from end and work to seg #1 ", false)
opt.qd=dialog.AddSlider("After Mutate:", 1, 1, 3, 0)
opt.q=dialog.AddLabel("1 = no interactions, 2 = shake only, 3 = shake & wiggle")
opt.qst=dialog.AddCheckbox("qStab after mutate",false)
opt.fz=dialog.AddCheckbox("always fuze after mutate",false)
opt.fzt=dialog.AddSlider(" or use threshold: ", -100, -500, 50, 1)
opt.sf=dialog.AddCheckbox("Short fuze",false)
opt.ok=dialog.AddButton("Go go!", 1)
dialog.Show(opt)
inRevers=opt.inR.value
qAd=opt.qd.value
fzt = opt.fzt.value
FFzt = (-1*fzt)
Fuzz = opt.fz.value
Sf = opt.sf.value
qSt = opt.qst.value
loops=opt.lo.value
end
-----------------------------------
p("")
function main()
dia()
p("")
band.DeleteAll()
if FilC() then behavior.SetSlowFiltersDisabled(false) end -- if true then Set..(false) end == filters enabled from here on
startscore = score()
bestscore = startscore
recentbest.Save()
save.Quicksave(1)
save.Quicksave(2)
save.Quicksave(93)
p("")
p(" maxCI = "..cival)
p("")
if RanMut==true then Rdialog()
mutateR()
elseif allwalk==true then allwalkD()
allWalk()
elseif allone==true then allbyoneD()
allByOne()
elseif mutateS==true then Sdialog()
mutate()
elseif AllSort==true then AllSoDia()
AllSorted()
elseif BFsim==true then BFdia()
BruteForceSimilar() end
Result()
end
err = xpcall(main,End)