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)
 
m
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''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''' 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 ALT-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 SHIFT-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  [[User:Remig/plico|here]]. It may be installed and accessed as a macro with the file:
 
AdjustNT 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:
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.4 beta    4/12/2016 -require latest common includes
 
#
 
#
 
#  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() {
 +
 
     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 29:
 
         g3chain = i
 
         g3chain = i
 
     }
 
     }
   
+
 
     select all
+
     select (thisModel)
     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 thisModel}
             color rasmol
+
             color {selected} @gAltScheme
             select {(resno=g5res) and (chain=g5chain)}
+
             select {(resno=g5res) and (chain=g5chain) and thisModel}
 
             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 thisModel}
            select {((resno=g5res) or (resno=g3res)) and (chain=g5chain)}
+
         color {selected} @gAltScheme
 +
        select {((resno=g5res) or (resno=g3res)) and (chain=g5chain)
 +
            and thisModel}
 
         halo on
 
         halo on
 
     }
 
     }
Line 48: Line 52:
  
 
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 70:
  
 
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 84: Line 88:
  
 
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
+
         var s = 0.0 + prompt("Enter base separation in angstroms", "4.8")%9999%0//4.68
         if (s != "NaN") {
+
         if (abs(s).type == "decimal") {
             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 (abs(a).type == "string") {
 
                 if ((s.type != "decimal") or (a.type != "decimal")
 
                 if ((s.type != "decimal") or (a.type != "decimal")
 
                     or (s < 2.0) or (s > 10) or (a < -180) or (a > 180)) {
 
                     or (s < 2.0) or (s > 10) or (a < -180) or (a > 180)) {
Line 95: Line 98:
 
                 }
 
                 }
 
                 else {
 
                 else {
                     gBusy = TRUE
+
                     gBusy = true
 
                     background ECHO pink
 
                     background ECHO pink
 
                     refresh
 
                     refresh
                     var savemt = useMinimizationThread
+
                     min5 = get_resno_min(g5chain)
                    set useMinimizationThread FALSE
+
                     max5 = get_resno_max(g5chain)
                    var min5 = {chain=g5chain}.resno.min
 
                     var 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
+
                     gBusy = false
                     gBusy = FALSE
 
 
                     background ECHO yellow
 
                     background ECHO yellow
 
                     refresh
 
                     refresh
Line 145: Line 145:
  
 
     # Load common functions if not already
 
     # Load common functions if not already
     if (kCommon < 2) {
+
     if (kCommon < 7) {
 
         script $SCRIPT_PATH$plicoCommon.spt
 
         script $SCRIPT_PATH$plicoCommon.spt
         if (kCommon < 2) {
+
         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 < 3) {
+
     if (kNTcommon < 6) {
 
         script $SCRIPT_PATH$plicoNTcommon.spt
 
         script $SCRIPT_PATH$plicoNTcommon.spt
         if (kNTcommon < 3) {
+
         if (kNTcommon < 6) {
 
             prompt ("A newer version of plicoNTcommon.SPT is required")
 
             prompt ("A newer version of plicoNTcommon.SPT is required")
 
             quit
 
             quit
 
         }
 
         }
 
     }
 
     }
 +
 
     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|ALT-SHIFT-CLICK=adjust" + "|SHIFT-DOUBLE-CLICK=exit")
 
     echo @gEcho
 
     echo @gEcho
 
     g5res = -1
 
     g5res = -1
Line 169: Line 170:
 
     g5chain = ""
 
     g5chain = ""
 
     g3chain = ""
 
     g3chain = ""
    unbind
 
  
 
     bind "ALT-LEFT-CLICK" "_pickAtom";
 
     bind "ALT-LEFT-CLICK" "_pickAtom";
Line 175: Line 175:
 
     bind "ALT-CTRL-LEFT-CLICK" "_pickAtom";
 
     bind "ALT-CTRL-LEFT-CLICK" "_pickAtom";
 
     bind "ALT-CTRL-LEFT-CLICK" "+:mark_nt_2_mb";
 
     bind "ALT-CTRL-LEFT-CLICK" "+:mark_nt_2_mb";
     bind "SHIFT-LEFT-CLICK" "_pickAtom";
+
     bind "ALT-SHIFT-LEFT-CLICK" "_pickAtom";
     bind "SHIFT-LEFT-CLICK" "+:adjust_mb";
+
     bind "ALT-SHIFT-LEFT-CLICK" "+:adjust_mb";
     bind "DOUBLE" "plico_exit";
+
     bind "SHIFT-DOUBLE" "plico_exit";
 +
    bind "LEFT-CLICK" "+:plico_menu_toggle";
 
}
 
}
 
# End of adjustNT.SPT
 
# End of adjustNT.SPT
 
</pre>
 
</pre>

Latest revision as of 17:26, 12 April 2016

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 ALT-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 SHIFT-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.4 beta    4/12/2016 -require latest common includes
#
#   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 (abs(s).type == "decimal") {
            var a = 0.0 + prompt("Enter base angle in degrees", "23.7")%9999%0//24.2
            if (abs(a).type == "string") {
                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 < 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
        }
    }

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

    gEcho = ("______Adjust NT______|ALT-CLICK=mark 1" +
        "|ALT-CTRL-CLICK=mark 2|ALT-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 "ALT-SHIFT-LEFT-CLICK" "_pickAtom";
    bind "ALT-SHIFT-LEFT-CLICK" "+:adjust_mb";
    bind "SHIFT-DOUBLE" "plico_exit";
    bind "LEFT-CLICK" "+:plico_menu_toggle";
}
# End of adjustNT.SPT

Contributors

Remig