Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help
Special pages
SBGrid Resources
SBGrid Consortium
SBGrid Data Bank
Software Webinars
PyMOL Webinar
PyMOL Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
ShowLigandWaters
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== The Code == Copy the following text and save it as waters.py <source lang="python"> # -*- coding: cp1252 -*- """ This script detects waters molecules within a specified distance from the ligand. Water molecules are shown. Distance between water molecules and O or N atoms of ligand are shown. Author: Gianluca Tomasello, Gianluca Molla University of Insubria, Varese, Italy 09/02/2013 gianluca.molla@uninsubria.it Usage waters, [ligand name, distance] Parameters ligand : the ligand residue name distance : a float number that specify the maximum distance from the ligand to consider the water molecule Output -A file is produced containing a list of distance between waters and ligand atoms and the number of interactions -A graphic output show the water molecules interacting whith the ligand atoms by showing the distances between them """ from pymol import cmd,stored #define function: waters def waters(ligand, distance): stored.HOH = [] cmd.set('label_color','white') cmd.delete ("sele") cmd.hide ("everything") cmd.show_as ("sticks", "resn %s" % ligand) #iterate all water molecules nearby the ligand cmd.iterate('resn %s around %s and resn HOH' % (ligand,distance),'stored.HOH.append(resi)') f = open("waters.txt","a") count=0 count_int=0 for i in range(0,len(stored.HOH)): cmd.distance('dist_HOH_FAD', 'resi ' + stored.HOH[i], '(resn %s and n. O*+N*) w. 3.6 of resi %s'% (ligand, stored.HOH[i])) stored.name = [] #iterate all ligand atoms within a predetermined distance from the water molecule cmd.iterate('(resn %s and n. O*+N*) w. 3.6 of resi %s'% (ligand, stored.HOH[i]),'stored.name.append([resn,resi,name])') if stored.name: count = count+1 count_int = count_int+len(stored.name) for j in range(0,len(stored.name)): cmd.select('base', 'resi ' + stored.HOH[i]) cmd.select('var','resn '+ligand+ ' and n. ' + stored.name[j][2]) #calculate the distance between a specific atom and the water molecule dist = cmd.get_distance('base','var') f.write('HOH residue %s -- and -- %s ---> %f A\n'%(stored.HOH[i],stored.name[j], dist)) cmd.select ("waters","resn %s around %s and resn HOH" % (ligand,distance)) cmd.show_as ("spheres", "waters") cmd.zoom ("visible") num_atm = cmd.count_atoms ("waters") print ("Total number of water molecules at %s A from ligand %s: %s \n" % (distance,ligand,num_atm)) print ("Number of water molecules that interact with ligand: %d\n" % (count)) print ("Number of interactions between water molecules and ligand: %d\n" % count_int) f.write('-------------------------------------------------------------\n') f.write("Total number of water molecules at %s A from ligand %s: %s \n" % (distance,ligand,num_atm)) f.write("Number of water molecules that interact with ligand: %d\n" % count) f.write("Number of interactions between water molecules and ligand: %d\n\n\n\n" % count_int) f.close() cmd.delete ("waters") cmd.extend("waters",waters) </source> [[Category:Script_Library]] [[Category:ObjSel_Scripts]] [[Category:Biochemical_Scripts]] [[Category:Structural_Biology_Scripts]]
Summary:
Please note that all contributions to PyMOL Wiki are considered to be released under the GNU Free Documentation License 1.2 (see
PyMOL Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
ShowLigandWaters
(section)
Add topic