Back to Recipes Homepage
recipe picture
Recipe: Scaffolding sheets V1.1
Your rating: None Average: 4.3 (109 votes)
Used 653 times with an average impact of -8546 points.


Name: Scaffolding sheets V1.1
ID: 9448
Created on: Fri, 08/27/2010 - 07:52
Updated on: Fri, 08/27/2010 - 14:52

Now with distance scaling. See script for details.

Best For


Joined: 09/18/2009
Groups: SETI.Germany
That's how the code does look like

-- Scaffolding by Crashguard303
-- Script request by Mat747
-- Included faster band removing, submitted by rav3n_pl

-- Applies bands between segments,
-- if their SPATIAL and INDEX distance is inbetween an user-specified range,
-- resulting a relative position lock of these segments (scaffolding).

-- NOTE:
-- At the moment, FoldIt doesn't allow us to set band lengths greater than 20.
-- We can't apply bands between adjacent segments, so these are skipped

function YesNo(Bool)
local Bool=Bool
local OS
if Bool==true then
end -- if
return OS
end -- function

function ss_check(SegA,SegB)

local SegAss=get_ss(SegA)
local SegBss=get_ss(SegB)
local ss_flag=false

if SegAss~=SegBss then -- if secondary structure is unequal
if BandMixed==true then -- And connecting mixed ss is okay
end -- if BandMixeed
else -- so if ss is equal
if SegAss=="L" then -- loops found
if BandLoops==true then
end -- if BandLoops
elseif SegAss=="H" then -- helices found
if BandHelices==true then
end -- if BandHelices
else -- No loops and helices, so it must be sheets
if BandSheets==true then
end -- if BandSheets
end -- if SegAss is letter
end -- if SegAss unequal
return ss_flag
end -- function

function DistanceCheck(k,l)
local k=k
local l=l
local Distance
local DistanceFlag=false
Distance=get_segment_distance(k,l) -- get distance
if Distance*DistFactor<=20 then
-- The game doesn't allow bands longer than 20, so check resulting band length=distance*factor
if Distance>=MinSdist then -- above or equal minimum?
if Distance<=MaxSdist then -- below or equal maximum?
end -- if Distance
end -- if Distance
if InvertFlag==true then DistanceFlag=not(DistanceFlag) end -- Invert result, if desired
end -- if Distance<=20
return Distance,DistanceFlag
end -- function

function Scaffolding()

if MinIdist>MaxIdist then MinIdist,MaxIdist=MaxIdist,MinIdist end
-- If Min>Max, swap them because it wouldn't make sense
if MinIdist<1 then MinIdist=1 end -- if value is smaller than 1, set it to 1

if MinSdist>MaxSdist then MinSdist,MaxSdist=MaxSdist,MinSdist end
-- If Min>Max, swap them because it wouldn't make sense
if MinSdist<1 then MinSdist=1 end -- if value is smaller than 1, set it to 1

if DeleteAllBands then
local BandsToDelete=get_band_count()
if BandsToDelete>0 then
print("Removing ",BandsToDelete," bands...")
for k=1,BandsToDelete do
end -- k loop
end -- if BandsToDelete>0
end -- if DeleteAllBands

print("Connecting segments with strength: ",Strength)
local OS
if InvertFlag==false then
OS="out of "
end -- if
print("Distance range spatial: ",OS,MinSdist," to ",MaxSdist)
print("Distance factor: ",DistFactor)
print("Distance range index: ",MinIdist," to ",MaxIdist)
print("Mixed: ",YesNo(BandMixed))
print("Loops: ",YesNo(BandLoops))
print("Helices: ",YesNo(BandHelices))
print("Sheets: ",YesNo(BandSheets))

local kFinish=NumSegs-MinIdist
local k

for k=1,kFinish do -- k=first segment index to check
local lStart=k+MinIdist
local lFinish=k+MaxIdist
if lFinish>NumSegs then lFinish=NumSegs end
local l

for l=lStart, lFinish do -- l=second segment index to check
Distance,DistanceFlag=DistanceCheck(k,l) -- Get distance and distance flag
if DistanceFlag then -- Does distance match?
if ss_check(k,l) then -- Do secondary structures match?
print("Connected ",k,":",l," distance:",Distance) -- Show
band_add_segment_segment(k,l) -- Connect
local TempBandCount=get_band_count() -- Get new band amount
Distance=Distance*DistFactor -- Change distance value by applying Factor
band_set_length(TempBandCount,Distance) -- Change length of last band
band_set_strength(TempBandCount,Strength) -- Change strength of last band
end -- if ss_check
end -- if DistanceFlag
end -- l loop
end -- k loop
end -- function

NumSegs=get_segment_count() -- Get amount of segments

DeleteAllBands=true -- delete all bands before script start, boolean value
-- If true, all existing bands are deleted before script is executed.
-- If false, previous bands are kept, however.

MinIdist=5 -- Minimum INDEX segment distance to band, INTEGER value
-- Minimum value:2,
-- because the game doesn't connect bands if the segments are too close
MaxIdist=NumSegs-1 -- Maximum INDEX segment distance to band, INTEGER value
MinSdist=4 -- Minimum SPATIAL segment distance to band, FLOAT value
MaxSdist=6 -- Maximum SPATIAL segment distance to band, FLOAT value
DistFactor=1 -- Factor, which changes the band length according to its spatial distance, float value, >=0
-- values<1 pull segments together,
-- values keep them in postion,
-- values>1 push them apart
-- Examples:
-- If a segment distance is 4, and factor is 2, the band length will be 8.
-- If a segment distance is 4, and factor is .5, the band length will be 2.
InvertFlag=false -- Distance inverting, boolean value
-- Set this to true if you want to invert spatial distance banding
-- Be careful with this option, it can create many bands if MinSdist and MaxSdist are close!

Strength=1 -- Band strength of the scaffold, float value

BandMixed=false -- Boolean value. If true, banding mixed secondary structures is allowed
BandLoops=false -- Boolean value. If true, banding loop to loop is allowed
BandHelices=false -- Boolean value. If true, banding helix to helix is allowed
BandSheets=true -- Boolean value. If true, banding sheet to sheet is allowed
-- Note: If you change BandMixed,BandLoops,BandHelices AND BandSheets to false
-- NO band will be applied. You will just waste some of your precious time.

Scaffolding() -- Call script with these parameters

Joined: 09/18/2009
Groups: SETI.Germany

This script is most useful after alignment, to keep the puzzle from "exploding", which means parts flying apart when wiggle is performed.

Using it, I recommend "Strength" values equal or below 1, to allow the segments some movement.

Do your alignment, apply scaffolding, then do wiggle, and when wiggling, slowly remove some bands.

Joined: 08/24/2010
Very powerful

Very useful when using sidechain, or rebuild recipes. They prevent the protein from ripping apart.

Want to try?
Add to Cookbook!
To download recipes to your cookbook, you need to have the game client running.



Developed by: UW Center for Game Science, UW Institute for Protein Design, Northeastern University, Vanderbilt University Meiler Lab, UC Davis
Supported by: DARPA, NSF, NIH, HHMI, Amazon, Microsoft, Adobe, Boehringer Ingelheim, RosettaCommons