Code
--[[
537 Clean check by Rav3n_pl
Script is checking that locked residues are mutated or not.
]]--
p=print
segCnt=structure.GetCount()
while structure.GetSecondaryStructure(segCnt)=="M" do segCnt=segCnt-1 end
function prt(tab)
a=""
l=0
for i=1,#tab do
a=a..tab[i].." "
l=l+1
if l>10 then p(a) a="" l=0 end
end
p(a)
end
p("Finding Mutable Segments - IsMutable")
local mutable={}
for i=1,segCnt do
if structure.IsMutable(i) then
mutable[#mutable + 1] = i
end
end
p(#mutable.." mutables found")
--prt(mutable)
function FindMutable() -- fsl.FindMutableSegments ()
p("Finding Mutable Segments -- old way")
save.Quicksave(10)
local mutable={}
local isG={}
local i
selection.SelectAll()
structure.SetAminoAcidSelected('g') -- all mutable segments are set to 'g'
for i=1,segCnt do
if structure.GetAminoAcid(i) == 'g' then -- find the 'g' segments
isG[#isG + 1] = i
end
end
structure.SetAminoAcidSelected('q') -- all mutable segments are set to 'q'
for j=1,#isG do
i=isG[j]
if structure.GetAminoAcid(i) == 'q' then -- this segment is mutable
mutable[#mutable + 1] = i
end
end
save.Quickload(10)
p(#mutable.." true mutables found")
return mutable
end
real=FindMutable()
locked={}
for i=1,#mutable do
lock=true
s1=mutable[i]
for j=1,#real do
if s1==real[j] then
lock=false
break
end
end
if lock==true then
locked[#locked+1]=s1
end
end
p(#locked.." LOCKED mutable found")
--[[
a="clean={"
for i=1,#locked do
a=a.."'"..structure.GetAminoAcid(locked[i]).."',"
end
a=a.."}"
p(a)
]]--
clean={'a','h','r','v','m','a','t','e','h','i','p','r','l','v','m','q','a','i','r','v','r','t','l','i','k','a','g','l','p','g','a','g','i','d','e','d','s','v','i','g','v','q','n','l','s','f','a','k','a','d','a','a','a','r','i','p','h','s','a','q','d','p','d','a','c','e','l','g','r','l','q','g','q','e','r','y','a','s','i','a','a','k','s','s','s','e','h','a','l','p','f','h','a','s','g','t','y','w','l','s','e','c','h','g','y','l','s','m','g','v','n','e','v','a',}
good=true
m=0
for i=1,#locked do
if structure.GetAminoAcid(locked[i])~=clean[i] then
good=false
m=m+1
end
end
if good==true then
p("OK! Looks like this solution is clean!")
else
p("SORRY! This solution is broken!")
p(m.." places are changed!")
end