Icon representing a recipe

Recipe: global design

created by Deleted player

Profile


Name
global design
ID
108242
Shared with
Public
Parent
None
Children
Created on
March 29, 2023 at 09:32 AM UTC
Updated on
April 01, 2023 at 12:14 PM UTC
Description

trying to automate the proteins for all kind of puzzles, this is a test recipe, please feel free to educate me with your thoughts/experience/tips and so on, thank you

Best for


Code


function round ( ii ) return ii - ii % 0.001 end function behavior() if behavior.GetBackboneHBondImportance() < 3 then imp=behavior.GetBackboneHBondImportance()+1 behavior.SetBackboneHBondImportance(imp) end if behavior.GetClashImportance() < 1 then imp= behavior.GetClashImportance()+1 behavior.SetClashImportance(imp) end if behavior.GetDensityImportance() < 3 then imp=behavior.GetDensityImportance()+1 behavior.SetDensityImportance(imp) end if behavior.GetHidingImportance() < 3 then imp=behavior.GetHidingImportance()+1 behavior.SetHidingImportance(imp) end if behavior.GetPackingImportance() < 3 then imp=behavior.GetPackingImportance()+1 behavior.SetPackingImportance(imp) end if behavior.GetPairwiseImportance() < 3 then imp=behavior.GetPairwiseImportance()+1 behavior.SetPairwiseImportance(imp) end if behavior.GetSidechainHBondImportance() < 3 then imp=behavior.GetSidechainHBondImportance()+1 behavior.SetSidechainHBondImportance(imp) end if behavior.GetWigglePower() == "l" or behavior.GetWigglePower() == "h" then behavior.SetWigglePower("a") end end function rotamers(rr, scr) rotamer.GetCount(rr) save.Quicksave ( 4 ) for rot = 1, rotamer.GetCount ( rr ) do rotamer.SetRotamer ( rr, rot ) if current.GetSegmentEnergySubscore ( rr, "sidechain" ) > scr then save.Quicksave ( 4 ) end end save.Quickload ( 4 ) end function normalSeg ( seg2, segcnt, symnum ) if seg2 <= segcnt or symnum == 0 then return seg2, 0 end local endz = {} for sym = 1, symnum do endz [ #endz + 1 ] = segcnt * sym + sym + 1 end local adjseg = 0 local adjsym = 0 for rng = #endz, 1, -1 do if seg2 >= endz [ rng ] then adjseg = seg2 - endz [ rng ] + 1 adjsym = rng break end end return adjseg, adjsym end function bonds(cc,ss ) segcnt = structure.GetCount () symcnt = structure.GetSymCount () bond = structure.GetHBonds () for ii = 1, #bond do local res2, chn = normalSeg ( bond [ ii ] [ "res2" ], segcnt, symcnt ) bx = band.AddBetweenSegments ( bond [ ii ] [ "res1" ], res2, bond [ ii ] [ "atom1" ], bond [ ii ] [ "atom2" ], chn ) if bx ~= nil and bx ~= 0 then blen = band.GetLength ( bx ) band.SetGoalLength(bx, blen) end end end function abego(aa, st) ab = structure.GetABEGO ( aa ) if structure.GetABEGO(aa) == "A" then bonds(bb, st) elseif structure.GetABEGO(aa) == "B" then bonds(bb, st) elseif structure.GetABEGO(aa) == "E" then bonds(bb, st) elseif structure.GetABEGO(aa) == "G" then bonds(bb, st) elseif structure.GetABEGO(aa) == "O" then bonds(bb, st) end end segCnt = structure.GetCount() bestscorepart = creditbest.GetScore() currentscorepart = 0 while currentscorepart < bestscorepart do for ii = 1, segCnt do absolutebest.Restore() bestengscorepart = creditbest.GetEnergyScore() currentengscorepart = 0 while currentengscorepart < bestengscorepart do local scoreparts = {} scoreparts = puzzle.GetPuzzleSubscoreNames() for jj = 1, #scoreparts do local sub = round ( current.GetSegmentEnergySubscore ( ii, scoreparts [ jj ] ) ) print( scoreparts [ jj ] .. ": " .. sub ) if sub ~= 0 then if structure.IsHydrophobic(ii) == "false" then rotamers(jj, sub) abego(ii, struc) else struc = structure.GetSecondaryStructure(ii) amino = structure.GetAminoAcid(ii) if struc == "H" then structure.SetAminoAcid(ii, "c") rotamers(jj, sub) abego(ii, struc) else rotamers(jj, sub) abego(ii, struc) end end else chains={"g";"a";"v";"c";"p";"t";"s";"i";"l";"n";"d";"m";"h";"q";"e";"f";"k";"y";"r";"w"} if structure.CanMutate(ii, chains[ jj ]) == "true" then if struc == "H" then structure.SetAminoAcid(ii, "c") rotamers(jj, sub) abego(ii, struc) end else rotamers(jj, sub) abego(ii, struc) end end selection.Select(ii) structure.IdealizeSelected() structure.RebuildSelected(1) structure.WiggleSelected(1, true, true) selection.Deselect(ii) end selection.Select(ii) freeze.FreezeSelected(true, true) selection.Deselect(ii) selection.DeselectAll() structure.ShakeSidechainsAll(1) structure.WiggleAll(1, false , true) structure.WiggleAll(1, true , true) currentengscorepart = bestengscorepart bestengscorepart = creditbest.GetEnergyScore() recentbest.Save() end selection.Select(ii) freeze.FreezeSelected(true, true) selection.Deselect(ii) selection.DeselectAll() structure.ShakeSidechainsAll(1) structure.WiggleAll(1, false , true) structure.WiggleAll(1, true , true) end currentscorepart = bestscorepart bestscorepart = creditbest.GetScore() recentbest.Save() end

Comments