Icon representing a recipe

Recipe: nicm25.dei.TestBaseScoring V0

created by Nicm25

Profile


Name
nicm25.dei.TestBaseScoring V0
ID
105164
Shared with
Public
Parent
None
Children
None
Created on
August 30, 2021 at 12:14 PM UTC
Updated on
August 30, 2021 at 12:14 PM UTC
Description

*demo script, test base scoring! (segment select, number seed, number setcount, boolean fixrandom)

Best for


Code


-- created by Nicm25; function pldc() local retd=dialog.CreateDialog("TestBaseScoring V0 - message") retd.la=dialog.AddLabel("can choose any value you like for random seed") retd.sr=dialog.AddSlider("seed",0.5,0.0,1.0,3) retd.si=dialog.AddSlider("set count",1,1,50,0) retd.ck=dialog.AddCheckbox("fix random",false) retd.bt=dialog.AddButton("Check",1) retd.bs=dialog.AddButton("Test",2) return retd end function plfa(avx,avy,avz,avt) local lc=0 local retv=0.0 local lfx=0 for lc=avx+5,avy-5 do retv=current.GetSegmentEnergyScore(lc)- current.GetSegmentEnergySubscore(lc,"clashing")- current.GetSegmentEnergySubscore(lc,"bonding")- current.GetSegmentEnergySubscore(lc,"ideality") lfx=avz[lc+3] avt[lfx+20]=avt[lfx+20]+retv avt[lfx+40]=avt[lfx+40]+1 end return retv end function plfb(avx,avy,avz,avd,avt) local lc=0 local lfx=0.1415926535897932 local lfy=avz lfx=(lfx*lfx*127+lfy)%1.0 lfy=(lfx+lfy)%1.0 lfx=(lfx*101.23457+0.53)%1.0 lfy=(lfx+lfy)%1.0 for lc=avx,avy do lfx=(lfx*101.23457+0.53)%1.0 lfy=(lfx+lfy)%1.0 avd[lc+3]=math.floor(lfy*19.1+1.0) structure.SetAminoAcid(lc,avt[avd[lc+3]]) end end function plfc(avx,avy,avz) local lc=0 local lfx=0.1415926535897932 local lfy=avz local lfz=0 lfx=(lfx*lfx*127+lfy)%1.0 lfy=(lfx+lfy)%1.0 lfx=(lfx*101.23457+0.53)%1.0 lfy=(lfx+lfy)%1.0 lfz=math.floor((avy-avx+1.25)*0.5)+avx lfz=band.Add(lfz,lfz+1,lfz+2,0.001,0.01,0.01,2,2,2) band.Disable(lfz) selection.DeselectAll() selection.SelectRange(avx+1,avy-1) structure.IdealSSSelected() selection.DeselectAll() selection.SelectRange(avx,avx+1) structure.IdealizeSelected() selection.DeselectAll() band.SetStrength(band.Add(avx,avx+1,avx+2,0.001,0.01,0.01,2,2,2),0.2) band.SetStrength(band.Add(avy,avy-1,avy-2,0.001,0.01,0.01,2,2,2),0.2) recentbest.Save() behavior.SetClashImportance(0.05) structure.ShakeSidechainsAll(1) behavior.SetClashImportance(0.25) structure.WiggleAll(3) for lc=1,6 do behavior.SetClashImportance(0.1-lc*0.01) structure.ShakeSidechainsAll(1) if (lc-0.5)%3.0>2.0 then behavior.SetClashImportance(0.25) structure.WiggleAll(3) behavior.SetClashImportance(0.5) structure.ShakeSidechainsAll(1) end behavior.SetClashImportance(1.0) structure.WiggleAll(3) end recentbest.Restore() band.Delete(lfz+2) band.Delete(lfz+1) lfz=math.floor((avy-avx+1.25)*0.5)+avx for lc=1,6 do lfx=(lfx*101.23457+0.53)%1.0 lfy=(lfx+lfy)%1.0 lfz=math.floor(lfy*(avy-avx+1))+avx lfx=(lfx*101.23457+0.53)%1.0 lfy=(lfx+lfy)%1.0 lfx=(lfx*101.23457+0.53)%1.0 band.Add(lfz,lfz+(avy-lfz<1.5 and -1 or 1),lfz+(avy-lfz<1.5 and -2 or 2), 1.6-lc*0.1,(lfx+lfy)%1.0*3.14159,lfy*6.28318,2,2,2) lfy=(lfx+lfy)%1.0 structure.WiggleAll(5) band.Delete(2) end recentbest.Restore() if band.GetCount(false)>1.5 then band.Delete(2) end if band.GetCount(false)>0.5 then band.Enable(1) structure.WiggleAll(5) band.DeleteAll() end end function plss() local lc=1 local retd={} for lc=1,structure.GetCount() do retd[lc]=selection.IsSelected(lc) and 1 or 0 end return retd end function run(avs,avx,avy,avz) local lc=0 local stcd={} local stcs={} local setsd=0.0 stcs[1]=structure.GetCount() stcs[2]=band.GetCount(false) stcd[1]="A" stcd[2]="C" stcd[3]="D" stcd[4]="E" stcd[5]="F" stcd[6]="G" stcd[7]="H" stcd[8]="I" stcd[9]="K" stcd[10]="L" stcd[11]="M" stcd[12]="N" stcd[13]="Q" stcd[14]="R" stcd[15]="S" stcd[16]="T" stcd[17]="V" stcd[18]="W" stcd[19]="Y" stcd[20]="P" stcs[3]=1 if avy<0.5 then stcs[4]=0 if selection.GetCount()>1.5 then for lc=stcs[4]+1,stcs[1] do if avs[lc]>0.5 then if stcs[4]<0.5 then stcs[4]=lc else stcs[1]=lc end end end end if stcs[4]<0.5 then stcs[4]=1 end stcs[3]=0.0 for lc=stcs[4],stcs[1] do stcs[3]=stcs[3]+current.GetSegmentEnergyScore(lc) end print("energy score :"..stcs[3]) stcs[3]=0.0 for lc=stcs[4],stcs[1] do stcs[3]=stcs[3]+current.GetSegmentEnergyScore(lc)- current.GetSegmentEnergySubscore(lc,"clashing")- current.GetSegmentEnergySubscore(lc,"bonding")- current.GetSegmentEnergySubscore(lc,"ideality") end print("offset score :"..stcs[3]) return 0 end for lc=1,40 do stcd[lc+20]=0.0 end setsd=avz and avx or ((os.time()%1000.0*101000.0+avx*1000000.0+ (((os.time()%500000.0)*101.0+0.5)%500000.0-0.5)+0.5)%1000000.0-0.5)*0.000001 if not("Protein Design Sandbox"==puzzle.GetName()) then print("this not Protein Design Sandbox") print("please try open that puzzle.") return 1 end if stcs[1]<10.5 then print("sorry not support too few residues.") return 1 end print("seed: "..(setsd*1000000.0)..",test begin") behavior.SetWigglePower("h") band.DeleteAll() undo.SetUndo(false) while avy*20-stcs[3]>-0.5 do plfb(1,stcs[1],(0.1271*(stcs[3]-1)+setsd)%1.0,stcs,stcd) plfc(1,stcs[1],(0.1271*stcs[3]+setsd+0.1)%1.0) plfa(1,stcs[1],stcs,stcd) if (stcs[3]-0.5)%20.0>19.0 and avy*20-stcs[3]>0.5 then undo.SetUndo(true) band.DeleteAll() undo.SetUndo(false) print("middle result:"..stcs[3]) for lc=1,40 do print(stcd[(lc-0.5)%20.0+0.5]..":"..stcd[lc+20]) end end stcs[3]=stcs[3]+1 end print("Last result:") for lc=1,40 do print(stcd[(lc-0.5)%20.0+0.5]..":"..stcd[lc+20]) end for lc=1,20 do print(stcd[lc]..":"..(stcd[lc+40]<0.5 and "none" or stcd[lc+20]/stcd[lc+40])) end undo.SetUndo(true) band.DeleteAll() return 0 end local lfi=0 local tdr=pldc() lfi=dialog.Show(tdr) if lfi>0.5 then lfi=run(plss(),tdr.sr.value,lfi>1.5 and tdr.si.value or -1,tdr.ck.value) if lfi>0.5 then print("terminated by exception error") end end

Comments


Nicm25 Lv 1

*note: this is demo script.
This recipe just repeats the random mutation and quick relax to find out the base energy required for folding,
and recipe has been adjusted to run in the 'Protein Design Sandbox'.
before running you should give secondary structure to you protein, examine it using idealSS as initial structure by this recipe.
4 arguments
select: currently selected segment will be this argument.(check mode only)
seed: choose any value you like to generate random AA's by random seed.
range: 0.0-1.0, default: 0.5, function: 1.0 is plus value, 0.0 is none value
setcount: run 20 times as one set, only 0 is check mode for scoring only.
range: 0-50 (ext0-1000), default: 1, function: 1 is one set 20 counts, 0 is check mode
fixrandom: set whether to fixed random seed.
default: false, function: false is always random seed, true is fixed random seed

Nicm25 Lv 1

Hi, this is an explanation of how this recipe was created….

I was trying to investigate in this recipe was true(valid) energy required for folding.
If we could pick arbitrary AA's and have our folding trends known, we would be able to design more stable energy landscape.
It is known that we have tendency to spontaneously fold from single strand(beta) into helix(alpha) where hydrogen bonds exist.
In order fold to helix, we must find another energy landscape that is more stable from helix.
to bend the helix, we have to find another energy landscape that makes helix more stable,
such as AA's sequence that is more stable when attached to each other's side chains by hydrophobic interactions.
How do we do this? using that result table, we can deduce from delta score the energy required to go from helix to strand.
and to bend the helix, we as loop 2-3 segments, some of which are untied from helix, and re fold them as strand.
this means that we need hydrophobic sidechain that gives high score in the regular case, least about 100 points(10 kcal/mol).
and when conformation can be altered by surface hydrogen bonding etc…, it may be re folded for more stable, lower energy.
*however, since that result table does not include hydrogen bonds, there is offset of about 10 points per segment in delta score.

*attached data
the results of helix and strand(sheet) data for each sidechains.

results tabulated using this recipe are as follows.

AAIndex,samples,helixscore,sheetscore,deltascore
A,3758,10.262,-61.200,71.462
C,3759,-61.791,-107.314,45.523
D,3832,24.937,3.691,21.246
E,3782,27.563,10.892,16.671
F,3754,-21.907,-18.889,-3.018
G,3759,5.880,-48.695,54.575
H,3865,14.048,-0.313,14.361
I,3683,-25.382,-50.216,24.834
K,3776,26.419,8.902,17.517
L,3748,-21.663,-63.682,42.019
M,3762,-23.315,-50.707,27.392
N,3772,22.178,-1.865,24.043
P,376,4.343,42.710,-38.367
Q,3746,21.790,2.002,19.788
R,3714,17.443,-2.977,20.420
S,3697,21.226,-16.516,37.742
T,3805,20.256,-35.937,56.193
V,3856,-22.929,-74.463,51.534
W,3824,-31.079,-46.403,15.324
Y,3732,-10.375,-2.023,-8.352
*sigma=0.18