Back to Recipes Homepage
recipe picture
Recipe: rav3n`s SSS v 1.0.3
Created by Rav3n_pl 82 1780
5
Your rating: None Average: 5 (4 votes)
Used 434 times with an average impact of 8316 points.

Profile

Name: rav3n`s SSS v 1.0.3
ID: 6217
Created on: Mon, 07/26/2010 - 09:56
Updated on: Sat, 08/21/2010 - 06:31
Description:

Settig secundary structure basing on natural aa predispositions. Freezing Glicyne to show most flexible areas and Proline to show possible ends of sheet or helix.



Best For


Comments

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 distance is inbetween an user-specified range,
-- resulting a relative position lock of these segments (scaffolding).
-- This example creates bands between all segments, which have have a distance from 4.75 to 6.

-- 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 ss_check(SegA,SegB)

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

if BandSheets==true then
if SegAss=="E" then
if SegBss=="E" then
ss_flag=true
end -- if SegBaa
end -- if SegAss
else
if BandHelices==true then
if SegAss=="H" then
if SegBss=="H" then
ss_flag=true
end -- if SegBaa
end -- if SegAss
else
if BandLoops==true then
if SegAss=="H" then
if SegBss=="H" then
ss_flag=true
end -- if SegBaa
end -- if SegAss
else
if BandMixed==true then
if SegAss=="H" then
if SegBss=="H" then
ss_flag=true
end -- if SegBaa
end -- if SegAss
end -- if BandMixed
end -- if BandLoops
end -- if BandHelices
end -- if BandSheets
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<=20 then -- The game doesn't allow bands longer than 20
if Distance>=MinDist then -- above or equal minimum?
if Distance<=MaxDist then -- below or equal maximum?
DistanceFlag=true
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(MinDist,MaxDist,DeleteAllBands,Strength)
local MinDist=MinDist
local MaxDist=MaxDist
local DeleteAllBands=DeleteAllBands
local Strength=Strength

local NumSegs=get_segment_count()

if MinDist<1 then MinDist=1 end -- if value is smaller than 1, set it to 1
if MinDist>20 then MinDist=20 end -- if value is bigger than 20, set it to 20
if MaxDist<1 then MaxDist=1 end
if MaxDist>20 then MaxDist=20 end

if MinDist>MaxDist then MinDist,MaxDist=MaxDist,MinDist end
-- If Min>Max, swap them because it wouldn't make sense

if DeleteAllBands then
print("Removing bands...")
while get_band_count() > 0 do band_delete(1) end
end -- if

local OS="Connecting segments with distance be"
if InvertFlag==false then
OS=OS.."tween"
else
OS=OS.."yound"
end -- if
OS=OS.." "..MinDist.."-"..MaxDist.."..."
print(OS)

local Finish=NumSegs-1
local k
for k=1,Finish do
local Start=k+1
local l
for l=Start, NumSegs do
if (l-k)>1 then -- check that there is at least 1 segment between
Distance,DistanceFlag=DistanceCheck(k,l)
if DistanceFlag==true then
if ss_check(l,k)== true then
print("Connected ",k,":",l," distance:",Distance) -- show
band_add_segment_segment(k,l) -- connect
local TempBandCount=get_band_count() -- get new band amount
band_set_length(TempBandCount,Distance)
band_set_strength(TempBandCount,Strength)
end -- if ss_check
end -- if DistanceCheck
end -- if l-k
end -- l loop
end -- k loop
end -- function

-- CHANGE PARAMETERS HERE:
MinDist=4.75 -- Minimum segment distance to band, float value
MaxDist=6 -- Maximum segment distance to band, float value
DeleteAllBands=true -- boolean value
-- If true, all existing bands are deleted before script is executed.
-- If false, previous bands are kept, however.
Strength=1 -- Band strength of the scaffold
-- I forgot minimum and maximum value.
-- Please look for yourself :p
InvertFlag=false -- boolean value
-- set this to true if you want to invert banding
BandSheets=true -- if true, band sheet to sheet
BandHelices=true -- if true, band helix to helix
BandLoops=true -- if true, band loop to loop
BandMixed=false -- if true, band mixed secondrary structures

Scaffolding(MinDist,MaxDist,DeleteAllBands,Strength,InvertFlag) -- Call script with these parameters

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

As you can see, BandMixed is set to false by default here.
This means, only pure Sheet-Shett, Helix-Helix, and Loop-Loop connections are made.

For example, if you only want to band Sheets, set BandSheets to true, BandHelices to false, BandLoops to false and BandMixed to false.

Joined: 06/17/2010
O_o

eee? it is not about my script!
Somthing buggy there!

This script only sets secundary structure. Nothing else. :)

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

Oh, the script header is your's,
the rest is mine?
It got mixed up!

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

none

Children
Authors
Sitemap

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, RosettaCommons