Difference between revisions of "User:Remig/plico/utilities"
(Some useful scripts for manually folding polypeptides) |
m |
||
| Line 21: | Line 21: | ||
<pre># utils - Jmol script by Ron Mignery | <pre># utils - Jmol script by Ron Mignery | ||
| − | # v1. | + | # v1.1 beta 4/12/2016 -require latest common includes |
# | # | ||
gE = false | gE = false | ||
| Line 38: | Line 38: | ||
} | } | ||
return is | return is | ||
| + | } | ||
| + | |||
| + | function eval_chain(iChain) { | ||
| + | gChain = iChain | ||
| + | select gChain | ||
| + | calculate structure | ||
| + | calculate hydrogens true | ||
| + | set hbondsRasmol false | ||
| + | calculate hbonds | ||
| + | set showHydrogens true | ||
| + | |||
| + | gSeq = "" | ||
| + | for (var i = get_resno_min(iChain); i <= get_resno_max(iChain); i++) { | ||
| + | var aCA = get_atom_rcn(i , iChain, "CA") | ||
| + | gSeq += aCA.group1 | ||
| + | gPsi += [aCA.psi] | ||
| + | gPhi += [aCA.phi] | ||
| + | } | ||
| + | gMin = get_resno_min(gChain) | ||
| + | gMax = get_resno_max(gChain) | ||
| + | gOff = 1-gMin | ||
| + | set multipleBondBananas true | ||
| + | #calc_masks() | ||
} | } | ||
| Line 49: | Line 72: | ||
} | } | ||
| − | function | + | function show_3d_ldbonds (){ |
| + | |||
var pc = 0 | var pc = 0 | ||
if (not gBusy) { | if (not gBusy) { | ||
var selsave = {selected} | var selsave = {selected} | ||
| − | select {visible} | + | select {visible and thisModel} |
gBusy = true | gBusy = true | ||
background ECHO pink | background ECHO pink | ||
refresh | refresh | ||
if (gE) { | if (gE) { | ||
| − | print "Hiding | + | print "Hiding 3D dispersion bonds" |
gE = false | gE = false | ||
draw ID "vdwe*" delete | draw ID "vdwe*" delete | ||
} | } | ||
else { | else { | ||
| − | print "Showing | + | print "Showing 3D dispersion bonds" |
# For all visible atoms | # For all visible atoms | ||
| Line 73: | Line 97: | ||
# If side chain carbon (or sulfur) | # If side chain carbon (or sulfur) | ||
if ({a and sidechain and not hydrogen} and a.selected) { | if ({a and sidechain and not hydrogen} and a.selected) { | ||
| − | var nset = {within(104, VDW, a) | + | var nset = {within(104.0, VDW, a) |
and ((chain != iChain) or (not within(4,GROUP, a))) | and ((chain != iChain) or (not within(4,GROUP, a))) | ||
and not hoh and not hydrogen and selected} | and not hoh and not hydrogen and selected} | ||
| + | var ps = "" | ||
for (var j = 1; j <= nset.size; j++) { | for (var j = 1; j <= nset.size; j++) { | ||
var id = format("vdwe%d.%d", i, j) | var id = format("vdwe%d.%d", i, j) | ||
draw ID @id arrow @{a} @{nset[j]} | draw ID @id arrow @{a} @{nset[j]} | ||
| + | ps += format("%s%d-%s%d(%s-%s) ", a.group, a.resno, | ||
| + | nset[j].group, nset[j].resno, a.atomName, nset[j].atomName) | ||
pc++ | pc++ | ||
| + | } | ||
| + | if ((ps.size > 0) and (a.atomIndex < nset[j].atomIndex)) { | ||
| + | print ps | ||
} | } | ||
} | } | ||
| Line 94: | Line 124: | ||
} | } | ||
| − | function | + | function show_2d_ldbonds() { |
if (not gBusy) { | if (not gBusy) { | ||
var selsave = {selected} | var selsave = {selected} | ||
| − | select {visible} | + | select {visible and thisModel} |
gBusy = true | gBusy = true | ||
var pc = 0 | var pc = 0 | ||
| Line 104: | Line 134: | ||
if (gR) { | if (gR) { | ||
| − | print "Hiding | + | print "Hiding 2D dispersion bonds" |
gR = false | gR = false | ||
draw ID "vdwr*" delete | draw ID "vdwr*" delete | ||
} | } | ||
else { | else { | ||
| − | print "Showing | + | print "Showing 2D dispersion bonds" |
# For all visible atoms | # For all visible atoms | ||
| Line 119: | Line 149: | ||
var nset = {within(100, VDW, a) and within(4,GROUP, a) | var nset = {within(100, VDW, a) and within(4,GROUP, a) | ||
and not connected(a) and not connected(connected(a)) | and not connected(a) and not connected(connected(a)) | ||
| + | #and not connected(connected(connected(a))) | ||
and not hydrogen and (chain = iChain) and selected} | and not hydrogen and (chain = iChain) and selected} | ||
| − | + | var ps = "" | |
| − | + | for (var j = 1; j <= nset.size; j++) { | |
| − | + | var id = format("vdwe%d.%d", i, j) | |
| − | + | draw ID @id arrow @{a} @{nset[j]} | |
| − | + | ps += format("%s%d-%s%d(%s-%s) ", a.group, a.resno, | |
| + | nset[j].group, nset[j].resno, a.atomName, nset[j].atomName) | ||
| + | pc++ | ||
| + | } | ||
| + | if ((ps.size > 0) and (a.atomIndex < nset[j].atomIndex)) { | ||
| + | print ps | ||
| + | } | ||
} | } | ||
} | } | ||
| Line 164: | Line 201: | ||
refresh | refresh | ||
print "Backbone cartoon, sidechain ball-and-stick, hbonds on, halo on CBs" | print "Backbone cartoon, sidechain ball-and-stick, hbonds on, halo on CBs" | ||
| − | select | + | select {thisModel} |
calculate STRUCTURE DSSP | calculate STRUCTURE DSSP | ||
cartoons only | cartoons only | ||
color structure | color structure | ||
| − | select {sidechain} | + | select {sidechain and thisModel} |
wireframe -0.1 | wireframe -0.1 | ||
spacefill 23% | spacefill 23% | ||
color jmol | color jmol | ||
| − | select {atomName="CB"} | + | select {atomName="CB" and thisModel} |
halo on | halo on | ||
set hbondsRasmol off | set hbondsRasmol off | ||
| − | select | + | select {thisModel} |
calculate hbonds | calculate hbonds | ||
background echo lightgrey | background echo lightgrey | ||
| Line 198: | Line 235: | ||
break | break | ||
case 3: | case 3: | ||
| − | print | + | print show_3d_ldbonds()/2 |
| − | |||
break | break | ||
case 4: | case 4: | ||
| − | print | + | print show_2d_ldbonds()/2 |
| − | |||
break | break | ||
case 5: | case 5: | ||
| − | print "Hiding all | + | print "Hiding all LD bonds" |
draw ID "vdw*" delete | draw ID "vdw*" delete | ||
gE = false | gE = false | ||
| Line 216: | Line 251: | ||
break | break | ||
case 7: | case 7: | ||
| + | eval_chain(gChain) | ||
| + | break | ||
| + | case 8: | ||
utils_exit() | utils_exit() | ||
break | break | ||
| Line 226: | Line 264: | ||
# 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 | ||
| Line 239: | Line 277: | ||
gR = false | gR = false | ||
| − | gEcho="______Menu_______|Hover++|List collisions|Show | + | gEcho="______Menu_______|Hover++|List collisions|Show 3D LD bonds|" + |
| − | "Show | + | "Show 2D LD bonds|Hide all LD bonds|Show helix pairing|Evaluate| BACK" |
set echo top left | set echo top left | ||
color echo black | color echo black | ||
Latest revision as of 17:36, 12 April 2016
Utils presents a menu of actions potentially useful for manual folding of polypeptides:
Hover text may be enhanced to include atomIndex values.
All collisions may be listed.
Dispersion bonds contributing to secondary structure (displayed as grey arrows between atoms on residues within 4 AAs of eachother) may be toggled on and off.
Dispersion bonds contributing to tertiary structure (displayed as yellow arrows between atoms outside 4 AAs of eachother) may be toggled on and off.
All dispersion bonds may be cleared.
Paired coils may be presented in a format that highlights the forces pairing them: cartoon backbone, ball-and-stick side-chains, hbonds, and halos on CB atoms.
Utils 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 Utilities Script=script <path to your script directory>/utils.spt;plico_utils
saved as utilities.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 utils.spt.
# utils - Jmol script by Ron Mignery
# v1.1 beta 4/12/2016 -require latest common includes
#
gE = false
gR = false
function is_collision_in_select() {
is = false
var cAtoms = ({})
var iChain = {selected}.chain
for (var no = {selected}.min.atomno; no <= {selected}.max.atomno; no++) {
a = {(atomno=no) and (chain=iChain) and thisModel}
if (a) {
is = true
break
}
}
return is
}
function eval_chain(iChain) {
gChain = iChain
select gChain
calculate structure
calculate hydrogens true
set hbondsRasmol false
calculate hbonds
set showHydrogens true
gSeq = ""
for (var i = get_resno_min(iChain); i <= get_resno_max(iChain); i++) {
var aCA = get_atom_rcn(i , iChain, "CA")
gSeq += aCA.group1
gPsi += [aCA.psi]
gPhi += [aCA.phi]
}
gMin = get_resno_min(gChain)
gMax = get_resno_max(gChain)
gOff = 1-gMin
set multipleBondBananas true
#calc_masks()
}
# A handy debug routine
function cc {
print count_collisions(true)
}
function super_coil_prompt() {
prompt("TBD")
}
function show_3d_ldbonds (){
var pc = 0
if (not gBusy) {
var selsave = {selected}
select {visible and thisModel}
gBusy = true
background ECHO pink
refresh
if (gE) {
print "Hiding 3D dispersion bonds"
gE = false
draw ID "vdwe*" delete
}
else {
print "Showing 3D dispersion bonds"
# For all visible atoms
for (var i = {*}.atomIndex.min; i <= {*}.atomIndex.max; i++) {
var a = {atomIndex=i}
if ((a.group != "hoh") and (a.element != "H")) {
var iChain = a.chain
# If side chain carbon (or sulfur)
if ({a and sidechain and not hydrogen} and a.selected) {
var nset = {within(104.0, VDW, a)
and ((chain != iChain) or (not within(4,GROUP, a)))
and not hoh and not hydrogen and selected}
var ps = ""
for (var j = 1; j <= nset.size; j++) {
var id = format("vdwe%d.%d", i, j)
draw ID @id arrow @{a} @{nset[j]}
ps += format("%s%d-%s%d(%s-%s) ", a.group, a.resno,
nset[j].group, nset[j].resno, a.atomName, nset[j].atomName)
pc++
}
if ((ps.size > 0) and (a.atomIndex < nset[j].atomIndex)) {
print ps
}
}
}
}
gE = true
}
background ECHO lightgrey
refresh
select selsave
gBusy = false
}
return pc
}
function show_2d_ldbonds() {
if (not gBusy) {
var selsave = {selected}
select {visible and thisModel}
gBusy = true
var pc = 0
background ECHO pink
refresh
if (gR) {
print "Hiding 2D dispersion bonds"
gR = false
draw ID "vdwr*" delete
}
else {
print "Showing 2D dispersion bonds"
# For all visible atoms
for (var i = {*}.atomIndex.min; i <= {*}.atomIndex.max; i++) {
var a = {atomIndex=i}
var iChain = a.chain
if ({a and sidechain and not hydrogen and selected}) {
var nset = {within(100, VDW, a) and within(4,GROUP, a)
and not connected(a) and not connected(connected(a))
#and not connected(connected(connected(a)))
and not hydrogen and (chain = iChain) and selected}
var ps = ""
for (var j = 1; j <= nset.size; j++) {
var id = format("vdwe%d.%d", i, j)
draw ID @id arrow @{a} @{nset[j]}
ps += format("%s%d-%s%d(%s-%s) ", a.group, a.resno,
nset[j].group, nset[j].resno, a.atomName, nset[j].atomName)
pc++
}
if ((ps.size > 0) and (a.atomIndex < nset[j].atomIndex)) {
print ps
}
}
}
color $vdwr* lightblue
gR = true
}
background ECHO lightgrey
refresh
select selsave
gBusy = false
}
return pc
}
function calculate_cb(resmin, resmax, ichain, d) {
# For all atoms in range
for (var i = {(resno=resmin) and (chain=ichain)}.atomno.min;
i <= {(resno=resmax) and (chain=ichain)}.atomno.max; i++) {
var a = {(atomno=i) and (chain=ichain)}
# If CB
if (a.atomName == "CB") {
# If within(d, a) and cb
var nset = {within(@d, a) and (atomName = "CB") and not a}
for (var j = 1; j <= nset.size; j++) {
measure @{nset[j]} @a
}
}
}
}
function show_alpha_pairs() {
if (not gBusy) {
gBusy = true
background echo pink
refresh
print "Backbone cartoon, sidechain ball-and-stick, hbonds on, halo on CBs"
select {thisModel}
calculate STRUCTURE DSSP
cartoons only
color structure
select {sidechain and thisModel}
wireframe -0.1
spacefill 23%
color jmol
select {atomName="CB" and thisModel}
halo on
set hbondsRasmol off
select {thisModel}
calculate hbonds
background echo lightgrey
refresh
gBusy = false
}
}
function utils_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:
print "hover++"
hi()
break
case 2:
print "Counting collisions"
cc()
break
case 3:
print show_3d_ldbonds()/2
break
case 4:
print show_2d_ldbonds()/2
break
case 5:
print "Hiding all LD bonds"
draw ID "vdw*" delete
gE = false
gR = false
break
case 6:
print "Show alpha chain pairs"
show_alpha_pairs()
break
case 7:
eval_chain(gChain)
break
case 8:
utils_exit()
break
}
}
}
# Top level of utils
function plico_utils() {
# 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 = "UTILS"
plico_prelim(false, false)
gE = false
gR = false
gEcho="______Menu_______|Hover++|List collisions|Show 3D LD bonds|" +
"Show 2D LD bonds|Hide all LD bonds|Show helix pairing|Evaluate| BACK"
set echo top left
color echo black
background echo lightgrey
echo @gEcho
bind "SHIFT-DOUBLE" "utils_exit";
bind "LEFT-CLICK" "+:plico_menu_toggle";
bind "LEFT-CLICK" "+:utils_click_mb";
}
function utils_exit() {
if (plico_exit(false)) {
display all
}
}
# End of UTILS.SPT