Icon representing a recipe

Recipe: Note specified AAs V1.1

created by gramps

Profile


Name
Note specified AAs V1.1
ID
43986
Shared with
Public
Parent
None
Children
None
Created on
August 25, 2012 at 00:14 AM UTC
Updated on
August 25, 2012 at 00:14 AM UTC
Description

places a brief Note onto segs with AAs from user list now can display scores

Best for


Code


-- Note specified AAs V1.1 -- -- places a brief Note onto segs with AAs from user list now can display scores -- -- by gramps (John McLeod) -- V1.0 -- August 14, 2012 -- V1.1 -- August 25, 2012 added score display function -- progname = "Note specified AAs V1.1" -- function NoteSpecified(search_arg, use_segno, use_AA, use_score) -- Notes the specified segs local hit_count = 0 local all_codes = "abcdefghijklmnopqrstuvwxyz" local search_str = "" local the_note = "" if search_arg == "" then search_str = all_codes else search_str = search_arg end search_str = string.lower(search_str) -- AAs are stored lowercase for i=1,structure.GetCount() do if string.find(search_str, structure.GetAminoAcid(i)) then hit_count = hit_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:", hit_count) end -- function NoteSpecified -- -- MAIN stuff -- print(progname,"started") -- local ask = dialog.CreateDialog("Note specified AAs") ask.Instructions = dialog.AddLabel("Note appears for AA codes supplied") ask.OK = dialog.AddButton("OK", 1) ask.Cancel = dialog.AddButton("Cancel", 0) ask.SearchString = dialog.AddTextbox("AA codes", "") 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 NoteSpecified(ask.SearchString.value, ask.SegNo.value, ask.AA.value, ask.score.value) else print("user canceled operation") end -- print(progname,"ended") -- -- end Note specified AAs V1.1

Comments