Profile
- Name
- The DeNebulizeR 1.53
- ID
- 48893
- Shared with
- Public
- Parent
- None
- Children
- Created on
- April 14, 2014 at 03:39 AM UTC
- Updated on
- April 14, 2014 at 03:39 AM UTC
- Description
for de novo
Best for
Code
--v1.53
--The DeNebulizeR 1.02
--drjr Feb 2013
--MonkeyShock 1.44
--ShoeHorn 1.08
--drjr Feb 2013
--[[
Rav3n_pl Compressor v2.1
ComputerMage - converted to V2.0 script.
trying to compress/decompress protein accepting loss of points between pulls
]]--
-- "lua v1 in v2" library by rav3n_pl
--just add it in front of your v1 code and use v2 and v1 code in v2 scripts :)
-- print(arg1[,...,argN]) no change :)
function CalulateFloppyScore()
FloppyScore=0
TotalSegments=structure.GetCount()
for a=1,TotalSegments do
for b= a, TotalSegments do
FloppyScore=FloppyScore+(structure.GetDistance(a,b)/TotalSegments)/100
end
end
return FloppyScore
end
function round ( i )
return i - i % 1
end
function are_conditions_met()
return current.AreConditionsMet()
end
function band_add_segment_segment(sgi1, sgi2)
band.AddBetweenSegments(sgi1, sgi2)
end
function band_delete(bndIdx)
if bndIdx~= nil then
band.Delete(bndIdx)
else
end
end
function band_disable(bndIdx)
if bndIdx~=nil then
band.Disable(bndIdx)
else
band.DisableAll()
end
end
function band_enable(bndIdx)
if bndIdx~=nil then
band.Enable(bndIdx)
else
band.EnableAll()
end
end
function band_set_length(bndIdx, len)
band.SetGoalLength(bndIdx, len)
end
function band_set_strength(bndIdx, str)
band.SetStrength(bndIdx, str)
end
function get_band_count()
return band.GetCount()
end
function deselect_all()
selection.DeselectAll()
end
function deselect_index(sgn)
selection.Deselect(sgn)
end
function select_all()
selection.SelectAll()
end
function select_index(sgn)
selection.Select(sgn)
end
function select_index_range(sg1,sg2)
selection.SelectRange(sg1,sg2)
end
function do_freeze(bbone,schain)
freeze.FreezeSelected(bbone,schain)
end
function do_unfreeze_all()
freeze.UnfreezeAll()
end
function do_global_wiggle_all(iters)
structure.WiggleAll(iters,true,true)
end
function do_global_wiggle_backbone(iters)
structure.WiggleAll(iters, true,false)
end
function do_global_wiggle_sidechains(iters)
structure.WiggleAll(iters,false,true)
end
function do_local_rebuild(iters)
structure.RebuildSelected(iters)
end
function do_local_wiggle(iters)
structure.LocalWiggleSelected(iters,true,true)
end
function do_mutate(iters)
structure.MutateSidechainsSelected(iters)
end
function do_shake(iters)
structure.ShakeSidechainsSelected(iters)
end
function do_sidechain_snap(sgn, snap)
rotamer.SetRotamer(sgn, snap)
end
function get_sidechain_snap_count(sgn)
return rotamer.GetCount(sgn)
end
function load_structure()
save.LoadSecondaryStructure()
end
function save_structure()
save.SaveSecondaryStructure()
end
function quickload(slot)
save.Quickload(slot)
end
function quicksave(slot)
save.Quicksave(slot)
end
function get_exploration_score()
return current.GetExplorationMultiplier()
end
function get_ranked_score()
return current.GetScore()
end
function get_score()
return current.GetEnergyScore()
end
function get_segment_distance(sg1,sg2)
return structure.GetDistance(sg1,sg2)
end
function get_aa(sn)
return structure.GetAminoAcid(sn)
end
function get_segment_count()
return structure.GetCount()
end
function get_ss(sn)
return structure.GetSecondaryStructure(sn)
end
function is_hydrophobic(sn)
return structure.IsHydrophobic(sn)
end
function replace_aa(aa)
for i=1,structure.GetCount() do
if selection.IsSelected(i) then
structure.SetAminoAcid(i, aa)
end
end
end
function replace_ss(ss)
for i=1,structure.GetCount() do
if selection.IsSelected(i) then
structure.SetSecondaryStructure(i,ss)
end
end
end
function get_segment_score(sg)
return current.GetSegmentEnergyScore(sg)
end
function get_segment_score_part(score_part,sg)
return current.GetSegmentEnergySubscore(sg,score_part)
end
function reset_puzzle()
puzzle.StartOver()
end
function restore_abs_best()
absolutebest.Restore()
end
function restore_credit_best()
creditbest.Restore()
end
function reset_recent_best()
recentbest.Save()
end
function restore_recent_best()
recentbest.Restore()
end
function set_behavior_clash_importance(ci)
behavior.SetClashImportance(ci)
end
-- end of library
--drjr-Alien Downloaded
--[[possibly not properly acredited.]]--
ss=no --Sheet Straightener
SSBandLength=9.5
SSBandStrength=1.5
MinimumDistance=8
BandStrength=1.5
StartBandLength=7
EndBandLength=5
PushBands=get_segment_count()/3
--compressor loss rav3n_pl
minDist=10 --minimum spatial distance between banding segments
maxDist=20 --maximum spatial distance between banding segments
compressFrac=4 --make bands shorter by that much points
--was at 4
minSkip=10 --minimum segment distance between banded segments
numBands=get_segment_count()/7 --how many bands use at once
bandStr=1 --band strenght
pullingCI=0.3 --clash impotrance during pull
maxLoss=50 --maximum acceptable LOSS after BF/PF. also lowering fuzeScore
reloadBest=4 --reload best solution after that many worst ones
fuzeScore=10 --how close we have to be to run BF/PF
usePF=false --true --use PinkFuse after qStab
useBF=false --true --use BlueFuse after qStab.
--fuzes are started form SAME state, NOT one after one!
allLoop=false --work in all-loop mode. sometimes work better than structure mode :)
numTries=1 --how many copmpress loops
function BBANG()
print('Starting BBANG (Better(Better(After New Geometry)))')
recentbest.Save()
selection.SelectAll()
save.Quicksave(1) --stores original
structure.WiggleSelected(10)
save.Quickload(1)
structure.ShakeSidechainsSelected(1)
structure.WiggleSelected(10)
recentbest.Restore()
save.Quicksave(1)
behavior.SetClashImportance(0.1)
structure.ShakeSidechainsSelected(1)
behavior.SetClashImportance(MaxCI)
structure.WiggleSelected(15)
save.Quickload(1)
behavior.SetClashImportance(0.1)
structure.ShakeSidechainsSelected(1)
structure.WiggleSelected(15)
behavior.SetClashImportance(MaxCI)
structure.WiggleSelected(15)
save.Quickload(1)
behavior.SetClashImportance(0.1)
structure.ShakeSidechainsSelected(1)
structure.WiggleSelected(15)
behavior.SetClashImportance(MaxCI)
structure.ShakeSidechainsSelected(1)
structure.WiggleSelected(15)
recentbest.Restore()
print('Halfway done...')
save.Quicksave(2)
behavior.SetClashImportance(0.1)
structure.ShakeSidechainsSelected(1)
structure.WiggleSelected(15)
behavior.SetClashImportance(MaxCI)
structure.WiggleSelected(15)
save.Quickload(2)
behavior.SetClashImportance(0.1)
structure.ShakeSidechainsSelected(1)
structure.WiggleSelected(15)
behavior.SetClashImportance(MaxCI)
structure.ShakeSidechainsSelected(1)
structure.WiggleSelected(15)
recentbest.Restore()
blueRfuse()
end
function SheetStraightener()
for s=1,get_segment_count()-2 do
if get_ss(s)=="E" then do
if get_ss(s+2)=="E" then do
band_add_segment_segment(s,s+2)
end
else end
end
else end
end
NewNewBandNo=get_band_count()
for m=NewBandNo+1,NewNewBandNo do
band_set_length(m,SSBandLength)
band_set_strength(m,SSBandStrength)
end
end
function SewTheSheets() --M. Suchard
print ('sewing the sheets')
-- sew sheets if near
nbsegtot=get_segment_count()
for noseg =2,nbsegtot do
for deuxseg =noseg+1,nbsegtot do
if (get_segment_distance(noseg, deuxseg)< 8 and get_ss(noseg)=='E' and get_ss(deuxseg)=='E' )then
band_add_segment_segment(noseg,deuxseg)
end
end
end
end
-- "dirty_dozen"
-- reports 12 worst-scoring segments for manual attention
-- code by smith92clone 6/21/10
-- contribution & integration of quicksort, minor cosmetic adjustments to report format - dimension9 6/21/10
-- quicksort from rosettacode.org
-- http://rosettacode.org/wiki/Sorting_algorithms/Quicksort
-- get all the segment scores and sort them
function get_all_seg_scores(start,finish)
local i
local seg_list = {}
for i= 1,get_segment_count() do
worstScore=get_segment_score_part('clashing',i)
score_set = {}
score_set.index = i
score_set.score = worstScore
seg_list[#seg_list+1] = score_set
end
return seg_list
end
--[[function sort_rebuild_list(seg_list) -- d9; substituted quicksort
if seg_list == nil then
print("sort_rebuild_list: seg_list is nil")
abort = abort + 1 -- this will stop program
end
-- binary sort
local outer
local inner
local seg_list_count = # seg_list
for outer = 1, seg_list_count-1 do
for inner = 1, seg_list_count-outer-1 do
local a = seg_list[inner+1]
local b = seg_list[inner]
if a.score < b.score then
seg_list[inner+1] = b
seg_list[inner] = a
end
end -- end of inner loopok, two tables in
end -- end of outer loop
return seg_list
end]]
--in-place quicksort
function quicksort(t, start, endi)
start, endi = start or 1, endi or #t
if(endi - start < 2) then return t end
local pivot = start
for i = start + 1, endi do
if t[i].score <= t[pivot].score then --d9; only adaptation needed ( add ".score")
local temp = t[pivot + 1]
t[pivot + 1] = t[pivot]
if(i == pivot + 1) then
t[pivot] = temp
else
t[pivot] = t[i]
t[i] = temp
end
pivot = pivot + 1
end
end
t = quicksort(t, start, pivot - 1)
return quicksort(t, pivot + 1, endi)
end
function the_list()
segment_list = get_all_seg_scores(1,get_segment_count())
--new_segment_list = sort_rebuild_list(segment_list) --d9; substitute quicksort
new_segment_list = quicksort(segment_list, 1, #segment_list)
--for jj=1,24 do --#new_segment_list --d9; only report 12 worst at a time (fits in window + it's all that's needed)
--print(jj," - segment # ",new_segment_list[jj].index," = ",new_segment_list[jj].score) --d9; added whitespace, removed brackets
--end
end
function blueRfuse()
set_behavior_clash_importance(0.2)
do_shake(1)
do_global_wiggle_all(10)
set_behavior_clash_importance(1)
do_shake(1)
do_global_wiggle_all(10)
set_behavior_clash_importance(0.05)
do_shake(1)
set_behavior_clash_importance(1)
do_global_wiggle_all(10)
set_behavior_clash_importance(0.07)
do_shake(1)
set_behavior_clash_importance(1)
do_global_wiggle_all(10)
set_behavior_clash_importance(0.3)
do_global_wiggle_all(15)
set_behavior_clash_importance(1)
do_global_wiggle_all(10)
end
function ShortFuse()
set_behavior_clash_importance(0.2)
do_shake(1)
do_global_wiggle_all(10)
set_behavior_clash_importance(1)
do_shake(1)
do_global_wiggle_all(10)
set_behavior_clash_importance(0.05)
do_shake(1)
set_behavior_clash_importance(1)
do_global_wiggle_all(10)
end
function ShorteRFuse()
set_behavior_clash_importance(0.2)
do_shake(1)
do_global_wiggle_all(10)
set_behavior_clash_importance(1)
do_shake(1)
do_global_wiggle_all(10)
end
function FreezeHelices()
for y=1,get_segment_count() do
deselect_all()
if get_ss(y)=="H" then do
select_index(y)
do_freeze(true,true)
end
else end
end
end
function FreezeSheets()
for x=1,get_segment_count() do
deselect_all()
if get_ss(x)=="E" then do
select_index(x)
do_freeze(true,true)
end
else end
end
end
function PushMePullYou()
reset_recent_best()
set_behavior_clash_importance(1)
BandLength=StartBandLength
the_list()
do_unfreeze_all()
band_disable()
--SheetStraightener()
for jj=1,PushBands do
for i=1,get_segment_count() do
if new_segment_list[jj].index-i>5 then do
if get_segment_distance(i,new_segment_list[jj].index) <= MinimumDistance then do
band_add_segment_segment(i,new_segment_list[jj].index)
end
else end
end
else end
end
end
NewBandNo=get_band_count()
for k=BandNo+1,NewBandNo do
band_set_strength(k,BandStrength)
band_set_length(k,BandLength)
end
--if ss==yes then do
--SheetStraightener()
--end
--else end
--SewTheSheets()
print('Total No of Bands: ',get_band_count())
select_all()
set_behavior_clash_importance(pullingCI)
do_global_wiggle_all(3)
set_behavior_clash_importance(1)
--band_set_strength(0.3)
--do_global_wiggle_all(10)
NewBandNo=get_band_count()
for r=BandNo+1,NewBandNo do
band_delete(BandNo+1)
end
--band_delete()
band_disable()
quicksave(99)
do_global_wiggle_all(10)
quicksave(100)
Score100=get_score()
quickload(99)
do_shake(1)
do_global_wiggle_all(10)
if Score100>get_score() then do
quickload(100)
end
else end
band_disable()
--do_shake(1)
--do_global_wiggle_all(10)
ShortFuse()
--ShorteRFuse()
--blueRfuse()
band_enable()
end
--[[
Compressor v1
trying to compress protein
]]--
--[[
Tlaloc`s math library
------------------------------------------------------------------------
The original random script this was ported from has the following notices:
Copyright (c) 2007 Richard L. Mueller
Hilltop Lab web site - http://www.rlmueller.net
Version 1.0 - January 2, 2007
You have a royalty-free right to use, modify, reproduce, and
distribute this script file in any way you find useful, provided that
you agree that the copyright owner above has no warranty, obligations,
or liability for such use.
------------------------------------------------------------------------
]]--
local lngX = 1000
local lngC = 48313
local function _MWC()
local S_Hi
local S_Lo
local C_Hi
local C_Lo
local F1
local F2
local F3
local T1
local T2
local T3
local A_Hi = 63551
local A_Lo = 25354
local M = 4294967296
local H = 65536
local S_Hi = math.floor(lngX / H)
local S_Lo = lngX - (S_Hi * H)
local C_Hi = math.floor(lngC / H)
local C_Lo = lngC - (C_Hi * H)
local F1 = A_Hi * S_Hi
local F2 = (A_Hi * S_Lo) + (A_Lo * S_Hi) + C_Hi
local F3 = (A_Lo * S_Lo) + C_Lo
local T1 = math.floor(F2 / H)
local T2 = F2 - (T1 * H)
lngX = (T2 * H) + F3
local T3 = math.floor(lngX / M)
lngX = lngX - (T3 * M)
lngC = math.floor((F2 / H) + F1)
return lngX
end
local function _abs(value)
if value < 0 then
value = -value
end
return value
end
local function _floor(value)
return value - (value % 1)
end
local function _randomseed(x)
lngX = x
end
local function _random(m,n)
if n == nil and m ~= nil then
n = m
m = 1
end
if (m == nil) and (n == nil) then
return _MWC() / 4294967296
else
if n < m then
return nil
end
return math.floor((_MWC() / 4294967296) * (n - m + 1)) + m
end
end
math=
{
abs = _abs,
floor = _floor,
random = _random,
randomseed = _randomseed,
}
--[[ End math library ]]--
function Score()
return get_score(true)
end
function seed()
local s=math.abs(Score())
s=s%0.001
s=1/s
while s<10000000 do s=s*10 end
s=s-s%1
math.randomseed(s)
end
seed()
segCnt=get_segment_count()
p=print
function round3(x)--cut all afer 3-rd place
return x-x%0.001
end
function down(x)
return x-x%1
end
function Wiggle(how, iters, minppi)
if how==nil then how="wa" end
if iters==nil then iters=6 end
if minppi==nil then minppi=0.001 end
if iters>0 then
iters=iters-1
sp=Score()
if how == "s" then do_shake(1)
elseif how == "wb" then do_global_wiggle_backbone(1)
elseif how == "ws" then do_global_wiggle_sidechains(1)
elseif how == "wa" then do_global_wiggle_all(1)
end
ep = Score()
ig=ep-sp
if how~="s" then
if ig > minppi then Wiggle(how, iters, minppi) end
end
end
end
function AllLoop() --turning entire structure to loops
local ok=false
for i=1, segCnt do
local s=get_ss(i)
if s~="L" then
save_structure()
ok=true
break
end
end
if ok then
select_all()
--replace_ss("L")
end
end
function BlueFuse()
p("BlueFuse...")
reset_recent_best()
select_all()
set_behavior_clash_importance(0.05)
do_shake(1)
set_behavior_clash_importance(1)
Wiggle()
set_behavior_clash_importance(0.07)
do_shake(1)
set_behavior_clash_importance(1)
Wiggle()
--restore_recent_best()
set_behavior_clash_importance(0.3)
do_global_wiggle_all(1)
set_behavior_clash_importance(1)
Wiggle()
--restore_recent_best()
SaveBest()
quicksave(6)
end
bestScore=Score()
function SaveBest()
local g=Score()-bestScore
if g>0 then
p("Gained another ",round3(g)," pts.")
bestScore=Score()
quicksave(3)
end
end
function FuseEnd()
set_behavior_clash_importance(1)
Wiggle()
Wiggle("s",1)
Wiggle()
SaveBest()
end
function Fuze1(ci1,ci2)
set_behavior_clash_importance(ci1)
Wiggle("s",1)
set_behavior_clash_importance(ci2)
Wiggle("wa",1)
FuseEnd()
end
function Fuze2(ci1,ci2)
set_behavior_clash_importance(ci1)
Wiggle("wa",1)
set_behavior_clash_importance(1)
Wiggle()
set_behavior_clash_importance(ci2)
Wiggle("wa",1)
FuseEnd()
end
function PinkFuse()
reset_recent_best()
p("PinkFuse...")
quicksave(4) -- store state before fuse
Fuze1(0.1,0.7)
quickload(4) -- load state before fuse
Fuze1(0.3,0.6)
quickload(4) -- load state before fuse
Fuze2(0.5,0.7)
quickload(4) -- load state before fuse
Fuze2(0.7,0.5)
restore_recent_best()
quicksave(5)
end
function qStab()
p("qStab...")
select_all()
set_behavior_clash_importance(0.1)
Wiggle("s",1)
set_behavior_clash_importance(1)
Wiggle("ws",1)
Wiggle()
Wiggle("s",1)
Wiggle()
SaveBest()
end
function MakeBandsOut(num)
local done=false
local s1=math.random(segCnt)
local s2=math.random(segCnt)
local blip1=math.random(segCnt)
local blip2=math.random(segCnt)
blip=(blip1-blip2)/segCnt
if s1>s2 then s1,s2=s2,s1 end
local d=get_segment_distance(s1,s2)
if s2-s1>=minSkip and d>=minDist and d<=maxDist then done=true end
if done then
num=num-1
band_add_segment_segment(s1,s2)
k=get_band_count()
band_set_length(k,d+1.44+blip)
--print('blip1= ',blip1)
--print('blip2= ',blip2)
--print('blip= ',blip)
--print(s1)
--print(s2)
--print(segCnt)
band_set_strength(k,bandStr)
end
if num>0 then MakeBandsOut(num) end
end
function MakeBandsIn(num)
local done=false
local s1=math.random(segCnt)
local s2=math.random(segCnt)
local blip1=math.random(segCnt)
local blip2=math.random(segCnt)
blip=(blip1-blip2)/segCnt
if s1>s2 then s1,s2=s2,s1 end
local d=get_segment_distance(s1,s2)
if s2-s1>=minSkip and d>=minDist and d<=maxDist then done=true end
if done then
num=num-1
band_add_segment_segment(s1,s2)
k=get_band_count()
band_set_length(k,d-1.76+blip)
--print('blip1= ',blip1)
--print('blip2= ',blip2)
--print('blip= ',blip)
--print(s1)
--print(s2)
--print(segCnt)
band_set_strength(k,bandStr)
end
if num>0 then MakeBandsIn(num) end
end
function Compressor()
p("Starting Compressor, ",numTries," loops.")
quicksave(3)
badOnes=0
reset_recent_best()
if allLoop then AllLoop() end
local sscore=Score()
for i=1,numTries do
local ls=Score()
p("Compress loop ",i," of ",numTries," started. Current score: ",round(ls))
BBScore=0
for f=1,get_segment_count() do
BBScore=BBScore+get_segment_score_part('backbone',f)
end
print('Total Backbone Score= ',BBScore)
reset_recent_best()
quicksave(99)
for j=1,3 do
print('Round ',j)
band_enable()
--print('No of Bands: ',get_band_count())
MakeBandsOut(numBands)
set_behavior_clash_importance(pullingCI)
select_all()
--SewTheSheets()
do_global_wiggle_all(10)
--print('No of Bands: ',get_band_count())
NewBandNo=get_band_count()
for r=BandNo+1,NewBandNo do
band_delete(BandNo+1)
end
band_disable()
do_unfreeze_all()
set_behavior_clash_importance(1)
do_global_wiggle_all(10)
do_shake(1)
--ShorteRFuse()
band_enable()
print('No of Bands: ',get_band_count())
MakeBandsIn(numBands)
set_behavior_clash_importance(pullingCI)
select_all()
--SewTheSheets()
do_global_wiggle_all(10)
print('No of Bands: ',get_band_count())
NewBandNo=get_band_count()
for r=BandNo+1,NewBandNo do
band_delete(BandNo+1)
end
band_disable()
do_unfreeze_all()
set_behavior_clash_importance(1)
do_global_wiggle_all(10)
do_shake(1)
ShorteRFuse()
end
for k=1,3 do
band_enable()
print('No of Bands: ',get_band_count())
MakeBandsIn(numBands)
set_behavior_clash_importance(pullingCI)
select_all()
--SewTheSheets()
do_global_wiggle_all(10)
print('No of Bands: ',get_band_count())
NewBandNo=get_band_count()
for r=BandNo+1,NewBandNo do
band_delete(BandNo+1)
end
band_disable()
do_unfreeze_all()
set_behavior_clash_importance(1)
do_global_wiggle_all(10)
do_shake(1)
ShorteRFuse()
end
BlueFuse()
--BBANG()
quickload(99)
restore_recent_best()
quicksave(99)
--FreezeSheets()
--FreezeHelices()
--PushMePullYou()
band_enable()
end
end
function DoDialog()
opt = dialog.CreateDialog("Sheets")
if NumberOfSheets>1 then
opt.Sheets1x2=dialog.AddCheckbox('Antiparallel Sheets1x2', AntiParallel1x2)
opt.StrSheets1x2=dialog.AddCheckbox('String Sheets1x2', StringSheets1x2)
end
if NumberOfSheets>2 then
opt.Sheets2x3=dialog.AddCheckbox('Antiparallel Sheets2x3', AntiParallel2x3)
opt.StrSheets2x3=dialog.AddCheckbox('String Sheets2x3', StringSheets2x3)
end
if NumberOfSheets>3 then
opt.Sheets3x4=dialog.AddCheckbox('Antiparallel Sheets3x4', AntiParallel3x4)
opt.StrSheets3x4=dialog.AddCheckbox('String Sheets3x4', StringSheets3x4)
end
if NumberOfSheets>4 then
opt.Sheets4x5=dialog.AddCheckbox('Antiparallel Sheets4x5', AntiParallel4x5)
opt.StrSheets4x5=dialog.AddCheckbox('String Sheets4x5', StringSheets4x5)
end
if NumberOfSheets>5 then
opt.Sheets5x6=dialog.AddCheckbox('Antiparallel Sheets5x6', AntiParallel5x6)
opt.StrSheets5x6=dialog.AddCheckbox('String Sheets5x6', StringSheets5x6)
end
if NumberOfSheets>6 then
opt.Sheets6x7=dialog.AddCheckbox('Antiparallel Sheets6x7', AntiParallel6x7)
opt.StrSheets6x7=dialog.AddCheckbox('String Sheets6x7', StringSheets6x7)
end
if NumberOfSheets>7 then
opt.Sheets7x8=dialog.AddCheckbox('Antiparallel Sheets7x8', AntiParallel7x8)
opt.StrSheets7x8=dialog.AddCheckbox('String Sheets7x8', StringSheets7x8)
end
if NumberOfSheets>8 then
opt.Sheets8x9=dialog.AddCheckbox('Antiparallel Sheets8x9', AntiParallel8x9)
opt.StrSheets8x9=dialog.AddCheckbox('String Sheets8x9', StringSheets8x9)
end
opt.CPS= dialog.AddSlider("CrossPiece Strength", CrossPieceStrength, 1, 3, 1)
opt.HMT= dialog.AddSlider("How many Times", HowMany, 1, 10, 0)
opt.RN= dialog.AddSlider("Number of Partial Rebuilds", RebuildNo, 1, 20, 0)
opt.SR= dialog.AddSlider("Number of Squeezing Rounds", SqueezingRounds, 1, 12, 0)
opt.TRAB=dialog.AddCheckbox('Total Rebuild at Begining', TotalRebuildAtBeginning)
opt.FA=dialog.AddCheckbox('Fine Adjust', false)
opt.FSFC=dialog.AddCheckbox('Freeze Structure for Compression', FreezeForCompression)
opt.UCSS=dialog.AddCheckbox('Use Current Secondary Structure', UseCurrentSecondaryStructure)
opt.HO=dialog.AddCheckbox('Helices OK?', HelicesOK)
opt.Sat=dialog.AddCheckbox('Satisfied?', Satisfied)
opt.Proceed = dialog.AddButton("It's All Good",1)
returnValue = dialog.Show( opt )
if NumberOfSheets>1 then
AntiParallel1x2=opt.Sheets1x2.value
StringSheets1x2=opt.StrSheets1x2.value
end
if NumberOfSheets>2 then
AntiParallel2x3=opt.Sheets2x3.value
StringSheets2x3=opt.StrSheets2x3.value
end
if NumberOfSheets>3 then
AntiParallel3x4=opt.Sheets3x4.value
StringSheets3x4=opt.StrSheets3x4.value
end
if NumberOfSheets>4 then
AntiParallel4x5=opt.Sheets4x5.value
StringSheets4x5=opt.StrSheets4x5.value
end
if NumberOfSheets>5 then
AntiParallel5x6=opt.Sheets5x6.value
StringSheets5x6=opt.StrSheets5x6.value
end
if NumberOfSheets>6 then
AntiParallel6x7=opt.Sheets6x7.value
StringSheets6x7=opt.StrSheets6x7.value
end
if NumberOfSheets>7 then
AntiParallel7x8=opt.Sheets7x8.value
StringSheets7x8=opt.StrSheets7x8.value
end
if NumberOfSheets>8 then
AntiParallel8x9=opt.Sheets8x9.value
StringSheets8x9=opt.StrSheets8x9.value
end
Satisfied=opt.Sat.value
SqueezingRounds=opt.SR.value
FineAdjust=opt.FA.value
CrossPieceStrength=opt.CPS.value
HowMany=opt.HMT.value
RebuildNo=opt.RN.value
UseCurrentSecondaryStructure=opt.UCSS.value
TotalRebuildAtBeginning=opt.TRAB.value
HelicesOK=opt.HO.value
FreezeForCompression=opt.FSFC.value
if FineAdjust==true then do
FineAdjustDialog()
end
else end
end
function FineAdjustDialog()
opt = dialog.CreateDialog("Fine Adjust:")
if NumberOfSheets>1 then
opt.FA1= dialog.AddSlider("Fine Adjust 1x2 Sheet 1:", FineAdjustOne, -2, 2, 0)
end
if NumberOfSheets>2 then
opt.FA2= dialog.AddSlider("Fine Adjust 2x3 Sheet 2:", FineAdjustTwo, -2, 2, 0)
end
if NumberOfSheets>3 then
opt.FA3= dialog.AddSlider("Fine Adjust 3x4 Sheet 3:", FineAdjustThree, -2, 2, 0)
end
if NumberOfSheets>4 then
opt.FA4= dialog.AddSlider("Fine Adjust 4x5 Sheet 4:", FineAdjustFour, -2, 2, 0)
end
if NumberOfSheets>5 then
opt.FA5= dialog.AddSlider("Fine Adjust 5x6 Sheet 5:", FineAdjustFive, -2, 2, 0)
end
if NumberOfSheets>6 then
opt.FA6= dialog.AddSlider("Fine Adjust 6x7 Sheet 6:", FineAdjustSix, -2, 2, 0)
end
if NumberOfSheets>7 then
opt.FA7= dialog.AddSlider("Fine Adjust 7x8 Sheet 7:", FineAdjustSeven, -2, 2, 0)
end
if NumberOfSheets>8 then
opt.FA8= dialog.AddSlider("Fine Adjust 8x9 Sheet 8:", FineAdjustEight, -2, 2, 0)
end
opt.Proceed = dialog.AddButton("Let's Go!",1)
returnValue = dialog.Show( opt )
if NumberOfSheets>1 then
FineAdjustOne=opt.FA1.value
end
if NumberOfSheets>2 then
FineAdjustTwo=opt.FA2.value
end
if NumberOfSheets>3 then
FineAdjustThree=opt.FA3.value
end
if NumberOfSheets>4 then
FineAdjustFour=opt.FA4.value
end
if NumberOfSheets>5 then
FineAdjustFive=opt.FA5.value
end
if NumberOfSheets>6 then
FineAdjustSix=opt.FA6.value
end
if NumberOfSheets>7 then
FineAdjustSeven=opt.FA7.value
end
if NumberOfSheets>8 then
FineAdjustEight=opt.FA8.value
end
end
function SewTheSheets()
recentbest.Save()
save.Quicksave(1)
print ('sewing the sheets')
-- sew sheets if near
nbsegtot=structure.GetCount()
BandNo=0
for noseg =2,nbsegtot do
for deuxseg =noseg+1,nbsegtot do
if (structure.GetDistance(noseg, deuxseg)< 8 and structure.GetSecondaryStructure(noseg)=='E' and structure.GetSecondaryStructure(deuxseg)=='E' )then do
if deuxseg-noseg>4 then do
band.AddBetweenSegments(noseg,deuxseg)
if structure.GetDistance(noseg,deuxseg)<5.5 then do
BandNo=BandNo+1
band.SetGoalLength(BandNo,ShortBandLength)
band.SetStrength(BandNo,SBLBSF)
end
else
if structure.GetDistance(noseg,deuxseg)>7 then do
BandNo=BandNo+1
band.SetGoalLength(BandNo,LongSheetLattitude)
end
else
BandNo=BandNo+1
band.SetGoalLength(BandNo,ShortSheetLattitude)
band.SetStrength(BandNo,SSLBSF)
end
end
end
else end
end
else end
end
end
end
function StringTheSheets()
BandNo=band.GetCount()
for s=1,structure.GetCount()-2 do
if structure.GetSecondaryStructure(s)=="E" then do
if s+2<structure.GetCount() then do
if structure.GetSecondaryStructure(s+2)=="E" then do
BandNo=BandNo+1
band.AddBetweenSegments(s,s+2)
band.SetGoalLength(BandNo,StringSheetLength)
band.SetStrength(BandNo,SLBSF)
end
else end
end
else end
end
else end
end
end
function LoopDLoop()
OneFourHelixLengthAtomOne={}
BandNo=band.GetCount()
for s=1,structure.GetCount()-4 do
if structure.GetSecondaryStructure(s)=="H" then do
if s+4<structure.GetCount() then do
if structure.GetSecondaryStructure(s+4)=="H" and structure.GetSecondaryStructure(s+3)=="H" and structure.GetSecondaryStructure(s+2)=="H" and structure.GetSecondaryStructure(s+1)=="H"then do
BandNo=BandNo+1
band.AddBetweenSegments(s,s+4)
band.SetGoalLength(BandNo,OneFourHelixLength)
end
else end
end
else end
end
else end
end
end
function LoopeR2()
BandNo=band.GetCount()
for s=1,structure.GetCount()-3 do
if structure.GetSecondaryStructure(s)=="H" then do
if s+4<structure.GetCount() then do
if structure.GetSecondaryStructure(s+3)=="H" and structure.GetSecondaryStructure(s+2)=="H" and structure.GetSecondaryStructure(s+1)=="H" then do
BandNo=BandNo+1
band.AddBetweenSegments(s,s+3)
band.SetGoalLength(BandNo,OneThreeHelixLength)
band.SetStrength(BandNo,OneThreeHBSF)
end
else end
end
else end
end
else end
end
end
function LoopeR3()
BandNo=band.GetCount()
for s=1,structure.GetCount()-5 do
if structure.GetSecondaryStructure(s)=="H" then do
if s+4<structure.GetCount() then do
if structure.GetSecondaryStructure(s+5)=="H" and structure.GetSecondaryStructure(s+4)=="H" and structure.GetSecondaryStructure(s+3)=="H" and structure.GetSecondaryStructure(s+2)=="H" and structure.GetSecondaryStructure(s+1)=="H" then do
BandNo=BandNo+1
band.AddBetweenSegments(s,s+5)
band.SetGoalLength(BandNo,OneFiveHelixLength)
band.SetStrength(BandNo,OneFiveHBSF)
end
else end
end
else end
end
else end
end
end
function SelectHelices()
print('Select Helices')
ui.CenterViewport()
selection.DeselectAll()
for mm=1,structure.GetCount() do
if structure.GetSecondaryStructure(mm)=='H' then do
selection.Select(mm)
if mm-1>0 and (freeze.IsFrozen(mm-1)==false) then do
selection.Select(mm-1)
if mm-2>0 and (freeze.IsFrozen(mm-2)==false) then do
selection.Select(mm-2)
if mm-3>0 and (freeze.IsFrozen(mm-3)==false) then do
selection.Select(mm-3)
end
else end
end
else end
end
else end
if mm+1<structure.GetCount() and (freeze.IsFrozen(mm+1)==false) then do
selection.Select(mm+1)
if mm+2<structure.GetCount() and (freeze.IsFrozen(mm+2)==false) then do
selection.Select(mm+2)
if mm+3<structure.GetCount() and (freeze.IsFrozen(mm+3)==false) then do
selection.Select(mm+3)
end
else end
end
else end
end
else end
end
else end
end
end
function FreezeSheets()
print('Freeze Sheets')
ui.CenterViewport()
for gg=1,structure.GetCount() do
selection.DeselectAll()
if structure.GetSecondaryStructure(gg)=='E' then do
selection.Select(gg)
freeze.FreezeSelected(true, fase)
end
else end
end
end
function SelectLoops()
print('Select Loops')
ui.CenterViewport()
selection.DeselectAll()
for mm=1,structure.GetCount() do
if structure.GetSecondaryStructure(mm)=='L' then do
selection.Select(mm)
end
else end
end
end
function RebuildSelected()
for xx=1,1 do
print('Rebuild',xx,'of',RebuildNo)
structure.RebuildSelected(1,1000)
ui.CenterViewport()
selection.SelectAll()
structure.ShakeSidechainsAll(1)
structure.WiggleAll(10)
end
end
function AD10100()
selection.SelectAll()
print('AD10100')
ui.CenterViewport()
--selection.SelectAll()
structure.WiggleAll(10)
behavior.SetClashImportance(0.1)
structure.ShakeSidechainsAll(1)
behavior.SetClashImportance(1)
structure.WiggleAll(10)
end
function BlueFuse()
print('Blue Fuse')
selection.SelectAll()
ui.CenterViewport()
behavior.SetClashImportance(.05)
structure.ShakeSidechainsSelected(1)
behavior.SetClashImportance(MaxCI)
structure.WiggleSelected(10)
behavior.SetClashImportance(.07)
structure.ShakeSidechainsSelected(1)
behavior.SetClashImportance(MaxCI)
structure.WiggleSelected(10)
--recentbest.Restore()
behavior.SetClashImportance(.3)
structure.WiggleSelected(1)
behavior.SetClashImportance(MaxCI)
structure.WiggleSelected(10)
--recentbest.Restore()
end
function AreConditionsMet()
ConditionsMet=true
BogusStructure=false
for alpo=1,structure.GetCount()-3 do
for rintintin=alpo+3,structure.GetCount() do
if structure.GetDistance(alpo,rintintin) < 2.5 then do
BogusStructure=true
end
else end
end
end
if BogusStructure==true then do
ConditionsMet=false
end
else end
return ConditionsMet
end
function MoBettahStringer()
--SewTheSheets()
StringTheSheets()
LoopDLoop()
LoopeR2()
LoopeR3()
end
------------------------------
MaxCI=1
RebuildNo=1
HowMany=3
behavior.SetClashImportance(1)
--drjr-Alien Downloaded
--[[possibly not properly acredited.]]--
ss=no --Sheet Straightener
SSBandLength=9.5
SSBandStrength=1.5
MinimumDistance=8
BandStrength=1.5
StartBandLength=7
EndBandLength=5
PushBands=get_segment_count()/3
--compressor loss rav3n_pl
minDist=10 --minimum spatial distance between banding segments
maxDist=20 --maximum spatial distance between banding segments
compressFrac=4 --make bands shorter by that much points
--was at 4
minSkip=10 --minimum segment distance between banded segments
numBands=get_segment_count()/7 --how many bands use at once
bandStr=1 --band strenght
pullingCI=0.3 --clash impotrance during pull
maxLoss=50 --maximum acceptable LOSS after BF/PF. also lowering fuzeScore
reloadBest=4 --reload best solution after that many worst ones
fuzeScore=10 --how close we have to be to run BF/PF
usePF=false --true --use PinkFuse after qStab
useBF=false --true --use BlueFuse after qStab.
--fuzes are started form SAME state, NOT one after one!
allLoop=false --work in all-loop mode. sometimes work better than structure mode :)
numTries=1 --how many copmpress loops
function BBANG()
print('Starting BBANG (Better(Better(After New Geometry)))')
recentbest.Save()
selection.SelectAll()
save.Quicksave(1) --stores original
structure.WiggleSelected(10)
save.Quickload(1)
structure.ShakeSidechainsSelected(1)
structure.WiggleSelected(10)
recentbest.Restore()
save.Quicksave(1)
behavior.SetClashImportance(0.1)
structure.ShakeSidechainsSelected(1)
behavior.SetClashImportance(MaxCI)
structure.WiggleSelected(15)
save.Quickload(1)
behavior.SetClashImportance(0.1)
structure.ShakeSidechainsSelected(1)
structure.WiggleSelected(15)
behavior.SetClashImportance(MaxCI)
structure.WiggleSelected(15)
save.Quickload(1)
behavior.SetClashImportance(0.1)
structure.ShakeSidechainsSelected(1)
structure.WiggleSelected(15)
behavior.SetClashImportance(MaxCI)
structure.ShakeSidechainsSelected(1)
structure.WiggleSelected(15)
recentbest.Restore()
print('Halfway done...')
save.Quicksave(2)
behavior.SetClashImportance(0.1)
structure.ShakeSidechainsSelected(1)
structure.WiggleSelected(15)
behavior.SetClashImportance(MaxCI)
structure.WiggleSelected(15)
save.Quickload(2)
behavior.SetClashImportance(0.1)
structure.ShakeSidechainsSelected(1)
structure.WiggleSelected(15)
behavior.SetClashImportance(MaxCI)
structure.ShakeSidechainsSelected(1)
structure.WiggleSelected(15)
recentbest.Restore()
blueRfuse()
end
function SheetStraightener()
for s=1,get_segment_count()-2 do
if get_ss(s)=="E" then do
if get_ss(s+2)=="E" then do
band_add_segment_segment(s,s+2)
end
else end
end
else end
end
NewNewBandNo=get_band_count()
for m=NewBandNo+1,NewNewBandNo do
band_set_length(m,SSBandLength)
band_set_strength(m,SSBandStrength)
end
end
function SewTheSheets() --M. Suchard
print ('sewing the sheets')
-- sew sheets if near
nbsegtot=get_segment_count()
for noseg =2,nbsegtot do
for deuxseg =noseg+1,nbsegtot do
if (get_segment_distance(noseg, deuxseg)< 8 and get_ss(noseg)=='E' and get_ss(deuxseg)=='E' )then
band_add_segment_segment(noseg,deuxseg)
end
end
end
end
-- "dirty_dozen"
-- reports 12 worst-scoring segments for manual attention
-- code by smith92clone 6/21/10
-- contribution & integration of quicksort, minor cosmetic adjustments to report format - dimension9 6/21/10
-- quicksort from rosettacode.org
-- http://rosettacode.org/wiki/Sorting_algorithms/Quicksort
-- get all the segment scores and sort them
function get_all_seg_scores(start,finish)
local i
local seg_list = {}
for i= 1,get_segment_count() do
worstScore=get_segment_score_part('clashing',i)
score_set = {}
score_set.index = i
score_set.score = worstScore
seg_list[#seg_list+1] = score_set
end
return seg_list
end
--[[function sort_rebuild_list(seg_list) -- d9; substituted quicksort
if seg_list == nil then
print("sort_rebuild_list: seg_list is nil")
abort = abort + 1 -- this will stop program
end
-- binary sort
local outer
local inner
local seg_list_count = # seg_list
for outer = 1, seg_list_count-1 do
for inner = 1, seg_list_count-outer-1 do
local a = seg_list[inner+1]
local b = seg_list[inner]
if a.score < b.score then
seg_list[inner+1] = b
seg_list[inner] = a
end
end -- end of inner loopok, two tables in
end -- end of outer loop
return seg_list
end]]
--in-place quicksort
function quicksort(t, start, endi)
start, endi = start or 1, endi or #t
if(endi - start < 2) then return t end
local pivot = start
for i = start + 1, endi do
if t[i].score <= t[pivot].score then --d9; only adaptation needed ( add ".score")
local temp = t[pivot + 1]
t[pivot + 1] = t[pivot]
if(i == pivot + 1) then
t[pivot] = temp
else
t[pivot] = t[i]
t[i] = temp
end
pivot = pivot + 1
end
end
t = quicksort(t, start, pivot - 1)
return quicksort(t, pivot + 1, endi)
end
function the_list()
segment_list = get_all_seg_scores(1,get_segment_count())
--new_segment_list = sort_rebuild_list(segment_list) --d9; substitute quicksort
new_segment_list = quicksort(segment_list, 1, #segment_list)
--for jj=1,24 do --#new_segment_list --d9; only report 12 worst at a time (fits in window + it's all that's needed)
--print(jj," - segment # ",new_segment_list[jj].index," = ",new_segment_list[jj].score) --d9; added whitespace, removed brackets
--end
end
function blueRfuse()
set_behavior_clash_importance(0.2)
do_shake(1)
do_global_wiggle_all(10)
set_behavior_clash_importance(1)
do_shake(1)
do_global_wiggle_all(10)
set_behavior_clash_importance(0.05)
do_shake(1)
set_behavior_clash_importance(1)
do_global_wiggle_all(10)
set_behavior_clash_importance(0.07)
do_shake(1)
set_behavior_clash_importance(1)
do_global_wiggle_all(10)
set_behavior_clash_importance(0.3)
do_global_wiggle_all(15)
set_behavior_clash_importance(1)
do_global_wiggle_all(10)
end
function ShortFuse()
set_behavior_clash_importance(0.2)
do_shake(1)
do_global_wiggle_all(10)
set_behavior_clash_importance(1)
do_shake(1)
do_global_wiggle_all(10)
set_behavior_clash_importance(0.05)
do_shake(1)
set_behavior_clash_importance(1)
do_global_wiggle_all(10)
end
function ShorteRFuse()
set_behavior_clash_importance(0.2)
do_shake(1)
do_global_wiggle_all(10)
set_behavior_clash_importance(1)
do_shake(1)
do_global_wiggle_all(10)
end
function FreezeHelices()
for y=1,get_segment_count() do
deselect_all()
if get_ss(y)=="H" then do
select_index(y)
do_freeze(true,true)
end
else end
end
end
function FreezeSheets()
for x=1,get_segment_count() do
deselect_all()
if get_ss(x)=="E" then do
select_index(x)
do_freeze(true,true)
end
else end
end
end
function PushMePullYou()
reset_recent_best()
set_behavior_clash_importance(1)
BandLength=StartBandLength
the_list()
do_unfreeze_all()
band_disable()
--SheetStraightener()
for jj=1,PushBands do
for i=1,get_segment_count() do
if new_segment_list[jj].index-i>5 then do
if get_segment_distance(i,new_segment_list[jj].index) <= MinimumDistance then do
band_add_segment_segment(i,new_segment_list[jj].index)
end
else end
end
else end
end
end
NewBandNo=get_band_count()
for k=BandNo+1,NewBandNo do
band_set_strength(k,BandStrength)
band_set_length(k,BandLength)
end
--if ss==yes then do
--SheetStraightener()
--end
--else end
--SewTheSheets()
print('Total No of Bands: ',get_band_count())
select_all()
set_behavior_clash_importance(pullingCI)
do_global_wiggle_all(3)
set_behavior_clash_importance(1)
--band_set_strength(0.3)
--do_global_wiggle_all(10)
NewBandNo=get_band_count()
for r=BandNo+1,NewBandNo do
band_delete(BandNo+1)
end
--band_delete()
band_disable()
quicksave(99)
do_global_wiggle_all(10)
quicksave(100)
Score100=get_score()
quickload(99)
do_shake(1)
do_global_wiggle_all(10)
if Score100>get_score() then do
quickload(100)
end
else end
band_disable()
--do_shake(1)
--do_global_wiggle_all(10)
ShortFuse()
--ShorteRFuse()
--blueRfuse()
band_enable()
end
--[[
Compressor v1
trying to compress protein
]]--
--[[
Tlaloc`s math library
------------------------------------------------------------------------
The original random script this was ported from has the following notices:
Copyright (c) 2007 Richard L. Mueller
Hilltop Lab web site - http://www.rlmueller.net
Version 1.0 - January 2, 2007
You have a royalty-free right to use, modify, reproduce, and
distribute this script file in any way you find useful, provided that
you agree that the copyright owner above has no warranty, obligations,
or liability for such use.
------------------------------------------------------------------------
]]--
local lngX = 1000
local lngC = 48313
local function _MWC()
local S_Hi
local S_Lo
local C_Hi
local C_Lo
local F1
local F2
local F3
local T1
local T2
local T3
local A_Hi = 63551
local A_Lo = 25354
local M = 4294967296
local H = 65536
local S_Hi = math.floor(lngX / H)
local S_Lo = lngX - (S_Hi * H)
local C_Hi = math.floor(lngC / H)
local C_Lo = lngC - (C_Hi * H)
local F1 = A_Hi * S_Hi
local F2 = (A_Hi * S_Lo) + (A_Lo * S_Hi) + C_Hi
local F3 = (A_Lo * S_Lo) + C_Lo
local T1 = math.floor(F2 / H)
local T2 = F2 - (T1 * H)
lngX = (T2 * H) + F3
local T3 = math.floor(lngX / M)
lngX = lngX - (T3 * M)
lngC = math.floor((F2 / H) + F1)
return lngX
end
local function _abs(value)
if value < 0 then
value = -value
end
return value
end
local function _floor(value)
return value - (value % 1)
end
local function _randomseed(x)
lngX = x
end
local function _random(m,n)
if n == nil and m ~= nil then
n = m
m = 1
end
if (m == nil) and (n == nil) then
return _MWC() / 4294967296
else
if n < m then
return nil
end
return math.floor((_MWC() / 4294967296) * (n - m + 1)) + m
end
end
math=
{
abs = _abs,
floor = _floor,
random = _random,
randomseed = _randomseed,
}
--[[ End math library ]]--
function Score()
return get_score(true)
end
function seed()
local s=math.abs(Score())
s=s%0.001
s=1/s
while s<10000000 do s=s*10 end
s=s-s%1
math.randomseed(s)
end
seed()
segCnt=get_segment_count()
p=print
function round3(x)--cut all afer 3-rd place
return x-x%0.001
end
function down(x)
return x-x%1
end
function Wiggle(how, iters, minppi)
if how==nil then how="wa" end
if iters==nil then iters=6 end
if minppi==nil then minppi=0.001 end
if iters>0 then
iters=iters-1
sp=Score()
if how == "s" then do_shake(1)
elseif how == "wb" then do_global_wiggle_backbone(1)
elseif how == "ws" then do_global_wiggle_sidechains(1)
elseif how == "wa" then do_global_wiggle_all(1)
end
ep = Score()
ig=ep-sp
if how~="s" then
if ig > minppi then Wiggle(how, iters, minppi) end
end
end
end
function AllLoop() --turning entire structure to loops
local ok=false
for i=1, segCnt do
local s=get_ss(i)
if s~="L" then
save_structure()
ok=true
break
end
end
if ok then
select_all()
--replace_ss("L")
end
end
function BlueFuse()
p("BlueFuse...")
reset_recent_best()
select_all()
set_behavior_clash_importance(0.05)
do_shake(1)
set_behavior_clash_importance(1)
Wiggle()
set_behavior_clash_importance(0.07)
do_shake(1)
set_behavior_clash_importance(1)
Wiggle()
--restore_recent_best()
set_behavior_clash_importance(0.3)
do_global_wiggle_all(1)
set_behavior_clash_importance(1)
Wiggle()
--restore_recent_best()
SaveBest()
quicksave(6)
end
bestScore=Score()
function SaveBest()
local g=Score()-bestScore
if g>0 then
p("Gained another ",round3(g)," pts.")
bestScore=Score()
quicksave(3)
end
end
function FuseEnd()
set_behavior_clash_importance(1)
Wiggle()
Wiggle("s",1)
Wiggle()
SaveBest()
end
function Fuze1(ci1,ci2)
set_behavior_clash_importance(ci1)
Wiggle("s",1)
set_behavior_clash_importance(ci2)
Wiggle("wa",1)
FuseEnd()
end
function Fuze2(ci1,ci2)
set_behavior_clash_importance(ci1)
Wiggle("wa",1)
set_behavior_clash_importance(1)
Wiggle()
set_behavior_clash_importance(ci2)
Wiggle("wa",1)
FuseEnd()
end
function PinkFuse()
reset_recent_best()
p("PinkFuse...")
quicksave(4) -- store state before fuse
Fuze1(0.1,0.7)
quickload(4) -- load state before fuse
Fuze1(0.3,0.6)
quickload(4) -- load state before fuse
Fuze2(0.5,0.7)
quickload(4) -- load state before fuse
Fuze2(0.7,0.5)
restore_recent_best()
quicksave(5)
end
function qStab()
p("qStab...")
select_all()
set_behavior_clash_importance(0.1)
Wiggle("s",1)
set_behavior_clash_importance(1)
Wiggle("ws",1)
Wiggle()
Wiggle("s",1)
Wiggle()
SaveBest()
end
function MakeBandsOut(num)
local done=false
local s1=math.random(segCnt)
local s2=math.random(segCnt)
local blip1=math.random(segCnt)
local blip2=math.random(segCnt)
blip=(blip1-blip2)/segCnt
if s1>s2 then s1,s2=s2,s1 end
local d=get_segment_distance(s1,s2)
if s2-s1>=minSkip and d>=minDist and d<=maxDist then done=true end
if done then
num=num-1
band_add_segment_segment(s1,s2)
k=get_band_count()
band_set_length(k,d+1.44+blip)
--print('blip1= ',blip1)
--print('blip2= ',blip2)
--print('blip= ',blip)
--print(s1)
--print(s2)
--print(segCnt)
band_set_strength(k,bandStr)
end
if num>0 then MakeBandsOut(num) end
end
function MakeBandsIn(num)
local done=false
local s1=math.random(segCnt)
local s2=math.random(segCnt)
local blip1=math.random(segCnt)
local blip2=math.random(segCnt)
blip=(blip1-blip2)/segCnt
if s1>s2 then s1,s2=s2,s1 end
local d=get_segment_distance(s1,s2)
if s2-s1>=minSkip and d>=minDist and d<=maxDist then done=true end
if done then
num=num-1
band_add_segment_segment(s1,s2)
k=get_band_count()
band_set_length(k,d-1.76+blip)
--print('blip1= ',blip1)
--print('blip2= ',blip2)
--print('blip= ',blip)
--print(s1)
--print(s2)
--print(segCnt)
band_set_strength(k,bandStr)
end
if num>0 then MakeBandsIn(num) end
end
function Compressor()
p("Starting Compressor, ",numTries," loops.")
quicksave(3)
badOnes=0
reset_recent_best()
if allLoop then AllLoop() end
local sscore=Score()
for i=1,numTries do
local ls=Score()
p("Compress loop ",i," of ",numTries," started. Current score: ",round3(ls))
BBScore=0
for f=1,get_segment_count() do
BBScore=BBScore+get_segment_score_part('backbone',f)
end
print('Total Backbone Score= ',BBScore)
reset_recent_best()
quicksave(99)
for j=1,1 do
print('Round ',j)
band_enable()
--print('No of Bands: ',get_band_count())
MakeBandsOut(numBands)
set_behavior_clash_importance(pullingCI)
select_all()
--SewTheSheets()
do_global_wiggle_all(10)
--print('No of Bands: ',get_band_count())
NewBandNo=get_band_count()
for r=BandNo+1,NewBandNo do
band_delete(BandNo+1)
end
band_disable()
do_unfreeze_all()
set_behavior_clash_importance(1)
do_global_wiggle_all(10)
do_shake(1)
--ShorteRFuse()
band_enable()
print('No of Bands: ',get_band_count())
MakeBandsIn(numBands)
set_behavior_clash_importance(pullingCI)
select_all()
--SewTheSheets()
do_global_wiggle_all(10)
print('No of Bands: ',get_band_count())
NewBandNo=get_band_count()
for r=BandNo+1,NewBandNo do
band_delete(BandNo+1)
end
band_disable()
do_unfreeze_all()
set_behavior_clash_importance(1)
do_global_wiggle_all(10)
do_shake(1)
ShorteRFuse()
end
BlueFuse()
--BBANG()
quickload(99)
restore_recent_best()
quicksave(99)
--FreezeSheets()
--FreezeHelices()
--PushMePullYou()
band_enable()
end
end
function SelectHelices()
print('Select Helices')
ui.CenterViewport()
selection.DeselectAll()
for mm=1,structure.GetCount() do
if structure.GetSecondaryStructure(mm)=='H' then do
selection.Select(mm)
if mm-1>0 and (freeze.IsFrozen(mm-1)==false) then do
selection.Select(mm-1)
if mm-2>0 and (freeze.IsFrozen(mm-2)==false) then do
selection.Select(mm-2)
if mm-3>0 and (freeze.IsFrozen(mm-3)==false) then do
selection.Select(mm-3)
end
else end
end
else end
end
else end
if mm+1<structure.GetCount() and (freeze.IsFrozen(mm+1)==false) then do
selection.Select(mm+1)
if mm+2<structure.GetCount() and (freeze.IsFrozen(mm+2)==false) then do
selection.Select(mm+2)
if mm+3<structure.GetCount() and (freeze.IsFrozen(mm+3)==false) then do
selection.Select(mm+3)
end
else end
end
else end
end
else end
end
else end
end
end
function FreezeSheets()
print('Freeze Sheets')
ui.CenterViewport()
for gg=1,structure.GetCount() do
selection.DeselectAll()
if structure.GetSecondaryStructure(gg)=='E' then do
selection.Select(gg)
freeze.FreezeSelected(true, false)
end
else end
end
end
function FreezeHelices()
print('Freeze Helices')
ui.CenterViewport()
for gg=1,structure.GetCount() do
selection.DeselectAll()
if structure.GetSecondaryStructure(gg)=='H' then do
selection.Select(gg)
freeze.FreezeSelected(true, false)
end
else end
end
end
function FreezeLoops()
print('Freeze Loops')
ui.CenterViewport()
for gg=1,structure.GetCount() do
selection.DeselectAll()
if structure.GetSecondaryStructure(gg)=='L' then do
selection.Select(gg)
freeze.FreezeSelected(true, false)
end
else end
end
end
function SelectLoops()
print('Select Loops')
ui.CenterViewport()
--selection.DeselectAll()
for mm=1,structure.GetCount() do
if structure.GetSecondaryStructure(mm)=='L' then do
selection.Select(mm)
end
else end
end
end
function SelectSheets()
print('Select Sheets')
ui.CenterViewport()
selection.DeselectAll()
for mm=1,structure.GetCount() do
if structure.GetSecondaryStructure(mm)=='E' then do
selection.Select(mm)
end
else end
end
end
function RebuildSelected()
for xx=1,1 do
--print('Rebuild',xx,'of',RebuildNo)
structure.RebuildSelected(1,1000)
ui.CenterViewport()
ShakeNWiggle()
end
end
function ShakeNWiggle()
selection.SelectAll()
ui.CenterViewport()
--selection.SelectAll()
behavior.SetClashImportance(1)
structure.ShakeSidechainsAll(1)
structure.WiggleAll(10)
end
function AD10100()
selection.SelectAll()
print('AD10100')
ui.CenterViewport()
--selection.SelectAll()
behavior.SetClashImportance(1)
structure.WiggleAll(10)
behavior.SetClashImportance(0.1)
structure.ShakeSidechainsAll(1)
--structure.MutateSidechainsAll(1)
behavior.SetClashImportance(1)
structure.WiggleAll(10)
end
function BlueFuse()
print('Blue Fuse')
selection.SelectAll()
ui.CenterViewport()
behavior.SetClashImportance(.05)
structure.ShakeSidechainsSelected(1)
behavior.SetClashImportance(MaxCI)
structure.WiggleSelected(10)
behavior.SetClashImportance(.07)
structure.ShakeSidechainsSelected(1)
behavior.SetClashImportance(MaxCI)
structure.WiggleSelected(10)
--recentbest.Restore()
behavior.SetClashImportance(.3)
structure.WiggleSelected(1)
behavior.SetClashImportance(MaxCI)
structure.WiggleSelected(10)
--recentbest.Restore()
end
function AreConditionsMet()
ConditionsMet=true
BogusStructure=false
for alpo=1,structure.GetCount()-3 do
for rintintin=alpo+3,structure.GetCount() do
if structure.GetDistance(alpo,rintintin) < 3.14 then do
BogusStructure=true
end
else end
end
end
if BogusStructure==true then do
ConditionsMet=false
end
else end
return ConditionsMet
end
function TallySheets()
NumberOfSheets=0
ReducedList={}
for x = 1,structure.GetCount() do
if structure.GetSecondaryStructure(x) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
ReducedList[x]= 'E'
end
else
if structure.GetSecondaryStructure(x) == 'H' then do
ReducedList[x]= 'H'
end
else
if structure.GetSecondaryStructure(x) == 'H' then do
ReducedList[x]= 'L'
end
else end
end
end
end
--[[
for v = 1,structure.GetCount() do
print(ReducedList[v])
end
a=0
for PareIt = 1,structure.GetCount() do
if ReducedList[PareIt] ~= (nil or 'H') then do
a=a+1
Sheet1[a]= ReducedList[PareIt]
end
else end
end
print('.................')
for count=1,a do
print(Sheet1[count])
end]]--
SheetOneStarted=false
SheetTwoStarted=false
SheetThreeStarted=false
SheetFourStarted=false
SheetFiveStarted=false
SheetSixStarted=false
SheetSevenStarted=false
SheetEightStarted=false
SheetNineStarted=false
--[[EndSheetTwo=1
EndSheetThree=1
EndSheetFour=1
EndSheetFive=1
EndSheetSix=1
EndSheetSeven=1
EndSheetEight=1]]--
for s=1,structure.GetCount()-1 do
if structure.GetSecondaryStructure(s) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
if SheetOneStarted==false then do
SheetOneStarted=true
StartSheetOne=s
structure.SetNote(s, "Sheet 1")
end
else end
if structure.GetSecondaryStructure(s+1) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
end
else
EndSheetOne=s
structure.SetNote(s, "Sheet 1")
NumberOfSheets=NumberOfSheets+1
LengthSheetOne=EndSheetOne-StartSheetOne+1
break
end
end
else end
end
for s=EndSheetOne+1,structure.GetCount()-1 do
if structure.GetSecondaryStructure(s) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
if SheetTwoStarted==false then do
SheetTwoStarted=true
StartSheetTwo=s
structure.SetNote(s, "Sheet 2")
end
else end
if structure.GetSecondaryStructure(s+1) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
end
else
EndSheetTwo=s
structure.SetNote(s, "Sheet 2")
NumberOfSheets=NumberOfSheets+1
LengthSheetTwo=EndSheetTwo-StartSheetTwo+1
break
end
end
else end
end
if EndSheetTwo ~= nil then do
for s=EndSheetTwo+1,structure.GetCount()-1 do
if structure.GetSecondaryStructure(s) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
if SheetThreeStarted==false then do
SheetThreeStarted=true
StartSheetThree=s
structure.SetNote(s, "Sheet 3")
end
else end
if structure.GetSecondaryStructure(s+1) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
end
else
EndSheetThree=s
structure.SetNote(s, "Sheet 3")
NumberOfSheets=NumberOfSheets+1
LengthSheetThree=EndSheetThree-StartSheetThree+1
break
end
end
else end
end
end
else end
if EndSheetThree ~= nil then do
for s=EndSheetThree+1,structure.GetCount()-1 do
if structure.GetSecondaryStructure(s) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
if SheetFourStarted==false then do
SheetFourStarted=true
StartSheetFour=s
structure.SetNote(s, "Sheet 4")
end
else end
if structure.GetSecondaryStructure(s+1) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
end
else
EndSheetFour=s
structure.SetNote(s, "Sheet 4")
NumberOfSheets=NumberOfSheets+1
LengthSheetFour=EndSheetFour-StartSheetFour+1
break
end
end
else end
end
end
else end
if EndSheetFour ~= nil then do
for s=EndSheetFour+1,structure.GetCount()-1 do
if structure.GetSecondaryStructure(s) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
if SheetFiveStarted==false then do
SheetFiveStarted=true
StartSheetFive=s
structure.SetNote(s, "Sheet 5")
end
else end
if structure.GetSecondaryStructure(s+1) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
end
else
EndSheetFive=s
structure.SetNote(s, "Sheet 5")
NumberOfSheets=NumberOfSheets+1
LengthSheetFive=EndSheetFive-StartSheetFive+1
break
end
end
else end
end
end
else end
if EndSheetFive ~= nil then do
for s=EndSheetFive+1,structure.GetCount()-1 do
if structure.GetSecondaryStructure(s) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
if SheetSixStarted==false then do
SheetSixStarted=true
StartSheetSix=s
structure.SetNote(s, "Sheet 6")
end
else end
if structure.GetSecondaryStructure(s+1) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
end
else
EndSheetSix=s
structure.SetNote(s, "Sheet 6")
NumberOfSheets=NumberOfSheets+1
LengthSheetSix=EndSheetSix-StartSheetSix+1
break
end
end
else end
end
end
else end
if EndSheetSix ~= nil then do
for s=EndSheetSix+1,structure.GetCount()-1 do
if structure.GetSecondaryStructure(s) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
if SheetSevenStarted==false then do
SheetSevenStarted=true
StartSheetSeven=s
structure.SetNote(s, "Sheet 7")
end
else end
if structure.GetSecondaryStructure(s+1) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
end
else
EndSheetSeven=s
structure.SetNote(s, "Sheet 7")
NumberOfSheets=NumberOfSheets+1
LengthSheetSeven=EndSheetSeven-StartSheetSeven+1
break
end
end
else end
end
end
else end
if EndSheetSeven ~= nil then do
for s=EndSheetSeven+1,structure.GetCount()-1 do
if structure.GetSecondaryStructure(s) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
if SheetEightStarted==false then do
SheetEightStarted=true
StartSheetEight=s
structure.SetNote(s, "Sheet 8")
end
else end
if structure.GetSecondaryStructure(s+1) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
end
else
EndSheetEight=s
structure.SetNote(s, "Sheet 8")
NumberOfSheets=NumberOfSheets+1
LengthSheetEight=EndSheetEight-StartSheetEight+1
break
end
end
else end
end
end
else end
if EndSheetEight ~= nil then do
for s=EndSheetEight+1,structure.GetCount()-1 do
if structure.GetSecondaryStructure(s) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
if SheetNineStarted==false then do
SheetNineStarted=true
StartSheetNine=s
structure.SetNote(s, "Sheet 9")
end
else end
if structure.GetSecondaryStructure(s+1) == 'E' then do
--ReducedList[x]= structure.IsHydrophobic(x)
end
else
EndSheetNine=s
structure.SetNote(s, "Sheet 9")
NumberOfSheets=NumberOfSheets+1
LengthSheetNine=EndSheetNine-StartSheetNine+1
break
end
end
else end
end
end
else end
if NumberOfSheets > 0 then
print('Sheet One:',StartSheetOne,'-',EndSheetOne)
end
if NumberOfSheets > 1 then
print('Sheet Two:',StartSheetTwo,'-',EndSheetTwo)
end
if NumberOfSheets > 2 then
print('Sheet Three:',StartSheetThree,'-',EndSheetThree)
end
if NumberOfSheets > 3 then
print('Sheet Four:',StartSheetFour,'-',EndSheetFour)
end
if NumberOfSheets > 4 then
print('Sheet Five:',StartSheetFive,'-',EndSheetFive)
end
if NumberOfSheets > 5 then
print('Sheet Six:',StartSheetSix,'-',EndSheetSix)
end
if NumberOfSheets > 6 then
print('Sheet Seven:',StartSheetSeven,'-',EndSheetSeven)
end
if NumberOfSheets > 7 then
print('Sheet Eight:',StartSheetEight,'-',EndSheetEight)
end
if NumberOfSheets > 8 then
print('Sheet Nine:',StartSheetNine,'-',EndSheetNine)
end
print('Number of Sheets=',NumberOfSheets)
return NumberOfSheets,LengthSheetOne,LengthSheetTwo,LengthSheetThree,LengthSheetFour,LengthSheetFive,LengthSheetSix,LengthSheetSeven,LengthSheetEight
end
function StringSheetsParallelVsAntiParallel(HandDrawnBandNo,NumberOfSheets,LengthSheetOne,LengthSheetTwo,LengthSheetThree,LengthSheetFour,LengthSheetFive,LengthSheetSix,LengthSheetSeven,LengthSheetEight)
if NumberOfSheets>1 then do
if FinalAnswer==true then do
end
else
for check=EndSheetOne,StartSheetTwo do
if (structure.GetSecondaryStructure(check) == 'H') and (StartSheetTwo-EndSheetOne > 7) then do
AntiParallel1x2=false
end
else end
end
end
if LengthSheetOne>LengthSheetTwo then limit=LengthSheetTwo
end
if LengthSheetOne<LengthSheetTwo then limit=LengthSheetOne
end
if LengthSheetOne==LengthSheetTwo then limit=LengthSheetOne
end
if AntiParallel1x2==true then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets1x2==true then do
for count=1,limit do
band.AddBetweenSegments(EndSheetOne-count+1+FineAdjustOne,StartSheetTwo+count)
if structure.GetAminoAcid(EndSheetOne-count+1+FineAdjustOne) ~= "G" then
if structure.GetAminoAcid(StartSheetTwo+count) ~= "G" then
--band.AddBetweenSegments(EndSheetOne-count+1+FineAdjustOne,StartSheetTwo+count,4,4)
end
end
end
if PrintOutSheetInfo== true then print('Sheet1 vs Sheet2: Antiparallel') end
end
else end
end
else end
if AntiParallel1x2 == false then do
--fill in the blanks
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets1x2==true then do
for count=1,limit do
band.AddBetweenSegments(StartSheetOne+count-1+FineAdjustOne,StartSheetTwo+count)
if structure.GetAminoAcid(StartSheetOne+count-1+FineAdjustOne) ~= "G" then
if structure.GetAminoAcid(StartSheetTwo+count) ~= "G" then
--band.AddBetweenSegments(StartSheetOne+count-1+FineAdjustOne,StartSheetTwo+count,4,4)
end
end
end
if PrintOutSheetInfo== true then print('Sheet1 vs Sheet2: Parallel') end
end
else end
end
else end
end
else end
if NumberOfSheets>2 then do
if FinalAnswer==true then do
end
else
for check=EndSheetTwo,StartSheetThree do
if (structure.GetSecondaryStructure(check) == 'H') and (StartSheetThree-EndSheetTwo > 7) then do
AntiParallel2x3=false
end
else end
end
end
if LengthSheetTwo>LengthSheetThree then limit=LengthSheetThree
end
if LengthSheetTwo<LengthSheetThree then limit=LengthSheetTwo
end
if LengthSheetTwo==LengthSheetThree then limit=LengthSheetTwo
end
if AntiParallel2x3== true then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets2x3==true then do
for count=1,limit do
band.AddBetweenSegments(EndSheetTwo-count+1+FineAdjustTwo,StartSheetThree+count)
if structure.GetAminoAcid(EndSheetTwo-count+1+FineAdjustTwo) ~= "G" then
if structure.GetAminoAcid(StartSheetThree+count) ~= "G" then
--band.AddBetweenSegments(EndSheetTwo-count+1+FineAdjustTwo,StartSheetThree+count,4,4)
end
end
end
if PrintOutSheetInfo== true then print('Sheet2 vs Sheet3: Antiparallel') end
end
else end
end
else end
if AntiParallel2x3 == false then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets2x3==true then do
for count=1,limit do
band.AddBetweenSegments(StartSheetTwo+count-1+FineAdjustTwo,StartSheetThree+count)
if structure.GetAminoAcid(StartSheetTwo+count-1+FineAdjustTwo) ~= "G" then
if structure.GetAminoAcid(StartSheetThree+count) ~= "G" then
--band.AddBetweenSegments(StartSheetTwo+count-1+FineAdjustTwo,StartSheetThree+count,4,4)
end
end
end
if PrintOutSheetInfo== true then print('Sheet2 vs Sheet3: Parallel') end
end
else end
end
else end
end
else end
if NumberOfSheets>3 then do
if FinalAnswer==true then do
end
else
for check=EndSheetThree,StartSheetFour do
if (structure.GetSecondaryStructure(check) == 'H') and (StartSheetFour-EndSheetThree > 7) then do
AntiParallel3x4=false
end
else end
end
end
if LengthSheetThree>LengthSheetFour then limit=LengthSheetFour
end
if LengthSheetThree<LengthSheetFour then limit=LengthSheetThree
end
if LengthSheetThree==LengthSheetFour then limit=LengthSheetThree
end
if AntiParallel3x4==true then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets3x4==true then do
for count=1,limit do
band.AddBetweenSegments(EndSheetThree-count+1+FineAdjustThree,StartSheetFour+count)
if structure.GetAminoAcid(EndSheetThree-count+1+FineAdjustThree) ~= "G" then
if structure.GetAminoAcid(StartSheetFour+count) ~= "G" then
--band.AddBetweenSegments(EndSheetThree-count+1+FineAdjustThree,StartSheetFour+count,4,4)
end
end
end
if PrintOutSheetInfo== true then print('Sheet3 vs Sheet4: Antiparallel') end
end
else end
end
else end
if AntiParallel3x4==false then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets3x4==true then do
for count=1,limit do
band.AddBetweenSegments(StartSheetThree+count-1+FineAdjustThree,StartSheetFour+count)
if structure.GetAminoAcid(StartSheetThree+count-1+FineAdjustThree) ~= "G" then
if structure.GetAminoAcid(StartSheetFour+count) ~= "G" then
--band.AddBetweenSegments(StartSheetThree+count-1+FineAdjustThree,StartSheetFour+count,4,4)
end
end
end
if PrintOutSheetInfo== true then print('Sheet3 vs Sheet4: Parallel') end
end
else end
end
else end
end
else end
if NumberOfSheets>4 then do
if FinalAnswer==true then do
end
else
for check=EndSheetFour,StartSheetFive do
if (structure.GetSecondaryStructure(check) == 'H') and (StartSheetFive-EndSheetFour > 7) then do
AntiParallel4x5=false
end
else end
end
end
if LengthSheetFour>LengthSheetFive then limit=LengthSheetFive
end
if LengthSheetFour<LengthSheetFive then limit=LengthSheetFour
end
if LengthSheetFour==LengthSheetFive then limit=LengthSheetFour
end
if AntiParallel4x5==true then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets4x5==true then do
for count=1,limit do
band.AddBetweenSegments(EndSheetFour-count+1+FineAdjustFour,StartSheetFive+count)
if structure.GetAminoAcid(EndSheetFour-count+1+FineAdjustFour) ~= "G" then
if structure.GetAminoAcid(StartSheetFive+count) ~= "G" then
--band.AddBetweenSegments(EndSheetFour-count+1+FineAdjustFour,StartSheetFive+count,4,4)
end
end
end
if PrintOutSheetInfo== true then print('Sheet4 vs Sheet5: Antiparallel') end
end
else end
end
else end
if AntiParallel4x5== false then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets4x5==true then do
for count=1,limit do
band.AddBetweenSegments(StartSheetFour+count-1+FineAdjustFour,StartSheetFive+count)
if structure.GetAminoAcid(StartSheetFour+count-1+FineAdjustFour) ~= "G" then
if structure.GetAminoAcid(StartSheetFive+count) ~= "G" then
--band.AddBetweenSegments(StartSheetFour+count-1+FineAdjustFour,StartSheetFive+count,4,4)
end
end
end
if PrintOutSheetInfo== true then print('Sheet4 vs Sheet5: Parallel') end
end
else end
end
else end
end
else end
if NumberOfSheets>5 then do
if FinalAnswer==true then do
end
else
for check=EndSheetFive,StartSheetSix do
if (structure.GetSecondaryStructure(check) == 'H') and (StartSheetSix-EndSheetFive > 7) then do
AntiParallel4x5=false
end
else end
end
end
if LengthSheetFive>LengthSheetSix then limit=LengthSheetSix
end
if LengthSheetFive<LengthSheetSix then limit=LengthSheetFive
end
if LengthSheetFive==LengthSheetSix then limit=LengthSheetFive
end
if AntiParallel5x6==true then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets5x6==true then do
for count=1,limit do
band.AddBetweenSegments(EndSheetFive-count+1+FineAdjustFive,StartSheetSix+count)
if structure.GetAminoAcid(EndSheetFive-count+1+FineAdjustFive) ~= "G" then
if structure.GetAminoAcid(StartSheetSix+count) ~= "G" then
--band.AddBetweenSegments(EndSheetFive-count+1+FineAdjustFive,StartSheetSix+count,4,4)
end
end
end
if PrintOutSheetInfo== true then print('Sheet5 vs Sheet6: Antiparallel') end
end
else end
end
else end
if AntiParallel5x6== false then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets5x6==true then do
for count=1,limit do
band.AddBetweenSegments(StartSheetFive+count-1+FineAdjustFive,StartSheetSix+count)
if structure.GetAminoAcid(StartSheetFive+count-1+FineAdjustFive) ~= "G" then
if structure.GetAminoAcid(StartSheetSix+count) ~= "G" then
--band.AddBetweenSegments(StartSheetFive+count-1+FineAdjustFive,StartSheetSix+count,4,4)
end
end
end
if PrintOutSheetInfo== true then print('Sheet5 vs Sheet6: Parallel') end
end
else end
end
else end
end
else end
if NumberOfSheets>6 then do
if FinalAnswer==true then do
end
else
for check=EndSheetSix,StartSheetSeven do
if (structure.GetSecondaryStructure(check) == 'H') and (StartSheetSeven-EndSheetSix > 7) then do
AntiParallel6x7=false
end
else end
end
end
if LengthSheetSix>LengthSheetSeven then limit=LengthSheetSeven
end
if LengthSheetSix<LengthSheetSeven then limit=LengthSheetSix
end
if LengthSheetSix==LengthSheetSeven then limit=LengthSheetSix
end
if AntiParallel6x7==true then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets6x7==true then do
for count=1,limit do
band.AddBetweenSegments(EndSheetSix-count+1+FineAdjustSix,StartSheetSeven+count)
if structure.GetAminoAcid(EndSheetSix-count+1+FineAdjustSix) ~= "G" then
if structure.GetAminoAcid(StartSheetSeven+count) ~= "G" then
--band.AddBetweenSegments(EndSheetSix-count+1+FineAdjustSix,StartSheetSeven+count,4,4)
end
end
end
if PrintOutSheetInfo== true then print('Sheet6 vs Sheet7: Antiparallel') end
end
else end
end
else end
if AntiParallel6x7== false then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets6x7==true then do
for count=1,limit do
band.AddBetweenSegments(StartSheetSix+count-1+FineAdjustSix,StartSheetSeven+count)
if structure.GetAminoAcid(StartSheetSix+count-1+FineAdjustSix) ~= "G" then
if structure.GetAminoAcid(StartSheetSeven+count) ~= "G" then
--band.AddBetweenSegments(StartSheetSix+count-1+FineAdjustSix,StartSheetSeven+count,4,4)
end
end
end
if PrintOutSheetInfo== true then print('Sheet6 vs Sheet7: Parallel') end
end
else end
end
else end
end
else end
if NumberOfSheets>7 then do
if FinalAnswer==true then do
end
else
for check=EndSheetSeven,StartSheetEight do
if (structure.GetSecondaryStructure(check) == 'H') and (StartSheetEight-EndSheetSeven > 7) then do
AntiParallel7x8=false
end
else end
end
end
if LengthSheetSeven>LengthSheetEight then limit=LengthSheetEight
end
if LengthSheetSeven<LengthSheetEight then limit=LengthSheetSeven
end
if LengthSheetSeven==LengthSheetEight then limit=LengthSheetSeven
end
if AntiParallel7x8==true then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets7x8==true then do
for count=1,limit do
band.AddBetweenSegments(EndSheetSeven-count+1+FineAdjustSeven,StartSheetEight+count)
if structure.GetAminoAcid(EndSheetSeven-count+1+FineAdjustSeven) ~= "G" then
if structure.GetAminoAcid(StartSheetEight+count) ~= "G" then
--band.AddBetweenSegments(EndSheetSeven-count+1+FineAdjustSeven,StartSheetEight+count,4,4)
end
end
end
if PrintOutSheetInfo== true then print('Sheet7 vs Sheet8: Antiparallel') end
end
else end
end
else end
if AntiParallel7x8== false then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets7x8==true then do
for count=1,limit do
band.AddBetweenSegments(StartSheetSeven+count-1+FineAdjustSeven,StartSheetEight+count)
if structure.GetAminoAcid(StartSheetSeven+count-1+FineAdjustSeven) ~= "G" then
if structure.GetAminoAcid(StartSheetEight+count) ~= "G" then
--band.AddBetweenSegments(StartSheetSeven+count-1+FineAdjustSeven,StartSheetEight+count,4,4)
end
end
end
if PrintOutSheetInfo== true then print('Sheet7 vs Sheet8: Parallel') end
end
else end
end
else end
end
else end
if NumberOfSheets>8 then do
if FinalAnswer==true then do
end
else
for check=EndSheetEight,StartSheetNine do
if (structure.GetSecondaryStructure(check) == 'H') and (StartSheetNine-EndSheetEight > 7) then do
AntiParallel8x9=false
end
else end
end
end
if LengthSheetEight>LengthSheetNine then limit=LengthSheetNine
end
if LengthSheetEight<LengthSheetNine then limit=LengthSheetEight
end
if LengthSheetEight==LengthSheetNine then limit=LengthSheetEight
end
if AntiParallel8x9==true then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets8x9==true then do
for count=1,limit do
band.AddBetweenSegments(EndSheetEight-count+1+FineAdjustEight,StartSheetNine+count)
if structure.GetAminoAcid(EndSheetEight-count+1+FineAdjustEight) ~= "G" then
if structure.GetAminoAcid(StartSheetNine+count) ~= "G" then
--band.AddBetweenSegments(EndSheetEight-count+1+FineAdjustEight,StartSheetNine+count,4,4)
end
end
end
if PrintOutSheetInfo== true then print('Sheet8 vs Sheet9: Antiparallel') end
end
else end
end
else end
if AntiParallel8x9== false then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets8x9==true then do
for count=1,limit do
band.AddBetweenSegments(StartSheetEight+count-1+FineAdjustEight,StartSheetNine+count)
if structure.GetAminoAcid(StartSheetEight+count-1+FineAdjustEight) ~= "G" then
if structure.GetAminoAcid(StartSheetNine+count) ~= "G" then
--band.AddBetweenSegments(StartSheetEight+count-1+FineAdjustEight,StartSheetNine+count,4,4)
end
end
end
if PrintOutSheetInfo== true then print('Sheet8 vs Sheet9: Parallel') end
end
else end
end
else end
end
else end
NewNewBandNo=band.GetCount()
for shift=HandDrawnBandNo+1,NewNewBandNo do
band.SetStrength(shift,CrossPieceStrength)
end
end
function TetherIt(HandDrawnBandNo,NumberOfSheets,LengthSheetOne,LengthSheetTwo,LengthSheetThree,LengthSheetFour,LengthSheetFive,LengthSheetSix,LengthSheetSeven,LengthSheetEight)
if NumberOfSheets>1 then do
if FinalAnswer==true then do
end
else
for check=EndSheetOne,StartSheetTwo do
if (structure.GetSecondaryStructure(check) == 'H') and (StartSheetTwo-EndSheetOne > 7) then do
AntiParallel1x2=false
end
else end
end
end
if LengthSheetOne>LengthSheetTwo then limit=LengthSheetTwo
end
if LengthSheetOne<LengthSheetTwo then limit=LengthSheetOne
end
if LengthSheetOne==LengthSheetTwo then limit=LengthSheetOne
end
if AntiParallel1x2==true then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets1x2==true then do
for count=1,limit do
--band.AddBetweenSegments(EndSheetOne-count+1+FineAdjustOne,StartSheetTwo+count)
if structure.GetAminoAcid(EndSheetOne-count+1+FineAdjustOne) ~= "G" then
if structure.GetAminoAcid(StartSheetTwo+count) ~= "G" then
band.AddBetweenSegments(EndSheetOne-count+1+FineAdjustOne,StartSheetTwo+count,5,5)
end
end
end
if PrintOutSheetInfo== true then print('Sheet1 vs Sheet2: Antiparallel') end
end
else end
end
else end
if AntiParallel1x2 == false then do
--fill in the blanks
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets1x2==true then do
for count=1,limit do
--band.AddBetweenSegments(StartSheetOne+count-1+FineAdjustOne,StartSheetTwo+count)
if structure.GetAminoAcid(StartSheetOne+count-1+FineAdjustOne) ~= "G" then
if structure.GetAminoAcid(StartSheetTwo+count) ~= "G" then
band.AddBetweenSegments(StartSheetOne+count-1+FineAdjustOne,StartSheetTwo+count,5,5)
end
end
end
if PrintOutSheetInfo== true then print('Sheet1 vs Sheet2: Parallel') end
end
else end
end
else end
end
else end
if NumberOfSheets>2 then do
if FinalAnswer==true then do
end
else
for check=EndSheetTwo,StartSheetThree do
if (structure.GetSecondaryStructure(check) == 'H') and (StartSheetThree-EndSheetTwo > 7) then do
AntiParallel2x3=false
end
else end
end
end
if LengthSheetTwo>LengthSheetThree then limit=LengthSheetThree
end
if LengthSheetTwo<LengthSheetThree then limit=LengthSheetTwo
end
if LengthSheetTwo==LengthSheetThree then limit=LengthSheetTwo
end
if AntiParallel2x3== true then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets2x3==true then do
for count=1,limit do
--band.AddBetweenSegments(EndSheetTwo-count+1+FineAdjustTwo,StartSheetThree+count)
if structure.GetAminoAcid(EndSheetTwo-count+1+FineAdjustTwo) ~= "G" then
if structure.GetAminoAcid(StartSheetThree+count) ~= "G" then
band.AddBetweenSegments(EndSheetTwo-count+1+FineAdjustTwo,StartSheetThree+count,5,5)
end
end
end
if PrintOutSheetInfo== true then print('Sheet2 vs Sheet3: Antiparallel') end
end
else end
end
else end
if AntiParallel2x3 == false then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets2x3==true then do
for count=1,limit do
--band.AddBetweenSegments(StartSheetTwo+count-1+FineAdjustTwo,StartSheetThree+count)
if structure.GetAminoAcid(StartSheetTwo+count-1+FineAdjustTwo) ~= "G" then
if structure.GetAminoAcid(StartSheetThree+count) ~= "G" then
band.AddBetweenSegments(StartSheetTwo+count-1+FineAdjustTwo,StartSheetThree+count,5,5)
end
end
end
if PrintOutSheetInfo== true then print('Sheet2 vs Sheet3: Parallel') end
end
else end
end
else end
end
else end
if NumberOfSheets>3 then do
if FinalAnswer==true then do
end
else
for check=EndSheetThree,StartSheetFour do
if (structure.GetSecondaryStructure(check) == 'H') and (StartSheetFour-EndSheetThree > 7) then do
AntiParallel3x4=false
end
else end
end
end
if LengthSheetThree>LengthSheetFour then limit=LengthSheetFour
end
if LengthSheetThree<LengthSheetFour then limit=LengthSheetThree
end
if LengthSheetThree==LengthSheetFour then limit=LengthSheetThree
end
if AntiParallel3x4==true then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets3x4==true then do
for count=1,limit do
--band.AddBetweenSegments(EndSheetThree-count+1+FineAdjustThree,StartSheetFour+count)
if structure.GetAminoAcid(EndSheetThree-count+1+FineAdjustThree) ~= "G" then
if structure.GetAminoAcid(StartSheetFour+count) ~= "G" then
band.AddBetweenSegments(EndSheetThree-count+1+FineAdjustThree,StartSheetFour+count,5,5)
end
end
end
if PrintOutSheetInfo== true then print('Sheet3 vs Sheet4: Antiparallel') end
end
else end
end
else end
if AntiParallel3x4==false then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets3x4==true then do
for count=1,limit do
--band.AddBetweenSegments(StartSheetThree+count-1+FineAdjustThree,StartSheetFour+count)
if structure.GetAminoAcid(StartSheetThree+count-1+FineAdjustThree) ~= "G" then
if structure.GetAminoAcid(FineAdjustThree,StartSheetFour+count) ~= "G" then
band.AddBetweenSegments(StartSheetThree+count-1+FineAdjustThree,StartSheetFour+count,5,5)
end
end
end
if PrintOutSheetInfo== true then print('Sheet3 vs Sheet4: Parallel') end
end
else end
end
else end
end
else end
if NumberOfSheets>4 then do
if FinalAnswer==true then do
end
else
for check=EndSheetFour,StartSheetFive do
if (structure.GetSecondaryStructure(check) == 'H') and (StartSheetFive-EndSheetFour > 7) then do
AntiParallel4x5=false
end
else end
end
end
if LengthSheetFour>LengthSheetFive then limit=LengthSheetFive
end
if LengthSheetFour<LengthSheetFive then limit=LengthSheetFour
end
if LengthSheetFour==LengthSheetFive then limit=LengthSheetFour
end
if AntiParallel4x5==true then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets4x5==true then do
for count=1,limit do
--band.AddBetweenSegments(EndSheetFour-count+1+FineAdjustFour,StartSheetFive+count)
if structure.GetAminoAcid(EndSheetFour-count+1+FineAdjustFour) ~= "G" then
if structure.GetAminoAcid(StartSheetFive+count) ~= "G" then
band.AddBetweenSegments(EndSheetFour-count+1+FineAdjustFour,StartSheetFive+count,5,5)
end
end
end
if PrintOutSheetInfo== true then print('Sheet4 vs Sheet5: Antiparallel') end
end
else end
end
else end
if AntiParallel4x5== false then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets4x5==true then do
for count=1,limit do
--band.AddBetweenSegments(StartSheetFour+count-1+FineAdjustFour,StartSheetFive+count)
if structure.GetAminoAcid(StartSheetFour+count-1+FineAdjustFour) ~= "G" then
if structure.GetAminoAcid(StartSheetFive+count) ~= "G" then
band.AddBetweenSegments(StartSheetFour+count-1+FineAdjustFour,StartSheetFive+count,5,5)
end
end
end
if PrintOutSheetInfo== true then print('Sheet4 vs Sheet5: Parallel') end
end
else end
end
else end
end
else end
if NumberOfSheets>5 then do
if FinalAnswer==true then do
end
else
for check=EndSheetFive,StartSheetSix do
if (structure.GetSecondaryStructure(check) == 'H') and (StartSheetSix-EndSheetFive > 7) then do
AntiParallel4x5=false
end
else end
end
end
if LengthSheetFive>LengthSheetSix then limit=LengthSheetSix
end
if LengthSheetFive<LengthSheetSix then limit=LengthSheetFive
end
if LengthSheetFive==LengthSheetSix then limit=LengthSheetFive
end
if AntiParallel5x6==true then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets5x6==true then do
for count=1,limit do
--band.AddBetweenSegments(EndSheetFive-count+1+FineAdjustFive,StartSheetSix+count)
if structure.GetAminoAcid(EndSheetFive-count+1+FineAdjustFive) ~= "G" then
if structure.GetAminoAcid(StartSheetSix+count) ~= "G" then
band.AddBetweenSegments(EndSheetFive-count+1+FineAdjustFive,StartSheetSix+count,5,5)
end
end
end
if PrintOutSheetInfo== true then print('Sheet5 vs Sheet6: Antiparallel') end
end
else end
end
else end
if AntiParallel5x6== false then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets5x6==true then do
for count=1,limit do
--band.AddBetweenSegments(StartSheetFive+count-1+FineAdjustFive,StartSheetSix+count)
if structure.GetAminoAcid(StartSheetFive+count-1+FineAdjustFive) ~= "G" then
if structure.GetAminoAcid(StartSheetSix+count) ~= "G" then
band.AddBetweenSegments(StartSheetFive+count-1+FineAdjustFive,StartSheetSix+count,5,5)
end
end
end
if PrintOutSheetInfo== true then print('Sheet5 vs Sheet6: Parallel') end
end
else end
end
else end
end
else end
if NumberOfSheets>6 then do
if FinalAnswer==true then do
end
else
for check=EndSheetSix,StartSheetSeven do
if (structure.GetSecondaryStructure(check) == 'H') and (StartSheetSeven-EndSheetSix > 7) then do
AntiParallel6x7=false
end
else end
end
end
if LengthSheetSix>LengthSheetSeven then limit=LengthSheetSeven
end
if LengthSheetSix<LengthSheetSeven then limit=LengthSheetSix
end
if LengthSheetSix==LengthSheetSeven then limit=LengthSheetSix
end
if AntiParallel6x7==true then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets6x7==true then do
for count=1,limit do
--band.AddBetweenSegments(EndSheetSix-count+1+FineAdjustSix,StartSheetSeven+count)
if structure.GetAminoAcid(EndSheetSix-count+1+FineAdjustSix) ~= "G" then
if structure.GetAminoAcid(StartSheetSeven+count) ~= "G" then
band.AddBetweenSegments(EndSheetSix-count+1+FineAdjustSix,StartSheetSeven+count,5,5)
end
end
end
if PrintOutSheetInfo== true then print('Sheet6 vs Sheet7: Antiparallel') end
end
else end
end
else end
if AntiParallel6x7== false then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets6x7==true then do
for count=1,limit do
--band.AddBetweenSegments(StartSheetSix+count-1+FineAdjustSix,StartSheetSeven+count)
if structure.GetAminoAcid(StartSheetSix+count-1+FineAdjustSix) ~= "G" then
if structure.GetAminoAcid(StartSheetSeven+count) ~= "G" then
band.AddBetweenSegments(StartSheetSix+count-1+FineAdjustSix,StartSheetSeven+count,5,5)
end
end
end
if PrintOutSheetInfo== true then print('Sheet6 vs Sheet7: Parallel') end
end
else end
end
else end
end
else end
if NumberOfSheets>7 then do
if FinalAnswer==true then do
end
else
for check=EndSheetSeven,StartSheetEight do
if (structure.GetSecondaryStructure(check) == 'H') and (StartSheetEight-EndSheetSeven > 7) then do
AntiParallel7x8=false
end
else end
end
end
if LengthSheetSeven>LengthSheetEight then limit=LengthSheetEight
end
if LengthSheetSeven<LengthSheetEight then limit=LengthSheetSeven
end
if LengthSheetSeven==LengthSheetEight then limit=LengthSheetSeven
end
if AntiParallel7x8==true then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets7x8==true then do
for count=1,limit do
--band.AddBetweenSegments(EndSheetSeven-count+1+FineAdjustSeven,StartSheetEight+count)
if structure.GetAminoAcid(EndSheetSeven-count+1+FineAdjustSeven) ~= "G" then
if structure.GetAminoAcid(StartSheetEight+count) ~= "G" then
band.AddBetweenSegments(EndSheetSeven-count+1+FineAdjustSeven,StartSheetEight+count,5,5)
end
end
end
if PrintOutSheetInfo== true then print('Sheet7 vs Sheet8: Antiparallel') end
end
else end
end
else end
if AntiParallel7x8== false then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets7x8==true then do
for count=1,limit do
--band.AddBetweenSegments(StartSheetSeven+count-1+FineAdjustSeven,StartSheetEight+count)
if structure.GetAminoAcid(StartSheetSeven+count-1+FineAdjustSeven) ~= "G" then
if structure.GetAminoAcid(StartSheetEight+count) ~= "G" then
band.AddBetweenSegments(StartSheetSeven+count-1+FineAdjustSeven,StartSheetEight+count,5,5)
end
end
end
if PrintOutSheetInfo== true then print('Sheet7 vs Sheet8: Parallel') end
end
else end
end
else end
end
else end
if NumberOfSheets>8 then do
if FinalAnswer==true then do
end
else
for check=EndSheetEight,StartSheetNine do
if (structure.GetSecondaryStructure(check) == 'H') and (StartSheetNine-EndSheetEight > 7) then do
AntiParallel8x9=false
end
else end
end
end
if LengthSheetEight>LengthSheetNine then limit=LengthSheetNine
end
if LengthSheetEight<LengthSheetNine then limit=LengthSheetEight
end
if LengthSheetEight==LengthSheetNine then limit=LengthSheetEight
end
if AntiParallel8x9==true then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets8x9==true then do
for count=1,limit do
--band.AddBetweenSegments(EndSheetEight-count+1+FineAdjustEight,StartSheetNine+count)
if structure.GetAminoAcid(EndSheetEight-count+1+FineAdjustEight) ~= "G" then
if structure.GetAminoAcid(StartSheetNine+count) ~= "G" then
band.AddBetweenSegments(EndSheetEight-count+1+FineAdjustEight,StartSheetNine+count,5,5)
end
end
end
if PrintOutSheetInfo== true then print('Sheet8 vs Sheet9: Antiparallel') end
end
else end
end
else end
if AntiParallel8x9== false then do
if PrintOutSheetInfo== true then print('Limit=',limit) end
if StringSheets8x9==true then do
for count=1,limit do
--band.AddBetweenSegments(StartSheetEight+count-1+FineAdjustEight,StartSheetNine+count)
if structure.GetAminoAcid(StartSheetEight+count-1+FineAdjustEight) ~= "G" then
if structure.GetAminoAcid(StartSheetNine+count) ~= "G" then
band.AddBetweenSegments(StartSheetEight+count-1+FineAdjustEight,StartSheetNine+count,5,5)
end
end
end
if PrintOutSheetInfo== true then print('Sheet8 vs Sheet9: Parallel') end
end
else end
end
else end
end
else end
NewNewBandNo=band.GetCount()
for shift=HandDrawnBandNo+1,NewNewBandNo do
band.SetStrength(shift,CrossPieceStrength)
end
end
function DeleteBands(BandNo)
NewBandNo=band.GetCount()
for w=BandNo, NewBandNo-1 do
band.Delete(BandNo+1)
end
end
function AdjustSS681()
print('Changing structure')
for zed=1,36 do
structure.SetSecondaryStructure(zed, 'L')
end
for zed=37,42 do
structure.SetSecondaryStructure(zed, 'E')
end
for zed=43,50 do
structure.SetSecondaryStructure(zed, 'L')
end
for zed=51,57 do
structure.SetSecondaryStructure(zed, 'E')
end
for zed=58,59 do
structure.SetSecondaryStructure(zed, 'L')
end
for zed=60,65 do
structure.SetSecondaryStructure(zed, 'E')
end
for zed=66,67 do
structure.SetSecondaryStructure(zed, 'L')
end
for zed=68,74 do
structure.SetSecondaryStructure(zed, 'E')
end
for zed=75,78 do
structure.SetSecondaryStructure(zed, 'L')
end
for zed=79,85 do
structure.SetSecondaryStructure(zed, 'E')
end
for zed=86,93 do
structure.SetSecondaryStructure(zed, 'L')
end
for zed=94,98 do
structure.SetSecondaryStructure(zed, 'E')
end
for zed=99,107 do
structure.SetSecondaryStructure(zed, 'L')
end
for zed=108,113 do
structure.SetSecondaryStructure(zed, 'E')
end
for zed=114,116 do
structure.SetSecondaryStructure(zed, 'L')
end
for zed=117,122 do
structure.SetSecondaryStructure(zed, 'E')
end
for zed=123,124 do
structure.SetSecondaryStructure(zed, 'L')
end
for zed=125,148 do
structure.SetSecondaryStructure(zed, 'H')
end
for zed=149,152 do
structure.SetSecondaryStructure(zed, 'L')
end
end
function AdjustSSStrep()
print('Changing structure')
for zed=1,4 do
structure.SetSecondaryStructure(zed, 'L')
end
for zed=5,9 do
structure.SetSecondaryStructure(zed, 'E')
end
for zed=10,13 do
structure.SetSecondaryStructure(zed, 'L')
end
for zed=14,19 do
structure.SetSecondaryStructure(zed, 'E')
end
for zed=20,24 do
structure.SetSecondaryStructure(zed, 'L')
end
for zed=25,37 do
structure.SetSecondaryStructure(zed, 'H')
end
for zed=38,42 do
structure.SetSecondaryStructure(zed, 'L')
end
for zed=43,47 do
structure.SetSecondaryStructure(zed, 'E')
end
for zed=48,51 do
structure.SetSecondaryStructure(zed, 'L')
end
for zed=52,56 do
structure.SetSecondaryStructure(zed, 'E')
end
for zed=57,57 do
structure.SetSecondaryStructure(zed, 'L')
end
end
function CheckHelices()
HelicesAreGood=true
for mm=1,structure.GetCount()-3 do
if structure.GetSecondaryStructure(mm)=='H' then do
if structure.GetSecondaryStructure(mm+3)=='H' then do
if not (4.7<(structure.GetDistance(mm,mm+3)) and (structure.GetDistance(mm,mm+3))<6.3) then do
HelicesAreGood=false
end
else end
end
else end
end
else end
end
return HelicesAreGood
end
function InitializeHelices()
selection.DeselectAll()
thecount=0
repeat
for h=1,1 do
thecount=thecount+1
SelectHelices()
SelectLoops()
structure.RebuildSelected(10)
CheckHelices()
structure.ShakeSidechainsAll(1)
structure.WiggleAll(10)
end
until HelicesAreGood==true or thecount==3
AD10100()
end
function BandFarthest(FloppyScore)
GreatestDistance=0
BandStrength=0.3
CompDecompAdjuster=-FloppyScore/1.8
BandCount=band.GetCount()
for s=1,structure.GetCount() do
GreatestDistance=0
FarthestSegment=s+1
for t=2,structure.GetCount() do
if structure.GetDistance(s,t)>GreatestDistance then do
GreatestDistance=structure.GetDistance(s,t)
FarthestSegment=t
end
else end
end
band.AddBetweenSegments(s,FarthestSegment)
BandCount=BandCount+1
band.SetStrength(BandCount,BandStrength)
BandLength=structure.GetDistance(s,FarthestSegment)
band.SetGoalLength(BandCount,BandLength+CompDecompAdjuster)
end
end
function SelectWorstLength()
SegmentLength=2
--print('Segment Length= ',SegmentLength)
deselect_all()
WorstSegScore=1000
--print(get_segment_count())
for CWScount=1,get_segment_count()-SegmentLength do
bbScore=0
for e=CWScount,CWScount+SegmentLength-1 do
bbScore=bbScore+get_segment_score_part("backbone",e)
--print(e)
end
if WorstSegScore>bbScore then do
WorstSegScore=bbScore
WorstStart=CWScount
end
else end
--print(CWScount)
end
--print('Worst segment= ',WorstSegScore)
--print('begins at ',WorstStart)
for t=WorstStart, WorstStart +SegmentLength do
select_index(t)
end
end
------------------------------------
function DangBBandTheBit()
BandNo=band.GetCount()
for s=1,structure.GetCount() do
--selection.DeselectAll()
if structure.IsHydrophobic(s)==true then do
for t=s,structure.GetCount() do
if structure.GetDistance(s,t) < 10 and structure.GetDistance(s,t)>6 then do
if structure.IsHydrophobic(t)==true then do
--print('made it to here')
band.AddBetweenSegments(s,t)
BandNo=BandNo+1
band.SetStrength(BandNo,1.2)
band.SetGoalLength(BandNo,structure.GetDistance(s,t)-1.5)
end
else end
end
else end
end
end
else end
for t=s,structure.GetCount() do
if structure.GetDistance(s,t) < 10 and structure.GetDistance(s,t) >6 then do
if structure.IsHydrophobic(s)==true then do
if structure.IsHydrophobic(t)==false then do
band.AddBetweenSegments(s,t)
BandNo=BandNo+1
--print(BandNo)
band.SetStrength(BandNo,0.7)
band.SetGoalLength(BandNo,structure.GetDistance(s,t)+0.7)
end
else end
end
else end
end
else end
end
end
end
function Interlude()
print('...Interlude...')
DeleteBands(HandDrawnBandNo)
recentbest.Save()
for yy=1,5 do
selection.DeselectAll()
SelectWorstLength()
structure.RebuildSelected(1,100)
ShakeNWiggle()
end
AD10100()
recentbest.Restore()
DeleteBands(HandDrawnBandNo)
quicksave(100)
quicksave(3)
end
------------------------------
MaxCI=1
RebuildNo=3
HowMany=5
behavior.SetClashImportance(1)
ShortBandLength=4.8
ShortSheetLattitude=6.1
LongSheetLattitude=7.6
OneThreeHelixLength=5.5
OneFourHelixLength=6.5
OneFiveHelixLength=8.6
SBLBSF=0.9
SSLBSF=0.3
LSLBSF=0.3
SLBSF=10
OneThreeHBSF=0.9
OneFourHBSF=0.9
OneFiveHBSF=0.9
StringSheetLength=6.71
CrossPieceStrength=1.2
StringerLengthPermuteFactor=1
StringerBandStrengthFactor=1
AntiParallel1x2=true
StringSheets1x2=true
AntiParallel2x3=true
StringSheets2x3=true
AntiParallel3x4=true
StringSheets3x4=true
AntiParallel4x5=true
StringSheets4x5=true
AntiParallel5x6=true
StringSheets5x6=true
AntiParallel6x7=true
StringSheets6x7=true
AntiParallel7x8=true
StringSheets7x8=true
AntiParallel8x9=true
StringSheets8x9=true
FineAdjustOne=0
FineAdjustTwo=0
FineAdjustThree=0
FineAdjustFour=0
FineAdjustFive=0
FineAdjustSix=0
FineAdjustSeven=0
FineAdjustEight=0
UseCurrentSecondaryStructure=true
PrintOutSheetInfo= true
NumberOfSheets=0
TotalRebuildAtBeginning=false
SqueezingRounds=3
HelicesOK=false
--
--
freeze.UnfreezeAll()
for f=1,structure.GetCount() do
if structure.GetSecondaryStructure(f)=='E' then do
DoTallySheets=true
end
else end
end
if DoTallySheets==true then do
TallySheets()
end
else end
structure.ShakeSidechainsAll(2)
CalulateFloppyScore()
print('FloppyScore=',round3(FloppyScore))
print('Try viewing this in note mode...')
print('FloppyScore=',round(FloppyScore))
print(puzzle.GetName())
FinalAnswer=false
HandDrawnBandNo=band.GetCount()
if HandDrawnBandNo> 0 then do
print('De-Check the sheet stringing options if you have placed crosspiece bands by hand!')
end
else end
StringSheetsParallelVsAntiParallel(HandDrawnBandNo,NumberOfSheets,LengthSheetOne,LengthSheetTwo,LengthSheetThree,LengthSheetFour,LengthSheetFive,LengthSheetSix,LengthSheetSeven,LengthSheetEight, LengthSheetNine)
DeleteBands(HandDrawnBandNo)
Satisfied=false
repeat
DoDialog()
DeleteBands(HandDrawnBandNo)
freeze.UnfreezeAll()
while UseCurrentSecondaryStructure== false do
if UseCurrentSecondaryStructure==false then do
print('Looking for alternate secondary structure...')
if (string.match(puzzle.GetName(),'681')=='681') then do
DeleteBands(HandDrawnBandNo)
AdjustSS681()
TallySheets()
UseCurrentSecondaryStructure=true
StringSheetsParallelVsAntiParallel(HandDrawnBandNo,NumberOfSheets,LengthSheetOne,LengthSheetTwo,LengthSheetThree,LengthSheetFour,LengthSheetFive,LengthSheetSix,LengthSheetSeven,LengthSheetEight, LengthSheetNine)
DeleteBands(HandDrawnBandNo)
DoDialog()
end
else end
if (string.match(puzzle.GetName(),'Strep')=='Strep') then do
DeleteBands(HandDrawnBandNo)
AdjustSSStrep()
TallySheets()
UseCurrentSecondaryStructure=true
StringSheetsParallelVsAntiParallel(HandDrawnBandNo,NumberOfSheets,LengthSheetOne,LengthSheetTwo,LengthSheetThree,LengthSheetFour,LengthSheetFive,LengthSheetSix,LengthSheetSeven,LengthSheetEight, LengthSheetNine)
DeleteBands(HandDrawnBandNo)
DoDialog()
end
else
print('Could not find any alternate secondary structures')
end
--UseCurrentSecondaryStructure=true
end
else end
end
FinalAnswer=true
StringSheetsParallelVsAntiParallel(HandDrawnBandNo,NumberOfSheets,LengthSheetOne,LengthSheetTwo,LengthSheetThree,LengthSheetFour,LengthSheetFive,LengthSheetSix,LengthSheetSeven,LengthSheetEight, LengthSheetNine)
PrintOutSheetInfo=false
MoBettahStringer()
--puzzle.StartOver()
ui.CenterViewport()
selection.SelectAll()
if TotalRebuildAtBeginning==true then do
structure.RebuildSelected(1,1000)
ui.CenterViewport()
structure.ShakeSidechainsAll(2)
FreezeSheets()
AD10100()
end
else end
FreezeSheets()
for j=1,1 do
behavior.SetClashImportance(0.01)
print('Really, really low Clashing Importance...')
structure.WiggleAll(1)
behavior.SetClashImportance(1)
print('Better now')
AD10100()
end
if HelicesOK==false then do
HelicesAreGood=false
InitializeHelices()
end
else end
recentbest.Save()
reset_recent_best()
quicksave(100)
quicksave(3)
print(current.GetEnergyScore())
print('Best score is saved in QuickSlot 3')
print('You should check recent best, too!')
--[[repeat
AreConditionsMet()
if ConditionsMet==false then do
freeze.UnfreezeAll()
selection.SelectAll()
structure.RebuildSelected(1,1000)
structure.ShakeSidechainsAll(2)
FreezeSheets()
--AD10100()
end
else end
until ConditionsMet==true]]--
selection.SelectAll()
AD10100()
freeze.UnfreezeAll()
DeleteBands(HandDrawnBandNo)
print('Can stop here for manual alignment. Must cancel script to do that.')
--
until Satisfied==true
recentbest.Save()
reset_recent_best()
quicksave(100)
quicksave(3)
print('A')
save.Quicksave(100)
quicksave(3)
recentbest.Save()
ui.CenterViewport()
ShakeNWiggle()
print('B')
for ww=1,HowMany do
recentbest.Save()
band.EnableAll()
for dixie=1,RebuildNo do
selection.DeselectAll()
SelectLoops()
RebuildSelected()
selection.SelectAll()
ShakeNWiggle()
end
recentbest.Restore()
DeleteBands(HandDrawnBandNo)
AD10100()
band.DisableAll()
freeze.UnfreezeAll()
print('C')
recentbest.Save()
DeleteBands(HandDrawnBandNo)
band.DisableAll()
Compressor()
band.DisableAll()
Interlude()
print('D')
DeleteBands(HandDrawnBandNo)
band.DisableAll()
Compressor()
band.EnableAll()
--FreezeSheets()
print('E')
DeleteBands(HandDrawnBandNo)
for dixie=1,RebuildNo do
SelectHelices()
RebuildSelected()
selection.SelectAll()
ShakeNWiggle()
end
print('F')
recentbest.Restore()
DeleteBands(HandDrawnBandNo)
AD10100()
band.DisableAll()
freeze.UnfreezeAll()
Interlude()
print('G')
DeleteBands(HandDrawnBandNo)
band.DisableAll()
Compressor()
band.DisableAll()
Interlude()
band.EnableAll()
print('H')
selection.SelectAll()
--AD10100()
freeze.UnfreezeAll()
AD10100()
band.DisableAll()
AD10100()
BlueFuse()
band.EnableAll()
--
--Compressor()
save.Quickload(100)
recentbest.Restore()
DeleteBands(HandDrawnBandNo)
save.Quicksave(100)
save.Quicksave(3)
DeleteBands(HandDrawnBandNo)
print(current.GetEnergyScore())
save.Quicksave(3)
band.EnableAll()
CalulateFloppyScore()
print('FloppyScore=',round3(FloppyScore))
--NewestBandNo=band.GetCount()
print('I')
for lmnop=1,SqueezingRounds do
print('J')
DeleteBands(HandDrawnBandNo)
StringTheSheets()
if FreezeForCompression==true then do
FreezeSheets()
FreezeHelices()
end
else end
StringSheetsParallelVsAntiParallel(HandDrawnBandNo,NumberOfSheets,LengthSheetOne,LengthSheetTwo,LengthSheetThree,LengthSheetFour,LengthSheetFive,LengthSheetSix,LengthSheetSeven,LengthSheetEight, LengthSheetNine)
--TetherIt(HandDrawnBandNo,NumberOfSheets,LengthSheetOne,LengthSheetTwo,LengthSheetThree,LengthSheetFour,LengthSheetFive,LengthSheetSix,LengthSheetSeven,LengthSheetEight)
BandFarthest(FloppyScore)
selection.SelectAll()
structure.WiggleAll(5)
DeleteBands(HandDrawnBandNo)
freeze.UnfreezeAll()
--DeleteBands(NewestBandNo)
if FreezeForCompression==true then do
FreezeSheets()
--FreezeHelices()
end
else end
StringTheSheets()
StringSheetsParallelVsAntiParallel(HandDrawnBandNo,NumberOfSheets,LengthSheetOne,LengthSheetTwo,LengthSheetThree,LengthSheetFour,LengthSheetFive,LengthSheetSix,LengthSheetSeven,LengthSheetEight, LengthSheetNine)
--FreezeHelices()
DangBBandTheBit()
structure.WiggleAll(5)
DeleteBands(HandDrawnBandNo)
freeze.UnfreezeAll()
Interlude()
CalulateFloppyScore()
print('FloppyScore=',round3(FloppyScore))
print(round3(current.GetScore()))
end
AD10100()
BlueFuse()
--TetherIt(HandDrawnBandNo,NumberOfSheets,LengthSheetOne,LengthSheetTwo,LengthSheetThree,LengthSheetFour,LengthSheetFive,LengthSheetSix,LengthSheetSeven,LengthSheetEight)
print('K')
DeleteBands(HandDrawnBandNo)
band.DisableAll()
Compressor()
band.DisableAll()
Interlude()
CalulateFloppyScore()
print('FloppyScore=',round3(FloppyScore))
print(round3(current.GetScore()))
freeze.UnfreezeAll()
print('L')
DeleteBands(HandDrawnBandNo)
band.DisableAll()
Compressor()
band.DisableAll()
Interlude()
--TetherIt(HandDrawnBandNo,NumberOfSheets,LengthSheetOne,LengthSheetTwo,LengthSheetThree,LengthSheetFour,LengthSheetFive,LengthSheetSix,LengthSheetSeven,LengthSheetEight)
print('M')
print('N')
StringTheSheets()
--FreezeSheets()
StringSheetsParallelVsAntiParallel(HandDrawnBandNo,NumberOfSheets,LengthSheetOne,LengthSheetTwo,LengthSheetThree,LengthSheetFour,LengthSheetFive,LengthSheetSix,LengthSheetSeven,LengthSheetEight, LengthSheetNine)
StringTheSheets()
--[[MoBettahStringer()
NewestBandNo=band.GetCount()
structure.RebuildSelected(1,1000)
DeleteBands(NewestBandNo)
StringSheetsParallelVsAntiParallel(HandDrawnBandNo,NumberOfSheets,LengthSheetOne,LengthSheetTwo,LengthSheetThree,LengthSheetFour,LengthSheetFive,LengthSheetSix,LengthSheetSeven,LengthSheetEight, LengthSheetNine)
MoBettahStringer()
FreezeSheets()
AD10100()]]--
end
--MoBettahStringer()
recentbest.Restore()