Fandom

Foldit Wiki

Lua Functions That Should Be Implemented

1,449pages on
this wiki
Add New Page
Comments0 Share

This is a place to brainstorm and figure out what functions should be added to foldit by the foldit team to allow you to create scripts that imitate the actions that you perform as a human.

With the release of the Lua V2 interface, functions that are now available have been removed from the list. Check the history of the page to see stuff that once was here.

Protein Manipulation Functions Edit

  • We need threshold parameters, which automatically stops wiggle and shake when the score goes outside of a delta range. For example, structure.WiggleAll(1,10,3) would perform the normal structure.WiggleAll(1) operation, but would stop the wiggle if the score went down by 10 points or more, or up by 3 or more. If these parameters are nil, then foldit performs the current functionality. Many scripts need to put the protein into a higher energy state to get them out of a local minimum, but not distort the protein structure excessively. One iteration frequently is too much change in the protein, which causes the current entire structure layout to be lost.
  • We need ability to change wiggle power
  • We need the ability to move and rotate the ligand in a protein design puzzle. And to move and rotate parts of protein after cut.
  • We need the ability to insert and remove protein segments in a protein design puzzle.

Banding Functions Edit

  • We need the ability to find the segment numbers of the endpoints of a band.
  • We need the ability to modify the strength and length of all existing bands, and affect all future created bands.
  • We need the ability to retrieve all the existing bands.
  • We need either the ability to save the current bands to a named object, or we need enough functions to be able to enumerate everything about every band and be able to reconstruct them ourselves. I need to be able to remove all the bands to the guide I have in place, run a script that uses bands, then reapply the bands to the guide.
  • We need the ability to band to the equivalent segment in the guide. This could be disabled in QTTN puzzles, if desired.
  • Delete shouldn't throw an exception when it fails - it can just not delete the non-existent band.
  • We need an ability to add notes to bands
  • We need an ability to add band going to symmetrical protein.

Cutpoint Functions Edit

  • We need to know if deleting a cutpoint has failed.
  • We need to be able to ask if there is a cutpoint at a segment.

Freezing Functions Edit

Alignment Functions Edit

  • We need the ability to determine the total number of available templates.
  • We need the ability to select/deselect a template.
  • We need the ability to determine the length of a template.
  • We need the ability to retrieve the template score.
  • We need the ability to shift/offset a letter (designation).
  • We need the ability to detect a gap (absence of a letter designation) in a template.
  • We need the ability to determine if a template is threadable.
  • We need the ability to determine which AAs and or sequences were threaded from which templates.

Guide Functions Edit

  • We need tools to manipulate the guide tool.

Investigative Functions Edit

  • We need structure.GetDistance() to take optional atom numbers.
  • We need the ability to get_aa_codon(), this information could be very vital, since an aa can be instantiated from more than one codon.
  • We need the ability to retrieve the entire group and solo rank lists to a lua table. This is important for a script trying to increase rank. If there is a 30 point difference between me and the person above me, a different part of the script may run than if there is .03 points between us. Also, some scripts may execute different strategies based on the score between me and the person in first place.
  • We need the ability to retrieve the date and time a puzzle was posted.
  • We need the ability to retrieve the date and time that a puzzle was first worked on. Early in the working on a puzzle, one might use a completely different strategy than later.
  • We need the ability to retrieve the names of all the current saves for a given puzzle.
  • We need the ability to find out where voids are located. This needs to happen in such a way that we can identify protein segments that are around the void.
  • We need the ability to get a rating of each segment on how well it aligns to the guide. This corresponds to the color of segments when View Color Relative to Guide is checked.
  • We need to know which aa's have hydrogen bonds to which other ones. Or something like contact map could be implemented for all puzzles - it reports what contacts exist. I suggest these functions:
    • table structure.GetBonds(integer segmentIndex) - returns table where key is index of segments and value is number of bonds with it.
    • number structure.GetBondsCount(integer segmentIndex) - returns number of bonds for this segment
    • number structure.GetTotalBonds - returns total number of bonds
  • Contact map info should return how close two aa's need to be in order for the contact to succeed.
  • We need GetAtom, GetDonorAtoms, GetAcceptorAtoms, GetPolarHydrogens. To get atomic info - atom type, donors, acceptors, polar hydrogen.

User Input Functions Edit

  • We need to have the type of point and click input that is possible in GUI scripts. The one I miss most is the ability to have the user select an amino acid or range along the backbone. I can have the user mark a range with a band before starting, which is ugly. But there is no way to ask a user for input in the middle of execution. (As an example, ask which sheet or helix to try straightening next.) RIEachus

Other Functions Edit

  • We need the ability to "Align Protein to Density'  from LUA.
  • We need the ability of a recipe to be able to call another recipe.
  • We need the ability to scale the viewport (the equivalent of scrolling the mouse wheel).
  • We need the ability to alter all of the options.
  • We need the ability to save and restore saves.
  • We need at least one of these two features:
    1. We need the ability to maintain a stack of savesets. A saveset here is defined as all of the quicksave slots, plus the recent best. We need a saveset_push() and saveset_pop() function. A saveset_push() would take the current savesets and copy them to the top of a stack. When a saveset_pop() occurs, the top of the stack would overwrite all of the current saveset slots. The purpose is to make parts of a complex script not have to worry about what slots have been used. So at the start of a function, it can call saveset_push(), and before it returns, it can call saveset_pop().
    2. We need the ability to save savesets by name. saveset_save('foo'), saveset_restore('foo'), would save and restore the current savesets to the name 'foo'. These do not have to be persisted across runs of a script. These could again be used to save a saveset at the beginning of a function and restore it at the end.

Tweak function Edit

  • We need Tweak straighten secondary structure
  • We need Tweak rotate secondary structure
  • We need the ability to tweak sheets and helices, with all of the operations available from the user interface.

UI Functions Edit

  • We need an ability to change view settings
  • We need an ability to move camera (or at least to center it on some segment)

Lua Functions Edit

Many of the Lua standard library functions need to be implemented. A discussion of which functions and their impact can be found at Lua Standard Libraries

ipairs / pairs -- index an array of strings Edit

I would like the following code to work:

   local _n = {["1"]=0,["2"]=0,["3"]=0,["4"]=0,}
   local function _s (n)
       for i,v in pairs (_n) do
           v = 1
       end
       return _n
   end
   _s(_n)
   print ( _n["3"] ) -- should print 1

Editor Edit

  • We need the ability to call an external editor, possibly set by user preferences

LUAEdit

  • It would be nice to be able to run "compiled" lua code (luac) so it would run faster
  • It would be nice to implement meta-tables (to allow things like read-only variables)
  • We need the ability to save recipes themselves to a file in Linux (cut/paste not working). External editor would address this

Recipes Edit

  • We need the problem with large all.macro files crashing the client resolved
  • We need a button to reload the all.macro file into the cookbook. This would facilitate editing the recipes outside of foldit; the painful workaround is to close and reopen foldit.
  • We need the ability to add folders to the Cookbook
  • We need the ability to sort recipes within the Cookbook
  • We need the ability to assign recipes to hotkeys

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.