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

From Jmol
Jump to navigation Jump to search
(Add menu toggle)
m
Line 9: Line 9:
  
 
<pre>#  adjustNT - Jmol script by Ron Mignery
 
<pre>#  adjustNT - Jmol script by Ron Mignery
#  v1.2 beta    7/24/2015 -add menu toggle
+
#  v1.3 beta    9/11/2015 -use thisModel
 
#
 
#
 
#  Adjust the twist and spacing of  a polynucleotide chain
 
#  Adjust the twist and spacing of  a polynucleotide chain
Line 20: Line 20:
  
 
function highlight_selection() {
 
function highlight_selection() {
    var f = (_frameID/1000000)
 
    var m = (_frameID%1000000)
 
  
 
     if ((g3res >= 0) and ((g3res < g5res) or  (g5res < 0))) {
 
     if ((g3res >= 0) and ((g3res < g5res) or  (g5res < 0))) {
Line 32: Line 30:
 
     }
 
     }
  
     select ((file=f) and (model=m))
+
     select (thisModel)
 
     color {selected} @gScheme
 
     color {selected} @gScheme
 
     halo off
 
     halo off
 
     if (g3res < 0) {
 
     if (g3res < 0) {
 
         if (g5res >= 0) {
 
         if (g5res >= 0) {
             select {(chain=g5chain) and (file=f) and (model=m)}
+
             select {(chain=g5chain) and thisModel}
 
             color {selected} @gAltScheme
 
             color {selected} @gAltScheme
             select {(resno=g5res) and (chain=g5chain) and (file=f) and (model=m)}
+
             select {(resno=g5res) and (chain=g5chain) and thisModel}
 
             halo on
 
             halo on
 
         }
 
         }
Line 45: Line 43:
 
     else if (g5chain == g3chain)  {
 
     else if (g5chain == g3chain)  {
 
         select {(resno >= g5res) and (resno <= g3res)
 
         select {(resno >= g5res) and (resno <= g3res)
             and (chain=g5Chain) and (file=f) and (model=m)}
+
             and (chain=g5Chain) and thisModel}
 
         color {selected} @gAltScheme
 
         color {selected} @gAltScheme
 
         select {((resno=g5res) or (resno=g3res)) and (chain=g5chain)
 
         select {((resno=g5res) or (resno=g3res)) and (chain=g5chain)
             and (file=f) and (model=m)}
+
             and thisModel}
 
         halo on
 
         halo on
 
     }
 
     }
Line 103: Line 101:
 
                     background ECHO pink
 
                     background ECHO pink
 
                     refresh
 
                     refresh
                     min5 = {chain=g5chain}.resno.min
+
                     min5 = get_resno_min(g5chain)
                     max5 = {chain=g5chain}.resno.max
+
                     max5 = get_resno_max(g5chain)
 
                     if (g3res < 0) {
 
                     if (g3res < 0) {
 
                         g5res = min5
 
                         g5res = min5
Line 161: Line 159:
 
         }
 
         }
 
     }
 
     }
 +
 
     gPlico = "Adjust NT"
 
     gPlico = "Adjust NT"
     plico_prelim(false)
+
     plico_prelim(false, true)
  
 
     gEcho = ("______Adjust NT______|ALT-CLICK=mark 1" +
 
     gEcho = ("______Adjust NT______|ALT-CLICK=mark 1" +
         "|ALT-CTRL-CLICK=mark 2|SHIFT-CLICK=adjust" + "|DOUBLE-CLICK=exit")
+
         "|ALT-CTRL-CLICK=mark 2|SHIFT-CLICK=adjust" + "|SHIFT-DOUBLE-CLICK=exit")
 
     echo @gEcho
 
     echo @gEcho
 
     g5res = -1
 
     g5res = -1
Line 171: Line 170:
 
     g5chain = ""
 
     g5chain = ""
 
     g3chain = ""
 
     g3chain = ""
    gMenuMin = false
 
    unbind
 
  
 
     bind "ALT-LEFT-CLICK" "_pickAtom";
 
     bind "ALT-LEFT-CLICK" "_pickAtom";
Line 180: Line 177:
 
     bind "SHIFT-LEFT-CLICK" "_pickAtom";
 
     bind "SHIFT-LEFT-CLICK" "_pickAtom";
 
     bind "SHIFT-LEFT-CLICK" "+:adjust_mb";
 
     bind "SHIFT-LEFT-CLICK" "+:adjust_mb";
     bind "DOUBLE" "plico_exit";
+
     bind "SHIFT-DOUBLE" "plico_exit";
 
     bind "LEFT-CLICK" "+:plico_menu_toggle";
 
     bind "LEFT-CLICK" "+:plico_menu_toggle";
 
}
 
}
 
# End of adjustNT.SPT
 
# End of adjustNT.SPT
 
</pre>
 
</pre>

Revision as of 15:14, 11 September 2015

AdjustNT allows the user to change the spacing and twist of a portion of a polynucleotide chain or chain pair. When you ALT-CLICK on any atom, its residue is marked with halos and its entire chain is highlighted and selected. You may then ALT-CTRL-CLICK on another residue in the same chain and its residue will then be marked with halos; the stretch of just the polynucleotides between the two residues will then be selected and highlighted. If you then SHIFT-CLICK anywhere, you are prompted to enter a new interbase spacing, i. e. the distance in angstroms between the proximal base atom (the one connected to C1') of one base and the next. Next you will be prompted for the desired angle between the bases measured as the dihedral between the previously described atoms and the distal ring nitrogens. The selected polynucleotide stretch will then be so adjusted. Note that this may take some time and that the legend background color will go pink for the duration of processing. Note that unusual values entered may produce unusual results with atom collisions. When you DOUBLE-CLICK to exit, however, you are given the chance to undo if desired.

AdjustNT 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 Adjust polynucleotide
Script=script <path to your script directory>/adjustNT.spt;plico_adjust_nt

saved as adjustNT.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 adjustNT.spt.

#   adjustNT - Jmol script by Ron Mignery
#   v1.3 beta    9/11/2015 -use thisModel
#
#   Adjust the twist and spacing of  a polynucleotide chain
#
g5res = -1
g3res = -1
g5chain = ""
g3chain = ""
gBusy = false

function highlight_selection() {

    if ((g3res >= 0) and ((g3res < g5res) or  (g5res < 0))) {
        i = g5res
        g5res = g3res
        g3res = i
        i = g5chain
        g5chain = g3chain
        g3chain = i
    }

    select (thisModel)
    color {selected} @gScheme
    halo off
    if (g3res < 0) {
        if (g5res >= 0) {
            select {(chain=g5chain) and thisModel}
            color {selected} @gAltScheme
            select {(resno=g5res) and (chain=g5chain) and thisModel}
            halo on
        }
    }
    else if (g5chain == g3chain)  {
        select {(resno >= g5res) and (resno <= g3res)
            and (chain=g5Chain) and thisModel}
        color {selected} @gAltScheme
        select {((resno=g5res) or (resno=g3res)) and (chain=g5chain)
            and thisModel}
        halo on
    }
}

function mark_nt_1_mb() {
    var r = {atomIndex=_atomPicked}.resno
    var iChain = {atomIndex=_atomPicked}.chain
    if ((g5res == r) and (g5chain = iChain)) {
        g5res = -1
        g5chain = ""
    }
    else {
        g5res = r
        g5chain = iChain
        if (g3chain != g5chain) {
            g3res = -1
            g3chain = ""
        }
    }
    highlight_selection()
}

function mark_nt_2_mb() {
    var r = {atomIndex=_atomPicked}.resno
    var iChain = {atomIndex=_atomPicked}.chain
    if ((g3res == r) and (g3chain = iChain)) {
        g3res = -1
        g3chain = ""
    }
    else {
        g3res = r
        g3chain = iChain
        if (g5chain != g3chain) {
            g5res = -1
            g5chain = ""
        }
    }
    highlight_selection()
}

function adjust_mb() {
    if ((not gBusy) and (g5res >= 0)) {
        var s = 0.0 + prompt("Enter base separation in angstroms", "4.8")%9999%0//4.68
        if (s != "NaN") {
            var a = 0.0 + prompt("Enter base angle in degrees", "23.7")%9999%0//24.2
            if (a != "NaN") {
                if ((s.type != "decimal") or (a.type != "decimal")
                    or (s < 2.0) or (s > 10) or (a < -180) or (a > 180)) {
                    prompt (format("Parameters (s=%s a=%s) out of range", s, a))
                }
                else {
                    gBusy = true
                    background ECHO pink
                    refresh
                    min5 = get_resno_min(g5chain)
                    max5 = get_resno_max(g5chain)
                    if (g3res < 0) {
                        g5res = min5
                        g3res = max5
                    }

                    # Collect any pairing
                    w = array()
                    for (var i = min5; i < max5; i++) {
                        w = w + [who_pairs(i, g5chain)]
                    }

                    # Twist and turn
                    for (var i = g5res; i < g3res; i++) {
                        base_stack_res(i, i+1, g5chain, g5chain, s, a)
                    }

                    # Restore pairings
                    var j = 1
                    for (var i = min5; i < max5; i++) {
                        if ((w[j])[1] >= 0) {
                            pair_it_res((w[j])[1], i, -1, (w[j])[2], g5chain)
                        }
                        j++
                    }

                    # Clean up
                    for (var i = g5res; i < g3res; i++) {
                        fix_p_res(i, g5chain, true)
                    }
                    gBusy = false
                    background ECHO yellow
                    refresh
                }
            }
        }
    }
}

# Top level of adjustNT
function plico_adjust_nt() {

    # Load common functions if not already
    if (kCommon < 6) {
        script $SCRIPT_PATH$plicoCommon.spt
        if (kCommon < 6) {
            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
        }
    }

    gPlico = "Adjust NT"
    plico_prelim(false, true)

    gEcho = ("______Adjust NT______|ALT-CLICK=mark 1" +
        "|ALT-CTRL-CLICK=mark 2|SHIFT-CLICK=adjust" + "|SHIFT-DOUBLE-CLICK=exit")
    echo @gEcho
    g5res = -1
    g3res = -1
    g5chain = ""
    g3chain = ""

    bind "ALT-LEFT-CLICK" "_pickAtom";
    bind "ALT-LEFT-CLICK" "+:mark_nt_1_mb";
    bind "ALT-CTRL-LEFT-CLICK" "_pickAtom";
    bind "ALT-CTRL-LEFT-CLICK" "+:mark_nt_2_mb";
    bind "SHIFT-LEFT-CLICK" "_pickAtom";
    bind "SHIFT-LEFT-CLICK" "+:adjust_mb";
    bind "SHIFT-DOUBLE" "plico_exit";
    bind "LEFT-CLICK" "+:plico_menu_toggle";
}
# End of adjustNT.SPT

Contributors

Remig