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

From Jmol
Jump to navigation Jump to search
(Jmol script to adjust spacing and twist of a portion of a single or double-stranded polynucleotide)
 
(Handle multiple frames)
Line 9: Line 9:
  
 
<pre>#  adjustNT - Jmol script by Ron Mignery
 
<pre>#  adjustNT - Jmol script by Ron Mignery
#  v1.0 beta    6/9/2014
+
#  v1.1 beta    7/9/2014 -handle multiple frames
 
#
 
#
 
#  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
  
 
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))) {
 
         i = g5res
 
         i = g5res
Line 27: Line 31:
 
         g3chain = i
 
         g3chain = i
 
     }
 
     }
   
+
 
     select all
+
     select ((file=f) and (model=m))
     color jmol
+
     color {selected} @gScheme
 
     halo off
 
     halo off
 
     if (g3res < 0) {
 
     if (g3res < 0) {
 
         if (g5res >= 0) {
 
         if (g5res >= 0) {
             select {chain=g5chain}
+
             select {(chain=g5chain) and (file=f) and (model=m)}
             color rasmol
+
             color {selected} @gAltScheme
             select {(resno=g5res) and (chain=g5chain)}
+
             select {(resno=g5res) and (chain=g5chain) and (file=f) and (model=m)}
 
             halo on
 
             halo on
 
         }
 
         }
 
     }
 
     }
 
     else if (g5chain == g3chain)  {
 
     else if (g5chain == g3chain)  {
         select {(resno >= g5res) and (resno <= g3res) and chain=iChain}
+
         select {(resno >= g5res) and (resno <= g3res)
         color rasmol
+
            and (chain=g5Chain) and (file=f) and (model=m)}
            select {((resno=g5res) or (resno=g3res)) and (chain=g5chain)}
+
         color {selected} @gAltScheme
 +
        select {((resno=g5res) or (resno=g3res)) and (chain=g5chain)
 +
            and (file=f) and (model=m)}
 
         halo on
 
         halo on
 
     }
 
     }
Line 48: Line 54:
  
 
function mark_nt_1_mb() {
 
function mark_nt_1_mb() {
     r = {atomIndex=_atomPicked}.resno
+
     var r = {atomIndex=_atomPicked}.resno
     iChain = {atomIndex=_atomPicked}.chain
+
     var iChain = {atomIndex=_atomPicked}.chain
 
     if ((g5res == r) and (g5chain = iChain)) {
 
     if ((g5res == r) and (g5chain = iChain)) {
 
         g5res = -1
 
         g5res = -1
Line 66: Line 72:
  
 
function mark_nt_2_mb() {
 
function mark_nt_2_mb() {
     r = {atomIndex=_atomPicked}.resno
+
     var r = {atomIndex=_atomPicked}.resno
     iChain = {atomIndex=_atomPicked}.chain
+
     var iChain = {atomIndex=_atomPicked}.chain
 
     if ((g3res == r) and (g3chain = iChain)) {
 
     if ((g3res == r) and (g3chain = iChain)) {
 
         g3res = -1
 
         g3res = -1
Line 86: Line 92:
 
print "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
+
         var s = 0.0 + prompt("Enter base separation in angstroms", "4.8")%9999%0//4.68
 
         if (s != "NaN") {
 
         if (s != "NaN") {
             var a = 0.0 + prompt("Enter base angle in degrees", "23.7")%9999%0
+
             var a = 0.0 + prompt("Enter base angle in degrees", "23.7")%9999%0//24.2
 
             if (a != "NaN") {
 
             if (a != "NaN") {
 
                 if ((s.type != "decimal") or (a.type != "decimal")
 
                 if ((s.type != "decimal") or (a.type != "decimal")
Line 100: Line 106:
 
                     var savemt = useMinimizationThread
 
                     var savemt = useMinimizationThread
 
                     set useMinimizationThread FALSE
 
                     set useMinimizationThread FALSE
                     var min5 = {chain=g5chain}.resno.min
+
                     min5 = {chain=g5chain}.resno.min
                     var max5 = {chain=g5chain}.resno.max
+
                     max5 = {chain=g5chain}.resno.max
 
                     if (g3res < 0) {
 
                     if (g3res < 0) {
 
                         g5res = min5
 
                         g5res = min5
 
                         g3res = max5
 
                         g3res = max5
 
                     }
 
                     }
                   
+
 
 
                     # Collect any pairing
 
                     # Collect any pairing
                     var w = array()
+
                     w = array()
 
                     for (var i = min5; i < max5; i++) {
 
                     for (var i = min5; i < max5; i++) {
 
                         w = w + [who_pairs(i, g5chain)]
 
                         w = w + [who_pairs(i, g5chain)]
 
                     }
 
                     }
                   
+
 
 
                     # Twist and turn
 
                     # Twist and turn
 
                     for (var i = g5res; i < g3res; i++) {
 
                     for (var i = g5res; i < g3res; i++) {
                         base_stack_a(i, i+1, g5chain, g5chain, s, a)  
+
                         base_stack_res(i, i+1, g5chain, g5chain, s, a)
 
                     }
 
                     }
                   
+
 
 
                     # Restore pairings
 
                     # Restore pairings
 
                     var j = 1
 
                     var j = 1
 
                     for (var i = min5; i < max5; i++) {
 
                     for (var i = min5; i < max5; i++) {
 
                         if ((w[j])[1] >= 0) {
 
                         if ((w[j])[1] >= 0) {
                             pair_it_res((w[j])[1], i, (w[j])[2], g5chain)
+
                             pair_it_res((w[j])[1], i, -1, (w[j])[2], g5chain)
 
                         }
 
                         }
                         j++
+
                         j++
 
                     }
 
                     }
                   
+
 
 
                     # Clean up
 
                     # Clean up
 
                     for (var i = g5res; i < g3res; i++) {
 
                     for (var i = g5res; i < g3res; i++) {
                         fix_p_res(i, g5chain)  
+
                         fix_p_res(i, g5chain, TRUE)
 
                     }
 
                     }
 
                     set useMinimizationThread savemt
 
                     set useMinimizationThread savemt
Line 145: Line 151:
  
 
     # Load common functions if not already
 
     # Load common functions if not already
     if (kCommon < 2) {
+
     if (kCommon < 3) {
 
         script $SCRIPT_PATH$plicoCommon.spt
 
         script $SCRIPT_PATH$plicoCommon.spt
         if (kCommon < 2) {
+
         if (kCommon < 3) {
 
             prompt ("A newer version of plicoCommon.SPT is required")
 
             prompt ("A newer version of plicoCommon.SPT is required")
 
             quit
 
             quit
 
         }
 
         }
 
     }
 
     }
     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 16:02, 21 July 2014

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.1 beta    7/9/2014 -handle multiple frames
#
#   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() {
print "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
                    var savemt = useMinimizationThread
                    set useMinimizationThread FALSE
                    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)
                    }
                    set useMinimizationThread savemt
                    gBusy = FALSE
                    background ECHO yellow
                    refresh
                }
            }
        }
    }
}

# Top level of adjustNT
function plico_adjust_nt() {

    # Load common functions if not already
    if (kCommon < 3) {
        script $SCRIPT_PATH$plicoCommon.spt
        if (kCommon < 3) {
            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 = ""
    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";
}
# End of adjustNT.SPT

Contributors

Remig