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

From Jmol
Jump to navigation Jump to search
(Handle multiple frames)
(Add menu toggle)
Line 9: Line 9:
  
 
<pre>#  adjustNT - Jmol script by Ron Mignery
 
<pre>#  adjustNT - Jmol script by Ron Mignery
#  v1.1 beta    7/9/2014 -handle multiple frames
+
#  v1.2 beta    7/24/2015 -add menu toggle
 
#
 
#
 
#  Adjust the twist and spacing of  a polynucleotide chain
 
#  Adjust the twist and spacing of  a polynucleotide chain
Line 17: Line 17:
 
g5chain = ""
 
g5chain = ""
 
g3chain = ""
 
g3chain = ""
gBusy = FALSE
+
gBusy = false
  
 
function highlight_selection() {
 
function highlight_selection() {
Line 90: Line 90:
  
 
function adjust_mb() {
 
function adjust_mb() {
print "adjust_mb"
 
 
     if ((not gBusy) and (g5res >= 0)) {
 
     if ((not gBusy) and (g5res >= 0)) {
 
         var s = 0.0 + prompt("Enter base separation in angstroms", "4.8")%9999%0//4.68
 
         var s = 0.0 + prompt("Enter base separation in angstroms", "4.8")%9999%0//4.68
Line 101: Line 100:
 
                 }
 
                 }
 
                 else {
 
                 else {
                     gBusy = TRUE
+
                     gBusy = true
 
                     background ECHO pink
 
                     background ECHO pink
 
                     refresh
 
                     refresh
                    var savemt = useMinimizationThread
 
                    set useMinimizationThread FALSE
 
 
                     min5 = {chain=g5chain}.resno.min
 
                     min5 = {chain=g5chain}.resno.min
 
                     max5 = {chain=g5chain}.resno.max
 
                     max5 = {chain=g5chain}.resno.max
Line 135: Line 132:
 
                     # Clean up
 
                     # Clean up
 
                     for (var i = g5res; i < g3res; i++) {
 
                     for (var i = g5res; i < g3res; i++) {
                         fix_p_res(i, g5chain, TRUE)
+
                         fix_p_res(i, g5chain, true)
 
                     }
 
                     }
                    set useMinimizationThread savemt
+
                     gBusy = false
                     gBusy = FALSE
 
 
                     background ECHO yellow
 
                     background ECHO yellow
 
                     refresh
 
                     refresh
Line 151: Line 147:
  
 
     # Load common functions if not already
 
     # Load common functions if not already
     if (kCommon < 3) {
+
     if (kCommon < 6) {
 
         script $SCRIPT_PATH$plicoCommon.spt
 
         script $SCRIPT_PATH$plicoCommon.spt
         if (kCommon < 3) {
+
         if (kCommon < 6) {
 
             prompt ("A newer version of plicoCommon.SPT is required")
 
             prompt ("A newer version of plicoCommon.SPT is required")
 
             quit
 
             quit
Line 166: Line 162:
 
     }
 
     }
 
     gPlico = "Adjust NT"
 
     gPlico = "Adjust NT"
     plico_prelim(FALSE)
+
     plico_prelim(false)
  
 
     gEcho = ("______Adjust NT______|ALT-CLICK=mark 1" +
 
     gEcho = ("______Adjust NT______|ALT-CLICK=mark 1" +
Line 175: Line 171:
 
     g5chain = ""
 
     g5chain = ""
 
     g3chain = ""
 
     g3chain = ""
 +
    gMenuMin = false
 
     unbind
 
     unbind
  
Line 184: Line 181:
 
     bind "SHIFT-LEFT-CLICK" "+:adjust_mb";
 
     bind "SHIFT-LEFT-CLICK" "+:adjust_mb";
 
     bind "DOUBLE" "plico_exit";
 
     bind "DOUBLE" "plico_exit";
 +
    bind "LEFT-CLICK" "+:plico_menu_toggle";
 
}
 
}
 
# End of adjustNT.SPT
 
# End of adjustNT.SPT
 
</pre>
 
</pre>

Revision as of 18:53, 24 July 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.2 beta    7/24/2015 -add menu toggle
#
#   Adjust the twist and spacing of  a polynucleotide chain
#
g5res = -1
g3res = -1
g5chain = ""
g3chain = ""
gBusy = false

function highlight_selection() {
    var f = (_frameID/1000000)
    var m = (_frameID%1000000)

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

    select ((file=f) and (model=m))
    color {selected} @gScheme
    halo off
    if (g3res < 0) {
        if (g5res >= 0) {
            select {(chain=g5chain) and (file=f) and (model=m)}
            color {selected} @gAltScheme
            select {(resno=g5res) and (chain=g5chain) and (file=f) and (model=m)}
            halo on
        }
    }
    else if (g5chain == g3chain)  {
        select {(resno >= g5res) and (resno <= g3res)
            and (chain=g5Chain) and (file=f) and (model=m)}
        color {selected} @gAltScheme
        select {((resno=g5res) or (resno=g3res)) and (chain=g5chain)
            and (file=f) and (model=m)}
        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 = {chain=g5chain}.resno.min
                    max5 = {chain=g5chain}.resno.max
                    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)

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

    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 "DOUBLE" "plico_exit";
    bind "LEFT-CLICK" "+:plico_menu_toggle";
}
# End of adjustNT.SPT

Contributors

Remig