Icon representing a recipe

Recipe: Asymmetry Symmetry Maker

created by phallicies

Profile


Name
Asymmetry Symmetry Maker
ID
45296
Shared with
Public
Parent
None
Children
None
Created on
January 31, 2013 at 19:11 PM UTC
Updated on
January 31, 2013 at 19:11 PM UTC
Description

Does cool things, run twice, and uncheck box second time. let it run fully and dont interupt. yes there is a lot of bands, and yes it will take a while the first run, don't be discouraged. it does a very accurate job.

Best for


Code


menu=dialog.CreateDialog("Symmetry Bander") menu.firsttime= dialog.AddCheckbox("First Run",true) menu.okay = dialog.AddButton("Okay",1) dialog.Show(menu) if menu.firsttime.value==true then for i=1, 50 do for j=1, structure.GetAtomCount(i) do band.AddBetweenSegments(i,i+50,j,j) band.SetGoalLength(band.GetCount(),0) band.SetStrength(band.GetCount(),10) end end behavior.SetClashImportance(0) structure.WiggleAll(2) behavior.SetClashImportance(1) band.DeleteAll() print("Move Protein far away from Locked Segments For Second Run") else for i=1, 50 do for j=i+2, 50 do band.AddBetweenSegments(i,j) bandnum=band.GetCount() bandlen=structure.GetDistance(i+50,j+50) band.SetGoalLength(bandnum,bandlen) end end behavior.SetClashImportance(1) structure.WiggleAll(2,true,false) band.DeleteAll() freeze.FreezeAll() atomnum=structure.GetAtomCount(5) band.AddBetweenSegments(26,55,atomnum,atomnum) band.AddBetweenSegments(5,76,atomnum,atomnum) band.SetGoalLength(1,2.02) band.SetGoalLength(2,2.02) band.SetStrength(1,10) band.SetStrength(2,10) structure.WiggleAll(5) end

Comments


LociOiling Lv 1

A recent feedback also reports that this recipe causes a crash on Mac.

On Windows, the recipe ends with an error, but doesn't crash Foldit.

Looking at the code, it tries to add a band from segment 1 to segment 51, then segment 2 to 52, and so on. It does this for the first 50 segments, so the last band would be from segment 50 to segment 100.

On puzzles where the protein has less than 100 segments, this code is guaranteed to produce an error. Puzzle 2174, for example, has only 60 segments.

Fortunately, another logic error prevents the recipe from getting that far. The recipe also specifies atom numbers for the start and end of each band. It tries to band each and every atom. The recipe assumes that the amino acids at both the start and end points of each band will have the same number of atoms.

Even at the start of a design puzzle, where each segment is usually the amino acid isoleucine, atom numbers differ. Isoleucine at segment 1 has 21 atoms. Isoleucine in a middle segment has 19 atoms. For the last segment, it has 20 atoms. (Amino acids lose atoms when they are joined by peptide bonds.)

For the starting pose of puzzle 2174, the recipe will try to band every atom of segment 1 to every atom of segment 51. It will start at atom 1, and keep going to atom 21. All is fine through atom 19. Atom 20 is fine for segment 1, but it doesn't exist for segment 51. The recipe terminates at that point, having successfully made 19 bands.

For a pose that's not all isoleucine, the exact results will vary, but crash is still likely.

The recipe also does some strange things toward the end, such as banding segment 26 to segment 55, and segment 5 to segment 76. It uses the atom count from segment 5 for both ends of those two bands. This might work in some cases, but a puzzle of at least 76 segments is required for it to have a chance.

Bottom line, this recipe is interesting only if it produces different results on Mac than on Windows.