Difference between revisions of "User:Remig/plico/toab"
< User:Remig | plico
Jump to navigation
Jump to search
(Do not var globals) |
|||
Line 5: | Line 5: | ||
Script=script <path to your scripts directory>/toab.spt;plicoToab | Script=script <path to your scripts directory>/toab.spt;plicoToab | ||
</pre>saved as plicotoab.macro in your .jmol/macros directory as described in [[Macro]]. | </pre>saved as plicotoab.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 | + | Copy and paste the following into a text editor and save in your scripts directory as toab.spt. |
− | <pre># | + | <pre># toAlphBeta - Jmol script by Ron Mignery |
− | # v1.1 beta 4 | + | # v1.1 beta 3/4/2014 for Jmol 14 -do not var globals for Jmol 14.0.13+ |
# | # | ||
− | # | + | # Move a stretch of polypeptide from alpha to beta or vice versa |
# | # | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
gToab = FALSE | gToab = FALSE | ||
gToabAlt = FALSE | gToabAlt = FALSE | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | # Bound to LEFT-UP by toabEnableDrag | |
− | + | function toabDragDoneMB() { | |
− | + | if (not gToabAlt) { | |
− | + | if (gNanchorIdx >= 0) { | |
− | + | tugDragDoneMB() | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | if ( | ||
− | |||
} | } | ||
− | } | + | } |
− | + | else { | |
− | + | if (gCanchorIdx >= 0) { | |
− | + | tugDragDoneMB() | |
− | |||
− | |||
− | |||
− | |||
− | if ( | ||
− | |||
− | |||
} | } | ||
} | } | ||
+ | } | ||
− | + | # Bound to ALT-SHIFT-LEFT-DRAG by toabEnableDrag | |
− | + | function toabDrag2MB() { | |
− | + | gToabAlt = TRUE | |
+ | toabDrag() | ||
} | } | ||
− | function | + | # Bound to ALT-LEFT-DRAG by toabEnableDrag |
− | + | function toabDragMB() { | |
− | + | gToabAlt = FALSE | |
− | + | toabDrag() | |
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | function toabDrag() { | |
− | + | if (not gBusy) { | |
− | + | gBusy = TRUE | |
− | + | var dx = (40.0 * (_mouseX - gMouseX))/_width | |
− | + | var dy = (40.0 * (_mouseY - gMouseY))/_height | |
− | + | var q = quaternion() | |
− | + | var ptd = {@dx @dy 0} | |
− | + | var pt = (!q)%ptd | |
− | + | if (distance(pt, {0 0 0}) > 0.004) { | |
− | + | ||
− | + | # If sidechain mode | |
− | var | + | if (gSCidx >= 0) { |
− | var | + | if ({atomIndex=gSCidx}.atomName == "O") { |
− | var | + | dir = ((abs(dx) > abs(dy)) |
− | var | + | ? ((dx < 0) ? 2 : -2) |
− | var | + | : ((dy < 0) ? 2 : -2)) |
− | + | counterRotate(gSCidx, dir, not gToabAlt) | |
− | if ( | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
else { | else { | ||
− | + | gSCcheck = not gToabAlt | |
− | + | tugSideChain(pt) | |
} | } | ||
− | |||
} | } | ||
− | # | + | # Else |
− | + | else { | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | # If new drag | |
− | + | if (gNewDrag) { | |
− | + | gNewDrag = FALSE | |
− | + | save state gState | |
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | # Move the cargo | |
− | + | select {gCargoSet} | |
− | |||
− | |||
− | |||
− | + | var phi = ((dx < 0) ? -57 : -90) | |
− | (atomno | + | var psi = ((dx < 0) ? -47 : 120) |
− | + | ||
− | + | # Move between alpha and beta | |
− | + | var nIdx = gNcargoIdx | |
− | + | var iNidx = {(atomno=@{{chain=gChain}.atomno.min}) | |
− | + | and (chain=gChain)}.atomIndex | |
− | ( | + | var maxIdx = {(atomno=@{{chain=gchain}.atomno.max}) |
− | + | and (chain=gchain)}.atomIndex | |
+ | var minIdx = {(atomno=@{{chain=gchain}.atomno.min}) | ||
+ | and (chain=gchain)}.atomIndex | ||
+ | while (TRUE) { | ||
+ | |||
+ | # Adjust phi | ||
+ | var ncIdx = getNwardBBidx(nIdx, gChain) | ||
+ | var caIdx = getCwardBBidx(nIdx, gChain) | ||
+ | var cIdx = getCwardBBidx(caIdx, gChain) | ||
+ | var dh= angle({atomIndex=ncIdx}, {atomIndex=nIdx}, | ||
+ | {atomIndex=caIdx}, {atomIndex=cIdx}) | ||
+ | var dir = ((phi > dh) ? abs(8*dx) : -(abs(8*dx))) | ||
+ | if (not gToabAlt) { | ||
+ | selectNwardIdx(nIdx, ((gNanchorIdx >= 0) ? gNcargoIdx : minIdx)) | ||
+ | } | ||
+ | else { | ||
+ | selectCwardIdx(caIdx, ((gCanchorIdx >= 0) ? gCcargoIdx : maxIdx)) | ||
+ | } | ||
+ | if (abs(phi-dh) > 0.5) { | ||
+ | rotateSelectedRecord(caIdx, {atomIndex=nIdx}, dir) | ||
+ | } | ||
+ | |||
+ | # Adjust psi | ||
+ | var cnIdx = getCwardBBidx (cIdx, gChain) | ||
+ | dh= angle({atomIndex=nIdx}, {atomIndex=caIdx}, | ||
+ | {atomIndex=cIdx}, {atomIndex=cnIdx}) | ||
+ | dir = ((psi > dh) ? abs(8*dx) : -(abs(8*dx))) | ||
+ | if (not gToabAlt) { | ||
+ | selectNwardIdx(caIdx, ((gNanchorIdx >= 0) ? gNcargoIdx : minIdx)) | ||
+ | } | ||
+ | else { | ||
+ | selectCwardIdx(cIdx, ((gCanchorIdx >= 0) ? gCcargoIdx : maxIdx)) | ||
+ | } | ||
+ | if (abs(psi-dh) > 0.5) { | ||
+ | rotateSelectedRecord(cIdx, {atomIndex=caIdx}, dir) | ||
+ | } | ||
+ | |||
+ | if (gCcargoIdx== cIdx) { | ||
+ | break | ||
+ | } | ||
+ | nIdx = cnIdx | ||
+ | } # endwhile | ||
+ | |||
+ | } | ||
+ | |||
+ | gMouseX = _mouseX | ||
+ | gMouseY = _mouseY | ||
} | } | ||
− | + | ||
− | + | select {gCargoSet} | |
− | + | var lcset = (within(kCtolerance, FALSE, {selected}) | |
− | select | + | and not {selected} and not connected({selected})) |
− | + | gOk2 = TRUE | |
− | + | if (lcset.size > 0) { | |
− | + | for (var i = 1; i <= lcset.size; i++) { | |
− | + | handleCollisions2(lcset[i].atomIndex) | |
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | if ( | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | + | var bkc = (gOk2 ? "yellow" : "pink") | |
− | + | background ECHO @bkc | |
− | + | ||
− | + | ||
− | + | gBusy = FALSE | |
− | + | } | |
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | # Called by tugCargoMB when gToab is true | |
− | + | function toabEnableDrag() { | |
− | + | gEcho = "____Alpha <==> Beta____|ALT-CLICK=mark block|SHIFT-CLICK=anchors" + | |
− | + | "|ALT-DRAG=move|SHIFT-ALT-DRAG=alt move|DOUBLE-CLICK=exit" | |
− | + | echo @gEcho | |
− | + | # Allow atoms to be dragged | |
− | + | bind "ALT-LEFT-DOWN" "tugMarkMB"; | |
− | + | bind "ALT-LEFT-UP" "tugDragDoneMB"; | |
− | + | bind "ALT-LEFT-DRAG" "toabDragMB"; | |
− | + | bind "ALT-SHIFT-LEFT-UP" "toabDragDoneMB"; | |
+ | bind "ALT-SHIFT-LEFT-DRAG" "toabDrag2MB"; | ||
− | + | unbind "SHIFT-LEFT-CLICK" | |
− | + | bind "SHIFT-LEFT-CLICK" "_pickAtom"; | |
− | + | bind "SHIFT-LEFT-CLICK" "+:tugAnchorMB"; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | # Bound to ALT-LEFT-CLICK by | + | # Bound to ALT-LEFT-CLICK by plicoToab |
− | function | + | function toabCargoMB() { |
− | + | print "toabCargoMB()"#TBD | |
− | + | gToab = TRUE | |
− | + | tugCargoMB | |
− | |||
− | |||
} | } | ||
− | # Top level of | + | # Top level of ToAlphaBeta |
− | function | + | function plicoToab() { |
− | # Load | + | # Load tug functions if not already |
− | if ( | + | if (kTug < 3) { |
− | script $SCRIPT_PATH$ | + | script $SCRIPT_PATH$tug.spt |
− | if ( | + | if (kTug < 3) { |
− | prompt ("A newer version of | + | prompt ("A newer version of TUG.SPT is required") |
quit | quit | ||
} | } | ||
} | } | ||
− | + | ||
− | gPlico = "TO | + | gPlico = "TO ALPHA/BETA" |
plicoPrelim() | plicoPrelim() | ||
− | + | ||
− | gEcho = (" | + | gEcho = ("____Alpha <==> Beta____|ALT-CLICK=mark block|DOUBLE-CLICK=exit") |
echo @gEcho | echo @gEcho | ||
gChain = "" | gChain = "" | ||
Line 433: | Line 197: | ||
bind "ALT-LEFT-CLICK" "_pickAtom"; | bind "ALT-LEFT-CLICK" "_pickAtom"; | ||
− | bind "ALT-LEFT-CLICK" "+: | + | bind "ALT-LEFT-CLICK" "+:toabCargoMB"; |
bind "DOUBLE" "plicoExit"; | bind "DOUBLE" "plicoExit"; | ||
} | } | ||
− | # End of | + | # End of TOAB.SPT |
</pre> | </pre> |
Revision as of 16:00, 3 April 2014
ToAlphaBeta allows the user to mark a section of a polypeptide chain to fold towards an alpha helix configuration or towards a beta strand configuration as described here.
ToAlphaBeta 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 To Alpha/Beta Script=script <path to your scripts directory>/toab.spt;plicoToab
saved as plicotoab.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 toab.spt.
# toAlphBeta - Jmol script by Ron Mignery # v1.1 beta 3/4/2014 for Jmol 14 -do not var globals for Jmol 14.0.13+ # # Move a stretch of polypeptide from alpha to beta or vice versa # gToab = FALSE gToabAlt = FALSE # Bound to LEFT-UP by toabEnableDrag function toabDragDoneMB() { if (not gToabAlt) { if (gNanchorIdx >= 0) { tugDragDoneMB() } } else { if (gCanchorIdx >= 0) { tugDragDoneMB() } } } # Bound to ALT-SHIFT-LEFT-DRAG by toabEnableDrag function toabDrag2MB() { gToabAlt = TRUE toabDrag() } # Bound to ALT-LEFT-DRAG by toabEnableDrag function toabDragMB() { gToabAlt = FALSE toabDrag() } function toabDrag() { if (not gBusy) { gBusy = TRUE var dx = (40.0 * (_mouseX - gMouseX))/_width var dy = (40.0 * (_mouseY - gMouseY))/_height var q = quaternion() var ptd = {@dx @dy 0} var pt = (!q)%ptd if (distance(pt, {0 0 0}) > 0.004) { # If sidechain mode if (gSCidx >= 0) { if ({atomIndex=gSCidx}.atomName == "O") { dir = ((abs(dx) > abs(dy)) ? ((dx < 0) ? 2 : -2) : ((dy < 0) ? 2 : -2)) counterRotate(gSCidx, dir, not gToabAlt) } else { gSCcheck = not gToabAlt tugSideChain(pt) } } # Else else { # If new drag if (gNewDrag) { gNewDrag = FALSE save state gState } # Move the cargo select {gCargoSet} var phi = ((dx < 0) ? -57 : -90) var psi = ((dx < 0) ? -47 : 120) # Move between alpha and beta var nIdx = gNcargoIdx var iNidx = {(atomno=@{{chain=gChain}.atomno.min}) and (chain=gChain)}.atomIndex var maxIdx = {(atomno=@{{chain=gchain}.atomno.max}) and (chain=gchain)}.atomIndex var minIdx = {(atomno=@{{chain=gchain}.atomno.min}) and (chain=gchain)}.atomIndex while (TRUE) { # Adjust phi var ncIdx = getNwardBBidx(nIdx, gChain) var caIdx = getCwardBBidx(nIdx, gChain) var cIdx = getCwardBBidx(caIdx, gChain) var dh= angle({atomIndex=ncIdx}, {atomIndex=nIdx}, {atomIndex=caIdx}, {atomIndex=cIdx}) var dir = ((phi > dh) ? abs(8*dx) : -(abs(8*dx))) if (not gToabAlt) { selectNwardIdx(nIdx, ((gNanchorIdx >= 0) ? gNcargoIdx : minIdx)) } else { selectCwardIdx(caIdx, ((gCanchorIdx >= 0) ? gCcargoIdx : maxIdx)) } if (abs(phi-dh) > 0.5) { rotateSelectedRecord(caIdx, {atomIndex=nIdx}, dir) } # Adjust psi var cnIdx = getCwardBBidx (cIdx, gChain) dh= angle({atomIndex=nIdx}, {atomIndex=caIdx}, {atomIndex=cIdx}, {atomIndex=cnIdx}) dir = ((psi > dh) ? abs(8*dx) : -(abs(8*dx))) if (not gToabAlt) { selectNwardIdx(caIdx, ((gNanchorIdx >= 0) ? gNcargoIdx : minIdx)) } else { selectCwardIdx(cIdx, ((gCanchorIdx >= 0) ? gCcargoIdx : maxIdx)) } if (abs(psi-dh) > 0.5) { rotateSelectedRecord(cIdx, {atomIndex=caIdx}, dir) } if (gCcargoIdx== cIdx) { break } nIdx = cnIdx } # endwhile } gMouseX = _mouseX gMouseY = _mouseY } select {gCargoSet} var lcset = (within(kCtolerance, FALSE, {selected}) and not {selected} and not connected({selected})) gOk2 = TRUE if (lcset.size > 0) { for (var i = 1; i <= lcset.size; i++) { handleCollisions2(lcset[i].atomIndex) } } var bkc = (gOk2 ? "yellow" : "pink") background ECHO @bkc gBusy = FALSE } } # Called by tugCargoMB when gToab is true function toabEnableDrag() { gEcho = "____Alpha <==> Beta____|ALT-CLICK=mark block|SHIFT-CLICK=anchors" + "|ALT-DRAG=move|SHIFT-ALT-DRAG=alt move|DOUBLE-CLICK=exit" echo @gEcho # Allow atoms to be dragged bind "ALT-LEFT-DOWN" "tugMarkMB"; bind "ALT-LEFT-UP" "tugDragDoneMB"; bind "ALT-LEFT-DRAG" "toabDragMB"; bind "ALT-SHIFT-LEFT-UP" "toabDragDoneMB"; bind "ALT-SHIFT-LEFT-DRAG" "toabDrag2MB"; unbind "SHIFT-LEFT-CLICK" bind "SHIFT-LEFT-CLICK" "_pickAtom"; bind "SHIFT-LEFT-CLICK" "+:tugAnchorMB"; } # Bound to ALT-LEFT-CLICK by plicoToab function toabCargoMB() { print "toabCargoMB()"#TBD gToab = TRUE tugCargoMB } # Top level of ToAlphaBeta function plicoToab() { # Load tug functions if not already if (kTug < 3) { script $SCRIPT_PATH$tug.spt if (kTug < 3) { prompt ("A newer version of TUG.SPT is required") quit } } gPlico = "TO ALPHA/BETA" plicoPrelim() gEcho = ("____Alpha <==> Beta____|ALT-CLICK=mark block|DOUBLE-CLICK=exit") echo @gEcho gChain = "" unbind bind "ALT-LEFT-CLICK" "_pickAtom"; bind "ALT-LEFT-CLICK" "+:toabCargoMB"; bind "DOUBLE" "plicoExit"; } # End of TOAB.SPT