User:Remig/plico/adjustNT
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