Difference between revisions of "User:Remig/plico/turn"

From Jmol
Jump to navigation Jump to search
(Add menu toggle)
m
Line 12: Line 12:
 
<pre>#  turn - Jmol script by Ron Mignery
 
<pre>#  turn - Jmol script by Ron Mignery
 
#
 
#
#  v1.4 beta    7/24/2015 -add menu toggle
+
#  v1.5 beta    9/11/2015 -use thisModel
 
#
 
#
 
#  Apply a type I or type II turn to a polypeptide
 
#  Apply a type I or type II turn to a polypeptide
 
#  or do cis <- trans on proline
 
#  or do cis <- trans on proline
 +
# TPEE NPTY motifs
 +
function toggle_pro_cis_trans(r, iChain, toCis) {
 +
    var aCA = get_atom_rcn( r, iChain, "CA")
 +
    var aN = get_atom_rcn( r, iChain, "N")
 +
    var aCp = get_atom_rcn( r-1, iChain, "C")
 +
    var aCAp = get_atom_rcn( r-1, iChain, "CA")
 +
    if (aCAp >= 0) {
 +
        select {(resno < r) and chain=iChain and thisModel}
 +
        var cis =(toCis ? toCis : (abs(angle(aCA, aN, aCp, aCAp)) < 30))
 +
        set_dihedral_atoms(aCA, aN, aCp, aCAp, (cis ? 180 : 0))
 +
    }
 +
}
 +
 +
function make_turn(r, iChain, nphi, npsi, cphi, cpsi) {
 +
    for (i = 0; i < 2; i++) {
 +
        var aCp = get_atom_rcn( r-1, iChain, "C")
 +
        var aN = get_atom_rcn( r, iChain, "N")
 +
        var aCA = get_atom_rcn( r, iChain, "CA")
 +
        var aC = get_atom_rcn( r, iChain, "C")
 +
        var aO = get_atom_rcn( r, iChain, "O")
 +
        var aNn = get_atom_rcn( r+1, iChain, "N")
 +
        if (aNn) {
 +
            select {(resno <= r) and not aC and not aO and chain=iChain
 +
                and thisModel}
 +
            set_dihedral_atoms(aNn, aC, aCA, aN, (i ? cpsi : npsi))
 +
        }
 +
        if (aCp and (aCA.group != "PRO")) {
 +
            select {(resno < r) and chain=iChain and thisModel}
 +
            set_dihedral_atoms(aC, aCA, aN, aCp, (i ? cphi : nphi))
 +
        }
 +
        color {resno=r} @gAltScheme
 +
        color {(resno=r) and oxygen} pink
 +
       
 +
        r++
 +
    }
 +
   
 +
    after_fold()
 +
}
  
 
# Bound to ALT-LEFT-CLICK by plico_turn
 
# Bound to ALT-LEFT-CLICK by plico_turn
 
function turn_cargo_1_mb() {
 
function turn_cargo_1_mb() {
     set echo TOP LEFT
+
     var iChain = {atomIndex=_atomPicked}.chain
    background ECHO pink
+
    var r = {atomIndex=_atomPicked}.resno
 
+
    if ({atomIndex=_atomPicked}.group = "PRO") {
    # If O atom picked
+
         toggle_pro_cis_trans(r, iChain, false)
    if ({atomIndex=_atomPicked}.atomName = "O") {
 
        gChain = {atomIndex=_atomPicked}.chain
 
        var cMidx = get_sc_bb_idx (_atomPicked, gChain)
 
 
 
        var caMidx = get_nward_bb_idx (cMidx, gChain)
 
        var nMidx = get_nward_bb_idx (caMidx, gChain)
 
        var ncMidx = get_nward_bb_idx (nMidx, gChain)
 
        var nPidx = get_cward_bb_idx (cMidx, gChain)
 
        var caPidx = get_cward_bb_idx (nPidx, gChain)
 
         var cPidx = get_cward_bb_idx (caPidx, gChain)
 
        var cnPidx = get_cward_bb_idx (cPidx, gChain)
 
 
 
        save state gState
 
        select_nward_idx(caPidx, 0)
 
        set_dihedral_idx(cnPidx, cPidx, caPidx, nPidx, 0) # cWard Psi
 
        select_nward_idx(nPidx, 0)
 
        set_dihedral_idx(cPidx, caPidx, nPidx, cMidx, -90) # cWard Phi
 
        select_nward_idx(caMidx, 0)
 
        set_dihedral_idx(nPidx, cMidx, caMidx, nMidx, -60) # nWard Psi
 
        select_nward_idx(nMidx, 0)
 
        set_dihedral_idx(cMidx, caMidx, nMidx, ncMidx, -40) # nWard Phi
 
 
 
        after_fold()
 
 
     }
 
     }
 
+
     else {
    # Else if PRO N atom picked
+
         make_turn(r, iChain, -60, -30, -90, 0) # I
     if (({atomIndex=_atomPicked}.atomName = "N")
 
         and ({atomIndex=_atomPicked}.group = "PRO")) {
 
        gChain = {atomIndex=_atomPicked}.chain
 
        save state gState
 
        var cMidx = get_nward_bb_idx (_atomPicked, gChain)
 
 
 
        # Rotate 180 on omega
 
        select_nward_idx(cMidx, 0)
 
        rotateSelected {atomIndex=_atomPicked} {atomIndex=cMidx} 180.0
 
 
 
        after_fold()
 
 
     }
 
     }
    set echo TOP LEFT
 
    background ECHO yellow
 
 
}
 
}
  
 
# Bound to SHIFT-LEFT-CLICK by plico_turn
 
# Bound to SHIFT-LEFT-CLICK by plico_turn
 
function turn_cargo_2_mb() {
 
function turn_cargo_2_mb() {
 +
    var iChain = {atomIndex=_atomPicked}.chain
 +
    var r = {atomIndex=_atomPicked}.resno
 +
    if ({atomIndex=_atomPicked}.group != "PRO") {
 +
        make_turn(r, iChain, -60, 120, 80, 0) # II
 +
    }
 +
}
  
     set echo TOP LEFT
+
# Bound to ALT-SHIFT-LEFT-CLICK by plico_turn
     background ECHO pink
+
function turn_cargo_1i_mb() {
 +
    var iChain = {atomIndex=_atomPicked}.chain
 +
    var r = {atomIndex=_atomPicked}.resno
 +
    if ({atomIndex=_atomPicked}.group = "PRO") {
 +
        toggle_pro_cis_trans(r, iChain, true)
 +
        make_turn(r, iChain, -57, 120, -90, 0) # VIa1
 +
    }
 +
     else {
 +
        make_turn(r, iChain, 60, 30, 90, 0) # I'
 +
     }
 +
}
  
    # If O atom picked
+
# Bound to SHIFT-CTRL-CLICK by plico_turn
    if ({atomIndex=_atomPicked}.atomName = "O") {
+
function turn_cargo_2i_mb() {
        gChain = {atomIndex=_atomPicked}.chain
+
    var iChain = {atomIndex=_atomPicked}.chain
        var caMidx = get_nward_bb_idx (_atomPicked, gChain)
+
    var r = {atomIndex=_atomPicked}.resno
        var cMidx = get_cward_bb_idx (caMidx, gChain)
+
    if ({atomIndex=_atomPicked}.group = "PRO") {
 
+
         toggle_pro_cis_trans(r, iChain, true)
        save state gState
+
         make_turn(r, iChain, -57, 120, -60, 0) # VIa2
        var caMidx = get_nward_bb_idx (cMidx, gChain)
+
    }
        var nMidx = get_nward_bb_idx (caMidx, gChain)
+
    else {
         var ncMidx = get_nward_bb_idx (nMidx, gChain)
+
         make_turn(r, iChain, 60, -120, -80, 0) # II'
        var nPidx = get_cward_bb_idx (cMidx, gChain)
+
    }
         var caPidx = get_cward_bb_idx (nPidx, gChain)
+
}
        var cPidx = get_cward_bb_idx (caPidx, gChain)
 
        var cnPidx = get_cward_bb_idx (cPidx, gChain)
 
 
 
        # Hi to lo since N-terminal is to move
 
        select_nward_idx(caPidx, 0)
 
        set_dihedral_idx(cnPidx, cPidx, caPidx, nPidx, 0) # cWard Psi
 
        select_nward_idx(nPidx, 0)
 
         set_dihedral_idx(cPidx, caPidx, nPidx, cMidx, 90) # cWard Phi
 
        select_nward_idx(caMidx, 0)
 
        set_dihedral_idx(nPidx, cMidx, caMidx, nMidx, 120) # nWard Psi
 
        select_nward_idx(nMidx, 0)
 
        set_dihedral_idx(cMidx, caMidx, nMidx, ncMidx, -70) # nWard Phi
 
  
         after_fold()
+
# Bound to ALT-CTRL-SHIFT-LEFT-CLICK by plico_turn
 +
function turn_cargo_8_mb() {
 +
    var iChain = {atomIndex=_atomPicked}.chain
 +
    var r = {atomIndex=_atomPicked}.resno
 +
    if ({atomIndex=_atomPicked}.group = "PRO") {
 +
        toggle_pro_cis_trans(r, iChain, true)
 +
         make_turn(r, iChain, -57, 135, -75, 160) # VIb
 
     }
 
     }
 
+
     else {
    # Else if PRO N atom picked
+
         make_turn(r, iChain, -60, -120, 120, 0) # VIII
     if (({atomIndex=_atomPicked}.atomName = "N")
 
         and ({atomIndex=_atomPicked}.group = "PRO")) {
 
        gChain = {atomIndex=_atomPicked}.chain
 
        save state gState
 
        var cMidx = get_nward_bb_idx (_atomPicked, gChain)
 
 
 
        # Rotate 180 on omega
 
        select_nward_idx(cMidx, 0)
 
        rotateSelected {atomIndex=_atomPicked} {atomIndex=cMidx} 180.0
 
 
 
        after_fold()
 
 
     }
 
     }
    set echo TOP LEFT
 
    background ECHO yellow
 
 
}
 
}
  
 
function after_fold() {
 
function after_fold() {
     handle_collisions( 0)
+
     to_handle_collisions( 0)
 
     var c = count_collisions(({}))
 
     var c = count_collisions(({}))
 
     if (c > 0) {
 
     if (c > 0) {
Line 141: Line 140:
 
     }
 
     }
  
     if (kTug < 3) {
+
     if (kNTCommon < 4) {
         script $SCRIPT_PATH$tug.spt
+
         script $SCRIPT_PATH$plicoNTcommon.spt
         if (kTug < 3) {
+
         if (kNTcommon < 4) {
             prompt ("A newer version of tug.SPT is required")
+
             prompt ("A newer version of plicoNTcommon.SPT is required")
 
             quit
 
             quit
 
         }
 
         }
 
     }
 
     }
 
+
   
 
     gPlico = "TURN"
 
     gPlico = "TURN"
     plico_prelim(true)
+
     plico_prelim(true, true)
  
     select (GLY and Oxygen) or (PRO and Nitrogen)
+
     gEcho = ("___________TURN___________" +
    halo on
+
        "|ALT-CLICK=Type I (or PRO C/T)|CTRL-SHIFT-CLICK=Type II" +
    var f = (_frameID/1000000)
+
        "|ALT-SHIFT-CLICK=Type I' (VIa1)|ALT-CTRL-CLICK=Type II' (VIa2)" +
    var m = (_frameID%1000000)
+
         "|ALT-CTRL-SHIFT-CLICK=Type VIII (VIb)|SHIFT-DOUBLE-CLICK=exit")
    select ((file=f) and (model=m))
 
    gEcho = ("_______TURN_______| *** Click on O ***|      (or proline N)|ALT-CLICK=Type I" +
 
         "|SHIFT-CLICK=Type II|DOUBLE-CLICK=exit")
 
 
     echo @gEcho
 
     echo @gEcho
    gChain = ""
 
    gMenuMin = false
 
    unbind
 
  
 
     bind "ALT-LEFT-CLICK" "_pickAtom";
 
     bind "ALT-LEFT-CLICK" "_pickAtom";
 
     bind "ALT-LEFT-CLICK" "+:turn_cargo_1_mb";
 
     bind "ALT-LEFT-CLICK" "+:turn_cargo_1_mb";
     bind "SHIFT-LEFT-CLICK" "_pickAtom";
+
     bind "CTRL-SHIFT-LEFT-CLICK" "_pickAtom";
     bind "SHIFT-LEFT-CLICK" "+:turn_cargo_2_mb";
+
     bind "CTRL-SHIFT-LEFT-CLICK" "+:turn_cargo_2_mb";
     bind "DOUBLE" "plico_exit";
+
     bind "ALT-SHIFT-LEFT-CLICK" "_pickAtom";
 +
    bind "ALT-SHIFT-LEFT-CLICK" "+:turn_cargo_1i_mb";
 +
    bind "ALT-CTRL-LEFT-CLICK" "_pickAtom";
 +
    bind "ALT-CTRL-LEFT-CLICK" "+:turn_cargo_2i_mb";
 +
    bind "ALT-CTRL-SHIFT-LEFT-CLICK" "_pickAtom";
 +
    bind "ALT-CTRL-SHIFT-LEFT-CLICK" "+:turn_cargo_8_mb";
 +
   
 +
    bind "SHIFT-DOUBLE" "plico_exit(true)";
 
     bind "LEFT-CLICK" "+:plico_menu_toggle";
 
     bind "LEFT-CLICK" "+:plico_menu_toggle";
 
}
 
}
  
 
# End of TURN.SPT</pre>
 
# End of TURN.SPT</pre>

Revision as of 14:43, 11 September 2015

Turn allows the user to make type I and II reverse turns and beta-hairpins in polypeptides with a single mouse click on the corner oxygen where you want the turn. ALT-CLICK creates a type I turn and SHIFT-CLICK makes a type II. Either on a proline N rotates the omega bond 180 for a cis/trans transition. Note that GLY oxygens and PRO nitrogens are haloed to indicate the usual sites of action.

Turn 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 Turn
Script=script <path to your scripts folder>/turn.spt;plico_turn

saved as plicoTurn.macro in your .jmol/macros folder as described in Macro.

A copy of the Plico script tug.spt must be in the same directory as this script.

Copy and paste the following to a text editor and save to your scripts directory as turn.spt:

#   turn - Jmol script by Ron Mignery
#
#   v1.5 beta    9/11/2015 -use thisModel
#
#   Apply a type I or type II turn to a polypeptide
#   or do cis <- trans on proline
# TPEE NPTY motifs
function toggle_pro_cis_trans(r, iChain, toCis) {
    var aCA = get_atom_rcn( r, iChain, "CA")
    var aN = get_atom_rcn( r, iChain, "N")
    var aCp = get_atom_rcn( r-1, iChain, "C")
    var aCAp = get_atom_rcn( r-1, iChain, "CA")
    if (aCAp >= 0) {
        select {(resno < r) and chain=iChain and thisModel}
        var cis =(toCis ? toCis : (abs(angle(aCA, aN, aCp, aCAp)) < 30))
        set_dihedral_atoms(aCA, aN, aCp, aCAp, (cis ? 180 : 0))
    }
}

function make_turn(r, iChain, nphi, npsi, cphi, cpsi) {
    for (i = 0; i < 2; i++) {
        var aCp = get_atom_rcn( r-1, iChain, "C")
        var aN = get_atom_rcn( r, iChain, "N")
        var aCA = get_atom_rcn( r, iChain, "CA")
        var aC = get_atom_rcn( r, iChain, "C")
        var aO = get_atom_rcn( r, iChain, "O")
        var aNn = get_atom_rcn( r+1, iChain, "N")
        if (aNn) {
            select {(resno <= r) and not aC and not aO and chain=iChain
                and thisModel}
            set_dihedral_atoms(aNn, aC, aCA, aN, (i ? cpsi : npsi))
        }
        if (aCp and (aCA.group != "PRO")) {
            select {(resno < r) and chain=iChain and thisModel}
            set_dihedral_atoms(aC, aCA, aN, aCp, (i ? cphi : nphi))
        }
        color {resno=r} @gAltScheme
        color {(resno=r) and oxygen} pink
        
        r++
    }
    
    after_fold()
}

# Bound to ALT-LEFT-CLICK by plico_turn
function turn_cargo_1_mb() {
    var iChain = {atomIndex=_atomPicked}.chain
    var r = {atomIndex=_atomPicked}.resno
    if ({atomIndex=_atomPicked}.group = "PRO") {
        toggle_pro_cis_trans(r, iChain, false)
    }
    else {
        make_turn(r, iChain, -60, -30, -90, 0) # I
    }
}

# Bound to SHIFT-LEFT-CLICK by plico_turn
function turn_cargo_2_mb() {
    var iChain = {atomIndex=_atomPicked}.chain
    var r = {atomIndex=_atomPicked}.resno
    if ({atomIndex=_atomPicked}.group != "PRO") {
        make_turn(r, iChain, -60, 120, 80, 0) # II
    }
}

# Bound to ALT-SHIFT-LEFT-CLICK by plico_turn
function turn_cargo_1i_mb() {
    var iChain = {atomIndex=_atomPicked}.chain
    var r = {atomIndex=_atomPicked}.resno
    if ({atomIndex=_atomPicked}.group = "PRO") {
        toggle_pro_cis_trans(r, iChain, true)
        make_turn(r, iChain, -57, 120, -90, 0) # VIa1
    }
    else {
        make_turn(r, iChain, 60, 30, 90, 0) # I'
    }
}

# Bound to SHIFT-CTRL-CLICK by plico_turn
function turn_cargo_2i_mb() {
    var iChain = {atomIndex=_atomPicked}.chain
    var r = {atomIndex=_atomPicked}.resno
    if ({atomIndex=_atomPicked}.group = "PRO") {
        toggle_pro_cis_trans(r, iChain, true)
        make_turn(r, iChain, -57, 120, -60, 0) # VIa2
    }
    else {
        make_turn(r, iChain, 60, -120, -80, 0) # II'
    }
}

# Bound to ALT-CTRL-SHIFT-LEFT-CLICK by plico_turn
function turn_cargo_8_mb() {
    var iChain = {atomIndex=_atomPicked}.chain
    var r = {atomIndex=_atomPicked}.resno
    if ({atomIndex=_atomPicked}.group = "PRO") {
        toggle_pro_cis_trans(r, iChain, true)
        make_turn(r, iChain, -57, 135, -75, 160) # VIb
    }
    else {
        make_turn(r, iChain, -60, -120, 120, 0) # VIII
    }
}

function after_fold() {
    to_handle_collisions( 0)
    var c = count_collisions(({}))
    if (c > 0) {
        refresh
        if (prompt( format("%d collisions detected - undo fold?", c),
            "Yes|No", true) = "Yes") {
            restore state gState
            connect
        }
    }
}

# Top level of Turn
function plico_turn() {

    # Load common functions if not already
    if (kCommon < 6) {
        script $SCRIPT_PATH$plicoCommon.spt
        if (kCommon < 6) {
            prompt ("A newer version of plicoCommon.SPT is required")
            quit
        }
    }

    if (kNTCommon < 4) {
        script $SCRIPT_PATH$plicoNTcommon.spt
        if (kNTcommon < 4) {
            prompt ("A newer version of plicoNTcommon.SPT is required")
            quit
        }
    }
    
    gPlico = "TURN"
    plico_prelim(true, true)

    gEcho = ("___________TURN___________" +
        "|ALT-CLICK=Type I (or PRO C/T)|CTRL-SHIFT-CLICK=Type II" +
        "|ALT-SHIFT-CLICK=Type I' (VIa1)|ALT-CTRL-CLICK=Type II' (VIa2)" +
        "|ALT-CTRL-SHIFT-CLICK=Type VIII (VIb)|SHIFT-DOUBLE-CLICK=exit")
    echo @gEcho

    bind "ALT-LEFT-CLICK" "_pickAtom";
    bind "ALT-LEFT-CLICK" "+:turn_cargo_1_mb";
    bind "CTRL-SHIFT-LEFT-CLICK" "_pickAtom";
    bind "CTRL-SHIFT-LEFT-CLICK" "+:turn_cargo_2_mb";
    bind "ALT-SHIFT-LEFT-CLICK" "_pickAtom";
    bind "ALT-SHIFT-LEFT-CLICK" "+:turn_cargo_1i_mb";
    bind "ALT-CTRL-LEFT-CLICK" "_pickAtom";
    bind "ALT-CTRL-LEFT-CLICK" "+:turn_cargo_2i_mb";
    bind "ALT-CTRL-SHIFT-LEFT-CLICK" "_pickAtom";
    bind "ALT-CTRL-SHIFT-LEFT-CLICK" "+:turn_cargo_8_mb";
    
    bind "SHIFT-DOUBLE" "plico_exit(true)";
    bind "LEFT-CLICK" "+:plico_menu_toggle";
}

# End of TURN.SPT

Contributors

Remig