Icon representing a recipe

Recipe: Complex_Remix v0.9

created by Serca

Profile


Name
Complex_Remix v0.9
ID
103304
Shared with
Public
Parent
None
Children
Created on
March 15, 2020 at 22:27 PM UTC
Updated on
March 15, 2020 at 22:27 PM UTC
Description

Remixes 2 large selections simultaneously.

Before starting script 2 selections should be made by user manually!
Script Remixes both selections together, iterating every possible combination between the Remix solutions for these 2 selections. Scores and fuzes all the solutions and chooses the best one.
If the selection length is 1 (one residue is selected for any of two selections), script adds neighborhood to selection making selection length 5 residues. If no selections found it increases selection length.

This script is usefull for building local mojo, packing 2 close loops very good.
It's perfect for searching optimal solution of the 2 cysteines. Just select 2 close cysteines (ctrl+click) and run this script. Better band the cysteine sidechain endings with the strong short band (length 0.9 strength 4) to make good cysteine bridge on fuze.

Best for


Code


--[[ Remixes 2 large selections simultaneously. Before starting script 2 selections should be made by user manually! Script Remixes both selections together, iterating every possible combination between the Remix solutions for these 2 selections. Scores and fuzes all the solutions and chooses the best one. If the selection length is 1 (one residue is selected for any of two selections), script adds neighborhood to selection making selection length 5 residues. If no selections found it increases selection length. This script is usefull for building local mojo, packing 2 close loops very good. It's perfect for searching optimal solution of the 2 cysteines. Just select 2 close cysteines (ctrl+click) and run this script. Better band the cysteine sidechain endings with the strong short band (length 0.9 strength 4) to make good cysteine bridge on fuze. ]]-- function FastFuze() behavior.SetClashImportance(0.05) structure.ShakeSidechainsAll(1) structure.WiggleAll(10) behavior.SetClashImportance(1) structure.WiggleAll(10) end function Fuze() behavior.SetClashImportance(0.05) structure.ShakeSidechainsAll(1) structure.WiggleAll(2) behavior.SetClashImportance(0.2) structure.ShakeSidechainsAll(1) structure.WiggleAll(1) behavior.SetClashImportance(1) structure.WiggleAll(1) behavior.SetClashImportance(0.3) structure.ShakeSidechainsAll(1) behavior.SetClashImportance(1) structure.WiggleAll(20) end function ScoreReturn() x = current.GetEnergyScore() return x-x%0.01 end --Return both selections back function RestoreSelection() selection.DeselectAll() for j=1, proteinLength do if j+1>sel1 and j<sel1+sel1Length then selection.Select (j) end if j+1>sel2 and j<sel2+sel2Length then selection.Select (j) end end end --main bestScore=-999999 bestSlot=0 proteinLength=structure.GetCount () wideSelection=2 --number of segments to wide (up and down) the short 1 segment length selection wideSelection1=wideSelection selectionLength=0 sel1=0 sel2=0 remixNum=0 remix2Num=0 incSwitch=0 recentbest.Save() save.Quicksave(1) --check for selections for i=1, proteinLength do if selection.IsSelected(i) then if selectionLength==0 then if sel1==0 then sel1=i --print ("sel1",i) elseif selectionLength == 0 then sel2=i --print ("sel2",i) end end selectionLength=selectionLength+1 --print ("selectionLength", selectionLength) else if selectionLength > 0 then if sel2 == 0 then sel1Length=i-sel1 --print ("sel1Length", sel1Length) else sel2Length=i-sel2 end end selectionLength=0 end end -- Wide the selection1 and selection2 if they are too short if sel1Length==1 then sel1=sel1-wideSelection sel1Length=wideSelection*2+1 print ("Selection1 is too short. Setting length to", sel1Length) end if sel2Length==1 then sel2=sel2-wideSelection sel2Length=wideSelection*2+1 print ("Selection2 is too short. Setting length to", sel2Length) end RestoreSelection() print ("Sel1 starts at", sel1, "length", sel1Length, " / sel2 starts at", sel2, "length", sel2Length) -- Remixing selection1 until get some solutions while remixNum==0 do if sel1Length>12 then return end --select first selection selection.DeselectAll() for j=1, proteinLength do if j+1>sel1 and j<sel1+sel1Length then selection.Select (j) end end remixNum = structure.RemixSelected(2, 95) if remixNum==0 then -- make selection wider if no solutions founds if incSwitch==0 then -- switch is used to increase selection by 1 seg every round (not by 2) sel1=sel1-1 sel1Length=sel1Length+1 incSwitch=1 else sel1Length=sel1Length+1 incSwitch=0 end print ("No solutions for selection1. Setting length to", sel1Length) end RestoreSelection() end print ("Got", remixNum, "solutions for 1st selection") wideSelection1=wideSelection -- reset the wide selection counter for i=2, remixNum+1 do save.Quickload(i) -- Remixing selection2 until get some solutions while remix2Num==0 do if sel2Length>12 then return end --select second selection selection.DeselectAll() for j=1, proteinLength do if j+1>sel2 and j<sel2+sel2Length then selection.Select (j) end end remix2Num = structure.RemixSelected(remixNum+2, 95-remixNum) if remix2Num==0 then -- make selection wider if no solutions founds if incSwitch==0 then -- switch is used to increase selection by 1 seg every round (not by 2) sel2=sel2-1 sel2Length=sel2Length+1 incSwitch=1 else sel2Length=sel2Length+1 incSwitch=0 print ("No solutions for selection2. Setting length to", sel2Length) end end if i==2 then print ("Got", remix2Num, "solutions for 2nd selection") end RestoreSelection() end print ("Have", remixNum-i+2, "*", remix2Num, "=", remix2Num*(remixNum-i+2), " fuzes to go") --fuze slot after remix for 2nd selection for j=remixNum+2, remix2Num+remixNum+1 do save.Quickload(j) FastFuze(0.3) save.Quicksave(j) crntScore = ScoreReturn() best="" if crntScore > bestScore then bestScore=crntScore bestSlot=j save.Quicksave(99) --save.Quickload(98) --save.Quicksave(97) recentbest.Save() best="*best" end print ("Remix", i-1, "-", j-1-remixNum, ": slot", j, "score", crntScore, " "..best) end end recentbest.Restore() save.Quickload(1) save.Quickload(99) print ("Max score", bestScore, "from slot", bestSlot) if remixNum*remix2Num > 1 then print ("Fuzing best position") Fuze() end save.Quicksave(99) save.Quickload(1) --starting solution save.Quickload(99)

Comments


Serca Lv 1

Selection1 is too short. Setting length to 5 Selection2 is too short. Setting length to 5 Sel1 starts at 11 length 5 / sel2 starts at 35 length 5 No solutions for selection1. Setting length to 6 Got 3 solutions for 1st selection Got 19 solutions for 2nd selection Have 3 * 19 = 57 fuzes to go Remix 1 - 1 : slot 5 score 9425.38 *best Remix 1 - 2 : slot 6 score 9424.75 Remix 1 - 3 : slot 7 score 9397.59 Remix 1 - 4 : slot 8 score 9367.81 Remix 1 - 5 : slot 9 score 9429.13 *best Remix 1 - 6 : slot 10 score 9485.06 *best Remix 1 - 7 : slot 11 score 9458.42 Remix 1 - 8 : slot 12 score 9332.23 Remix 1 - 9 : slot 13 score 9411.58 Remix 1 - 10 : slot 14 score 8875.3 Remix 1 - 11 : slot 15 score 9484.84 Remix 1 - 12 : slot 16 score 9455.54 Remix 1 - 13 : slot 17 score 9503.47 *best Remix 1 - 14 : slot 18 score 9464.91 Remix 1 - 15 : slot 19 score 9407.39 Remix 1 - 16 : slot 20 score 9404.75 Remix 1 - 17 : slot 21 score 9508.16 *best Remix 1 - 18 : slot 22 score 9365.01 Remix 1 - 19 : slot 23 score 9500.32 Have 2 * 19 = 38 fuzes to go Remix 2 - 1 : slot 5 score 9482.53 Remix 2 - 2 : slot 6 score 9444.31 Remix 2 - 3 : slot 7 score 9448.99 Remix 2 - 4 : slot 8 score 9422.24 Remix 2 - 5 : slot 9 score 9462.3 Remix 2 - 6 : slot 10 score 9453.6 Remix 2 - 7 : slot 11 score 9483.11 Remix 2 - 8 : slot 12 score 9287.09 Remix 2 - 9 : slot 13 score 9417.29 Remix 2 - 10 : slot 14 score 8973.66 Remix 2 - 11 : slot 15 score 9440.95 Remix 2 - 12 : slot 16 score 9470.8 Remix 2 - 13 : slot 17 score 9511.33 *best Remix 2 - 14 : slot 18 score 9467.12 Remix 2 - 15 : slot 19 score 9445.43 Remix 2 - 16 : slot 20 score 9451.98 Remix 2 - 17 : slot 21 score 9516.46 *best Remix 2 - 18 : slot 22 score 9380.64 Remix 2 - 19 : slot 23 score 9464.28 Have 1 * 19 = 19 fuzes to go Remix 3 - 1 : slot 5 score 9481.42 Remix 3 - 2 : slot 6 score 9446.22 Remix 3 - 3 : slot 7 score 9487 Remix 3 - 4 : slot 8 score 9375.82 Remix 3 - 5 : slot 9 score 9507.69 Remix 3 - 6 : slot 10 score 9457.63 Remix 3 - 7 : slot 11 score 9482.97 Remix 3 - 8 : slot 12 score 9330.81 Remix 3 - 9 : slot 13 score 9419.65 Remix 3 - 10 : slot 14 score 8928.37 Remix 3 - 11 : slot 15 score 9454.53 Remix 3 - 12 : slot 16 score 9471.83 Remix 3 - 13 : slot 17 score 9465.82 Remix 3 - 14 : slot 18 score 9470.14 Remix 3 - 15 : slot 19 score 9444.45 Remix 3 - 16 : slot 20 score 9463.66 Remix 3 - 17 : slot 21 score 9475.67 Remix 3 - 18 : slot 22 score 9426.66 Remix 3 - 19 : slot 23 score 9469.54 Max score 9516.46 from slot 21 Fuzing best position

Formula350 Lv 1

Request: Instead of having us enter Interface Mode to make the selection (since annoyingly, there's no hotkey to quickly toggle that mode), could you also have it look for two Frozen segments to treat as selections and have it translate it into a selection through the API?
I don't remember which recipe it is that I have, but that's how it worked by being able to use Selection or "Freeze-Proxy" (for lack of better word lol). As I recall, it also have a lead-up dialog box to confirm with the user to use Frozen Segments as "Selected" points. So you could even offer that as well in case someone wants to use this while still having frozen points.


Alternatively… Since pressing Tab (for Segment Information) works even with a recipe running, you could offer input boxes in the configuration dialog window that asks for Segment Number in lieu of u using Frozen ones entirely.

Thanks! :)
-Form

Serca Lv 1

I cant figure out how to make the initial selection.

You need to switch to Selection Interface in Menu for that and make selection with ctrl+click or shift+click

Formula350, thank you for your opinion. I understand that Original Interface is not good to run this script. Will be updated soon.