Profile
- Name
- Server Acid Checker
- ID
- 49674
- Shared with
- Public
- Parent
- None
- Children
- None
- Created on
- July 22, 2014 at 01:30 AM UTC
- Updated on
- July 22, 2014 at 01:30 AM UTC
- Description
Loop through server starts, highlighting cys, pro and gly. Easier to use than Notes.
Best for
Code
--[[
* Server Acid Checker -- Brow42
*
* Highlights prolines, glycines and cysteines (without notes)
* Version 1.0 -- July 21, 2014
--]]
get_aa = structure.GetAminoAcid
set_ss = structure.SetSecondaryStructure
nSeg = structure.GetCount()
function ZLB(iSeg,atom)
local s1,s2 = iSeg-1,iSeg+1
if iSeg == 1 then s1,s2 = iSeg+1,iSeg+2
elseif iSeg==nSeg then s1,s2 = iSeg-1,iSeg-2 end
local iBand = band.Add(iSeg,s1,s2, 0.001, 0.0, 0.0, atom)
if iBand > 0 then band.SetGoalLength(iBand,0.001) end
end
function MarkProlines()
for i = 1, nSeg do
if get_aa(i) == 'p' then
set_ss(i,'L')
ZLB(i,6)
elseif get_aa(i) == 'g' then
set_ss(i,'L')
end
end
end
function BandCysteines()
local list = {}
for i = 1, nSeg do
if get_aa(i) == 'c' then
list[#list+1] = i
end
end
for i = 1, #list do
for j = i+1, #list do
local k = band.AddBetweenSegments(list[i],list[j])
if k > 0 and band.GetLength(k) < 4.0 then
band.SetStrength(k,3.0)
end
end
end
end
ok = dialog.CreateDialog("Continue?")
ok.button1 = dialog.AddButton("Yes",1)
ok.button2 = dialog.AddButton("No",0)
while true do
MarkProlines()
BandCysteines()
rc = dialog.Show(ok)
if rc == 0 then break end
puzzle.StartOver()
end