Displacementmap: Difference between revisions

From PyMOLWiki
Jump to navigation Jump to search
 
(61 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Infobox script-repo
|type      = script
|filename  = displacementmap.py
|author    = [[User:Tlinnet|Troels E. Linnet]]
|license  = BSD
}}
== Overview ==
== Overview ==
DisplacementMap is made for easy investigations of suitable positions for site-directed mutagenesis of amino residues into cysteines and FRET/EPR pair labelling.
DisplacementMap is made for easy investigations of suitable positions for site-directed mutagenesis of amino residues into cysteines and FRET/EPR pair labelling.
A Open and Closed form of a protein should be loaded. New objects should be created for the selected asymmetric unit.
 
Parts of the protein should be aligned, leaving the flexible part in two different positions.
A Open and Closed form of a protein should be loaded. New objects should be created for the selected asymmetric unit. Parts of the protein should be aligned, leaving the flexible part in two different positions.
The input is the the objects, Open (Object1) and Closed (Object2). Further is the criteria for selecting which atom the distance should be calculated between. Standard is atom='CA' (atom). Then one selects the Förster distance R0 (MinResResDist). This is the minimum distance between the residues. This depends of the selection of the FRET pair and protein at hand. But usually in the range 40 - 80 Angstrom is suitable. Then one defines the minimum displacement that is accepted. Usually R0/2 (MinDeltaDist). The script will find the 5 best (MinMaxListLength=5) positive and negative distance displacement between the two objects. It parses the results back to Pymol, that is standard set to show it as sticks (showsticks='yes'). If one is looking for a particular residue range for the fret pair, this can be specified in the last two input.
 
Res1=24.45-47.86 Res2=100-105.107  Res1 is "from" and Res2 is "to". Individual residues are split by a ".", and ranges are defined with "-".
The input is the objects, Open (molecule1) and Closed (molecule2). <br />
Further is the criteria for selecting which atom the distance should be calculated between. Standard is atom='CA' (atom). <br />
Then one selects the Förster distance R0 (mindist). This is the minimum distance between the residues. This depends of the selection of the FRET pair and protein at hand. But usually in the range 40 - 80 Angstrom is suitable. <br />
Then one defines the minimum displacement that is accepted. Usually R0/2 (mindelta). <br />
The script will find the 5 best (listlength=5) positive and negative distance displacement between the two objects.  
 
It parses the results back to Pymol, that is standard set to show it as sticks (showsticks='yes'). <br />
If one is looking for a particular residue range for the FRET pair, this can be specified with two input.
resi1=24.45-47.86 resi2=100-105.107  resi1 is "from" and resi2 is "to". Individual residues are split by a ".", and ranges are defined with "-".<br />
In the end, it makes a large data-matrix with all the distances. It also produces a gnuplot file, for easy visualisation. Just drag the .plt file for win gnuplot command window and it plots your datamatrix.
In the end, it makes a large data-matrix with all the distances. It also produces a gnuplot file, for easy visualisation. Just drag the .plt file for win gnuplot command window and it plots your datamatrix.


== Bugs ==
== Bugs ==
If the criterion is set to low, the memory gets flooded in the data-matrix file, making the file unreadable. No solutions found yet.
If the criterion is set to low, the memory gets flooded in the data-matrix file, making the file unreadable. No solutions found yet.
== Instructions ==
# Make a folder
# Copy the code to your machine, and name: DisplacementMap.py
# Download the .pdf files of the Open and Closed form of your protein
# Make a pymol script file, that makes the alignment and such. See example.
# Run the script and see the results in command window and suggestions in pymol window
# Run the gnuplot file to see the data-matrix


== Example ==
== Example ==
<source lang="python">
<syntaxhighlight lang="python">
DisplacementMap(Object1, Object2, atom='CA', MinResResDist=40.0, MinDeltaDist=15.0, MinMaxListLength=5, showsticks='yes', Res1=str(0), Res2=str(0)):
dispmap(molecule1="NIL", molecule2="NIL", mindist=30.0, mindelta=15.0, resi1=str(0), resi2=str(0), atom='CA', listlength=5, showsticks='yes'):
DisplacementMap O5NT-1HP1-A, C5NT-1HPU-C, CA, 40.0, 15.0, 5, showsticks=yes, 23.50-500, 40-250.270-550
</syntaxhighlight>
</source>
Use of functions
<syntaxhighlight lang="python">
import displacementmap
dispmap Open5NT, Closed5NT, 40.0, 15.0, resi1=206, resi2=1-512.515-550
dispmap Open5NT, Closed5NT, 30.0, 15.0, resi2=1-512.515-550, atom=CA, listlength=10
</syntaxhighlight>


== Output ==
== Output ==
[[File:O5NT-1HP1-A-C5NT-1HPU-C-CA-dist.png]][[File:O5NT-1HP1-A-C5NT-1HPU-C-CA-dist-map.png]]
Suggestions are created in pymol, and gnuplot file is created for easy visualisation of pair data-matrix and the general backbone displacement.
 
<gallery heights="200px" widths="200px">
== Pymol script file ==
Image:O5NT-C5NT-CA-dist.png|
<source lang="python">
Image:O5NT-C5NT-CA-dist-menu.png|
reinitialize
Image:O5NT-C5NT-CA-dist-gnuplot.png|
#load pdb files and rename
Image:O5NT-C5NT-CA-dist-backbone.png
load 1HP1.pdb, O5NT-1HP1
</gallery>
load 1HPU.pdb, C5NT-1HPU
 
hide everything
#Select asymmetric units from pdb file
create O5NT-1HP1-A, /O5NT-1HP1//A
create C5NT-1HPU-C, /C5NT-1HPU//C
delete O5NT-1HP1
delete C5NT-1HPU
 
cartoon auto
show cartoon, O5NT-1HP1-A
show cartoon, C5NT-1HPU-C
set cartoon_fancy_helices=1
set bg,[1,1,1]
 
# align
align O5NT-1HP1-A and resi 26-355, C5NT-1HPU-C and resi 26-355
 
# Color
set_color goldenrod1, [1.000, 0.757, 0.145]
color goldenrod1, resi 26-355
set_color darkolivegreen1, [0.792, 1.000, 0.439]
color darkolivegreen1, O5NT-1HP1-A and resi 356-362
set_color darkolivegreen4, [0.431, 0.545, 0.239]
color darkolivegreen4, C5NT-1HPU-C and resi 356-362
set_color chocolate3, [0.804, 0.400, 0.114]
color chocolate3, O5NT-1HP1-A and resi 363-550
set_color purple4, [0.333, 0.102, 0.545]
color purple4, C5NT-1HPU-C and resi 363-550
 
#make sharper
set fog=0
 
#Load my function
run DisplacementMap.py
#Run function with input
DisplacementMap O5NT-1HP1-A, C5NT-1HPU-C, CA, 40.0, 15.0, 5, showsticks=yes
 
set cartoon_transparency, 0.9
set_view (\
    0.094686687,  -0.390707940,    0.915631354,\
    0.809000611,  -0.505792081,  -0.299485058,\
    0.580131471,    0.769104064,    0.268191338,\
    0.000000000,    0.000000000, -280.940521240,\
    26.240486145,  46.146961212,  21.702068329,\
  231.830673218,  330.050415039,  -20.000000000 )
</source>
 
== DisplacementMap.py ==
<source lang="python">
from pymol import cmd, stored
from math import sqrt
import os, re
 
## Thx for inspiration from Andreas Henschel
## http://www.mail-archive.com/pymol-users@lists.sourceforge.net/msg05595.html (17 dec 2010)
## And from Simple scriptin PymMOl http://www.pymolwiki.org/index.php/Simple_Scripting
### This is a rather slow version, since many matrix modules is not available on our system
### Ma.Sc student. Troels Linnet, 2010-12-18. troels.linnet@bbz.uni-leipzig.de
 
###Calculates the distance for example between all CA atoms between a closed and open form of a structure.
### Give a data matrix and a gnuplot file, and input to pymol for easy visualisation
### Possible so select interesting residues in ranges. Needs to be separated with a dot '.'
### Example input from pymol. with 2 objects.
### DistMatrix O5NT-1HP1-A, C5NT-1HPU-C, CA, 40.0, 15.0, 5, showsticks=yes, 23-25
 
def DisplacementMap(Object1, Object2, atom='CA', MinResResDist=40.0, MinDeltaDist=15.0, MinMaxListLength=5, showsticks='yes', Res1=str(0), Res2=str(0)):
print "\n"
print "Hello, PyMOLers in Leipzig"
print "You passed in %s and %s" % (Object1, Object2)
 
### Open filenames
filename = str(Object1) + "-" + str(Object2) + "-" + str(atom) + "-dist.txt"
        gnufilename = str(Object1) + "-" + str(Object2) + "-" + str(atom) + "-dist.plt"
outfile = open(filename, "w")
gnuoutfile = open(gnufilename, "w")
print "I have opened matrix %s for you" % (filename)
print "\n"
 
### Sorting for interesting residues for Obj1 and Obj2.
### Input is a string, and need to be sorted.
Res1 = Res1.split('.')
Res2 = Res2.split('.')
Res1List = []
Res2List = []
for i in Res1:
if '-' in i:
tmp = i.split('-')
Res1List.extend(range(int(tmp[0]),int(tmp[-1])+1))
if '-' not in i:
                        Res1List.append(int(i))
for i in Res2:
if '-' in i:
tmp = i.split('-')
Res2List.extend(range(int(tmp[0]),int(tmp[-1])+1))
if '-' not in i:
Res2List.append(int(i))
Res1List.sort()
Res2List.sort()
 
### Only take the lines where atom is specified in input
Object3 = Object1 + " and name " + str(atom)
Object4 = Object2 + " and name " + str(atom)
 
### Open 2 name arrays
### Append residue and atom name to the arrays
stored.OpenPDB = []
stored.ClosedPDB = []
cmd.iterate(Object3, "stored.OpenPDB.append((resi, name, resn))")
cmd.iterate(Object4, "stored.ClosedPDB.append((resi, name, resn))")
 
### Open 2 x,y,z position arrays
### Append atom position
stored.OpenPos = []
stored.ClosedPos = []
cmd.iterate_state(1, selector.process(Object3), "stored.OpenPos.append((x,y,z))")
cmd.iterate_state(1, selector.process(Object4), "stored.ClosedPos.append((x,y,z))")
 
### Sometimes residues gets skipped in X-ray crys, because of low signal or sim. This leads to number conflict.
### Make ordered array according to residue number. Find largest residue number via -1
OpenOrderedPDB = []
ClosedOrderedPDB = []
OpenOrderedPos = []
ClosedOrderedPos = []
 
### First fill arrays with zeros
for i in range(int(stored.OpenPDB[-1][0])+1):
OpenOrderedPDB.append([0,0,0])
for i in range(int(stored.ClosedPDB[-1][0])+1):
ClosedOrderedPDB.append([0,0,0])
for i in range(int(stored.OpenPDB[-1][0])+1):
OpenOrderedPos.append((0,0,0))
for i in range(int(stored.ClosedPDB[-1][0])+1):
ClosedOrderedPos.append((0,0,0))
 
### Fill in data the right places
j=0
for i in stored.OpenPDB:
OpenOrderedPDB[int(i[0])]=[int(i[0]),i[1],i[2]]
OpenOrderedPos[int(i[0])]=stored.OpenPos[j]
j = j + 1
j=0
for i in stored.ClosedPDB:
ClosedOrderedPDB[int(i[0])]=[int(i[0]),i[1],i[2]]
ClosedOrderedPos[int(i[0])]=stored.ClosedPos[j]
j = j + 1
 
### Make a list with the missing residues
MissingRes = []
for index, resi in enumerate(OpenOrderedPDB):
if abs(OpenOrderedPDB[index][0]-ClosedOrderedPDB[index][0]) != 0:
MissingRes.append(abs(OpenOrderedPDB[index][0]-ClosedOrderedPDB[index][0]))
print "Following residues miss in one of the files, and are discharged for"
print "further calculations"
print MissingRes
        print "\n"
 
### Make the data matrix
CalcMatrix = create_nXn_matrix(len(OpenOrderedPos))
print "Calculate a %s X %s distance Matrix" % (len(OpenOrderedPos), len(ClosedOrderedPos))
 
### Make a list with 10 most negative/positive distances
MaxNegDist = []
      MaxPosDist = []
for i in range(int(MinMaxListLength)):
MaxNegDist.append([0,0,0,0,0,0,0])
                MaxPosDist.append([0,0,0,0,0,0,0])
 
### Calculate distances
for i in range(len(OpenOrderedPos)):
for j in range(len(ClosedOrderedPos)):
if OpenOrderedPos[i][0] != 0 and ClosedOrderedPos[j][0] != 0 and OpenOrderedPDB[i][0] not in MissingRes and ClosedOrderedPDB[j][0] not in MissingRes:
distOpenOpen = distance(OpenOrderedPos, OpenOrderedPos, i, j)
distClosedClosed = distance(ClosedOrderedPos, ClosedOrderedPos, i, j)
distOpenClosed = distance(OpenOrderedPos, ClosedOrderedPos, i, j)
DeltaDist =  distOpenClosed - distOpenOpen
###Test if distance is larger than threshold
if distOpenOpen > float(MinResResDist) and distClosedClosed > float(MinResResDist) and abs(DeltaDist) > float(MinDeltaDist):
CalcMatrix[i][j] = str(round(DeltaDist, 0))
if DeltaDist < 0 and DeltaDist < MaxNegDist[-1][0] and (i in Res1List or Res1List[-1]==0) and (j in Res2List or Res2List[-1]==0):
MaxNegDist[-1][0] = DeltaDist
                                                MaxNegDist[-1][1] = i
                                                MaxNegDist[-1][2] = j
MaxNegDist[-1][3] = distOpenOpen
                                                MaxNegDist[-1][4] = distOpenClosed
                                                MaxNegDist[-1][5] = str(OpenOrderedPDB[i][2])
                                                MaxNegDist[-1][6] = str(ClosedOrderedPDB[j][2])
MaxNegDist = sorted(MaxNegDist)
if DeltaDist > 0 and DeltaDist > MaxPosDist[-1][0] and (i in Res1List or Res1List[-1]==0) and (j in Res2List or Res2List[-1]==0):
MaxPosDist[-1][0] = DeltaDist
                                                MaxPosDist[-1][1] = i
                                                MaxPosDist[-1][2] = j
MaxPosDist[-1][3] = distOpenOpen
                                                MaxPosDist[-1][4] = distOpenClosed
                                                MaxPosDist[-1][5] = str(OpenOrderedPDB[i][2])
                                                MaxPosDist[-1][6] = str(ClosedOrderedPDB[j][2])
MaxPosDist = sorted(MaxPosDist, reverse=True)


print "I made a datamatrix txt file for you"
== Text output ==
print "filename: %s" % (filename)
In the data-matrix.txt file, you find the best suggestions
print "I made a gnuplot file for you, to view the datamatrix"
<syntaxhighlight lang="text">
print "filename: %s" % (gnufilename)
# Input 1: Open5NT  and Input 2: Closed5NT
print "\n"
# Find for: CA  with min. residue-residue dist: 30.0 Angstrom
# Looking for min. displacement dist: 15.0 Angstrom
# I give nr# suggestions: 5, and do I show sticks in pymol?: yes
# I look for suggestions in the range: ([0]=>means all residues)
# for Input 1: ['0'] and for Input 2: ['0']
# Mutation info is BLOSUM62 log-odds likelihood score and PAM250 is probability in % for evolutionary distance
###########################################################################################################
# Max Negative and positive distances                                      #      Mutation info        #
###########################################################################################################
# Obj.1  Obj.2  Delta  Op-Op Cl-Cl # Obj.1  Obj.2  Delta  Op-Op Cl-Cl # Res.1  Res.2 # Res.1  Res.2 #
# Res.1  Res.2  -Dist  Dist  Dist  # Res.1  Res.2  +Dist  Dist  Dist  # B62/PAM250% # B62/PAM250% #
###########################################################################################################
# PRO241  ASP456  -25.7  59.1  33.4 # PRO274  PRO513  26.8  31.2  58.0 # -3/ 2 -3/ 1  # -3/ 2 -3/ 2  #
# LYS197  ASP456  -25.6  57.3  31.7 # THR273  PRO513  26.1  31.6  57.7 # -1/ 1 -3/ 1  # -1/ 2 -3/ 2  #
# PRO513  ASP456  -25.4  32.4    7.0 # PRO274  GLY514  24.8  32.9  57.6 # -3/ 2 -3/ 1  # -3/ 2 -3/ 2  #
# LEU198  ASP456  -25.3  59.0  33.7 # PRO274  LYS512  24.7  30.3  55.0 # -1/ 1 -3/ 1  # -3/ 2 -1/ 1  #
# GLN201  ASP456  -25.2  62.8  37.6 # ASN311  PRO513  24.7  35.6  60.3 # -3/ 1 -3/ 1  # -3/ 1 -3/ 2  #
</syntaxhighlight>
The script also automatically make the gnuplot plot file (.plt), with all the defined variables, for easy visualisation of the data-matrix.txt and the backbone displacement.


###Print distance matrix
== Example 1 ==
outfile.write(("# Input 1: %s  and Input 2: %s" + '\n') % (Object1, Object2))
{{Template:PymolScriptRepoDownload|examples/displacementmap_1.pml}}
outfile.write(("# Find for: %s  with min. residue-residue dist: %s Angstrom" + '\n') % (atom, MinResResDist))
<include src="https://raw.github.com/Pymol-Scripts/Pymol-script-repo/master/examples/displacementmap_1.pml" highlight="python" />
      outfile.write(("# Looking for min. displacement dist: %s Angstrom" + '\n') % (MinDeltaDist))
      outfile.write(("# I give nr# suggestions: %s, and do I show sticks in pymol?: %s" + '\n') % (MinMaxListLength, showsticks))
outfile.write(("# I look for suggestions in the range: ([0]=>means all residues)" + '\n'))
outfile.write(("# for Input 1: %s and for Input 2: %s  " + '\n') % (Res1, Res2))
        outfile.write(("###########################################################################" + "\n"))
outfile.write(("# Max Negative and positive distances                                    #" + "\n"))
outfile.write(("###########################################################################" + "\n"))
print("# Input 1: %s  and Input 2: %s") % (Object1, Object2)
print("# Find for: %s  with min. residue-residue dist: %s Angstrom") % (atom, MinResResDist)
      print("# Looking for min. displacement dist: %s Angstrom") % (MinDeltaDist)
      print("# I give nr# suggestions: %s, and do I show sticks in pymol?: %s") % (MinMaxListLength, showsticks)
print("# I look for suggestions in the range: ([0]=>means all residues)")
print("# for Input 1: %s and for Input 2: %s  ") % (Res1, Res2)
print("###########################################################################")
print("# Max Negative and positive distances                                    #")
      print("###########################################################################")
outfile.write("# Obj.1  Obj.2  Delta  Op-Op Cl-Cl #  Obj.1  Obj.2  Delta  Op-Op Cl-Cl #" + "\n")
        outfile.write("# Res.1  Res.2  -Dist  Dist  Dist  #  Res.1  Res.2  +Dist  Dist  Dist  #" + "\n")
outfile.write("###########################################################################" + "\n")
        print("# Obj.1  Obj.2  Delta  Op-Op Cl-Cl #  Obj.1  Obj.2  Delta  Op-Op Cl-Cl #")
        print("# Res.1  Res.2  -Dist  Dist  Dist  #  Res.1  Res.2  +Dist  Dist  Dist  #")
      print("###########################################################################")
for i in range(len(MaxNegDist)):
                outfile.write("# " + str(MaxNegDist[i][5]) + str(MaxNegDist[i][1]) + (5-len(str(MaxNegDist[i][1])))*" " + str(MaxNegDist[i][6]) + str(MaxNegDist[i][2]) + (5-len(str(MaxNegDist[i][2])))*" " + str(round(MaxNegDist[i][0], 1)) + "  " + str(round(MaxNegDist[i][3], 1)) + "  " + str(round(MaxNegDist[i][4], 1)) + "  #  " + str(MaxPosDist[i][5]) + str(MaxPosDist[i][1]) + (5-len(str(MaxPosDist[i][1])))*" " + str(MaxPosDist[i][6]) + str(MaxPosDist[i][2]) + (5-len(str(MaxPosDist[i][2])))*" " + str(round(MaxPosDist[i][0], 1)) + "  " + str(round(MaxPosDist[i][3], 1)) + "  " + str(round(MaxPosDist[i][4], 1)) + "\n")
print("# " + str(MaxNegDist[i][5]) + str(MaxNegDist[i][1]) + (5-len(str(MaxNegDist[i][1])))*" " + str(MaxNegDist[i][6]) + str(MaxNegDist[i][2]) + (5-len(str(MaxNegDist[i][2])))*" " + str(round(MaxNegDist[i][0], 1)) + "  " + str(round(MaxNegDist[i][3], 1)) + "  " + str(round(MaxNegDist[i][4], 1)) + "  #  " + str(MaxPosDist[i][5]) + str(MaxPosDist[i][1]) + (5-len(str(MaxPosDist[i][1])))*" " + str(MaxPosDist[i][6]) + str(MaxPosDist[i][2]) + (5-len(str(MaxPosDist[i][2])))*" " + str(round(MaxPosDist[i][0], 1)) + "  " + str(round(MaxPosDist[i][3], 1)) + "  " + str(round(MaxPosDist[i][4], 1)))
for i in range(len(CalcMatrix)):
writing = ""
for j in range(len(CalcMatrix)):
writing = writing + " " + str(CalcMatrix[i][j])
### Add break line
writing = writing + " " + "\n"
outfile.write(writing)
outfile.close()
        print "\n"


###Make gnuplot plot file
== References ==
        gnuoutfile.write("reset" + "\n")
For EPR considerations <br>
        gnuoutfile.write("cd " + "'" + os.getcwd() + "'" + "\n")
''Conformation of T4 Lysozyme in Solution. Hinge-Bending Motion and the Substrate-Induced Conformational Transition Studied by Site-Directed Spin Labeling'' <br>
        gnuoutfile.write("\n")
Hassane S. Mchaourab, Kyoung Joon Oh, Celia J. Fang, and Wayne L. Hubbell <br>
        gnuoutfile.write("#Title hacks \\n is newline, and 0,1 is x,y offset adjustment" + "\n")
''Biochemistry'' '''1997''', 36, 307-316
        gnuoutfile.write('#set title "Protein ' + str(atom) + ' Displacement matrix map \\n ResRes min. ' + str(MinResResDist) + ' Ang, ' + 'Delta min. ' + str(MinDeltaDist) + ' Ang" 0,1' + "\n")
        gnuoutfile.write('set title "Protein ' + str(atom) + ' Displacement matrix map \\n ResRes min. ' + str(MinResResDist) + ' Ang, ' + 'Delta min. ' + str(MinDeltaDist) + ' Ang" 0,1' + ' font "Times-Roman,12"' + '\n')
        gnuoutfile.write("# x is column" + "\n")
        gnuoutfile.write("#set xlabel 'Res nr. for " + str(Object2) + "\n")
        gnuoutfile.write("set xlabel 'Res nr. for " + str(Object2) + "' font 'Times-Roman,10'" + "\n")
        gnuoutfile.write("# y is row" + "\n")
        gnuoutfile.write("#set ylabel 'Res nr. for " + str(Object1) + "\n")
        gnuoutfile.write("set ylabel 'Res nr. for " + str(Object1) + "' font 'Times-Roman,10'" + "\n")
        gnuoutfile.write("\n")
        gnuoutfile.write("#set xrange [300:550]; set yrange [0:400]" + "\n")
gnuoutfile.write("set xtics 50" + " font 'Times-Roman,6'" + "\n")
gnuoutfile.write("set ytics 50" + " font 'Times-Roman,6'" + "\n")
gnuoutfile.write("set mxtics 5" + "\n")
gnuoutfile.write("set mytics 5" + "\n")
        gnuoutfile.write("set size ratio 1" + "\n")
        gnuoutfile.write("unset key" + "\n")
        gnuoutfile.write("\n")
        gnuoutfile.write("set cbrange [-30:30]" + "\n")
        gnuoutfile.write("set palette defined (-30 'blue', 0 'white', 30 'red')" + "\n")
        gnuoutfile.write("set pm3d map" + "\n")
        gnuoutfile.write("\n")
        gnuoutfile.write("splot '" + str(filename) + "' matrix" + "\n")
gnuoutfile.write("pause -1" + "\n")


###Create stick residue objects
''Probing Single-Molecule T4 Lysozyme Conformational Dynamics by Intramolecular Fluorescence Energy Transfer'' <br>
        for i in range(len(MaxNegDist)):
Yu Chen, Dehong Hu, Erich R. Vorpagel, and H. Peter Lu <br>
name = str(round(MaxNegDist[i][0],1))+"_"+str(MaxNegDist[i][1])+"-"+str(MaxNegDist[i][2])
J. Phys. Chem. B '''2003''', 107, 7947-7956
selection = str(Object1)+" and resi "+str(MaxNegDist[i][1]) + "+"+str(MaxNegDist[i][2])+" + "+str(Object2)+" and resi "+str(MaxNegDist[i][2])
cmd.create(name, selection)
if showsticks=='yes' or showsticks=='y':
cmd.show("sticks", name)
        for i in range(len(MaxPosDist)):
name = str(round(MaxPosDist[i][0],1))+"_"+str(MaxPosDist[i][1])+"-"+str(MaxPosDist[i][2])
selection = str(Object1)+" and resi " + str(MaxPosDist[i][1])+"+" + str(MaxPosDist[i][2])+" + " + str(Object2)+" and resi "+str(MaxPosDist[i][2])
cmd.create(name, selection)
if showsticks=='yes' or showsticks=='y':
cmd.show("sticks", name)
print "Done"
        print "\n"
cmd.extend("DisplacementMap",DisplacementMap)


def create_nXn_matrix(n):
For FRET pair selection and considerations <br>
return [[0.0 for x in range(n)] for x in range(n)]
''Fluorescent probes and bioconjugation chemistries for single-molecule fluorescence analysis of biomolecules'' <br>
Achillefs N. Kapanidisa and Shimon Weiss <br>
''Journal of chemical physics'' VOLUME 117, Number 24 22 '''December 2002'''


def distance(array1, array2, i, j):
'''For inspiration to DisplacementMap. Fig: 6, Difference-distance matrix for the difference in CA-CA distances.''' <br>
i = int(i); j = int(j)
''Structure of a Hinge-bending Bacteriophage T4 Lysozyme Mutant, Ile3 -> Pro'' <br>
dist = sqrt((array1[i][0] - array2[j][0])**2 + (array1[i][1] - array2[j][1])**2 + (array1[i][2] - array2[j][2])**2)
M. M. Dixon, H. Nicholsont, L. Shewchuk W. A. Baase and B. W. Matthews1 <br>
return dist
J. Mol. Biol. ('''1992''') 227. 917-933
</source>


[[Category:Script_Library|DisplacementMap]]
[[Category:Script_Library|DisplacementMap]]
[[Category:Structural_Biology_Scripts]]
[[Category:Structural_Biology_Scripts]]
[[Category:Pymol-script-repo]]

Latest revision as of 10:03, 15 January 2012

Type Python Script
Download displacementmap.py
Author(s) Troels E. Linnet
License BSD
This code has been put under version control in the project Pymol-script-repo

Overview

DisplacementMap is made for easy investigations of suitable positions for site-directed mutagenesis of amino residues into cysteines and FRET/EPR pair labelling.

A Open and Closed form of a protein should be loaded. New objects should be created for the selected asymmetric unit. Parts of the protein should be aligned, leaving the flexible part in two different positions.

The input is the objects, Open (molecule1) and Closed (molecule2).
Further is the criteria for selecting which atom the distance should be calculated between. Standard is atom='CA' (atom).
Then one selects the Förster distance R0 (mindist). This is the minimum distance between the residues. This depends of the selection of the FRET pair and protein at hand. But usually in the range 40 - 80 Angstrom is suitable.
Then one defines the minimum displacement that is accepted. Usually R0/2 (mindelta).
The script will find the 5 best (listlength=5) positive and negative distance displacement between the two objects.

It parses the results back to Pymol, that is standard set to show it as sticks (showsticks='yes').
If one is looking for a particular residue range for the FRET pair, this can be specified with two input. resi1=24.45-47.86 resi2=100-105.107 resi1 is "from" and resi2 is "to". Individual residues are split by a ".", and ranges are defined with "-".
In the end, it makes a large data-matrix with all the distances. It also produces a gnuplot file, for easy visualisation. Just drag the .plt file for win gnuplot command window and it plots your datamatrix.

Bugs

If the criterion is set to low, the memory gets flooded in the data-matrix file, making the file unreadable. No solutions found yet.

Example

dispmap(molecule1="NIL", molecule2="NIL", mindist=30.0, mindelta=15.0, resi1=str(0), resi2=str(0), atom='CA', listlength=5, showsticks='yes'):

Use of functions

import displacementmap
dispmap Open5NT, Closed5NT, 40.0, 15.0, resi1=206, resi2=1-512.515-550 
dispmap Open5NT, Closed5NT, 30.0, 15.0, resi2=1-512.515-550, atom=CA, listlength=10

Output

Suggestions are created in pymol, and gnuplot file is created for easy visualisation of pair data-matrix and the general backbone displacement.

Text output

In the data-matrix.txt file, you find the best suggestions

# Input 1: Open5NT  and Input 2: Closed5NT
# Find for: CA  with min. residue-residue dist: 30.0 Angstrom
# Looking for min. displacement dist: 15.0 Angstrom
# I give nr# suggestions: 5, and do I show sticks in pymol?: yes
# I look for suggestions in the range: ([0]=>means all residues)
# for Input 1: ['0'] and for Input 2: ['0']
# Mutation info is BLOSUM62 log-odds likelihood score and PAM250 is probability in % for evolutionary distance
###########################################################################################################
# Max Negative and positive distances                                       #       Mutation info         #
###########################################################################################################
# Obj.1   Obj.2   Delta   Op-Op Cl-Cl # Obj.1   Obj.2   Delta   Op-Op Cl-Cl # Res.1  Res.2 # Res.1  Res.2 #
# Res.1   Res.2   -Dist   Dist  Dist  # Res.1   Res.2   +Dist   Dist  Dist  # B62/PAM250%  # B62/PAM250%  #
###########################################################################################################
# PRO241  ASP456  -25.7   59.1   33.4 # PRO274  PRO513   26.8   31.2   58.0 # -3/ 2 -3/ 1  # -3/ 2 -3/ 2  #
# LYS197  ASP456  -25.6   57.3   31.7 # THR273  PRO513   26.1   31.6   57.7 # -1/ 1 -3/ 1  # -1/ 2 -3/ 2  #
# PRO513  ASP456  -25.4   32.4    7.0 # PRO274  GLY514   24.8   32.9   57.6 # -3/ 2 -3/ 1  # -3/ 2 -3/ 2  #
# LEU198  ASP456  -25.3   59.0   33.7 # PRO274  LYS512   24.7   30.3   55.0 # -1/ 1 -3/ 1  # -3/ 2 -1/ 1  #
# GLN201  ASP456  -25.2   62.8   37.6 # ASN311  PRO513   24.7   35.6   60.3 # -3/ 1 -3/ 1  # -3/ 1 -3/ 2  #

The script also automatically make the gnuplot plot file (.plt), with all the defined variables, for easy visualisation of the data-matrix.txt and the backbone displacement.

Example 1

Download: examples/displacementmap_1.pml
This code has been put under version control in the project Pymol-script-repo

<include src="https://raw.github.com/Pymol-Scripts/Pymol-script-repo/master/examples/displacementmap_1.pml" highlight="python" />

References

For EPR considerations
Conformation of T4 Lysozyme in Solution. Hinge-Bending Motion and the Substrate-Induced Conformational Transition Studied by Site-Directed Spin Labeling
Hassane S. Mchaourab, Kyoung Joon Oh, Celia J. Fang, and Wayne L. Hubbell
Biochemistry 1997, 36, 307-316

Probing Single-Molecule T4 Lysozyme Conformational Dynamics by Intramolecular Fluorescence Energy Transfer
Yu Chen, Dehong Hu, Erich R. Vorpagel, and H. Peter Lu
J. Phys. Chem. B 2003, 107, 7947-7956

For FRET pair selection and considerations
Fluorescent probes and bioconjugation chemistries for single-molecule fluorescence analysis of biomolecules
Achillefs N. Kapanidisa and Shimon Weiss
Journal of chemical physics VOLUME 117, Number 24 22 December 2002

For inspiration to DisplacementMap. Fig: 6, Difference-distance matrix for the difference in CA-CA distances.
Structure of a Hinge-bending Bacteriophage T4 Lysozyme Mutant, Ile3 -> Pro
M. M. Dixon, H. Nicholsont, L. Shewchuk W. A. Baase and B. W. Matthews1
J. Mol. Biol. (1992) 227. 917-933