Icon representing a recipe

Recipe: AA Morph 2.1

created by Ronin-Sensei

Profile


Name
AA Morph 2.1
ID
49897
Shared with
Public
Parent
None
Children
None
Created on
August 23, 2014 at 05:58 AM UTC
Updated on
August 23, 2014 at 05:58 AM UTC
Description

Brute force AA morph for DeNovo puzzles, gives you a groundwork, nothing more. use at your own risk.

Best for


Code


total_segments = structure.GetCount() ignore_loops = true stepping = nil AAs={"a", "c", "d", "e", "f", "g", "h", "i", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "y"} function Parameters() dlg = dialog.CreateDialog(" It's Morphin Time! ") dlg.Label = dialog.AddLabel("Set Start and End Segments") dlg.startSeg = dialog.AddSlider("Start Segment", 1, 1, total_segments, 0) dlg.endSeg = dialog.AddSlider("End Segment", total_segments, 1, total_segments, 0) dlg.stepping = dialog.AddSlider("Stepping", 1, 1, 10, 0) dlg.reverse = dialog.AddCheckbox("Reverse Order", false) dlg.ignoreloops = dialog.AddCheckbox("Ignore Loops", true) dlg.ok = dialog.AddButton("GO!", 1) dialog.Show(dlg) local startSeg = dlg.startSeg.value local endSeg = dlg.endSeg.value local reverse = dlg.reverse.value ignore_loops = dlg.ignoreloops.value stepping = dlg.stepping.value loop_morph(startSeg, endSeg, reverse) end function loop_morph(startS, endS, reverse) local score_start = current.GetScore() local new_score = current.GetScore() local aa = structure.GetAminoAcid(1) local best_aa = structure.GetAminoAcid(1) local step = stepping local ss if reverse then eS = startS sS = endS step = (-stepping) startS = sS endS = eS end save.Quicksave(69) for i=startS, endS, step do ss = structure.GetSecondaryStructure(i) if ignore_loops == true and ss ~= "L" then aa = structure.GetAminoAcid(i) print("Seg: "..i.." AA: "..aa.." Score: "..score_start) for j=1, #AAs do score_start = current.GetScore() structure.SetAminoAcid(i, AAs[j]) new_score = current.GetScore() if new_score > score_start then save.Quicksave(69) else save.Quickload(69) end end else aa = structure.GetAminoAcid(i) score_start = current.GetScore() print("Seg: "..i.." AA: "..aa.." Score: "..score_start) for j=1, #AAs do score_start = current.GetScore() structure.SetAminoAcid(i, AAs[j]) new_score = current.GetScore() if new_score > score_start then save.Quicksave(69) else save.Quickload(69) end end end end end Parameters()

Comments


Ronin-Sensei Lv 1

I decided to create this script for Freestyle and DeNovo puzzles that allow you to change the Amino Acids of a structure chain. Essentially if sets up a framework for you to continue building your structure by hand.

I added a Start and End segment sliders because some puzzles actually have structures locked and only allow you to change certain areas.

The idea behind it came from the Ebola glycoprotein puzzle 971c
http://fold.it/portal/node/998358

Keep in mind this a BRUTE-FORCE method, it isn't smart by any means and from what I've discovered running the script myself it like to ignore Hydrophobes for Hydrophilics. Use at your own risk.

USAGE:
Start Slider - the Number of the Segment you wish to start at
ie: Puzzle 971c Start would be at 159, the first changeable structure.

End Slider - The number of the Segment you wish to end at.
This number defaults to the maximum number of segments inside the protein chain.

There are two check boxes, currently the "Ignore Loops" doesn't work, (even though the code is there for whatever bugged reason so I need to update it)

But the Reverse checkbox does work.
Reverse allows you instead of going from Start to End it will go from End to Start.
ALSO and this is important!!!
The script is smart enough to know if the Start is Larger than the End to start walking backwards. So if you set Start to the Max Segments like in the Ebola 971c Puzzle and set the End to 159 (the first mutable segment) it will reverse itself on it's own. The script is still buggy so use at your own risk.

I will make an update soon, so be on the look out for AA Morph 2.2 to fix the bugs and add some "smart-ness" to it.