Profile
- Name
- Set to VAL
- ID
- 104426
- Shared with
- Public
- Parent
- None
- Children
- None
- Created on
- February 01, 2021 at 22:19 PM UTC
- Updated on
- February 01, 2021 at 22:19 PM UTC
- Description
Originally by Vincero. Translated to LuaV1 using Rav3n_pl's converter.
Best for
Code
-- Converted from v1 lua by Rav3n_pl v1 to v2 converter
--[[
Modified from Rav3n 425 Marie set aa
print/set AA
]]--
p=print
segCnt=structure.GetCount()
function FindMutable() -- fsl.FindMutableSegments ()
p("Finding Mutable Segments -- don't kill during this routine")
save.Quicksave(10)
local mutable={}
local isG={}
local i
selection.SelectAll()
structure.SetAminoAcidSelected('v') -- all mutable segments are set to 'v'
for i=1,segCnt do
if structure.GetAminoAcid(i) == 'v' then -- find the 'v' segments
isG[#isG + 1] = i
end
end
structure.SetAminoAcidSelected('v') -- all mutable segments are set to 'v'
for j=1,#isG do
i=isG[j]
if structure.GetAminoAcid(i) == 'v' then -- this segment is mutable
mutable[#mutable + 1] = i
end
end
save.Quickload(10)
p(#mutable," mutables found")
return mutable
end
mutable=FindMutable()
function show()
--for i=1,#mutable do
-- sgn=mutable[i]
--p("SG: ",sgn," AA=",structure.GetAminoAcid(sgn))
-- end
t=""
for i=1,#mutable do
t=t.."'"..structure.GetAminoAcid(mutable[i]).."',"
end
p(t) --for copy/paste ;]
end
--edit below to set proper AAs for given puzzle
--aas={'v'} --428 from AD consensus
aas={'V'}--428 from AD consensus recipe
lower={'v'}
upper={'V'}
function tolowerhack(char)
for i=1,26 do
if upper[i] == char then
char = lower[i]
return char
end
end
end
function set()
for i=1,#mutable do
selection.DeselectAll()
sn=mutable[i]
selection.Select(sn)
aa=tolowerhack(aas[i])
-- aa=string.lower(string.sub(longaa,sn,sn))
if structure.GetAminoAcid(sn) ~= aa then
structure.SetAminoAcidSelected(aas[i])
end
end
end
p("Before:")
show()
set()
p("After:")
show()