Icon representing a recipe

Recipe: Label Cysteines

created by marsfan

Profile


Name
Label Cysteines
ID
103594
Shared with
Public
Parent
None
Children
None
Created on
June 15, 2020 at 01:00 AM UTC
Updated on
June 15, 2020 at 01:00 AM UTC
Description

Add/remove a note to each segment that has a cysteine sidechain. useful to help find them in puzzles that have Disulfide bonds.

Best for


Code


cysteineFlag = "<C> " -- String to add to note to indicate presence of cystine -- Add flags cysteine segments function addFlags() local note = "" -- loop through all segments, looking for cysteines for segment=1, structure.GetCount() do if structure.GetAminoAcid(segment) == 'c' then -- Get current note, in case we need to append to it. (We don't want to delete existing notes) note = structure.GetNote(segment) -- If the string already has a cystine flag, do not add another if (not string.find(note, cysteineFlag) == 1) then note = note -- If string is not empty, then add the flag to the start of the string. elseif not (string == nil or string == "") then note = cysteineFlag..note -- Otherwise, just add the cysteine flag else note = cysteineFlag end -- Set the note structure.SetNote(segment, note) end end end -- Remove flags from sidechain function removeFlags() local note = "" --loop through all segments, removing cysteine flags for segment = 1, structure.GetCount() do note = structure.GetNote(segment) note = string.gsub(note, cysteineFlag, "") structure.SetNote(segment, note) end end -- Main Function function main() -- Set up menu to choose to add/delete the flags menu = dialog.CreateDialog("Cysteine Labeler") menu.add = dialog.AddButton("Add", 1) menu.remove = dialog.AddButton("Remove", 2) menu.cancel = dialog.AddButton("Cancel", 0) -- Show menu, get user choice local choice = dialog.Show(menu) -- Run operation depending on use choice if choice == 1 then addFlags() elseif choice == 2 then removeFlags() end end -- Run the main function main()

Comments


Bruno Kestemont Lv 1

I see that you are investing in the custom use of notes.

It's an interesting exploration path for many different uses.

Suggestion: (in selection interface you can see all notes together, not in default interface):

-add an visible element like a freeze or a band in space in order to show the cysteins (or the notes to be read)

A band in space can immediately be used in hand fold next step and it can be deleted easilly with deletebands.