Difference between revisions of "User:Remig/plico/toABnt"

From Jmol
Jump to navigation Jump to search
(Add multi-frame support)
m
Line 94: Line 94:
 
         }
 
         }
 
     }
 
     }
     if (kNTcommon < 3) {
+
     if (kNTcommon < 4) {
 
         script $SCRIPT_PATH$plicoNTcommon.spt
 
         script $SCRIPT_PATH$plicoNTcommon.spt
         if (kNTcommon < 3) {
+
         if (kNTcommon < 4) {
 
             prompt ("A newer version of plicoNTcommon.SPT is required")
 
             prompt ("A newer version of plicoNTcommon.SPT is required")
 
             quit
 
             quit

Revision as of 14:51, 16 July 2014

ToABnt allows the user to convert a polynucleotide chain or chain pair from A-form to B-form and vice versa. Both chains are converted in double helixes. 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.

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.8 beta    7/11/2014 -add multi-frame support
#
#   Convert a 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_nt(auto) {
    if (not gBusy) {
        gBusy = TRUE
        var f = (_frameID/1000000)
        var m = (_frameID%1000000)
        var toab = (gToA ? "A" : "B")
        var a = (gToA ? 20.8 : 19.3)
        var s = (gToA ? 4.44 : 4.73)

        var minres = {(chain=gChain1) and (file=f)and (model=m)}.resno.min
        var maxres = {(chain=gChain1) and (file=f)and (model=m)}.resno.max
        var maxP = atom_rcn(maxres, gChain1, "P")
        var cp = maxP.xyz
        var w = array()
        for (var i = maxres-1; i <= minres; i--) {
            w += who_pairs(i, gChain1)
        }
        if (auto == FALSE) {
            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", TRUE)
            if (p == "A-form") {
                toab = "A"
                a = 20.8
                s = 4.44
            }
            else if (p == "B-form") {
                toab = "B"
                a = 19.3
                s = 4.73
            }
            else {
                color {all} @gScheme
                return # early exit
            }
            background ECHO pink
            refresh
            print format("Converting to %s", p)
        }
        adjust_nts(minres, maxres, gChain1, toab, a, s)
        select {(file=f)and (model=m)}
        var v = cp - maxP.xyz
        translateSelected @v
    }
}

# Bound to ALT-LEFT-CLICK by plicoto_ab_nt
function to_ab_chain_mb() {
    color {(file=f)and (model=m)} @gScheme
    gChain1 = {atomIndex=_atomPicked}.chain
    color {(chain=gChain1) and (file=f)and (model=m)} @gAltScheme
    refresh
    to_ab_nt(FALSE)
}

# Load common functions if not already
function load_common() {
    if (kCommon < 2) {
        script $SCRIPT_PATH$plicoCommon.spt
        if (kCommon < 2) {
            prompt ("A newer version of plicoCommon.SPT is required")
            quit
        }
    }
    if (kNTcommon < 4) {
        script $SCRIPT_PATH$plicoNTcommon.spt
        if (kNTcommon < 4) {
            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
    load_common()

    gPlico = "TO A-FORM/B-FORM"
    plico_prelim(FALSE)

    gEcho = ("________A <==> B_______|ALT-CLICK=mark chain|DOUBLE-CLICK=exit")
    echo @gEcho
    gChain = ""
    unbind

    bind "ALT-LEFT-CLICK" "_pickAtom";
    bind "ALT-LEFT-CLICK" "+:to_ab_chain_mb";
    bind "DOUBLE" "plico_exit";
}
# End of to_ab_nt.SPT

Contributors

Remig