Icon representing a recipe

Recipe: Note mutable segments V1.1

created by gramps

Profile


Name
Note mutable segments V1.1
ID
43990
Shared with
Public
Parent
None
Children
None
Created on
August 25, 2012 at 01:06 AM UTC
Updated on
August 25, 2012 at 01:06 AM UTC
Description

places a brief Note onto each mutable segment now can display scores

Best for


Code


-- Note mutable segments V1.1 -- -- places a brief Note onto each mutable segment now can display scores -- -- by gramps (John McLeod) -- V1.0 -- August 14, 2012 -- V1.1 -- August 25, 2012 added scores display -- progname = "Note mutable segments V1.1" -- function NoteMutables(use_segno, use_AA, use_score) -- Notes the mutable segs local mutable_count = 0 local the_note = "" for i=1,structure.GetCount() do if structure.IsMutable(i) then mutable_count = mutable_count + 1 the_note="" if use_segno then the_note = the_note .. " " .. i end if use_AA then the_note = the_note .. " " .. string.upper(structure.GetAminoAcid(i)) end if use_score then the_note = the_note .. " " .. string.format("%3.1f", current.GetSegmentEnergyScore(i)) end structure.SetNote(i, the_note) print(the_note) end end print("segments Noted:", mutable_count) end -- function NoteMutables -- -- MAIN stuff -- print(progname,"started") -- local ask = dialog.CreateDialog("Note mutable segments") ask.Instructions = dialog.AddLabel("add brief Note to all mutables") ask.OK = dialog.AddButton("OK", 1) ask.Cancel = dialog.AddButton("Cancel", 0) ask.SegNo = dialog.AddCheckbox("Note the seg num", true) ask.AA = dialog.AddCheckbox("Note the AA code", true) ask.score = dialog.AddCheckbox("Note the score", false) if (dialog.Show(ask) > 0) then NoteMutables(ask.SegNo.value, ask.AA.value, ask.score.value) -- put a Note on each mutable else print("user canceled operation") end -- print(progname,"ended") -- -- end Note mutable segments V1.1

Comments