Foldit Wiki
Advertisement

INTRODUCTION

As you may know, the newest Fold-it update includes support for Lua Scripting. In very basic terms, Lua is a simple programming language that we can use to manipulate proteins and automate repetitive tasks -- much like we already do with the Cookbook

.

Output

Running a script with output!

A script is actually quite similar to a Cookbook recipe (as well as to a real-life recipe for say, a cake) -- it contains a series of instructions (called commands) that tell Foldit what to do with your protein (just as a real-life recipe has step by step instructions about how to combine ingredients to create a cake!)


Lua scripting adds an exciting new layer of gameplay to Foldit!  Fortunately, lua is easy enough to learn that everyone can use it, even people who have never programmed or scripted before.  The best place to get started if you don't have any programming experience is to work through the Lua Scripting Tutorial (Beginner 1) (followed by Lua Scripting Tutorial (Beginner 2) and the upcoming Lua Scripting Tutorial (Beginner 3)

). If you're not interested in scripting yourself but just want to download and run other people's scripts, Beginner 1 is all you need!  But if you want to go a bit further and modify scripts and write your own, you can move onto Beginner 2 and 3.

Multitool

Viewing code: Crashguard's Multitool script

If, on the other hand, you have some programming experience or want to get a quicker start, begin with Lua Scripting Tutorial (Intermediate).  This intermediate tutorial starts from the ground up and assumes no prior knowledge but moves through material at a more rapid pace, including basics about how to run and modify scripts as well as core programming concepts like looping and variables.


Another option for experienced programmers is to use the full Lua Interface listing (below) in combination with the Lua Reference Manual to learn the material on your own.  If you already know how to program, you'll find that it's a  simple issue of learning Lua's simple syntax and the Foldit command set.  Additional resources for working with Lua are listed below, including guides to exporting and importing scripts and more!


Whatever option you choose, best of luck and happy scripting!

RESOURCES

Lua Scripting Tutorial (Beginner 1)

Lua Scripting Tutorial (Beginner 2)

Lua Scripting Tutorial (Beginner 3)

Lua Scripting Tutorial (Intermediate)

Lua Scripting Tutorial (Advanced)

Lua Export and Import of Scripts using Text and HEX editor

Lua Export and Import of Scripts using WORDPAD++

Foldit Recipes and Scripts Homepage

Lua 5.1 Reference Manual

Lua-users wiki

Foldit Scripting Preview

Foldit Cookbook Scripting

LUA INTERFACE

void set_behavior_clash_importance(number importance)
Set the clashing importance to 'importance' (between 0 and 1).

number get_score()
Return the current score.

number get_segment_score(integer segment_index_1[,..., integer segment_index_n])
Return the score of the given segments. More than one segment index may be specified.

string get_ss(integer segment_index_1[,..., integer segment_index_n])
Get residue's secondary structure type at given segment indices.

number get_segment_distance(integer segment_index_1, integer segment_index_2)
Return distance between 2 segments.

integer get_band_count()
Return the number of bands.

integer get_segment_count()
Return the number of segments.

void reset_recent_best()
Set this pose as recent best

void band_add_segment_segment(integer segment_index_1, integer segment_index_2)
Add a band between the segments at 'segment_index_1' and at 'segment_index_2'.

void restore_abs_best()
Restore to the absolute best pose

void restore_recent_best()
Restore to the recent best pose

void reset_puzzle()
Reset puzzle to the starting structure

void band_disable(integer band_index_1[, ..., integer band_index_n])
Disable the bands at the given band indices.

void band_enable(integer band_index_1[, ..., integer band_index_n])
Enable the bands at the given band indices.

void band_delete(integer band_index_1[, ..., integer band_index_n])
Delete the bands at the given band indices.

void do_mutate([integer iterations])
Run mutate. Run for 'iterations' iterations if given; otherwise, until stopped.

void do_local_rebuild([integer iterations])
Run local rebuild on selection. Run for 'iterations' iterationas if given; otherwise, until stopped.

void deselect_all()
Clear Selection.

void select_all()
Select all segments.

void do_shake([integer iterations])
Run shake. Run for 'iterations' iterations if given; otherwise, until stopped.

void do_global_wiggle_sidechains([integer iterations])
Run global wiggle on sidechains. Run for 'iterations' iterations if given; otherwise, until stopped.

void do_global_wiggle_backbone([integer iterations])
Run global wiggle on backbone. Run for 'iterations' iterations if given; otherwise, until stopped.

void do_global_wiggle_all([integer iterations])
Run global wiggle on backbone and sidechains. Run for 'iterations' iterations if given; otherwise, until stopped.

number get_segment_score_part(string score_part, integer segment_index_1[, ..., integer segment_index_n])
Return the current backbone score of the given segments.  More than one segment index may be specified.

void replace_ss(string ss)
Replace residues' secondary structure within selection with 'ss'.

void replace_aa(string aa)
Replace residues' amino acid within selection with 'aa'.

void deselect_index(integer segment_index_1[, ..., integer segment_index_n])
Deselect segments at the given indices.  More than one segment index may be specified.

void select_index_range(integer segment_index_1, integer segment_index_2)
Select all segments from (including) 'segment_index_1' to (including) 'segment_index_2'.

void select_index(integer segment_index_1[, ..., integer segment_index_n])
Select segments at the given indices.  More than one segment index may be specified.

void help(void)
Prints to Recipe Output, an unannotated list of Foldit functions.

string get_aa(integer segment_index_1[, ..., integer segment_index_n])
Get residue's amino acid type at given segment indices.

(This function was removed on 10/13/2009.)

Advertisement