Icon representing a recipe

Recipe: ST-foldit-API-Library

created by Seagat2011

Profile


Name
ST-foldit-API-Library
ID
103285
Shared with
Public
Parent
None
Children
None
Created on
March 16, 2020 at 21:29 PM UTC
Updated on
March 16, 2020 at 21:29 PM UTC
Description

Interactive foldit API library. View operating updates in the recipe output window.

Best for


Code


--init pkg local foldit={ {'print','( string [, string] [..string] )',print}, --absolutebest pkg {'absolutebest.AreConditionsMet','()',absolutebest.AreConditionsMet}, {'absolutebest.GetEnergyScore','()',absolutebest.GetEnergyScore}, {'absolutebest.GetExplorationMultiplier','()',absolutebest.GetExplorationMultiplier}, {'absolutebest.GetScore','()',absolutebest.GetScore}, {'absolutebest.GetSegmentEnergyScore','( iSegIDX )',absolutebest.GetSegmentEnergyScore}, {'absolutebest.GetSegmentEnergySubscore','( iSegIDX,\n [ Clashing, Pairwise, Packing, Hiding, \nBonding, Ideality, Other Bonding, Backbone, \nSidechain, Disulfides, Reference, Structure, \nHoles, Surface Area, Interchain Docking, \nNeighbor Vector, Symmetry, Van Der Waals, Density, \nOther ] )',absolutebest.GetSegmentEnergySubscore}, {'absolutebest.Restore','()',absolutebest.Restore}, --band pkg {'band.Add','( iOrigin, iXAxis, iYAxis, fRho, fTheta, fPhi\n [, iAtomOrigin, iAtomXAxis, iAtomYAxis ] )',band.Add}, {'band.AddBetweenSegments','( iSegIDX1, iSegIDX2 \n[, iAtomSegIDX1, iAtomSegIDX2, iSymm ] )',band.AddBetweenSegments}, {'band.AddToBandEndpoint','( iSegIDX1, iSegIDX2 \n[, iAtomIDX ] )',band.AddToBandEndpoint}, {'band.Delete','( iBandIDX )',band.Delete}, {'band.DeleteAll','()',band.DeleteAll}, {'band.Disable','( iBandIDX )',band.Disable}, {'band.Enable','( iBandIDX )',band.Enable}, {'band.EnableAll','()',band.EnableAll}, {'band.GetCount','()',band.GetCount}, {'band.GetGoalLength','( iBandIDX )',band.GetGoalLength}, {'band.GetLength','( iBandIDX )',band.GetLength}, {'band.GetStrength','( iBandIDX )',band.GetStrength}, {'band.IsEnabled','( iBandIDX )',band.IsEnabled}, {'band.SetGoalLength','( iBandIDX, 0.0 < iLength < 10E4 )',band.SetGoalLength}, {'band.SetStrength','( iBandIDX, 0.0 < fStrength < 10.0 )',band.SetStrength}, --behavior pkg {'behavior.GetBandStrength','()',behavior.GetBandStrength}, {'behavior.GetBuriedSidechainShakeAccuracy','()',behavior.GetBuriedSidechainShakeAccuracy}, {'behavior.GetClashImportance','()',behavior.GetClashImportance}, {'behavior.GetExposedSidechainShakeAccuracy','()',behavior.GetExposedSidechainShakeAccuracy}, {'behavior.GetFiltersDisabled','()',behavior.GetFiltersDisabled}, {'behavior.GetShakeAccuracy','()',behavior.GetShakeAccuracy}, {'behavior.GetSlowFiltersDisabled','()',behavior.GetSlowFiltersDisabled}, {'behavior.GetWiggleAccuracy','()',behavior.GetWiggleAccuracy}, {'behavior.GetWigglePower','()',behavior.GetWigglePower}, {'behavior.HighPowerAllowed','()',behavior.HighPowerAllowed}, {'behavior.SetBandStrengthFactor','( 0.5 < fFactor < 1.5 )',behavior.SetBandStrengthFactor}, {'behavior.SetBuriedSidechainShakeAccuracy','( 0.0 < fAccuracy < 1.0 )',behavior.SetBuriedSidechainShakeAccuracy}, {'behavior.SetClashImportance','( 0.0 < fCI < 1.0 )',behavior.SetClashImportance}, {'behavior.SetExposedSidechainShakeAccuracy','\n( 0.0 < fExpo < 1.0 )',behavior.SetExposedSidechainShakeAccuracy}, {'behavior.SetFiltersDisabled','()',behavior.SetFiltersDisabled}, {'behavior.SetShakeAccuracy','( 0 < iShakeA < 4 )',behavior.SetShakeAccuracy}, {'behavior.SetSlowFiltersDisabled','( bDisabled )',behavior.SetSlowFiltersDisabled}, {'behavior.SetWiggleAccuracy','( 0.0 < fAcc < 7.0 )',behavior.SetWiggleAccuracy}, {'behavior.SetWigglePower',"( l=low m=med h=high a=auto )",behavior.SetWigglePower}, --contactmap pkg {'contactmap.GetHeat','( iSegIDX1, iSegIDX2 )',contactmap.GetHeat}, {'contactmap.IsContact','( iSegIDX1, iSegIDX2 )',contactmap.IsContact}, --creditbest pkg {'creditbest.AreConditionsMet','()',creditbest.AreConditionsMet}, {'creditbest.GetEnergyScore','()',creditbest.GetEnergyScore}, {'creditbest.GetExplorationMultiplier','()',creditbest.GetExplorationMultiplier}, {'creditbest.GetScore','()',creditbest.GetScore}, {'creditbest.GetSegmentEnergyScore','( iSegIDX )',creditbest.GetSegmentEnergyScore}, {'creditbest.GetSegmentEnergySubscore','( iSegIDX,\n [ Clashing, Pairwise, Packing, Hiding, \nBonding, Ideality, Other Bonding, Backbone, \nSidechain, Disulfides, Reference, Structure, \nHoles, Surface Area, Interchain Docking, \nNeighbor Vector, Symmetry, Van Der Waals, Density, \nOther ] )',creditbest.GetSegmentEnergySubscore}, {'creditbest.Restore','()',creditbest.Restore}, --current pkg {'current.AreConditionsMet','()',current.AreConditionsMet}, {'current.GetEnergyScore','()',current.GetEnergyScore}, {'current.GetExplorationMultiplier','()',current.GetExplorationMultiplier}, {'current.GetScore','()',current.GetScore}, {'current.GetEnergySegmentScore','( iSegIDX )',current.GetEnergySegmentScore}, {'current.GetEnergySegmentSubscore','( iSegIDX,\n [ Clashing, Pairwise, Packing, Hiding, \nBonding, Ideality, Other Bonding, Backbone, \nSidechain, Disulfides, Reference, Structure, \nHoles, Surface Area, Interchain Docking, \nNeighbor Vector, Symmetry, Van Der Waals, Density, \nOther ] )',current.GetEnergySegmentSubscore}, --dialog pkg {'dialog.AddButton','( sLabel, iValue )',dialog.AddButton}, {'dialog.AddCheckbox','( sLabel, bValue )',dialog.AddCheckbox}, {'dialog.AddLabel','( sLabel )',dialog.AddLabel}, {'dialog.AddSlider','( sLabel, iCurr, iMin, iMax, \niTotalSnaps )',dialog.AddSlider}, {'dialog.AddTextbox','( sLabel, sPlaceHolder )',dialog.AddTextbox}, {'dialog.CreateDialog','( sTitle )',dialog.CreateDialog}, {'dialog.Show','( dialogObject )',dialog.Show}, --filter pkg {'filter.AreAllEnabled','()',filter.AreAllEnabled}, {'filter.ConditionsSatisfied','( sFilterName )',filter.ConditionsSatisfied}, {'filter.Disable','( sFilterName )',filter.Disable}, {'filter.DisableAll','()',filter.DisableAll}, {'filter.Enable','( sFilterName )',filter.Enable}, {'filter.EnableAll','()',filter.EnableAll}, {'filter.GetBonus','( sFilterName )',filter.GetBonus}, {'filter.GetBonusTotal','()',filter.GetBonusTotal}, {'filter.GetDisabledNames','()',filter.GetDisabledNames}, {'filter.GetEnabledNames','()',filter.GetEnabledNames}, {'filter.GetNames','()',filter.GetNames}, {'filter.HasBonus','( sFilterName )',filter.HasBonus}, {'filter.IsEnabled','( sFilterName )',filter.IsEnabled}, --freeze pkg {'freeze.Freeze','( iSegIDX, bFreezeBackbone, \nbFreezeSidechains )',freeze.Freeze}, {'freeze.FreezeAll','()',freeze.FreezeAll}, {'freeze.FreezeSelected','( bFreezeBackbone, bFreezeSidechains )',freeze.FreezeSelected}, {'freeze.GetCount','()',freeze.GetCount}, {'freeze.IsFrozen','( iSegIDX )',freeze.IsFrozen}, {'freeze.Unfreeze','( iSegIDX, bFreezeBackbone, \nbFreezeSidechains )',freeze.Unfreeze}, {'freeze.UnfreezeAll','()',freeze.UnfreezeAll}, --puzzle pkg {'puzzle.GetDescription','()',puzzle.GetDescription}, {'puzzle.GetExpirationTime','()',puzzle.GetExpirationTime}, {'puzzle.GetName','()',puzzle.GetName}, {'puzzle.GetPuzzleID','()',puzzle.GetPuzzleID}, {'puzzle.GetPuzzleSubscoreNames','()',puzzle.GetPuzzleSubscoreNames}, {'puzzle.GetStructureName','()',puzzle.GetStructureName}, {'puzzle.StartOver','()',puzzle.StartOver}, --recentbest pkg {'recentbest.AreConditionsMet','()',recentbest.AreConditionsMet}, {'recentbest.GetEnergyScore','()',recentbest.GetEnergyScore}, {'recentbest.GetExplorationMultiplier','()',recentbest.GetExplorationMultiplier}, {'recentbest.GetScore','()',recentbest.GetScore}, {'recentbest.GetSegmentEnergyScore','( iSegIDX )',recentbest.GetSegmentEnergyScore}, {'recentbest.GetSegmentEnergySubscore','( iSegIDX,\n [ Clashing, Pairwise, Packing, Hiding, \nBonding, Ideality, Other Bonding, Backbone, \nSidechain, Disulfides, Reference, Structure, \nHoles, Surface Area, Interchain Docking, \nNeighbor Vector, Symmetry, Van Der Waals, Density, \nOther ] )',recentbest.GetSegmentEnergySubscore}, {'recentbest.Restore','()',recentbest.Restore}, {'recentbest.Save','()',recentbest.Save}, --recipe pkg {'recipe.CompareNumbers','( iNum1, iNum2 )',recipe.CompareNumbers}, {'recipe.GetRandomSeed','()',recipe.GetRandomSeed}, {'recipe.ReportStatus','()',recipe.ReportStatus}, {'recipe.SectionEnd','()',recipe.SectionEnd}, {'recipe.SectionStart','( sSectionName )',recipe.SectionStart}, --rotamer pkg {'rotamer.GetCount','( iSegIDX )',rotamer.GetCount}, {'rotamer.SetRotamer','( iSegIDX, \niRotamerSnap < rotamer.GetCount() )',rotamer.SetRotamer}, --save pkg {'save.GetSolutions','()',save.GetSolutions}, {'save.LoadSecondaryStructure','()',save.LoadSecondaryStructure}, {'save.LoadSolutionsByName','( sSolName )',save.LoadSolutionsByName}, {'save.Quickload','( 1 < iSlotNumber < 100 )',save.Quickload}, {'save.Quicksave','( 1 < iSlotNumber < 100 )',save.Quicksave}, {'save.QuicksaveEmpty','( 1 < iSlotNumber < 100 )',save.QuicksaveEmpty}, {'save.SaveSecondaryStructure','()',save.SaveSecondaryStructure}, {'save.SaveSolution','( sSolName )',save.SaveSolution}, --scoreboard pkg {'scoreboard.GetGroupRank','()',scoreboard.GetGroupRank}, {'scoreboard.GetGroupScore','( enumScoreType )',scoreboard.GetGroupScore}, {'scoreboard.GetRank','( enumScoreType )',scoreboard.GetRank}, {'scoreboard.GetScore','()',scoreboard.GetScore}, {'scoreboard.GetScoreType','()',scoreboard.GetScoreType}, --selection pkg {'selection.Deselect','( iSegIDX )',selection.Deselect}, {'selection.DeselectAll','()',selection.DeselectAll}, {'selection.GetCount','()',selection.GetCount}, {'selection.IsSelected','( iSegIDX )',selection.IsSelected}, {'selection.Select','( iSegIDX )',selection.Select}, {'selection.SelectAll','()',selection.SelectAll}, {'selection.SelectRange','( iSegIDX1, iSegIDX2 )',selection.SelectRange}, --structure pkg {'structure.CanMutate',"( iSegIDX, aa )",structure.CanMutate}, {'structure.DeleteCut','( iSegIDX )',structure.DeleteCut}, {'structure.DeleteResidue','( iSegIDX )',structure.DeleteResidue}, {'structure.GetAminoAcid','( iSegIDX )',structure.GetAminoAcid}, {'structure.GetAtomCount','( iSegIDX )',structure.GetAtomCount}, {'structure.GetCount','()',structure.GetCount}, {'structure.GetDistance','( iSegIDX1, iSegIDX2 )',structure.GetDistance}, {'structure.GetNote','( iSegIDX )',structure.GetNote}, {'structure.GetSecondaryStructure','( iSegIDX )',structure.GetSecondaryStructure}, {'structure.GetSymCount','()',structure.GetSymCount}, {'structure.IdealizeSelected','()',structure.IdealizeSelected}, {'structure.InsertCut','( iSegIDX )',structure.InsertCut}, {'structure.InsertResidue','( iSegIDX )',structure.InsertResidue}, {'structure.IsHydrophobic','( iSegIDX )',structure.IsHydrophobic}, {'structure.IsLocked','( iSegIDX )',structure.IsLocked}, {'structure.IsMutable','( iSegIDX )',structure.IsMutable}, {'structure.LocalWiggle','( iIters \n[, bWiggleBachbone, bWiggleSidechain ] )',structure.LocalWiggle}, {'structure.LocalWiggleSelected','( iIters \n[, bWiggleBachbone, bWiggleSidechain ] )',structure.LocalWiggleSelected}, {'structure.MutateSidechains','( iIters )',structure.MutateSidechains}, {'structure.RebuildSelected','( iIters )',structure.ReBuildSelected}, {'structure.RemixSelected','( iStartQuickSave, iNumberResults )',structure.RemixSelected}, {'structure.SetAminoAcid',"( iSegIDX, aa )",structure.SetAminoAcid}, {'structure.SetAminoAcidSelected',"( aa )",structure.SetAminoAcidSelected}, {'structure.SetNote','( iSegIDX, sNote )',structure.SetNote}, {'structure.SetSecondaryStructure','( iSegIDX, ss )',structure.SetSecondaryStructure}, {'structure.SetSecondaryStructureSelected','( ss )',structure.SetSecondaryStructureSelected}, {'structure.ShakeSidechainsAll','( iIters )',structure.ShakeSidechainsAll}, {'structure.TweakRotate','( iSegIDX, fRho )',structure.TweakRotate}, {'structure.TweakShift','( iSegIDX, bDirection )',structure.TweakShift}, {'structure.TweakStraighten','( iSegIDX )',structure.TweakStraightn}, {'structure.WiggleAll','( iIters, bWiggleBachbone, \nbWiggleSidechain )',structure.WiggleAll}, {'structure.WiggleSelected','( iIters )',structure.WiggleSelected}, --ui pkg {'ui.AlignGuide','( iSegIDX )',ui.AlignGuide}, {'ui.CenterViewPort','()',ui.CenterViewPort}, {'ui.GetPlatform','()',ui.GetPlatform}, {'ui.GetTrackName','()',ui.GetTrackName}, --undo pkg {'undo.SetUndo','( bEnable )',undo.SetUndo}, --user pkg {'user.GetGroupID','()',user.GetGroupID}, {'user.GetGroupName','()',user.GetGroupName}, {'user.GetPlayerID','()',user.GetPlayerID}, {'user.GetPlayerName','()',user.GetPlayerName}, } --[[ for i,j in ipairs(foldit) do print(i,j[1],j[1]..j[2]) end for i,j in pairs(foldit) do print(i,j[1],j[1]..j[2]) end ]]-- local mod=10 local win={ lib=foldit, pg=1, mod=mod, PG=#foldit/mod-#foldit/mod%1 + 1, TOTAL=#foldit, nextState=0, status='BROWSE', } repeat local k = win.mod*(win.pg - 1) + 1 local K = 1--k + math.min(win.mod - 1,win.TOTAL-k) local obj = dialog.CreateDialog('foldit API library') -- render BROWSE view -- if true then -- new view -- for i = k,win.TOTAL do -- render page -- obj["chk_"..i] = dialog.AddCheckbox(win.lib[i][1],false) if K < win.mod then K = K + 1 else break end end obj.lbl = dialog.AddLabel('__________________________________________') obj.sdr = dialog.AddSlider('Page',win.pg,1,win.PG,0) obj.btn00 = dialog.AddButton('First',1) obj.btn01 = dialog.AddButton('< Prev',2) obj.btn02 = dialog.AddButton('OK',3) obj.btn03 = dialog.AddButton('Next >',4) obj.btn04 = dialog.AddButton('Last',5) end win.nextState = dialog.Show(obj) -- get nextState -- if win.nextState == 0 then win.nextState = "DONE" break elseif win.nextState == 1 then -- first page -- win.pg = 1 elseif win.nextState == 2 and win.pg > 1 then -- previous page -- win.pg = win.pg - 1 elseif win.nextState == 3 then -- go to page (iff required) -- if win.pg ~= obj.sdr.value then win.pg = obj.sdr.value else for _,attr in pairs(obj) do if string.find(_,'chk_(%d)') and attr.value == true then -- render CHOOSE view -- local r,s,ii = string.find(_,'chk_(%d+)') ii = tonumber(ii) local pObj = dialog.CreateDialog('foldit API library') pObj.lb100 = dialog.AddLabel('') pObj.lb102 = dialog.AddLabel('') pObj.lb103 = dialog.AddLabel('') pObj.lbl04 = dialog.AddLabel(win.lib[ii][1]..' '..win.lib[ii][2]) pObj.lb105 = dialog.AddLabel('') pObj.lb106 = dialog.AddLabel('') pObj.lb107 = dialog.AddLabel('') pObj.lbl08 = dialog.AddLabel('i-integer f-float s-string b-bool e-enum aa-amino \nss-structure') pObj.lb109 = dialog.AddLabel('') pObj.lbl10 = dialog.AddLabel('aa : a, b, c, ..., z') pObj.lb111 = dialog.AddLabel('') pObj.lbl12 = dialog.AddLabel('ss : H=Helix E=Strand L=Loop M=Mutable \n A=Auto') pObj.lb113 = dialog.AddLabel('') pObj.txtbx00 = dialog.AddTextbox('Parameters','') pObj.btn00 = dialog.AddButton('Back',1) pObj.btn01 = dialog.AddButton('OK',2) pObj.btn02 = dialog.AddButton('Cancel',3) win.nextState = dialog.Show(pObj) if win.nextState == 0 then win.nextState = "DONE" break elseif win.nextState == 1 then -- unimplemented -- elseif win.nextState == 2 then local iii = 1 local params = {} for j in string.gfind(pObj.txtbx00.value,'[^,]+') do params[iii] = j iii = iii + 1 end local _,res = pcall(win.lib[ii][3],unpack(params)) local w = params[1] or "" for y=2,#params do w = w..", "..params[y] end if res then print(win.lib[ii][1].."("..w..")".." : ("..tostring(res)..")") end elseif win.nextState == 3 then -- unimplemented -- end -- test(nextState (pObj)) -- break end-- test(obj), attr -- end--loop(obj) -- end -- test(win.pg) -- elseif win.nextState == 4 and win.pg < win.PG then -- next page -- win.pg = win.pg + 1 elseif win.nextState == 5 then -- last page -- win.pg = win.PG end -- test(win.nextState) -- until win.nextState == 'DONE'

Comments