User:Remig/plico/turn

From Jmol
Jump to navigation Jump to search

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.6 beta    4/12/2016 -require latest common includes
#
#   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 < 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 = "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