Difference between revisions of "User:Remig/plico/plots"
(Some useful plots for manually folding polyopeptides) |
m |
||
Line 23: | Line 23: | ||
<pre># plots - Jmol script by Ron Mignery | <pre># plots - Jmol script by Ron Mignery | ||
− | # v1. | + | # v1.1 beta 4/12/2016 -require latest common includes |
# | # | ||
Line 30: | Line 30: | ||
select none | select none | ||
+ | var resmax = 0 | ||
var iChain = "" | var iChain = "" | ||
var chains = {not hoh and not ligands and thisModel}.chain | var chains = {not hoh and not ligands and thisModel}.chain | ||
Line 36: | Line 37: | ||
iChain = chains[c] | iChain = chains[c] | ||
for (var i = get_resno_min(iChain); i <= get_resno_max(iChain); i++) { | for (var i = get_resno_min(iChain); i <= get_resno_max(iChain); i++) { | ||
+ | try { | ||
var aN = get_atom_rcn(i, iChain, "N") | var aN = get_atom_rcn(i, iChain, "N") | ||
var aCA = get_atom_rcn(i, iChain, "CA") | var aCA = get_atom_rcn(i, iChain, "CA") | ||
Line 61: | Line 63: | ||
select ADD aCA | select ADD aCA | ||
+ | } | ||
+ | catch { | ||
+ | print "error" | ||
+ | } | ||
+ | if (i > resmax) { | ||
+ | resmax = i | ||
+ | } | ||
} | } | ||
} | } | ||
} | } | ||
− | gPlotEcho[1 + _lastFrame[1]] = "vx = chi 1 (0 if none) vy = chi 2 (0 if none)" | + | gPlotEcho[1 + _lastFrame[1]] = "vx = chi 1 (0 if none) vy = chi 2 (0 if none) {hover = chi1 chi2 resno)" |
− | plot properties vx vy resno | + | plot properties vx vy resno MIN{-180, -180, 1} MAX{180, 180, @resmax} |
} | } | ||
Line 71: | Line 80: | ||
print "Plotting CHIs 3&4" | print "Plotting CHIs 3&4" | ||
select none | select none | ||
+ | var resmax = 0 | ||
var iChain = "" | var iChain = "" | ||
var chains = {not hoh and not ligands and thisModel}.chain | var chains = {not hoh and not ligands and thisModel}.chain | ||
Line 95: | Line 105: | ||
aCZ = get_atom_rcn(i, iChain, "?Z1") | aCZ = get_atom_rcn(i, iChain, "?Z1") | ||
} | } | ||
− | if (aCE) { | + | if (aCE.size > 0) { |
aCA.vx = angle(aCB, aCG, aCD, aCE) | aCA.vx = angle(aCB, aCG, aCD, aCE) | ||
− | if (aCZ) { | + | if (aCZ.size > 0) { |
aCA.vy = angle(aCG, aCD, aCE, aCZ) | aCA.vy = angle(aCG, aCD, aCE, aCZ) | ||
} | } | ||
Line 109: | Line 119: | ||
select ADD aCA | select ADD aCA | ||
+ | if (i > resmax) { | ||
+ | resmax = i | ||
+ | } | ||
} | } | ||
} | } | ||
} | } | ||
− | gPlotEcho[1 + _lastFrame[1]] = "vx = chi 3 (0 if none) vy = chi 4 (0 if none)" | + | gPlotEcho[1 + _lastFrame[1]] = "vx = chi 3 (0 if none) vy = chi 4 (0 if none) {hover = resno chi3 chi4)" |
− | plot properties resno vx vy | + | plot properties resno vx vy MIN{1, -180, -180} MAX{@resmax, 180, 180} |
} | } | ||
Line 123: | Line 136: | ||
var aCAp = ({}) | var aCAp = ({}) | ||
var aCp = ({}) | var aCp = ({}) | ||
+ | var resmax = 0 | ||
var iChain = "" | var iChain = "" | ||
var chains = {not hoh and not ligands and thisModel}.chain | var chains = {not hoh and not ligands and thisModel}.chain | ||
Line 144: | Line 158: | ||
aCAp = aCA | aCAp = aCA | ||
aCp = aC | aCp = aC | ||
+ | if (i > resmax) { | ||
+ | resmax = i | ||
+ | } | ||
} | } | ||
} | } | ||
} | } | ||
− | gPlotEcho[1 + _lastFrame[1]] = "vx = phi vy = n-ward psi" | + | gPlotEcho[1 + _lastFrame[1]] = "vx = phi vy = n-ward psi (hover = phi resno psi)" |
− | plot properties vx resno vy | + | plot properties vx resno vy MIN{-180, 1, -180} MAX{180, @resmax, 180} |
} | } | ||
Line 156: | Line 173: | ||
var first = true | var first = true | ||
var aCp = ({}) | var aCp = ({}) | ||
+ | var resmax = 0 | ||
var iChain = "" | var iChain = "" | ||
var chains = {not hoh and not ligands and thisModel}.chain | var chains = {not hoh and not ligands and thisModel}.chain | ||
Line 176: | Line 194: | ||
} | } | ||
aCp = aC | aCp = aC | ||
+ | if (i > resmax) { | ||
+ | resmax = i | ||
+ | } | ||
} | } | ||
} | } | ||
} | } | ||
− | gPlotEcho[1 + _lastFrame[1]] = "vx = phi vy = psi" | + | gPlotEcho[1 + _lastFrame[1]] = "vx = phi vy = psi (hover = psi resno phi)" |
− | plot properties vy resno vx | + | plot properties vy resno vx MIN{-180, 1, -180} MAX{180, @resmax, 180} |
} | } | ||
Line 234: | Line 255: | ||
# Load common functions if not already | # Load common functions if not already | ||
− | if (kCommon < | + | if (kCommon < 7) { |
script $SCRIPT_PATH$plicoCommon.spt | script $SCRIPT_PATH$plicoCommon.spt | ||
− | if (kCommon < | + | if (kCommon < 7) { |
prompt ("A newer version of plicoCommon.SPT is required") | prompt ("A newer version of plicoCommon.SPT is required") | ||
quit | quit |
Latest revision as of 17:38, 12 April 2016
Plots allows the user to generate explorable 3D plots of various interesting aspects of protein folding such as O rotations, chi values, and phi psi values. A menu is presented of available actions:
Plot O rotations - plot the phi and psi angle on either side of all peptide bonds. This is useful to view where O atoms have been pushed aside.
Plot CHIs 1&2 - plot chi values 1 & 2 (0 if n/a).
Plot CHIs 2&3 - plot chi values 2 & 3 (0 if n/a).
Plot PHIs and PSIs - a Ramachandran plot.
Back - exit plots.
All plots have 'resno' as the third dimension. The plots are of the vx and vx values of a single atom from each residue (N or CA). The vx and vy values are overloaded with the values of interest before the plot is generated.
Note that display, select, color, halo on/off, etc. commands may be applied to the plot to highlight and identify areas and aspects of interest.
Plots 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 Plots Script=script <path to your script directory>/plots.spt;plico_plots
saved as Plots.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 plots.spt.
# plots - Jmol script by Ron Mignery # v1.1 beta 4/12/2016 -require latest common includes # function plot_chis12() { print "Plotting CHIs 1&2" select none var resmax = 0 var iChain = "" var chains = {not hoh and not ligands and thisModel}.chain for (var c = 1; c <= chains.size; c++) { if (iChain != chains[c]) { iChain = chains[c] for (var i = get_resno_min(iChain); i <= get_resno_max(iChain); i++) { try { var aN = get_atom_rcn(i, iChain, "N") var aCA = get_atom_rcn(i, iChain, "CA") var aCB = get_atom_rcn(i, iChain, "CB") var aCG = get_atom_rcn(i, iChain, "?G") if (aCG.size == 0) { aCG = get_atom_rcn(i, iChain, "?G1") } var aCD = get_atom_rcn(i, iChain, "?D") if (aCD.size == 0) { aCD = get_atom_rcn(i, iChain, "?D1") } if (aCG) { aCA.vx = angle(aN, aCA, aCB, aCG) if (aCD) { aCA.vy = angle(aCA, aCB, aCG, aCD) } else { aCA.vy = 0 } } else { aCA.vx = 0 } select ADD aCA } catch { print "error" } if (i > resmax) { resmax = i } } } } gPlotEcho[1 + _lastFrame[1]] = "vx = chi 1 (0 if none) vy = chi 2 (0 if none) {hover = chi1 chi2 resno)" plot properties vx vy resno MIN{-180, -180, 1} MAX{180, 180, @resmax} } function plot_chis34( ) { print "Plotting CHIs 3&4" select none var resmax = 0 var iChain = "" var chains = {not hoh and not ligands and thisModel}.chain for (var c = 1; c <= chains.size; c++) { if (iChain != chains[c]) { iChain = chains[c] for (var i = get_resno_min(iChain); i <= get_resno_max(iChain); i++) { var aCA = get_atom_rcn(i, iChain, "CA") var aCB = get_atom_rcn(i, iChain, "CB") var aCG = get_atom_rcn(i, iChain, "?G") if (aCG.size == 0) { aCG = get_atom_rcn(i, iChain, "?G1") } var aCD = get_atom_rcn(i, iChain, "?D") if (aCD.size == 0) { aCD = get_atom_rcn(i, iChain, "?D1") } var aCE = get_atom_rcn(i, iChain, "?E") if (aCE.size == 0) { aCE = get_atom_rcn(i, iChain, "?E1") } var aCZ = get_atom_rcn(i, iChain, "?Z") if (aCZ.size == 0) { aCZ = get_atom_rcn(i, iChain, "?Z1") } if (aCE.size > 0) { aCA.vx = angle(aCB, aCG, aCD, aCE) if (aCZ.size > 0) { aCA.vy = angle(aCG, aCD, aCE, aCZ) } else { aCA.vy = 0 } } else { aCA.vx = 0 } select ADD aCA if (i > resmax) { resmax = i } } } } gPlotEcho[1 + _lastFrame[1]] = "vx = chi 3 (0 if none) vy = chi 4 (0 if none) {hover = resno chi3 chi4)" plot properties resno vx vy MIN{1, -180, -180} MAX{@resmax, 180, 180} } function plot_o_rot() { print "Plotting O rotations" select none var first = true var aNp = ({}) var aCAp = ({}) var aCp = ({}) var resmax = 0 var iChain = "" var chains = {not hoh and not ligands and thisModel}.chain for (var c = 1; c <= chains.size; c++) { if (iChain != chains[c]) { iChain = chains[c] for (var i = get_resno_min(iChain); i <= get_resno_max(iChain); i++) { var aN = get_atom_rcn(i, iChain, "N") var aCA = get_atom_rcn(i, iChain, "CA") var aC = get_atom_rcn(i, iChain, "C") if (first) { first = false } else { aN.vx = angle(aCp, aN, aCA, aC) aN.vy = angle(aNp, aCAp, aCp, aN) select ADD aN } aNp = aN aCAp = aCA aCp = aC if (i > resmax) { resmax = i } } } } gPlotEcho[1 + _lastFrame[1]] = "vx = phi vy = n-ward psi (hover = phi resno psi)" plot properties vx resno vy MIN{-180, 1, -180} MAX{180, @resmax, 180} } function plot_phis_and_psis() { print "Plotting PHIs and PSIs" select none var first = true var aCp = ({}) var resmax = 0 var iChain = "" var chains = {not hoh and not ligands and thisModel}.chain for (var c = 1; c <= chains.size; c++) { if (iChain != chains[c]) { iChain = chains[c] for (var i = get_resno_min(iChain); i <= get_resno_max(iChain); i++) { var aN = get_atom_rcn(i, iChain, "N") var aCA = get_atom_rcn(i, iChain, "CA") var aC = get_atom_rcn(i, iChain, "C") var aNn = get_atom_rcn(i+1, iChain, "N") if (first) { first = false } else if (aNn) { aCA.vx = angle(aCp, aN, aCA, aC) #phi aCA.vy = angle(aN, aCA, aC, aNn) #psi select ADD aCA } aCp = aC if (i > resmax) { resmax = i } } } } gPlotEcho[1 + _lastFrame[1]] = "vx = phi vy = psi (hover = psi resno phi)" plot properties vy resno vx MIN{-180, 1, -180} MAX{180, @resmax, 180} } # Callback and plot frames persist if plots closed with just yes function plot_frame_callback() { if (_currentFrame > 0) { unbind "LEFT-CLICK" "+:plico_menu_toggle"; unbind "LEFT-CLICK" "+:plots_click_mb"; set echo top left color echo red background echo yellow echo @{gPlotEcho[1+_currentFrame]} } else { if (gPlico == "PLOTS") { bind "LEFT-CLICK" "+:plico_menu_toggle"; bind "LEFT-CLICK" "+:plots_click_mb"; } set echo top left color echo black background echo lightgrey echo @gEcho } } function plots_click_mb() { # If in menu zone if ((_mouseX < 100) and ((_height-_mouseY) < 343)) { var line = ((_mouseX < 125) ? ((_height-_mouseY)\26) : 0) switch (line) { case 1: plot_o_rot() break case 2: plot_chis12() break case 3: plot_chis34() break case 4: plot_phis_and_psis() break case 5: plots_exit() break } } } # Top level of plots function plico_plots() { # 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 } } gPlico = "PLOTS" gPlotEcho = [] plico_prelim(false, true) gEcho="______Menu_______|Plot O rotations|Plot CHIs 1&2|Plot CHIs 3&4|" + "Plot PHIs and PSIs| BACK" set echo top left color echo black background echo lightgrey echo @gEcho bind "SHIFT-DOUBLE" "plots_exit"; bind "LEFT-CLICK" "+:plico_menu_toggle"; bind "LEFT-CLICK" "+:plots_click_mb"; set AnimFrameCallback "jmolscript:plot_frame_callback" } function plots_exit() { if (plico_exit(true)) { reset gEcho display all gPlico = "" } } # End of PLOTS.SPT