Difference between revisions of "User:Remig/plico/toABnt"
(Do not var globals) |
(Avoid "axis," a newly reserved word) |
||
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | '''ToABnt''' allows the user to convert a polynucleotide chain from A-form to B-form and ''vice versa''. | + | '''ToABnt''' allows the user to convert a nucleotide or a polynucleotide chain or chain pair from A-form to B-form and ''vice versa''. |
+ | |||
When you ALT-CLICK on any atom, you are prompted to convert its chain from its current form to either the A-form or the B-form. The two forms differ primarily in the pucker conformation of their sugar moieties. The A-form has its sugars in the C3'-endo conformation whereas the B-form has it in the C2'-endo conformation. The A-form is characteristic of RNA while the B-form is characteristic of DNA. | When you ALT-CLICK on any atom, you are prompted to convert its chain from its current form to either the A-form or the B-form. The two forms differ primarily in the pucker conformation of their sugar moieties. The A-form has its sugars in the C3'-endo conformation whereas the B-form has it in the C2'-endo conformation. The A-form is characteristic of RNA while the B-form is characteristic of DNA. | ||
+ | |||
+ | When you SHIFT-CLICK on any atom, you are prompted to convert just the selected nucleotide. | ||
This routine is called automatically by the Plico routine [[Recycling_Corner/DNA_Generator|Polymeraze]] when a polynucleotide is generated. | This routine is called automatically by the Plico routine [[Recycling_Corner/DNA_Generator|Polymeraze]] when a polynucleotide is generated. | ||
Line 6: | Line 9: | ||
ToABnt is a member of the Plico suite of protein folding tools described [[User:Remig/plico|here]]. It may be installed and accessed as a macro with the file: | ToABnt is a member of the Plico suite of protein folding tools described [[User:Remig/plico|here]]. It may be installed and accessed as a macro with the file: | ||
<pre>Title=PLICO toAB NT | <pre>Title=PLICO toAB NT | ||
− | Script=script <path to your script directory>/toABnt.spt; | + | Script=script <path to your script directory>/toABnt.spt;plico_to_ab_nt |
</pre> saved as toABnt.macro in your .jmol/macros directory as described in [[Macro]]. | </pre> saved as toABnt.macro in your .jmol/macros directory as described in [[Macro]]. | ||
Copy and paste the following into a text editor and save in your scripts directory as toABnt.spt. | Copy and paste the following into a text editor and save in your scripts directory as toABnt.spt. | ||
<pre># toABnt - Jmol script by Ron Mignery | <pre># toABnt - Jmol script by Ron Mignery | ||
− | # v1. | + | # v1.13 beta 4/12/2016 -require latest common includes |
# | # | ||
− | # Convert a polynucleotide chain from A-form to B-form or vice versa | + | # Convert a nucleotide or polynucleotide chain |
+ | # from A-form to B-form or vice versa | ||
# | # | ||
− | + | gToab = false | |
− | + | gToabAlt = false | |
− | + | gToA = false | |
− | + | gBusy = false | |
− | |||
− | |||
− | + | function to_ab_nt_auto(iChain, toA) { | |
− | |||
− | |||
− | |||
− | |||
− | + | # Load common functions if not already | |
− | + | load_common() | |
− | + | gChain1 = iChain | |
− | + | gToA = toA | |
− | + | to_ab_nt(true) | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | function | + | function to_ab_single_nt(res, iChain) { |
− | var | + | var f = {atomIndex=_atomPicked}.file |
− | var | + | var m = {atomIndex=_atomPicked}.model |
− | + | var isForm = (is_form_a( res, iChain) ? "A" : "B") | |
− | + | var p = prompt(format("Convert residue %d from %s-form to:", | |
− | var | + | res, isForm), "A-form|B-form|Cancel", true) |
− | + | var toab = false | |
− | + | if (p == "A-form") { | |
− | + | toab = true | |
− | + | } | |
− | + | else if (p != "B-form") { | |
− | + | color {all} @gScheme | |
+ | return # early exit | ||
+ | } | ||
+ | |||
+ | # Call worker function | ||
+ | to_ab_nt_res(res, res+1, iChain, toab) | ||
} | } | ||
− | + | function to_ab_nt(auto) { | |
− | function | + | if (not gBusy) { |
− | + | gBusy = true | |
− | + | var toab = (gToA ? "A" : "B") | |
− | + | ||
− | + | var a = (gToA ? 24.0 : 33.3) | |
− | + | var s = (gToA ? 4.6 : 4.46) | |
− | + | var minres = get_resno_min(gChain1) | |
− | + | var maxres = get_resno_max(gChain1) | |
− | var | + | var a0 = within(kDtolerance, {0 0 0}) |
− | + | if (auto == false) { | |
− | + | var f = {atomIndex=_atomPicked}.file | |
− | var | + | var m = {atomIndex=_atomPicked}.model |
− | + | var isForm = (is_form_a( maxres, gChain1) ? "A" : "B") | |
− | + | var p = prompt(format("Convert chain %s from %s-form to:", | |
− | var | + | gChain1, isForm), "A-form|B-form|Cancel", true) |
− | + | if (p == "A-form") { | |
− | + | toab = "A" | |
− | + | a = 24.0 | |
− | + | s = 4.6 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | + | else if (p == "B-form") { | |
− | + | toab = "B" | |
− | if ( | + | a = 33.3 |
− | + | s = 4.46 | |
} | } | ||
− | + | else { | |
− | + | color {all} @gScheme | |
− | + | return # early exit | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | { | ||
− | |||
} | } | ||
+ | } | ||
+ | else { | ||
+ | gEcho = "" | ||
+ | } | ||
+ | set echo TOP LEFT | ||
+ | background ECHO pink | ||
+ | var ps = "Converting to " + toab + " form..." | ||
+ | echo @ps | ||
+ | refresh | ||
+ | |||
+ | # Call worker function | ||
+ | adjust_nts(minres, maxres, gChain1, toab, a, s) | ||
− | + | select {thisModel} | |
− | + | if (a0) { | |
+ | translateSelected @{-a0.xyz} | ||
+ | } | ||
+ | |||
+ | background ECHO yellow | ||
+ | echo @gEcho | ||
+ | gBusy = false | ||
+ | } | ||
+ | |||
+ | } | ||
− | + | # Bound to ALT-LEFT-CLICK by plicoto_ab_nt | |
− | + | function to_ab_chain_mb() { | |
− | + | color {thisModel} @gScheme | |
− | + | gChain1 = {atomIndex=_atomPicked}.chain | |
− | + | color {(chain=gChain1) and thisModel} @gAltScheme | |
− | + | refresh | |
+ | to_ab_nt(false) | ||
+ | } | ||
− | + | # Bound to SHIFT-LEFT-CLICK by plicoto_ab_nt | |
− | + | function to_ab_res_mb() { | |
− | + | color {thisModel} @gScheme | |
− | + | iChain = {atomIndex=_atomPicked}.chain | |
− | + | res = {atomIndex=_atomPicked}.resno | |
− | + | color {(chain=iChain) and thisModel and (resno=res)} @gAltScheme | |
− | + | refresh | |
− | + | to_ab_single_nt(res, iChain) | |
− | |||
} | } | ||
− | + | # Load common functions if not already | |
− | + | function load_common() { | |
− | + | if (kCommon < 7) { | |
− | if (kCommon < | ||
script $SCRIPT_PATH$plicoCommon.spt | script $SCRIPT_PATH$plicoCommon.spt | ||
− | if (kCommon < | + | if (kCommon < 7) { |
prompt ("A newer version of plicoCommon.SPT is required") | prompt ("A newer version of plicoCommon.SPT is required") | ||
quit | quit | ||
} | } | ||
} | } | ||
− | + | if (kNTcommon < 6) { | |
− | + | script $SCRIPT_PATH$plicoNTcommon.spt | |
− | + | if (kNTcommon < 6) { | |
− | + | prompt ("A newer version of plicoNTcommon.SPT is required") | |
− | + | quit | |
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | # Top level of | + | # Top level of to_ab_nt |
− | function | + | function plico_to_ab_nt() { |
# Load common functions if not already | # Load common functions if not already | ||
− | if (kCommon < | + | if (kCommon < 7) { |
script $SCRIPT_PATH$plicoCommon.spt | script $SCRIPT_PATH$plicoCommon.spt | ||
− | if (kCommon < | + | if (kCommon < 7) { |
prompt ("A newer version of plicoCommon.SPT is required") | prompt ("A newer version of plicoCommon.SPT is required") | ||
+ | quit | ||
+ | } | ||
+ | } | ||
+ | if (kNTCommon < 6) { | ||
+ | script $SCRIPT_PATH$plicoCommon.spt | ||
+ | if (kCommon < 6) { | ||
+ | prompt ("A newer version of plicoNTcommon.SPT is required") | ||
quit | quit | ||
} | } | ||
Line 429: | Line 166: | ||
gPlico = "TO A-FORM/B-FORM" | gPlico = "TO A-FORM/B-FORM" | ||
− | + | plico_prelim(false, true) | |
− | gEcho = ("________A <==> B_______|ALT-CLICK= | + | gEcho = ("________A <==> B_______|ALT-CLICK=convert chain" + |
+ | "|SHIFT-CLICK=convert NT|SHIFT-DOUBLE-CLICK=exit") | ||
echo @gEcho | echo @gEcho | ||
− | |||
− | |||
bind "ALT-LEFT-CLICK" "_pickAtom"; | bind "ALT-LEFT-CLICK" "_pickAtom"; | ||
− | bind "ALT-LEFT-CLICK" "+: | + | bind "ALT-LEFT-CLICK" "+:to_ab_chain_mb"; |
− | bind "DOUBLE" " | + | bind "SHIFT-LEFT-CLICK" "_pickAtom"; |
+ | bind "SHIFT-LEFT-CLICK" "+:to_ab_res_mb"; | ||
+ | bind "SHIFT-DOUBLE" "plico_exit(true)"; | ||
+ | bind "LEFT-CLICK" "+:plico_menu_toggle"; | ||
} | } | ||
− | # End of | + | # End of to_ab_nt.SPT |
</pre> | </pre> |
Latest revision as of 17:05, 12 April 2016
ToABnt allows the user to convert a nucleotide or a polynucleotide chain or chain pair from A-form to B-form and vice versa.
When you ALT-CLICK on any atom, you are prompted to convert its chain from its current form to either the A-form or the B-form. The two forms differ primarily in the pucker conformation of their sugar moieties. The A-form has its sugars in the C3'-endo conformation whereas the B-form has it in the C2'-endo conformation. The A-form is characteristic of RNA while the B-form is characteristic of DNA.
When you SHIFT-CLICK on any atom, you are prompted to convert just the selected nucleotide.
This routine is called automatically by the Plico routine Polymeraze when a polynucleotide is generated.
ToABnt is a member of the Plico suite of protein folding tools described here. It may be installed and accessed as a macro with the file:
Title=PLICO toAB NT Script=script <path to your script directory>/toABnt.spt;plico_to_ab_nt
saved as toABnt.macro in your .jmol/macros directory as described in Macro.
Copy and paste the following into a text editor and save in your scripts directory as toABnt.spt.
# toABnt - Jmol script by Ron Mignery # v1.13 beta 4/12/2016 -require latest common includes # # Convert a nucleotide or polynucleotide chain # from A-form to B-form or vice versa # gToab = false gToabAlt = false gToA = false gBusy = false function to_ab_nt_auto(iChain, toA) { # Load common functions if not already load_common() gChain1 = iChain gToA = toA to_ab_nt(true) } function to_ab_single_nt(res, iChain) { var f = {atomIndex=_atomPicked}.file var m = {atomIndex=_atomPicked}.model var isForm = (is_form_a( res, iChain) ? "A" : "B") var p = prompt(format("Convert residue %d from %s-form to:", res, isForm), "A-form|B-form|Cancel", true) var toab = false if (p == "A-form") { toab = true } else if (p != "B-form") { color {all} @gScheme return # early exit } # Call worker function to_ab_nt_res(res, res+1, iChain, toab) } function to_ab_nt(auto) { if (not gBusy) { gBusy = true var toab = (gToA ? "A" : "B") var a = (gToA ? 24.0 : 33.3) var s = (gToA ? 4.6 : 4.46) var minres = get_resno_min(gChain1) var maxres = get_resno_max(gChain1) var a0 = within(kDtolerance, {0 0 0}) if (auto == false) { var f = {atomIndex=_atomPicked}.file var m = {atomIndex=_atomPicked}.model var isForm = (is_form_a( maxres, gChain1) ? "A" : "B") var p = prompt(format("Convert chain %s from %s-form to:", gChain1, isForm), "A-form|B-form|Cancel", true) if (p == "A-form") { toab = "A" a = 24.0 s = 4.6 } else if (p == "B-form") { toab = "B" a = 33.3 s = 4.46 } else { color {all} @gScheme return # early exit } } else { gEcho = "" } set echo TOP LEFT background ECHO pink var ps = "Converting to " + toab + " form..." echo @ps refresh # Call worker function adjust_nts(minres, maxres, gChain1, toab, a, s) select {thisModel} if (a0) { translateSelected @{-a0.xyz} } background ECHO yellow echo @gEcho gBusy = false } } # Bound to ALT-LEFT-CLICK by plicoto_ab_nt function to_ab_chain_mb() { color {thisModel} @gScheme gChain1 = {atomIndex=_atomPicked}.chain color {(chain=gChain1) and thisModel} @gAltScheme refresh to_ab_nt(false) } # Bound to SHIFT-LEFT-CLICK by plicoto_ab_nt function to_ab_res_mb() { color {thisModel} @gScheme iChain = {atomIndex=_atomPicked}.chain res = {atomIndex=_atomPicked}.resno color {(chain=iChain) and thisModel and (resno=res)} @gAltScheme refresh to_ab_single_nt(res, iChain) } # Load common functions if not already function load_common() { if (kCommon < 7) { script $SCRIPT_PATH$plicoCommon.spt if (kCommon < 7) { prompt ("A newer version of plicoCommon.SPT is required") quit } } if (kNTcommon < 6) { script $SCRIPT_PATH$plicoNTcommon.spt if (kNTcommon < 6) { prompt ("A newer version of plicoNTcommon.SPT is required") quit } } } # Top level of to_ab_nt function plico_to_ab_nt() { # Load common functions if not already if (kCommon < 7) { script $SCRIPT_PATH$plicoCommon.spt if (kCommon < 7) { prompt ("A newer version of plicoCommon.SPT is required") quit } } if (kNTCommon < 6) { script $SCRIPT_PATH$plicoCommon.spt if (kCommon < 6) { prompt ("A newer version of plicoNTcommon.SPT is required") quit } } gPlico = "TO A-FORM/B-FORM" plico_prelim(false, true) gEcho = ("________A <==> B_______|ALT-CLICK=convert chain" + "|SHIFT-CLICK=convert NT|SHIFT-DOUBLE-CLICK=exit") echo @gEcho bind "ALT-LEFT-CLICK" "_pickAtom"; bind "ALT-LEFT-CLICK" "+:to_ab_chain_mb"; bind "SHIFT-LEFT-CLICK" "_pickAtom"; bind "SHIFT-LEFT-CLICK" "+:to_ab_res_mb"; bind "SHIFT-DOUBLE" "plico_exit(true)"; bind "LEFT-CLICK" "+:plico_menu_toggle"; } # End of to_ab_nt.SPT