1 #!/bin/env python 2 # 3 # File: PyMOLVisualizeMacromolecules.py 4 # Author: Manish Sud <msud@san.rr.com> 5 # 6 # Copyright (C) 2024 Manish Sud. All rights reserved. 7 # 8 # The functionality available in this script is implemented using PyMOL, a 9 # molecular visualization system on an open source foundation originally 10 # developed by Warren DeLano. 11 # 12 # This file is part of MayaChemTools. 13 # 14 # MayaChemTools is free software; you can redistribute it and/or modify it under 15 # the terms of the GNU Lesser General Public License as published by the Free 16 # Software Foundation; either version 3 of the License, or (at your option) any 17 # later version. 18 # 19 # MayaChemTools is distributed in the hope that it will be useful, but without 20 # any warranty; without even the implied warranty of merchantability of fitness 21 # for a particular purpose. See the GNU Lesser General Public License for more 22 # details. 23 # 24 # You should have received a copy of the GNU Lesser General Public License 25 # along with MayaChemTools; if not, see <http://www.gnu.org/licenses/> or 26 # write to the Free Software Foundation Inc., 59 Temple Place, Suite 330, 27 # Boston, MA, 02111-1307, USA. 28 # 29 30 from __future__ import print_function 31 32 # Add local python path to the global path and import standard library modules... 33 import os 34 import sys; sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), "..", "lib", "Python")) 35 import time 36 import re 37 38 # PyMOL imports... 39 try: 40 import pymol 41 # Finish launching PyMOL in a command line mode for batch processing (-c) 42 # along with the following options: disable loading of pymolrc and plugins (-k); 43 # suppress start up messages (-q) 44 pymol.finish_launching(['pymol', '-ckq']) 45 except ImportError as ErrMsg: 46 sys.stderr.write("\nFailed to import PyMOL module/package: %s\n" % ErrMsg) 47 sys.stderr.write("Check/update your PyMOL environment and try again.\n\n") 48 sys.exit(1) 49 50 # MayaChemTools imports... 51 try: 52 from docopt import docopt 53 import MiscUtil 54 import PyMOLUtil 55 except ImportError as ErrMsg: 56 sys.stderr.write("\nFailed to import MayaChemTools module/package: %s\n" % ErrMsg) 57 sys.stderr.write("Check/update your MayaChemTools environment and try again.\n\n") 58 sys.exit(1) 59 60 ScriptName = os.path.basename(sys.argv[0]) 61 Options = {} 62 OptionsInfo = {} 63 64 def main(): 65 """Start execution of the script.""" 66 67 MiscUtil.PrintInfo("\n%s (PyMOL v%s; MayaChemTools v%s; %s): Starting...\n" % (ScriptName, pymol.cmd.get_version()[0], MiscUtil.GetMayaChemToolsVersion(), time.asctime())) 68 69 (WallClockTime, ProcessorTime) = MiscUtil.GetWallClockAndProcessorTime() 70 71 # Retrieve command line arguments and options... 72 RetrieveOptions() 73 74 # Process and validate command line arguments and options... 75 ProcessOptions() 76 77 # Perform actions required by the script... 78 GenerateMacromolecularVisualization() 79 80 MiscUtil.PrintInfo("\n%s: Done...\n" % ScriptName) 81 MiscUtil.PrintInfo("Total time: %s" % MiscUtil.GetFormattedElapsedTime(WallClockTime, ProcessorTime)) 82 83 def GenerateMacromolecularVisualization(): 84 """Generate macromolecular visualization.""" 85 86 Outfile = OptionsInfo["PMLOutfile"] 87 OutFH = open(Outfile, "w") 88 if OutFH is None: 89 MiscUtil.PrintError("Failed to open output fie %s " % Outfile) 90 91 MiscUtil.PrintInfo("\nGenerating file %s..." % Outfile) 92 93 # Setup header... 94 WritePMLHeader(OutFH, ScriptName) 95 WritePyMOLParameters(OutFH) 96 97 # Load reffile for alignment.. 98 if OptionsInfo["Align"]: 99 WriteAlignReference(OutFH) 100 101 # Setup view for each input file... 102 FirstComplex = True 103 FirstComplexFirstChainName = None 104 for FileIndex in range(0, len(OptionsInfo["InfilesInfo"]["InfilesNames"])): 105 # Setup PyMOL object names... 106 PyMOLObjectNames = SetupPyMOLObjectNames(FileIndex) 107 108 # Setup complex view... 109 WriteComplexView(OutFH, FileIndex, PyMOLObjectNames, FirstComplex) 110 111 # Setup trajectories views... 112 if GetTrajectoriesStatus(FileIndex): 113 WriteTrajectoriesView(OutFH, FileIndex, PyMOLObjectNames) 114 115 SpecifiedChainsAndLigandsInfo = OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex] 116 FirstChain = True 117 for ChainID in SpecifiedChainsAndLigandsInfo["ChainIDs"]: 118 if FirstComplex and FirstChain: 119 FirstComplexFirstChainName = PyMOLObjectNames["Chains"][ChainID]["ChainAlone"] 120 121 WriteChainView(OutFH, FileIndex, PyMOLObjectNames, ChainID) 122 123 # Setup ligand views... 124 FirstLigand = True 125 for LigandID in SpecifiedChainsAndLigandsInfo["LigandIDs"][ChainID]: 126 WriteChainLigandView(OutFH, FileIndex, PyMOLObjectNames, ChainID, LigandID) 127 128 # Set up ligand level group... 129 Enable, Action = [False, "close"] 130 if FirstLigand: 131 FirstLigand = False 132 Enable, Action = [True, "open"] 133 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Ligands"][ChainID][LigandID]["ChainLigandGroup"], PyMOLObjectNames["Ligands"][ChainID][LigandID]["ChainLigandGroupMembers"], Enable, Action) 134 135 # Setup docked poses views... 136 if GetChainAloneDockedPosesStatus(FileIndex, ChainID): 137 WriteChainDockedPosesView(OutFH, FileIndex, PyMOLObjectNames, ChainID) 138 139 # Setup Chain level group... 140 Enable, Action = [False, "close"] 141 if FirstChain: 142 FirstChain = False 143 Enable, Action = [True, "open"] 144 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Chains"][ChainID]["ChainGroup"], PyMOLObjectNames["Chains"][ChainID]["ChainGroupMembers"], Enable, Action) 145 146 # Set up complex level group... 147 Enable, Action = [False, "close"] 148 if FirstComplex: 149 FirstComplex = False 150 Enable, Action = [True, "open"] 151 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["PDBGroup"], PyMOLObjectNames["PDBGroupMembers"], Enable, Action) 152 153 # Delete empty PyMOL objects... 154 DeleteEmptyPyMOLObjects(OutFH, FileIndex, PyMOLObjectNames) 155 156 if OptionsInfo["Align"]: 157 DeleteAlignReference(OutFH) 158 159 if FirstComplexFirstChainName is not None: 160 OutFH.write("""\ncmd.orient("%s", animate = -1)\n""" % FirstComplexFirstChainName) 161 else: 162 OutFH.write("""\ncmd.orient("visible", animate = -1)\n""") 163 164 OutFH.close() 165 166 # Generate PSE file as needed... 167 if OptionsInfo["PSEOut"]: 168 GeneratePyMOLSessionFile() 169 170 def WritePMLHeader(OutFH, ScriptName): 171 """Write out PML header.""" 172 173 HeaderInfo = PyMOLUtil.SetupPMLHeaderInfo(ScriptName) 174 OutFH.write("%s\n" % HeaderInfo) 175 176 def WritePyMOLParameters(OutFH): 177 """Write out PyMOL global parameters.""" 178 179 PMLCmds = [] 180 PMLCmds.append("""cmd.set("transparency", %.2f, "", 0)""" % (OptionsInfo["SurfaceTransparency"])) 181 PMLCmds.append("""cmd.set("label_font_id", %s)""" % (OptionsInfo["LabelFontID"])) 182 PML = "\n".join(PMLCmds) 183 184 OutFH.write("""\n""\n"Setting up PyMOL gobal parameters..."\n""\n""") 185 OutFH.write("%s\n" % PML) 186 187 def WriteAlignReference(OutFH): 188 """Setup object for alignment reference.""" 189 190 RefFileInfo = OptionsInfo["RefFileInfo"] 191 RefFile = RefFileInfo["RefFileName"] 192 RefName = RefFileInfo["PyMOLObjectName"] 193 194 PMLCmds = [] 195 PMLCmds.append("""cmd.load("%s", "%s")""" % (RefFile, RefName)) 196 PMLCmds.append("""cmd.hide("everything", "%s")""" % (RefName)) 197 PMLCmds.append("""cmd.disable("%s")""" % (RefName)) 198 PML = "\n".join(PMLCmds) 199 200 OutFH.write("""\n""\n"Loading %s and setting up view for align reference..."\n""\n""" % RefFile) 201 OutFH.write("%s\n" % PML) 202 203 def WriteAlignComplex(OutFH, FileIndex, PyMOLObjectNames): 204 """Setup alignment of complex to reference.""" 205 206 RefFileInfo = OptionsInfo["RefFileInfo"] 207 RefName = RefFileInfo["PyMOLObjectName"] 208 209 ComplexName = PyMOLObjectNames["Complex"] 210 211 if re.match("^FirstChain$", OptionsInfo["AlignMode"], re.I): 212 RefFirstChainID = RefFileInfo["ChainsAndLigandsInfo"]["ChainIDs"][0] 213 RefAlignSelection = "%s and chain %s" % (RefName, RefFirstChainID) 214 215 ComplexFirstChainID = RetrieveFirstChainID(FileIndex) 216 ComplexAlignSelection = "%s and chain %s" % (ComplexName, ComplexFirstChainID) 217 else: 218 RefAlignSelection = RefName 219 ComplexAlignSelection = ComplexName 220 221 PML = PyMOLUtil.SetupPMLForAlignment(OptionsInfo["AlignMethod"], RefAlignSelection, ComplexAlignSelection) 222 OutFH.write("""\n""\n"Aligning %s against reference %s ..."\n""\n""" % (ComplexAlignSelection, RefAlignSelection)) 223 OutFH.write("%s\n" % PML) 224 225 def DeleteAlignReference(OutFH): 226 """Delete alignment reference object.""" 227 228 RefName = OptionsInfo["RefFileInfo"]["PyMOLObjectName"] 229 OutFH.write("""\n""\n"Deleting alignment reference object %s..."\n""\n""" % RefName) 230 OutFH.write("""cmd.delete("%s")\n""" % RefName) 231 232 def WriteComplexView(OutFH, FileIndex, PyMOLObjectNames, FirstComplex): 233 """Write out PML for viewing polymer complex.""" 234 235 # Setup complex... 236 Infile = OptionsInfo["InfilesInfo"]["InfilesNames"][FileIndex] 237 PML = PyMOLUtil.SetupPMLForPolymerComplexView(PyMOLObjectNames["Complex"], Infile, True) 238 OutFH.write("""\n""\n"Loading %s and setting up view for complex..."\n""\n""" % Infile) 239 OutFH.write("%s\n" % PML) 240 241 if OptionsInfo["Align"]: 242 # No need to align complex on to itself... 243 if not (re.match("^FirstInputFile$", OptionsInfo["AlignRefFile"], re.I) and FirstComplex): 244 WriteAlignComplex(OutFH, FileIndex, PyMOLObjectNames) 245 246 if OptionsInfo["SurfaceComplex"]: 247 # Setup hydrophobic surface... 248 PML = PyMOLUtil.SetupPMLForHydrophobicSurfaceView(PyMOLObjectNames["ComplexHydrophobicSurface"], PyMOLObjectNames["Complex"], ColorPalette = OptionsInfo["SurfaceColorPalette"], Enable = False) 249 OutFH.write("\n%s\n" % PML) 250 251 # Setup complex group... 252 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["ComplexGroup"], PyMOLObjectNames["ComplexGroupMembers"], False, "close") 253 254 def WriteChainView(OutFH, FileIndex, PyMOLObjectNames, ChainID): 255 """Write out PML for viewing chain.""" 256 257 OutFH.write("""\n""\n"Setting up views for chain %s..."\n""\n""" % ChainID) 258 259 ChainComplexName = PyMOLObjectNames["Chains"][ChainID]["ChainComplex"] 260 261 # Setup chain complex group view... 262 WriteChainComplexViews(OutFH, FileIndex, PyMOLObjectNames, ChainID) 263 264 # Setup chain view... 265 WriteChainAloneViews(OutFH, FileIndex, PyMOLObjectNames, ChainID) 266 267 # Setup chain solvent view... 268 PML = PyMOLUtil.SetupPMLForSolventView(PyMOLObjectNames["Chains"][ChainID]["Solvent"], ChainComplexName, False) 269 OutFH.write("\n%s\n" % PML) 270 271 # Setup chain inorganic view... 272 PML = PyMOLUtil.SetupPMLForInorganicView(PyMOLObjectNames["Chains"][ChainID]["Inorganic"], ChainComplexName, False) 273 OutFH.write("\n%s\n" % PML) 274 275 def WriteChainComplexViews(OutFH, FileIndex, PyMOLObjectNames, ChainID): 276 """Write chain complex views.""" 277 278 # Setup chain complex... 279 ChainComplexName = PyMOLObjectNames["Chains"][ChainID]["ChainComplex"] 280 PML = PyMOLUtil.SetupPMLForPolymerChainComplexView(ChainComplexName, PyMOLObjectNames["Complex"], ChainID, True) 281 OutFH.write("%s\n" % PML) 282 283 if OptionsInfo["SurfaceChainComplex"]: 284 # Setup hydrophobic surface... 285 PML = PyMOLUtil.SetupPMLForHydrophobicSurfaceView(PyMOLObjectNames["Chains"][ChainID]["ChainComplexHydrophobicSurface"], ChainComplexName, ColorPalette = OptionsInfo["SurfaceColorPalette"], Enable = False) 286 OutFH.write("\n%s\n" % PML) 287 288 # Setup chain complex group... 289 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Chains"][ChainID]["ChainComplexGroup"], PyMOLObjectNames["Chains"][ChainID]["ChainComplexGroupMembers"], False, "close") 290 291 def WriteChainAloneViews(OutFH, FileIndex, PyMOLObjectNames, ChainID): 292 """Write individual chain views.""" 293 294 ChainComplexName = PyMOLObjectNames["Chains"][ChainID]["ChainComplex"] 295 296 # Setup chain view... 297 ChainName = PyMOLObjectNames["Chains"][ChainID]["ChainAlone"] 298 PML = PyMOLUtil.SetupPMLForPolymerChainView(ChainName, ChainComplexName, True) 299 OutFH.write("\n%s\n" % PML) 300 301 WriteChainAloneBFactorViews(OutFH, FileIndex, PyMOLObjectNames, ChainID) 302 303 WriteChainAloneChainSelectionsView(OutFH, FileIndex, PyMOLObjectNames, ChainID) 304 WriteChainAloneResidueTypesView(OutFH, FileIndex, PyMOLObjectNames, ChainID) 305 306 if GetChainAloneContainsSurfacesStatus(FileIndex, ChainID): 307 # Setup a generic color surface... 308 PML = PyMOLUtil.SetupPMLForSurfaceView(PyMOLObjectNames["Chains"][ChainID]["ChainAloneSurface"], ChainName, Enable = False, Color = OptionsInfo["SurfaceColor"]) 309 OutFH.write("\n%s\n" % PML) 310 311 if GetChainAloneSurfaceChainStatus(FileIndex, ChainID): 312 # Setup surface colored by hydrophobicity... 313 PML = PyMOLUtil.SetupPMLForHydrophobicSurfaceView(PyMOLObjectNames["Chains"][ChainID]["ChainAloneHydrophobicSurface"], ChainName, ColorPalette = OptionsInfo["SurfaceColorPalette"], Enable = False) 314 OutFH.write("\n%s\n" % PML) 315 316 # Setup surface colored by hyrdophobicity and charge... 317 PML = PyMOLUtil.SetupPMLForHydrophobicAndChargeSurfaceView(PyMOLObjectNames["Chains"][ChainID]["ChainAloneHydrophobicChargeSurface"], ChainName, OptionsInfo["AtomTypesColorNames"]["HydrophobicAtomsColor"], OptionsInfo["AtomTypesColorNames"]["NegativelyChargedAtomsColor"], OptionsInfo["AtomTypesColorNames"]["PositivelyChargedAtomsColor"], OptionsInfo["AtomTypesColorNames"]["OtherAtomsColor"], Enable = False, DisplayAs = None) 318 OutFH.write("\n%s\n" % PML) 319 320 if GetChainAloneSurfaceChainElectrostaticsStatus(FileIndex, ChainID): 321 # Setup electrostatics surface... 322 SelectionObjectName = ChainName 323 ElectrostaticsGroupName = PyMOLObjectNames["Chains"][ChainID]["ChainAloneElectrostaticsGroup"] 324 ElectrostaticsGroupMembers = PyMOLObjectNames["Chains"][ChainID]["ChainAloneElectrostaticsGroupMembers"] 325 WriteSurfaceElectrostaticsView("Surface", OutFH, SelectionObjectName, ElectrostaticsGroupName, ElectrostaticsGroupMembers, DisplayAs = "cartoon") 326 327 # Setup surface group... 328 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Chains"][ChainID]["ChainAloneSurfaceGroup"], PyMOLObjectNames["Chains"][ChainID]["ChainAloneSurfaceGroupMembers"], True, "open") 329 330 # Setup disulfide group... 331 WriteChainAloneDisulfideBondsView(OutFH, FileIndex, PyMOLObjectNames, ChainID) 332 333 # Setup salt bridges group... 334 WriteChainAloneSaltBridgesView(OutFH, FileIndex, PyMOLObjectNames, ChainID) 335 336 # Setup chain group... 337 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Chains"][ChainID]["ChainAloneGroup"], PyMOLObjectNames["Chains"][ChainID]["ChainAloneGroupMembers"], True, "close") 338 339 def WriteChainLigandView(OutFH, FileIndex, PyMOLObjectNames, ChainID, LigandID): 340 """Write out PML for viewing ligand in a chain.""" 341 342 for GroupID in ["Ligand", "Pocket", "PocketSolvent", "PocketInorganic"]: 343 ComplexName = PyMOLObjectNames["Chains"][ChainID]["ChainComplex"] 344 LigandName = PyMOLObjectNames["Ligands"][ChainID][LigandID]["Ligand"] 345 346 # Setup main object... 347 GroupTypeObjectID = "%s" % (GroupID) 348 GroupTypeObjectName = PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupTypeObjectID] 349 350 if re.match("^Ligand$", GroupID, re.I): 351 OutFH.write("""\n""\n"Setting up views for ligand %s in chain %s..."\n""\n""" % (LigandID, ChainID)) 352 PML = PyMOLUtil.SetupPMLForLigandView(GroupTypeObjectName, ComplexName, LigandID, Enable = True, IgnoreHydrogens = OptionsInfo["IgnoreHydrogens"]) 353 OutFH.write("%s\n" % PML) 354 elif re.match("^Pocket$", GroupID, re.I): 355 OutFH.write("""\n""\n"Setting up views for pocket around ligand %s in chain %s..."\n""\n""" % (LigandID, ChainID)) 356 PML = PyMOLUtil.SetupPMLForLigandPocketView(GroupTypeObjectName, ComplexName, LigandName, OptionsInfo["PocketDistanceCutoff"], Enable = True, IgnoreHydrogens = OptionsInfo["IgnoreHydrogens"]) 357 OutFH.write("%s\n" % PML) 358 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (OptionsInfo["PocketLabelColor"], GroupTypeObjectName)) 359 elif re.match("^PocketSolvent$", GroupID, re.I): 360 OutFH.write("""\n""\n"Setting up views for solvent in pockect around ligand %s in chain %s..."\n""\n""" % (LigandID, ChainID)) 361 PML = PyMOLUtil.SetupPMLForLigandPocketSolventView(GroupTypeObjectName, ComplexName, LigandName, OptionsInfo["PocketDistanceCutoff"], Enable = True) 362 OutFH.write("%s\n" % PML) 363 elif re.match("^PocketInorganic$", GroupID, re.I): 364 OutFH.write("""\n""\n"Setting up views for inorganic in pockect around ligand %s in chain %s..."\n""\n""" % (LigandID, ChainID)) 365 PML = PyMOLUtil.SetupPMLForLigandPocketInorganicView(GroupTypeObjectName, ComplexName, LigandName, OptionsInfo["PocketDistanceCutoff"], Enable = True) 366 OutFH.write("%s\n" % PML) 367 368 # Set up polar contacts... 369 if re.match("^(Pocket|PocketSolvent|PocketInorganic)$", GroupID, re.I): 370 PolarContactsID = "%sPolarContacts" % (GroupID) 371 PolarContactsName = PyMOLObjectNames["Ligands"][ChainID][LigandID][PolarContactsID] 372 373 PolarContactsColor = OptionsInfo["PocketContactsLigandColor"] 374 if re.match("^PocketSolvent$", GroupID, re.I): 375 PolarContactsColor = OptionsInfo["PocketContactsSolventColor"] 376 elif re.match("^PocketInorganic$", GroupID, re.I): 377 PolarContactsColor = OptionsInfo["PocketContactsInorganicColor"] 378 379 PML = PyMOLUtil.SetupPMLForPolarContactsView(PolarContactsName, LigandName, GroupTypeObjectName, Enable = False, Color = PolarContactsColor, Cutoff = OptionsInfo["PocketContactsCutoff"]) 380 OutFH.write("\n%s\n" % PML) 381 382 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (PolarContactsColor, PolarContactsName)) 383 384 if re.match("^PocketInorganic$", GroupID, re.I): 385 # Setup pi cation contacts... 386 PiCationContactsID = "%sPiCationContacts" % (GroupID) 387 PiCationContactsName = PyMOLObjectNames["Ligands"][ChainID][LigandID][PiCationContactsID] 388 PiCationContactsColor = OptionsInfo["PocketContactsInorganicPiCationColor"] 389 390 PML = PyMOLUtil.SetupPMLForPiCationContactsView(PiCationContactsName, LigandName, GroupTypeObjectName, Enable = False, Color = PiCationContactsColor, Cutoff = OptionsInfo["PocketContactsCutoff"]) 391 OutFH.write("\n%s\n" % PML) 392 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (PiCationContactsColor, PiCationContactsName)) 393 394 if re.match("^Pocket$", GroupID, re.I): 395 # Setup hydrophobic contacts... 396 HydrophobicContactsID = "%sHydrophobicContacts" % (GroupID) 397 HydrophobicContactsName = PyMOLObjectNames["Ligands"][ChainID][LigandID][HydrophobicContactsID] 398 HydrophobicContactsColor = OptionsInfo["PocketContactsLigandHydrophobicColor"] 399 400 PML = PyMOLUtil.SetupPMLForHydrophobicContactsView(HydrophobicContactsName, LigandName, GroupTypeObjectName, Enable = False, Color = HydrophobicContactsColor, Cutoff = OptionsInfo["PocketContactsCutoff"]) 401 OutFH.write("\n%s\n" % PML) 402 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (HydrophobicContactsColor, HydrophobicContactsName)) 403 404 # Setup pi pi contacts... 405 PiPiContactsID = "%sPiPiContacts" % (GroupID) 406 PiPiContactsName = PyMOLObjectNames["Ligands"][ChainID][LigandID][PiPiContactsID] 407 PiPiContactsColor = OptionsInfo["PocketContactsLigandPiPiColor"] 408 409 PML = PyMOLUtil.SetupPMLForPiPiContactsView(PiPiContactsName, LigandName, GroupTypeObjectName, Enable = False, Color = PiPiContactsColor, Cutoff = OptionsInfo["PocketContactsCutoff"]) 410 OutFH.write("\n%s\n" % PML) 411 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (PiPiContactsColor, PiPiContactsName)) 412 413 # Setup pi cation contacts... 414 PiCationContactsID = "%sPiCationContacts" % (GroupID) 415 PiCationContactsName = PyMOLObjectNames["Ligands"][ChainID][LigandID][PiCationContactsID] 416 PiCationContactsColor = OptionsInfo["PocketContactsLigandPiCationColor"] 417 418 PML = PyMOLUtil.SetupPMLForPiCationContactsView(PiCationContactsName, LigandName, GroupTypeObjectName, Enable = False, Color = PiCationContactsColor, Cutoff = OptionsInfo["PocketContactsCutoff"]) 419 OutFH.write("\n%s\n" % PML) 420 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (PiCationContactsColor, PiCationContactsName)) 421 422 # Setup halogen contacts... 423 HalogenContactsID = "%sHalogenContacts" % (GroupID) 424 HalogenContactsName = PyMOLObjectNames["Ligands"][ChainID][LigandID][HalogenContactsID] 425 HalogenContactsColor = OptionsInfo["PocketContactsLigandHalogenColor"] 426 427 PML = PyMOLUtil.SetupPMLForHalogenContactsView(HalogenContactsName, LigandName, GroupTypeObjectName, Enable = False, Color = HalogenContactsColor, Cutoff = OptionsInfo["PocketContactsCutoff"]) 428 OutFH.write("\n%s\n" % PML) 429 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (HalogenContactsColor, HalogenContactsName)) 430 431 # Setup pocket selections... 432 WritePocketSelectionsView(OutFH, FileIndex, PyMOLObjectNames, ChainID, LigandID, GroupTypeObjectID) 433 434 # Setup pocket residues... 435 WritePocketResidueTypesView(OutFH, FileIndex, PyMOLObjectNames, ChainID, LigandID, GroupTypeObjectID) 436 WritePocketSurfacesTypesView(OutFH, FileIndex, PyMOLObjectNames, ChainID, LigandID, GroupTypeObjectID) 437 438 if re.match("^Ligand$", GroupID, re.I): 439 # Setup ball and stick view... 440 BallAndStickNameID = "%sBallAndStick" % (GroupID) 441 BallAndStickName = PyMOLObjectNames["Ligands"][ChainID][LigandID][BallAndStickNameID] 442 PML = PyMOLUtil.SetupPMLForBallAndStickView(BallAndStickName, GroupTypeObjectName, Enable = False) 443 OutFH.write("\n%s\n" % PML) 444 445 # Setup group... 446 GroupNameID = "%sGroup" % (GroupID) 447 GroupMembersID = "%sGroupMembers" % (GroupID) 448 GroupName = PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupNameID] 449 GroupMembers = PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupMembersID] 450 451 Action = "close" 452 Enable = False 453 if re.match("^(Ligand|Pocket)$", GroupID, re.I): 454 Action = "open" 455 Enable = True 456 GenerateAndWritePMLForGroup(OutFH, GroupName, GroupMembers, Enable, Action) 457 458 def WriteChainDockedPosesView(OutFH, FileIndex, PyMOLObjectNames, ChainID): 459 """Write out PML for viewing docked poses for input files in a chain.""" 460 461 if not GetChainAloneDockedPosesStatus(FileIndex, ChainID): 462 return 463 464 SpecifiedChainsAndLigandsInfo = OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex] 465 for InputFileIndex, InputFile in enumerate(SpecifiedChainsAndLigandsInfo["DockedPosesInputFiles"][ChainID]): 466 WriteChainDockedPosesViewForInputFile(OutFH, FileIndex, PyMOLObjectNames, ChainID, InputFileIndex) 467 468 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Chains"][ChainID]["DockedPosesGroup"], PyMOLObjectNames["Chains"][ChainID]["DockedPosesGroupMembers"], False, "close") 469 470 def WriteChainDockedPosesViewForInputFile(OutFH, PDBFileIndex, PyMOLObjectNames, ChainID, InputFileIndex): 471 """Write out PML for viewing docked poses for an input file in a chain.""" 472 473 DockedPosesInfo = OptionsInfo["DockedPosesInfo"] 474 DockedPosesDistanceContactsInfo = OptionsInfo["DockedPosesDistanceContactsInfo"] 475 476 LigandID = DockedPosesInfo["LigandID"][PDBFileIndex] 477 UseInputFileAsLigandID = DockedPosesInfo["UseInputFileAsLigandID"][PDBFileIndex] 478 InputFile = DockedPosesInfo["InputFiles"][PDBFileIndex][InputFileIndex] 479 InputFileID = DockedPosesInfo["InputFilesIDs"][PDBFileIndex][InputFileIndex] 480 481 OutFH.write("""\n""\n"Setting up views for docked poses in input file ID %s for chain %s..."\n""\n""" % (InputFileID, ChainID)) 482 483 # Setup poses view... 484 PosesName = PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID]["Poses"] 485 PML = PyMOLUtil.SetupPMLForLigandsInputFileView(PosesName, InputFile, Enable = True, IgnoreHydrogens = OptionsInfo["IgnoreHydrogens"]) 486 OutFH.write("%s\n" % PML) 487 488 for GroupID in ["Pocket", "PocketSolvent", "PocketInorganic"]: 489 ComplexName = PyMOLObjectNames["Chains"][ChainID]["ChainComplex"] 490 LigandName = PosesName if UseInputFileAsLigandID else PyMOLObjectNames["Ligands"][ChainID][LigandID]["Ligand"] 491 492 # Setup pocket object... 493 PocketID = "%sPocket" % (GroupID) 494 PocketName = PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][PocketID] 495 496 if re.match("^Pocket$", GroupID, re.I): 497 PML = PyMOLUtil.SetupPMLForLigandPocketView(PocketName, ComplexName, LigandName, OptionsInfo["PocketDistanceCutoff"], Enable = True, IgnoreHydrogens = OptionsInfo["IgnoreHydrogens"]) 498 OutFH.write("%s\n" % PML) 499 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (OptionsInfo["PocketLabelColor"], PocketName)) 500 elif re.match("^PocketSolvent$", GroupID, re.I): 501 PML = PyMOLUtil.SetupPMLForLigandPocketSolventView(PocketName, ComplexName, LigandName, OptionsInfo["PocketDistanceCutoff"], Enable = True) 502 OutFH.write("%s\n" % PML) 503 elif re.match("^PocketInorganic$", GroupID, re.I): 504 PML = PyMOLUtil.SetupPMLForLigandPocketInorganicView(PocketName, ComplexName, LigandName, OptionsInfo["PocketDistanceCutoff"], Enable = True) 505 OutFH.write("%s\n" % PML) 506 507 if DockedPosesInfo["DistanceContacts"] and re.match("^Pocket$", GroupID, re.I): 508 # Setup distance contacts... 509 for ContactIndex, ContactID in enumerate(DockedPosesDistanceContactsInfo["ContactIDs"]): 510 ContactCutoff = DockedPosesDistanceContactsInfo["ContactCutoff"][ContactID] 511 512 DistanceContactID = "%sPocketDistanceContacts%s" % (GroupID, ContactID) 513 DistanceContactName = PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][DistanceContactID] 514 515 DistanceContactsColor = OptionsInfo["DockedPosesDistanceContactsColor"] 516 EnableContact = True if ContactIndex == 0 else False 517 PML = PyMOLUtil.SetupPMLForDistanceContactsView(DistanceContactName, PosesName, PocketName, Enable = EnableContact, Color = DistanceContactsColor, Cutoff = ContactCutoff, IgnoreHydrogens = True) 518 OutFH.write("\n%s\n" % PML) 519 520 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (DistanceContactsColor, DistanceContactName)) 521 522 # Setup distance conatcts group... 523 DistanceContactGroupNameID = "%sDistanceContactsGroup" % GroupID 524 DistanceContactGroupMembersID = "%sDistanceContactsGroupMembers" % GroupID 525 526 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][DistanceContactGroupNameID], PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][DistanceContactGroupMembersID], True, "open") 527 528 # Setup polar contacts... 529 if re.match("^(Pocket|PocketSolvent|PocketInorganic)$", GroupID, re.I): 530 PolarContactsID = "%sPolarContacts" % (GroupID) 531 PolarContactsName = PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][PolarContactsID] 532 533 PolarContactsColor = OptionsInfo["PocketContactsLigandColor"] 534 if re.match("^PocketSolvent$", GroupID, re.I): 535 PolarContactsColor = OptionsInfo["PocketContactsSolventColor"] 536 elif re.match("^PocketInorganic$", GroupID, re.I): 537 PolarContactsColor = OptionsInfo["PocketContactsInorganicColor"] 538 539 PML = PyMOLUtil.SetupPMLForPolarContactsView(PolarContactsName, PosesName, PocketName, Enable = False, Color = PolarContactsColor, Cutoff = OptionsInfo["PocketContactsCutoff"]) 540 OutFH.write("\n%s\n" % PML) 541 542 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (PolarContactsColor, PolarContactsName)) 543 544 if re.match("^PocketInorganic$", GroupID, re.I): 545 # Setup pi cation contacts... 546 PiCationContactsID = "%sPiCationContacts" % (GroupID) 547 PiCationContactsName = PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][PiCationContactsID] 548 PiCationContactsColor = OptionsInfo["PocketContactsInorganicPiCationColor"] 549 550 PML = PyMOLUtil.SetupPMLForPiCationContactsView(PiCationContactsName, PosesName, PocketName, Enable = False, Color = PiCationContactsColor, Cutoff = OptionsInfo["PocketContactsCutoff"]) 551 OutFH.write("\n%s\n" % PML) 552 553 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (PiCationContactsColor, PiCationContactsName)) 554 555 if re.match("^Pocket$", GroupID, re.I): 556 # Setup hydrophobic contacts... 557 HydrophobicContactsID = "%sHydrophobicContacts" % (GroupID) 558 HydrophobicContactsName = PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][HydrophobicContactsID] 559 HydrophobicContactsColor = OptionsInfo["PocketContactsLigandHydrophobicColor"] 560 561 PML = PyMOLUtil.SetupPMLForHydrophobicContactsView(HydrophobicContactsName, PosesName, PocketName, Enable = False, Color = HydrophobicContactsColor, Cutoff = OptionsInfo["PocketContactsCutoff"]) 562 OutFH.write("\n%s\n" % PML) 563 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (HydrophobicContactsColor, HydrophobicContactsName)) 564 565 # Setup pi pi contacts... 566 PiPiContactsID = "%sPiPiContacts" % (GroupID) 567 PiPiContactsName = PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][PiPiContactsID] 568 PiPiContactsColor = OptionsInfo["PocketContactsLigandPiPiColor"] 569 570 PML = PyMOLUtil.SetupPMLForPiPiContactsView(PiPiContactsName, PosesName, PocketName, Enable = False, Color = PiPiContactsColor, Cutoff = OptionsInfo["PocketContactsCutoff"]) 571 OutFH.write("\n%s\n" % PML) 572 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (PiPiContactsColor, PiPiContactsName)) 573 574 # Setup pi cation contacts... 575 PiCationContactsID = "%sPiCationContacts" % (GroupID) 576 PiCationContactsName = PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][PiCationContactsID] 577 PiCationContactsColor = OptionsInfo["PocketContactsLigandPiCationColor"] 578 579 PML = PyMOLUtil.SetupPMLForPiCationContactsView(PiCationContactsName, PosesName, PocketName, Enable = False, Color = PiCationContactsColor, Cutoff = OptionsInfo["PocketContactsCutoff"]) 580 OutFH.write("\n%s\n" % PML) 581 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (PiCationContactsColor, PiCationContactsName)) 582 583 # Setup halogen contacts... 584 HalogenContactsID = "%sHalogenContacts" % (GroupID) 585 HalogenContactsName = PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][HalogenContactsID] 586 HalogenContactsColor = OptionsInfo["PocketContactsLigandHalogenColor"] 587 588 PML = PyMOLUtil.SetupPMLForHalogenContactsView(HalogenContactsName, LigandName, PocketName, Enable = False, Color = HalogenContactsColor, Cutoff = OptionsInfo["PocketContactsCutoff"]) 589 OutFH.write("\n%s\n" % PML) 590 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (HalogenContactsColor, HalogenContactsName)) 591 592 593 # Setup group for an input file... 594 GroupNameID = "%sGroup" % (GroupID) 595 GroupMembersID = "%sGroupMembers" % (GroupID) 596 Enable = True if re.match("^Pocket$", GroupID, re.I) else False 597 Action = "open" if re.match("^Pocket$", GroupID, re.I) else "close" 598 599 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][GroupNameID], PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][GroupMembersID], Enable, Action) 600 601 # Setup docked poses group for an input file... 602 Action = "open" if InputFileIndex == 0 else "close" 603 Enable = True if InputFileIndex == 0 else False 604 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID]["DockedPosesGroupName"], PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID]["DockedPosesGroupMembers"], Enable, Action) 605 606 def WritePocketSelectionsView(OutFH, FileIndex, PyMOLObjectNames, ChainID, LigandID, PocketObjectID): 607 """Write out PML for viewing selections for a lgand pocket.""" 608 609 if not GetPocketContainsSelectionsStatus(FileIndex, ChainID, LigandID): 610 return 611 612 PocketObjectName = PyMOLObjectNames["Ligands"][ChainID][LigandID][PocketObjectID] 613 SelectionsGroupIDPrefix = "PocketSelectionsGroup" 614 615 for Index in range(0, len(OptionsInfo["PocketChainSelectionsInfo"]["Names"])): 616 SelectionName = OptionsInfo["PocketChainSelectionsInfo"]["Names"][Index] 617 Selection = OptionsInfo["PocketChainSelectionsInfo"]["Selections"][Index] 618 619 SelectionNameGroupID = SelectionName 620 621 # Setup a selection object... 622 SelectionObjectID = "%s%sSelection" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 623 SelectionObjectName = PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionObjectID] 624 SelectionCmd = "(%s and (%s))" % (PocketObjectName, Selection) 625 PML = PyMOLUtil.SetupPMLForSelectionDisplayView(SelectionObjectName, SelectionCmd, OptionsInfo["SelectionsPocketStyle"], Enable = True, IgnoreHydrogens = OptionsInfo["IgnoreHydrogens"]) 626 OutFH.write("\n%s\n" % PML) 627 628 if GetPocketSelectionSurfaceChainStatus(FileIndex, ChainID, LigandID): 629 # Display style for selection objects in surfaces... 630 DisplayStyle = "lines" 631 632 # Setup a generic color surface... 633 SurfaceID = "%s%s%sSurface" % (SelectionsGroupIDPrefix, SelectionNameGroupID, "Surface") 634 SurfaceName = PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfaceID] 635 PML = PyMOLUtil.SetupPMLForSurfaceView(SurfaceName, SelectionObjectName, Enable = False, Color = OptionsInfo["SurfaceColor"], DisplayAs = DisplayStyle) 636 OutFH.write("\n%s\n" % PML) 637 638 # Setup a surface colored by hydrphobicity... 639 HydrophobicSurfaceID = "%s%sSurfaceHydrophobicity" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 640 HydrophobicSurfaceName = PyMOLObjectNames["Ligands"][ChainID][LigandID][HydrophobicSurfaceID] 641 PML = PyMOLUtil.SetupPMLForHydrophobicSurfaceView(HydrophobicSurfaceName, SelectionObjectName, ColorPalette = OptionsInfo["SurfaceColorPalette"], Enable = False, DisplayAs = DisplayStyle) 642 OutFH.write("\n%s\n" % PML) 643 644 # Setup a surface colored by hydrphobicity and charge... 645 HydrophobicChargeSurfaceID = "%s%sSurfaceHydrophobicityCharge" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 646 HydrophobicChargeSurfaceName = PyMOLObjectNames["Ligands"][ChainID][LigandID][HydrophobicChargeSurfaceID] 647 PML = PyMOLUtil.SetupPMLForHydrophobicAndChargeSurfaceView(HydrophobicChargeSurfaceName, SelectionObjectName, OptionsInfo["AtomTypesColorNames"]["HydrophobicAtomsColor"], OptionsInfo["AtomTypesColorNames"]["NegativelyChargedAtomsColor"], OptionsInfo["AtomTypesColorNames"]["PositivelyChargedAtomsColor"], OptionsInfo["AtomTypesColorNames"]["OtherAtomsColor"], Enable = False, DisplayAs = DisplayStyle) 648 OutFH.write("\n%s\n" % PML) 649 650 # Setup group for surfaces... 651 SurfaceGroupID = "%s%sSurfaceGroup" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 652 SurfaceGroupMembersID = "%s%sSurfaceGroupMembers" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 653 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfaceGroupID], PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfaceGroupMembersID], True, "open") 654 655 # Setup groups for named selections... 656 SelectionsNameGroupID = "%s%sGroup" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 657 SelectionsNameGroupMembersID = "%s%sGroupMembers" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 658 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionsNameGroupID], PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionsNameGroupMembersID], True, "open") 659 660 # Setup a group for selections... 661 SelectionsGroupID = "%s" % (SelectionsGroupIDPrefix) 662 SelectionsGroupMembersID = "%sGroupMembers" % (SelectionsGroupIDPrefix) 663 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionsGroupID], PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionsGroupMembersID], True, "close") 664 665 def WritePocketSurfacesTypesView(OutFH, FileIndex, PyMOLObjectNames, ChainID, LigandID, PocketObjectID): 666 """Write out PML for viewing surfaces for a ligand pocket.""" 667 668 if not GetPocketContainsSurfaceStatus(FileIndex, ChainID, LigandID): 669 return 670 671 PocketObjectName = PyMOLObjectNames["Ligands"][ChainID][LigandID][PocketObjectID] 672 673 SurfacesGroupID = "%sSurfacesGroup" % (PocketObjectID) 674 SurfacesGroupMembersID = "%sSurfacesGroupMembers" % (PocketObjectID) 675 676 # Cavity modes: 1 or 2. 1: Cavity surfaces; 2: Culled cavity surfaces... 677 CavityMode = 2 678 679 # Setup surfaces subgroup and its members... 680 for SubGroupType in ["Surface", "Cavity"]: 681 ProcessingCavity = True if re.match("^Cavity$", SubGroupType, re.I) else False 682 683 SubGroupID = re.sub("_", "", SubGroupType) 684 SurfacesSubGroupID = "%s%sGroup" % (SurfacesGroupID, SubGroupID) 685 SurfacesSubGroupMembersID = "%sMembers" % (SurfacesSubGroupID) 686 687 # Turn off lines display for cavity surfaces... 688 DisplayStyle = None if ProcessingCavity else "lines" 689 690 # Setup a generic color surface... 691 SurfaceID = "%sSurface" % (SurfacesSubGroupID) 692 SurfaceName = PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfaceID] 693 PML = PyMOLUtil.SetupPMLForSurfaceView(SurfaceName, PocketObjectName, Enable = False, Color = OptionsInfo["SurfaceColor"], DisplayAs = DisplayStyle) 694 OutFH.write("\n%s\n" % PML) 695 696 if ProcessingCavity: 697 OutFH.write("""cmd.set("surface_cavity_mode", %d, "%s")\n""" % (CavityMode, SurfaceName)) 698 699 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (OptionsInfo["PocketLabelColor"], SurfaceName)) 700 701 if GetPocketSurfaceChainStatus(FileIndex, ChainID, LigandID): 702 # Setup a surface colored by hydrphobicity... 703 HydrophobicSurfaceID = "%sHydrophobicSurface" % (SurfacesSubGroupID) 704 HydrophobicSurfaceName = PyMOLObjectNames["Ligands"][ChainID][LigandID][HydrophobicSurfaceID] 705 PML = PyMOLUtil.SetupPMLForHydrophobicSurfaceView(HydrophobicSurfaceName, PocketObjectName, ColorPalette = OptionsInfo["SurfaceColorPalette"], Enable = False, DisplayAs = DisplayStyle) 706 OutFH.write("\n%s\n" % PML) 707 708 if ProcessingCavity: 709 OutFH.write("""cmd.set("surface_cavity_mode", %d, "%s")\n""" % (CavityMode, HydrophobicSurfaceName)) 710 711 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (OptionsInfo["PocketLabelColor"], HydrophobicSurfaceName)) 712 713 # Setup a surface colored by hydrphobicity and charge... 714 HydrophobicChargeSurfaceID = "%sHydrophobicChargeSurface" % (SurfacesSubGroupID) 715 HydrophobicChargeSurfaceName = PyMOLObjectNames["Ligands"][ChainID][LigandID][HydrophobicChargeSurfaceID] 716 PML = PyMOLUtil.SetupPMLForHydrophobicAndChargeSurfaceView(HydrophobicChargeSurfaceName, PocketObjectName, OptionsInfo["AtomTypesColorNames"]["HydrophobicAtomsColor"], OptionsInfo["AtomTypesColorNames"]["NegativelyChargedAtomsColor"], OptionsInfo["AtomTypesColorNames"]["PositivelyChargedAtomsColor"], OptionsInfo["AtomTypesColorNames"]["OtherAtomsColor"], Enable = False, DisplayAs = DisplayStyle) 717 OutFH.write("\n%s\n" % PML) 718 719 if ProcessingCavity: 720 OutFH.write("""cmd.set("surface_cavity_mode", %d, "%s")\n""" % (CavityMode, HydrophobicChargeSurfaceName)) 721 722 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (OptionsInfo["PocketLabelColor"], HydrophobicChargeSurfaceName)) 723 724 if GetPocketSurfaceChainElectrostaticsStatus(FileIndex, ChainID, LigandID): 725 # Set up a electrostatics surface... 726 ElectrostaticsGroupID = "%sElectrostaticsGroup" % (SurfacesSubGroupID) 727 ElectrostaticsGroupMembersID = "%sElectrostaticsGroupMembers" % (SurfacesSubGroupID) 728 ElectrostaticsGroupName = PyMOLObjectNames["Ligands"][ChainID][LigandID][ElectrostaticsGroupID] 729 ElectrostaticsGroupMembers = PyMOLObjectNames["Ligands"][ChainID][LigandID][ElectrostaticsGroupMembersID] 730 WriteSurfaceElectrostaticsView(SubGroupType, OutFH, PocketObjectName, ElectrostaticsGroupName, ElectrostaticsGroupMembers, DisplayAs = DisplayStyle, SurfaceCavityMode = CavityMode) 731 732 # Setup surfaces sub group... 733 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfacesSubGroupID], PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfacesSubGroupMembersID], True, "open") 734 735 # Setup surface group... 736 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfacesGroupID], PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfacesGroupMembersID], True, "open") 737 738 def WritePocketResidueTypesView(OutFH, FileIndex, PyMOLObjectNames, ChainID, LigandID, PocketObjectID): 739 """Write out PML for viewing residue types for a ligand pocket.""" 740 741 if not GetPocketResidueTypesStatus(FileIndex, ChainID, LigandID): 742 return 743 744 PocketObjectName = PyMOLObjectNames["Ligands"][ChainID][LigandID][PocketObjectID] 745 746 ResiduesGroupID = "%sResiduesGroup" % (PocketObjectID) 747 ResiduesGroupMembersID = "%sMembers" % (ResiduesGroupID) 748 749 # Setup residue types objects... 750 for SubGroupType in ["Aromatic", "Hydrophobic", "Polar", "Positively_Charged", "Negatively_Charged", "Other"]: 751 SubGroupID = re.sub("_", "", SubGroupType) 752 753 ResiduesSubGroupID = "%s%sGroup" % (ResiduesGroupID, SubGroupID) 754 ResiduesSubMembersGroupID = "%sMembers" % (ResiduesSubGroupID) 755 756 SubGroupMemberID = "%sResidues" % (ResiduesSubGroupID) 757 ResiduesObjectName = PyMOLObjectNames["Ligands"][ChainID][LigandID][SubGroupMemberID] 758 759 SubGroupMemberID = "%sSurface" % (ResiduesSubGroupID) 760 ResiduesSurfaceObjectName = PyMOLObjectNames["Ligands"][ChainID][LigandID][SubGroupMemberID] 761 762 ResiduesColor = OptionsInfo["ResidueTypesParams"][SubGroupType]["Color"] 763 ResiduesNames = OptionsInfo["ResidueTypesParams"][SubGroupType]["Residues"] 764 765 NegateResidueNames = True if re.match("^Other$", SubGroupType, re.I) else False 766 WriteResidueTypesResiduesAndSurfaceView(OutFH, PocketObjectName, ResiduesObjectName, ResiduesSurfaceObjectName, ResiduesColor, ResiduesNames, NegateResidueNames) 767 768 # Setup residue type sub groups... 769 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Ligands"][ChainID][LigandID][ResiduesSubGroupID], PyMOLObjectNames["Ligands"][ChainID][LigandID][ResiduesSubMembersGroupID], True, "close") 770 771 # Setup residue types group... 772 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Ligands"][ChainID][LigandID][ResiduesGroupID], PyMOLObjectNames["Ligands"][ChainID][LigandID][ResiduesGroupMembersID], False, "close") 773 774 def WriteChainAloneChainSelectionsView(OutFH, FileIndex, PyMOLObjectNames, ChainID): 775 """Write out PML for viewing selections for a chain.""" 776 777 if not GetChainAloneContainsSelectionsStatus(FileIndex, ChainID): 778 return 779 780 ChainName = PyMOLObjectNames["Chains"][ChainID]["ChainAlone"] 781 SelectionsGroupIDPrefix = "ChainAloneSelections" 782 783 for Index in range(0, len(OptionsInfo["ChainSelectionsInfo"]["Names"])): 784 SelectionName = OptionsInfo["ChainSelectionsInfo"]["Names"][Index] 785 Selection = OptionsInfo["ChainSelectionsInfo"]["Selections"][Index] 786 787 SelectionNameGroupID = SelectionName 788 789 # Setup a selection object... 790 SelectionObjectID = "%s%sSelection" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 791 SelectionObjectName = PyMOLObjectNames["Chains"][ChainID][SelectionObjectID] 792 SelectionCmd = "(%s and (%s))" % (ChainName, Selection) 793 PML = PyMOLUtil.SetupPMLForSelectionDisplayView(SelectionObjectName, SelectionCmd, OptionsInfo["SelectionsChainStyle"], Enable = True, IgnoreHydrogens = OptionsInfo["IgnoreHydrogens"]) 794 OutFH.write("\n%s\n" % PML) 795 796 if GetChainAloneContainsChainSelectionSurfacesStatus(FileIndex, ChainID): 797 # Display style for selection objects in surfaces... 798 DisplayStyle = "lines" 799 800 # Setup a generic color surface... 801 SurfaceID = "%s%s%sSurface" % (SelectionsGroupIDPrefix, SelectionNameGroupID, "Surface") 802 SurfaceName = PyMOLObjectNames["Chains"][ChainID][SurfaceID] 803 PML = PyMOLUtil.SetupPMLForSurfaceView(SurfaceName, SelectionObjectName, Enable = False, Color = OptionsInfo["SurfaceColor"], DisplayAs = DisplayStyle) 804 OutFH.write("\n%s\n" % PML) 805 806 if GetChainAloneSurfaceChainSelectionStatus(FileIndex, ChainID): 807 # Setup a surface colored by hydrphobicity... 808 HydrophobicSurfaceID = "%s%sSurfaceHydrophobicity" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 809 HydrophobicSurfaceName = PyMOLObjectNames["Chains"][ChainID][HydrophobicSurfaceID] 810 PML = PyMOLUtil.SetupPMLForHydrophobicSurfaceView(HydrophobicSurfaceName, SelectionObjectName, ColorPalette = OptionsInfo["SurfaceColorPalette"], Enable = False, DisplayAs = DisplayStyle) 811 OutFH.write("\n%s\n" % PML) 812 813 # Setup a surface colored by hydrphobicity and charge... 814 HydrophobicChargeSurfaceID = "%s%sSurfaceHydrophobicityCharge" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 815 HydrophobicChargeSurfaceName = PyMOLObjectNames["Chains"][ChainID][HydrophobicChargeSurfaceID] 816 PML = PyMOLUtil.SetupPMLForHydrophobicAndChargeSurfaceView(HydrophobicChargeSurfaceName, SelectionObjectName, OptionsInfo["AtomTypesColorNames"]["HydrophobicAtomsColor"], OptionsInfo["AtomTypesColorNames"]["NegativelyChargedAtomsColor"], OptionsInfo["AtomTypesColorNames"]["PositivelyChargedAtomsColor"], OptionsInfo["AtomTypesColorNames"]["OtherAtomsColor"], Enable = False, DisplayAs = DisplayStyle) 817 OutFH.write("\n%s\n" % PML) 818 819 # Setup group for surfaces... 820 SurfaceGroupID = "%s%sSurfaceGroup" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 821 SurfaceGroupMembersID = "%s%sSurfaceGroupMembers" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 822 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Chains"][ChainID][SurfaceGroupID], PyMOLObjectNames["Chains"][ChainID][SurfaceGroupMembersID], True, "close") 823 824 # Setup groups for named selections... 825 SelectionsNameGroupID = "%s%sGroup" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 826 SelectionsNameGroupMembersID = "%s%sGroupMembers" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 827 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Chains"][ChainID][SelectionsNameGroupID], PyMOLObjectNames["Chains"][ChainID][SelectionsNameGroupMembersID], True, "open") 828 829 # Setup a group for selections... 830 SelectionsGroupID = "%sGroup" % (SelectionsGroupIDPrefix) 831 SelectionsGroupMembersID = "%sGroupMembers" % (SelectionsGroupIDPrefix) 832 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Chains"][ChainID][SelectionsGroupID], PyMOLObjectNames["Chains"][ChainID][SelectionsGroupMembersID], False, "close") 833 834 def WriteChainAloneResidueTypesView(OutFH, FileIndex, PyMOLObjectNames, ChainID): 835 """Write out PML for viewing residue types for a chain.""" 836 837 if not GetChainAloneResidueTypesStatus(FileIndex, ChainID): 838 return 839 840 ChainName = PyMOLObjectNames["Chains"][ChainID]["ChainAlone"] 841 842 # Setup residue types objects... 843 ResiduesGroupIDPrefix = "ChainAloneResidues" 844 for SubGroupType in ["Aromatic", "Hydrophobic", "Polar", "Positively_Charged", "Negatively_Charged", "Other"]: 845 SubGroupID = re.sub("_", "", SubGroupType) 846 847 ResiduesObjectID = "%s%sResidues" % (ResiduesGroupIDPrefix, SubGroupID) 848 ResiduesObjectName = PyMOLObjectNames["Chains"][ChainID][ResiduesObjectID] 849 850 ResiduesSurfaceObjectID = "%s%sSurface" % (ResiduesGroupIDPrefix, SubGroupID) 851 ResiduesSurfaceObjectName = PyMOLObjectNames["Chains"][ChainID][ResiduesSurfaceObjectID] 852 853 ResiduesColor = OptionsInfo["ResidueTypesParams"][SubGroupType]["Color"] 854 ResiduesNames = OptionsInfo["ResidueTypesParams"][SubGroupType]["Residues"] 855 856 NegateResidueNames = True if re.match("^Other$", SubGroupType, re.I) else False 857 WriteResidueTypesResiduesAndSurfaceView(OutFH, ChainName, ResiduesObjectName, ResiduesSurfaceObjectName, ResiduesColor, ResiduesNames, NegateResidueNames) 858 859 # Setup sub groups for residue types.. 860 ResiduesSubGroupID = "%s%sGroup" % (ResiduesGroupIDPrefix, SubGroupID) 861 ResiduesSubGroupMembersID = "%s%sGroupMembers" % (ResiduesGroupIDPrefix, SubGroupID) 862 863 # Setup residue type sub groups... 864 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Chains"][ChainID][ResiduesSubGroupID], PyMOLObjectNames["Chains"][ChainID][ResiduesSubGroupMembersID], True, "close") 865 866 # Setup residue types group... 867 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Chains"][ChainID]["ChainAloneResiduesGroup"], PyMOLObjectNames["Chains"][ChainID]["ChainAloneResiduesGroupMembers"], False, "close") 868 869 def WriteChainAloneBFactorViews(OutFH, FileIndex, PyMOLObjectNames, ChainID): 870 """Write out PML for viewing B factor values for a chain.""" 871 872 if not GetChainAloneBFactorStatus(FileIndex, ChainID): 873 return 874 875 ChainName = PyMOLObjectNames["Chains"][ChainID]["ChainAlone"] 876 877 # Setup cartoon... 878 Name = PyMOLObjectNames["Chains"][ChainID]["ChainAloneBFactorCartoon"] 879 PML = PyMOLUtil.SetupPMLForBFactorCartoonView(Name, ChainName, ColorPalette = OptionsInfo["BFactorColorPalette"], Enable = False) 880 OutFH.write("\n%s\n" % PML) 881 882 # Setup putty... 883 Name = PyMOLObjectNames["Chains"][ChainID]["ChainAloneBFactorPutty"] 884 PML = PyMOLUtil.SetupPMLForBFactorPuttyView(Name, ChainName, ColorPalette = OptionsInfo["BFactorColorPalette"], Enable = True) 885 OutFH.write("\n%s\n" % PML) 886 887 # Setup B factor group... 888 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Chains"][ChainID]["ChainAloneBFactorGroup"], PyMOLObjectNames["Chains"][ChainID]["ChainAloneBFactorGroupMembers"], False, "close") 889 890 891 def WriteChainAloneDisulfideBondsView(OutFH, FileIndex, PyMOLObjectNames, ChainID): 892 """Write out PML for viewing disulfide bonds for a chain.""" 893 894 if not GetChainAloneDisulfideBondsStatus(FileIndex, ChainID): 895 return 896 897 ChainName = PyMOLObjectNames["Chains"][ChainID]["ChainAlone"] 898 Name = PyMOLObjectNames["Chains"][ChainID]["ChainAloneDisulfideBondsResidues"] 899 900 PML = PyMOLUtil.SetupPMLForDisulfideBondsView(Name, ChainName, "sticks", Enable = True) 901 OutFH.write("\n%s\n" % PML) 902 903 # Setup disulfide bonds group... 904 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Chains"][ChainID]["ChainAloneDisulfideBondsGroup"], PyMOLObjectNames["Chains"][ChainID]["ChainAloneDisulfideBondsGroupMembers"], True, "close") 905 906 def WriteChainAloneSaltBridgesView(OutFH, FileIndex, PyMOLObjectNames, ChainID): 907 """Write out PML for viewing salt bridges for a chain.""" 908 909 if not GetChainAloneSaltBridgesStatus(FileIndex, ChainID): 910 return 911 912 ChainName = PyMOLObjectNames["Chains"][ChainID]["ChainAlone"] 913 914 # Seup salt bridges resiudes group... 915 PositivelyChargedResiduesName = PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesResiduesPositivelyCharged"] 916 PML = PyMOLUtil.SetupPMLForSaltBridgesResiduesView(PositivelyChargedResiduesName, ChainName, OptionsInfo["SaltBridgesChainResiduesInfo"]["Positively_Charged"], "lines", Enable = True) 917 OutFH.write("\n%s\n" % PML) 918 919 NegativelyChargedResiduesName = PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesResiduesNegativelyCharged"] 920 PML = PyMOLUtil.SetupPMLForSaltBridgesResiduesView(NegativelyChargedResiduesName, ChainName, OptionsInfo["SaltBridgesChainResiduesInfo"]["Negatively_Charged"], "lines", Enable = True) 921 OutFH.write("\n%s\n" % PML) 922 923 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesResiduesGroup"], PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesResiduesGroupMembers"], True, "open") 924 925 # Setup salt bridges contacts... 926 ContactsColor = OptionsInfo["SaltBridgesChainContactsColor"] 927 ContactsName = PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesContacts"] 928 PML = PyMOLUtil.SetupPMLForPolarContactsView(ContactsName, PositivelyChargedResiduesName, NegativelyChargedResiduesName, Enable = True, Color = ContactsColor, Cutoff = OptionsInfo["SaltBridgesChainCutoff"]) 929 OutFH.write("\n%s\n" % PML) 930 931 OutFH.write("""cmd.set("label_color", "%s", "%s")\n""" % (ContactsColor, ContactsName)) 932 933 # Setup salt bridges group... 934 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesGroup"], PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesGroupMembers"], False, "close") 935 936 def WriteResidueTypesResiduesAndSurfaceView(OutFH, SelectionObjectName, Name, SurfaceName, ResiduesColor, ResiduesNames, NegateResidueNames): 937 """Write residue types residues and surface view.""" 938 939 ResidueNamesSelection = "+".join(ResiduesNames) 940 if NegateResidueNames: 941 Selection = "%s and (not resn %s)" % (SelectionObjectName, ResidueNamesSelection) 942 else: 943 Selection = "%s and (resn %s)" % (SelectionObjectName, ResidueNamesSelection) 944 945 # Setup residues... 946 PML = PyMOLUtil.SetupPMLForSelectionDisplayView(Name, Selection, "lines", ResiduesColor, True, IgnoreHydrogens = OptionsInfo["IgnoreHydrogens"]) 947 OutFH.write("\n%s\n" % PML) 948 949 # Setup surface... 950 PML = PyMOLUtil.SetupPMLForSelectionDisplayView(SurfaceName, Selection, "surface", ResiduesColor, True, IgnoreHydrogens = OptionsInfo["IgnoreHydrogens"]) 951 OutFH.write("\n%s\n" % PML) 952 953 def WriteSurfaceElectrostaticsView(Mode, OutFH, SelectionObjectName, ElectrostaticsGroupName, ElectrostaticsGroupMembers, DisplayAs = None, SurfaceCavityMode = 2): 954 """Write out PML for viewing surface electrostatics.""" 955 956 if len(ElectrostaticsGroupMembers) == 5: 957 Name, ContactPotentialName, MapName, LegendName, VolumeName = ElectrostaticsGroupMembers 958 else: 959 Name, ContactPotentialName, MapName, LegendName = ElectrostaticsGroupMembers 960 VolumeName = None 961 962 PMLCmds = [] 963 964 # Setup chain... 965 PMLCmds.append("""cmd.create("%s", "(%s)")""" % (Name, SelectionObjectName)) 966 967 # Setup vacuum electrostatics surface along with associated objects... 968 PMLCmds.append("""util.protein_vacuum_esp("%s", mode=2, quiet=0, _self=cmd)""" % (Name)) 969 PMLCmds.append("""cmd.set_name("%s_e_chg", "%s")""" % (Name, ContactPotentialName)) 970 971 if DisplayAs is not None: 972 PMLCmds.append("""cmd.show("%s", "(%s)")""" % (DisplayAs, ContactPotentialName)) 973 974 if re.match("^Cavity$", Mode, re.I): 975 if SurfaceCavityMode is not None: 976 PMLCmds.append("""cmd.set("surface_cavity_mode", %d, "%s")\n""" % (SurfaceCavityMode, ContactPotentialName)) 977 978 PMLCmds.append(PyMOLUtil.SetupPMLForEnableDisable(ContactPotentialName, Enable = True)) 979 980 PMLCmds.append("""cmd.set_name("%s_e_map", "%s")""" % (Name, MapName)) 981 PMLCmds.append(PyMOLUtil.SetupPMLForEnableDisable(MapName, Enable = False)) 982 983 PMLCmds.append("""cmd.set_name("%s_e_pot", "%s")""" % (Name, LegendName)) 984 PMLCmds.append(PyMOLUtil.SetupPMLForEnableDisable(LegendName, Enable = False)) 985 986 if VolumeName is not None: 987 PMLCmds.append("""cmd.volume("%s", "%s", "%s", "(%s)")""" % (VolumeName, MapName, "esp", Name)) 988 PMLCmds.append(PyMOLUtil.SetupPMLForEnableDisable(VolumeName, Enable = False)) 989 990 # Delete name and take it out from the group membership. It is 991 # is already part of ContactPotential object. 992 PMLCmds.append("""cmd.delete("%s")""" % (Name)) 993 ElectrostaticsGroupMembers.pop(0) 994 995 PML = "\n".join(PMLCmds) 996 997 OutFH.write("\n%s\n" % PML) 998 999 # Setup group... 1000 GenerateAndWritePMLForGroup(OutFH, ElectrostaticsGroupName, ElectrostaticsGroupMembers, False, "close") 1001 1002 def GenerateAndWritePMLForGroup(OutFH, GroupName, GroupMembers, Enable = False, Action = "close"): 1003 """Generate and write PML for group.""" 1004 1005 PML = PyMOLUtil.SetupPMLForGroup(GroupName, GroupMembers, Enable, Action) 1006 OutFH.write("""\n""\n"Setting up group %s..."\n""\n""" % GroupName) 1007 OutFH.write("%s\n" % PML) 1008 1009 def WriteTrajectoriesView(OutFH, FileIndex, PyMOLObjectNames): 1010 """Write out PML for viewing trajectories for a PDB file.""" 1011 1012 if not GetTrajectoriesStatus(FileIndex): 1013 return 1014 1015 # Setup topology view... 1016 Name = PyMOLObjectNames["Trajectories"]["Topology"] 1017 1018 PMLCmds = [] 1019 PMLCmds.append("""cmd.load("%s", "%s")""" % (OptionsInfo["InfilesInfo"]["InfilesNames"][FileIndex], Name)) 1020 PMLCmds.append("""cmd.show("cartoon", "%s")""" % (Name)) 1021 PMLCmds.append("""util.cba(33, "%s", _self = cmd)""" % (Name)) 1022 PMLCmds.append("""cmd.show("sticks", "(organic and (%s))")""" % (Name)) 1023 PMLCmds.append(PyMOLUtil.SetupPMLForEnableDisable(Name, Enable = False)) 1024 1025 PML = "\n".join(PMLCmds) 1026 OutFH.write("\n%s\n" % PML) 1027 1028 # Write view for each trajectory file... 1029 for TrajFileIndex, TrajFile in enumerate(OptionsInfo["TrajectoriesInfo"]["TrajFiles"][FileIndex]): 1030 WriteTrajectoryViewTrajectoryFile(OutFH, FileIndex, PyMOLObjectNames, TrajFileIndex) 1031 1032 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Trajectories"]["TrajectoriesGroup"], PyMOLObjectNames["Trajectories"]["TrajectoriesGroupMembers"], False, "close") 1033 1034 def WriteTrajectoryViewTrajectoryFile(OutFH, PDBFileIndex, PyMOLObjectNames, TrajFileIndex): 1035 """Write out PML for viewing a trajectory file.""" 1036 1037 TrajFile = OptionsInfo["TrajectoriesInfo"]["TrajFiles"][PDBFileIndex][TrajFileIndex] 1038 TrajFileID = OptionsInfo["TrajectoriesInfo"]["TrajFilesIDs"][PDBFileIndex][TrajFileIndex] 1039 1040 OutFH.write("""\n""\n"Setting up views for trajectory file ID %s..."\n""\n""" % (TrajFileID)) 1041 1042 # Setup trajectory view... 1043 Name = PyMOLObjectNames["Trajectories"][TrajFileID]["Trajectory"] 1044 PDBFile = OptionsInfo["InfilesInfo"]["InfilesNames"][PDBFileIndex] 1045 1046 PMLCmds = [] 1047 PMLCmds.append("""cmd.load("%s", "%s")""" % (PDBFile, Name)) 1048 PMLCmds.append("""cmd.load_traj("%s", "%s", state = 1)""" % (TrajFile, Name)) 1049 PMLCmds.append("""cmd.show("cartoon", "%s")""" % (Name)) 1050 PMLCmds.append("""util.cba(33, "%s", _self = cmd)""" % (Name)) 1051 PMLCmds.append("""cmd.show("sticks", "(organic and (%s))")""" % (Name)) 1052 PMLCmds.append(PyMOLUtil.SetupPMLForEnableDisable(Name, Enable = True)) 1053 1054 PML = "\n".join(PMLCmds) 1055 OutFH.write("%s\n" % PML) 1056 1057 # Setup group for a trajectory file... 1058 Action = "open" if TrajFileIndex == 0 else "close" 1059 Enable = True if TrajFileIndex == 0 else False 1060 GenerateAndWritePMLForGroup(OutFH, PyMOLObjectNames["Trajectories"][TrajFileID]["TrajectoryGroup"], PyMOLObjectNames["Trajectories"][TrajFileID]["TrajectoryGroupMembers"], Enable, Action) 1061 1062 def GeneratePyMOLSessionFile(): 1063 """Generate PME file from PML file.""" 1064 1065 PSEOutfile = OptionsInfo["PSEOutfile"] 1066 PMLOutfile = OptionsInfo["PMLOutfile"] 1067 1068 MiscUtil.PrintInfo("\nGenerating file %s..." % PSEOutfile) 1069 1070 PyMOLUtil.ConvertPMLFileToPSEFile(PMLOutfile, PSEOutfile) 1071 1072 if not os.path.exists(PSEOutfile): 1073 MiscUtil.PrintWarning("Failed to generate PSE file, %s..." % (PSEOutfile)) 1074 1075 if not OptionsInfo["PMLOut"]: 1076 MiscUtil.PrintInfo("Deleting file %s..." % PMLOutfile) 1077 os.remove(PMLOutfile) 1078 1079 def DeleteEmptyPyMOLObjects(OutFH, FileIndex, PyMOLObjectNames): 1080 """Delete empty PyMOL objects.""" 1081 1082 if OptionsInfo["AllowEmptyObjects"]: 1083 return 1084 1085 SpecifiedChainsAndLigandsInfo = OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex] 1086 for ChainID in SpecifiedChainsAndLigandsInfo["ChainIDs"]: 1087 OutFH.write("""\n""\n"Checking and deleting empty objects for chain %s..."\n""\n""" % (ChainID)) 1088 1089 # Delete any chain level objects... 1090 WritePMLToCheckAndDeleteEmptyObjects(OutFH, PyMOLObjectNames["Chains"][ChainID]["Solvent"]) 1091 WritePMLToCheckAndDeleteEmptyObjects(OutFH, PyMOLObjectNames["Chains"][ChainID]["Inorganic"]) 1092 1093 # Delete chain selection objects... 1094 DeleteEmptyChainSelectionsObjects(OutFH, FileIndex, PyMOLObjectNames, ChainID) 1095 1096 # Delete residue type objects... 1097 DeleteEmptyChainResidueTypesObjects(OutFH, FileIndex, PyMOLObjectNames, ChainID) 1098 1099 # Delete disulfide bonds objects... 1100 DeleteEmptyChainDisulfideBondsObjects(OutFH, FileIndex, PyMOLObjectNames, ChainID) 1101 1102 # Delete salt bridges objects... 1103 DeleteEmptyChainSaltBridgesObjects(OutFH, FileIndex, PyMOLObjectNames, ChainID) 1104 1105 # Delete ligand objects... 1106 for LigandID in SpecifiedChainsAndLigandsInfo["LigandIDs"][ChainID]: 1107 # Delete ligand level objects... 1108 for GroupID in ["Pocket", "PocketSolvent", "PocketInorganic"]: 1109 GroupNameID = "%sGroup" % (GroupID) 1110 GroupName = PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupNameID] 1111 1112 GroupTypeObjectID = "%s" % (GroupID) 1113 GroupTypeObjectName = PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupTypeObjectID] 1114 1115 WritePMLToCheckAndDeleteEmptyObjects(OutFH, GroupTypeObjectName, GroupName) 1116 1117 if re.match("^Pocket$", GroupID, re.I): 1118 DeleteEmptyPocketSelectionsObjects(OutFH, FileIndex, PyMOLObjectNames, ChainID, LigandID, GroupTypeObjectID) 1119 DeleteEmptyPocketResidueTypesObjects(OutFH, FileIndex, PyMOLObjectNames, ChainID, LigandID, GroupTypeObjectID) 1120 1121 # Delete docked poses objects... 1122 DeleteEmptyChainDockedPosesObjects(OutFH, FileIndex, PyMOLObjectNames, ChainID) 1123 1124 def DeleteEmptyChainSelectionsObjects(OutFH, FileIndex, PyMOLObjectNames, ChainID): 1125 """Delete empty chain selection objects """ 1126 1127 if not GetChainAloneContainsSelectionsStatus(FileIndex, ChainID): 1128 return 1129 1130 SelectionsGroupIDPrefix = "ChainAloneSelections" 1131 1132 for SelectionName in OptionsInfo["ChainSelectionsInfo"]["Names"]: 1133 SelectionNameGroupID = SelectionName 1134 1135 # Delete surface objects and surface group... 1136 if GetChainAloneContainsChainSelectionSurfacesStatus(FileIndex, ChainID): 1137 SurfaceGroupID = "%s%sSurfaceGroup" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 1138 SurfaceGroupMembersID = "%s%sSurfaceGroupMembers" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 1139 WritePMLToCheckAndDeleteEmptyObjects(OutFH, ",".join(PyMOLObjectNames["Chains"][ChainID][SurfaceGroupMembersID]), PyMOLObjectNames["Chains"][ChainID][SurfaceGroupID]) 1140 1141 # Delete Selection object and selection name group... 1142 SelectionObjectID = "%s%sSelection" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 1143 SelectionsGroupID = "%s%sGroup" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 1144 WritePMLToCheckAndDeleteEmptyObjects(OutFH, PyMOLObjectNames["Chains"][ChainID][SelectionObjectID], PyMOLObjectNames["Chains"][ChainID][SelectionsGroupID]) 1145 1146 def DeleteEmptyChainResidueTypesObjects(OutFH, FileIndex, PyMOLObjectNames, ChainID): 1147 """Delete empty chain residue objects.""" 1148 1149 if not GetChainAloneResidueTypesStatus(FileIndex, ChainID): 1150 return 1151 1152 ResiduesGroupIDPrefix = "ChainAloneResidues" 1153 for GroupType in ["Aromatic", "Hydrophobic", "Polar", "Positively_Charged", "Negatively_Charged", "Other"]: 1154 GroupID = re.sub("_", "", GroupType) 1155 1156 ResiduesGroupID = "%s%sGroup" % (ResiduesGroupIDPrefix, GroupID) 1157 GroupName = PyMOLObjectNames["Chains"][ChainID][ResiduesGroupID] 1158 1159 GroupObjectNamesList = [] 1160 1161 ResiduesObjectID = "%s%sResidues" % (ResiduesGroupIDPrefix, GroupID) 1162 ResiduesObjectName = PyMOLObjectNames["Chains"][ChainID][ResiduesObjectID] 1163 GroupObjectNamesList.append(ResiduesObjectName) 1164 1165 ResiduesSurfaceObjectID = "%s%sSurface" % (ResiduesGroupIDPrefix, GroupID) 1166 ResiduesSurfaceObjectName = PyMOLObjectNames["Chains"][ChainID][ResiduesSurfaceObjectID] 1167 GroupObjectNamesList.append(ResiduesSurfaceObjectName) 1168 1169 GroupObjectNames = ",".join(GroupObjectNamesList) 1170 WritePMLToCheckAndDeleteEmptyObjects(OutFH, GroupObjectNames, GroupName) 1171 1172 def DeleteEmptyChainDisulfideBondsObjects(OutFH, FileIndex, PyMOLObjectNames, ChainID): 1173 """Delete empty chain disulfide bonds objects.""" 1174 1175 if not GetChainAloneDisulfideBondsStatus(FileIndex, ChainID): 1176 return 1177 1178 WritePMLToCheckAndDeleteEmptyObjects(OutFH, PyMOLObjectNames["Chains"][ChainID]["ChainAloneDisulfideBondsResidues"], PyMOLObjectNames["Chains"][ChainID]["ChainAloneDisulfideBondsGroup"]) 1179 1180 def DeleteEmptyChainSaltBridgesObjects(OutFH, FileIndex, PyMOLObjectNames, ChainID): 1181 """Delete empty chain salt bridges objects.""" 1182 1183 if not GetChainAloneSaltBridgesStatus(FileIndex, ChainID): 1184 return 1185 1186 Names = [] 1187 Names.append(PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesResiduesPositivelyCharged"]) 1188 Names.append(PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesResiduesNegativelyCharged"]) 1189 1190 WritePMLToCheckAndDeleteEmptyObjects(OutFH, ",".join(Names), PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesGroup"]) 1191 1192 def DeleteEmptyPocketSelectionsObjects(OutFH, FileIndex, PyMOLObjectNames, ChainID, LigandID, PocketObjectID): 1193 """Delete empty pocket selection objects.""" 1194 1195 if not GetPocketContainsSelectionsStatus(FileIndex, ChainID, LigandID): 1196 return 1197 1198 PocketObjectName = PyMOLObjectNames["Ligands"][ChainID][LigandID][PocketObjectID] 1199 SelectionsGroupIDPrefix = "PocketSelectionsGroup" 1200 1201 for SelectionName in OptionsInfo["PocketChainSelectionsInfo"]["Names"]: 1202 SelectionNameGroupID = SelectionName 1203 1204 # Delete surface objects and surface group... 1205 if GetPocketSelectionSurfaceChainStatus(FileIndex, ChainID, LigandID): 1206 SurfaceGroupID = "%s%sSurfaceGroup" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 1207 SurfaceGroupMembersID = "%s%sSurfaceGroupMembers" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 1208 WritePMLToCheckAndDeleteEmptyObjects(OutFH, ",".join(PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfaceGroupMembersID]), PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfaceGroupID]) 1209 1210 # Delete Selection object and selection name group... 1211 SelectionObjectID = "%s%sSelection" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 1212 SelectionsGroupID = "%s%sGroup" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 1213 WritePMLToCheckAndDeleteEmptyObjects(OutFH, PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionObjectID], PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionsGroupID]) 1214 1215 def DeleteEmptyPocketResidueTypesObjects(OutFH, FileIndex, PyMOLObjectNames, ChainID, LigandID, PocketObjectID): 1216 """Delete empty chain residue objects. """ 1217 1218 if not GetPocketResidueTypesStatus(FileIndex, ChainID, LigandID): 1219 return 1220 1221 ResiduesGroupID = "%sResiduesGroup" % (PocketObjectID) 1222 ResiduesGroupMembersID = "%sMembers" % (ResiduesGroupID) 1223 1224 for SubGroupType in ["Aromatic", "Hydrophobic", "Polar", "Positively_Charged", "Negatively_Charged", "Other"]: 1225 SubGroupID = re.sub("_", "", SubGroupType) 1226 1227 ResiduesSubGroupID = "%s%sGroup" % (ResiduesGroupID, SubGroupID) 1228 ResiduesSubMembersGroupID = "%sMembers" % (ResiduesSubGroupID) 1229 1230 SubGroupName = PyMOLObjectNames["Ligands"][ChainID][LigandID][ResiduesSubGroupID] 1231 SubGroupObjectNames = ",".join(PyMOLObjectNames["Ligands"][ChainID][LigandID][ResiduesSubMembersGroupID]) 1232 1233 WritePMLToCheckAndDeleteEmptyObjects(OutFH, SubGroupObjectNames, SubGroupName) 1234 1235 def DeleteEmptyChainDockedPosesObjects(OutFH, PDBFileIndex, PyMOLObjectNames, ChainID): 1236 """Delete empty chain docked poses objest.""" 1237 1238 if not GetChainAloneDockedPosesStatus(PDBFileIndex, ChainID): 1239 return 1240 1241 SpecifiedChainsAndLigandsInfo = OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][PDBFileIndex] 1242 DockedPosesInfo = OptionsInfo["DockedPosesInfo"] 1243 1244 for InputFileIndex, InputFile in enumerate(SpecifiedChainsAndLigandsInfo["DockedPosesInputFiles"][ChainID]): 1245 InputFileID = DockedPosesInfo["InputFilesIDs"][PDBFileIndex][InputFileIndex] 1246 for GroupID in ["Pocket", "PocketSolvent", "PocketInorganic"]: 1247 GroupNameID = "%sGroup" % (GroupID) 1248 GroupName = PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][GroupNameID] 1249 1250 GroupTypeObjectID = "%sPocket" % (GroupID) 1251 GroupTypeObjectName = PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][GroupTypeObjectID] 1252 1253 WritePMLToCheckAndDeleteEmptyObjects(OutFH, GroupTypeObjectName, GroupName) 1254 1255 def WritePMLToCheckAndDeleteEmptyObjects(OutFH, ObjectName, ParentObjectName = None): 1256 """Write PML to check and delete empty PyMOL objects.""" 1257 1258 if ParentObjectName is None: 1259 PML = """CheckAndDeleteEmptyObjects("%s")""" % (ObjectName) 1260 else: 1261 PML = """CheckAndDeleteEmptyObjects("%s", "%s")""" % (ObjectName, ParentObjectName) 1262 1263 OutFH.write("%s\n" % PML) 1264 1265 def SetupPyMOLObjectNames(FileIndex): 1266 """Setup hierarchy of PyMOL groups and objects for ligand centric views of 1267 chains and ligands present in input file. 1268 """ 1269 1270 PyMOLObjectNames = {} 1271 PyMOLObjectNames["Chains"] = {} 1272 PyMOLObjectNames["Ligands"] = {} 1273 PyMOLObjectNames["DockedPosesInputFile"] = {} 1274 PyMOLObjectNames["Trajectories"] = {} 1275 1276 # Setup groups and objects for complex... 1277 SetupPyMOLObjectNamesForComplex(FileIndex, PyMOLObjectNames) 1278 1279 # Setup groups and object for trajectories... 1280 if GetTrajectoriesStatus(FileIndex): 1281 SetupPyMOLObjectNamesForTrajectories(FileIndex, PyMOLObjectNames) 1282 1283 # Setup groups and objects for chain... 1284 SpecifiedChainsAndLigandsInfo = OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex] 1285 for ChainID in SpecifiedChainsAndLigandsInfo["ChainIDs"]: 1286 SetupPyMOLObjectNamesForChain(FileIndex, PyMOLObjectNames, ChainID) 1287 1288 # Setup groups and objects for ligand... 1289 for LigandID in SpecifiedChainsAndLigandsInfo["LigandIDs"][ChainID]: 1290 SetupPyMOLObjectNamesForLigand(FileIndex, PyMOLObjectNames, ChainID, LigandID) 1291 1292 # Setup group and objects for docked poses... 1293 if GetChainAloneDockedPosesStatus(FileIndex, ChainID): 1294 SetupPyMOLObjectNamesForDockedPoses(FileIndex, PyMOLObjectNames, ChainID) 1295 1296 return PyMOLObjectNames 1297 1298 def SetupPyMOLObjectNamesForComplex(FileIndex, PyMOLObjectNames): 1299 """Setup groups and objects for complex.""" 1300 1301 PDBFileRoot = OptionsInfo["InfilesInfo"]["InfilesRoots"][FileIndex] 1302 1303 PDBGroupName = "%s" % PDBFileRoot 1304 PyMOLObjectNames["PDBGroup"] = PDBGroupName 1305 PyMOLObjectNames["PDBGroupMembers"] = [] 1306 1307 ComplexGroupName = "%s.Complex" % PyMOLObjectNames["PDBGroup"] 1308 PyMOLObjectNames["ComplexGroup"] = ComplexGroupName 1309 PyMOLObjectNames["PDBGroupMembers"].append(ComplexGroupName) 1310 1311 PyMOLObjectNames["Complex"] = "%s.Complex" % ComplexGroupName 1312 if OptionsInfo["SurfaceComplex"]: 1313 PyMOLObjectNames["ComplexHydrophobicSurface"] = "%s.Surface" % ComplexGroupName 1314 1315 PyMOLObjectNames["ComplexGroupMembers"] = [] 1316 PyMOLObjectNames["ComplexGroupMembers"].append(PyMOLObjectNames["Complex"]) 1317 if OptionsInfo["SurfaceComplex"]: 1318 PyMOLObjectNames["ComplexGroupMembers"].append(PyMOLObjectNames["ComplexHydrophobicSurface"]) 1319 1320 def SetupPyMOLObjectNamesForTrajectories(FileIndex, PyMOLObjectNames): 1321 """Setup groups and objects for a PDB file.""" 1322 1323 if not GetTrajectoriesStatus(FileIndex): 1324 return 1325 1326 # Setup a group for trajectories.... 1327 TrajectoriesGroupName = "%s.Trajectories" % PyMOLObjectNames["PDBGroup"] 1328 PyMOLObjectNames["Trajectories"]["TrajectoriesGroup"] = TrajectoriesGroupName 1329 PyMOLObjectNames["PDBGroupMembers"].append(TrajectoriesGroupName) 1330 1331 PyMOLObjectNames["Trajectories"]["TrajectoriesGroupMembers"] = [] 1332 1333 # Setup a topolgy object... 1334 TopologyName = "%s.Topology" % TrajectoriesGroupName 1335 PyMOLObjectNames["Trajectories"]["Topology"] = TopologyName 1336 PyMOLObjectNames["Trajectories"]["TrajectoriesGroupMembers"].append(TopologyName) 1337 1338 # Setup trajectory objects... 1339 for TrajFileIndex, TrajFile in enumerate(OptionsInfo["TrajectoriesInfo"]["TrajFiles"][FileIndex]): 1340 SetupPyMOLObjectNamesForTrajectoryFile(FileIndex, PyMOLObjectNames, TrajFileIndex) 1341 1342 def SetupPyMOLObjectNamesForTrajectoryFile(PDBFileIndex, PyMOLObjectNames, TrajFileIndex): 1343 """Setup groups and objest for a trajectory file for a PDB file.""" 1344 1345 TrajFileID = OptionsInfo["TrajectoriesInfo"]["TrajFilesIDs"][PDBFileIndex][TrajFileIndex] 1346 1347 PyMOLObjectNames["Trajectories"][TrajFileID] = {} 1348 1349 TrajectoriesGroupName = PyMOLObjectNames["Trajectories"]["TrajectoriesGroup"] 1350 1351 # Setup a trajectories level trajectory file group... 1352 TrajectoryFileGroupName = "%s.%s" % (TrajectoriesGroupName, TrajFileID) 1353 PyMOLObjectNames["Trajectories"][TrajFileID]["TrajectoryGroup"] = TrajectoryFileGroupName 1354 PyMOLObjectNames["Trajectories"]["TrajectoriesGroupMembers"].append(TrajectoryFileGroupName) 1355 1356 PyMOLObjectNames["Trajectories"][TrajFileID]["TrajectoryGroupMembers"] = [] 1357 1358 # Setup object for a trajectory file... 1359 TrajectoryName = "%s.Trajectory" % (TrajectoryFileGroupName) 1360 PyMOLObjectNames["Trajectories"][TrajFileID]["Trajectory"] = TrajectoryName 1361 PyMOLObjectNames["Trajectories"][TrajFileID]["TrajectoryGroupMembers"].append(TrajectoryName) 1362 1363 def SetupPyMOLObjectNamesForChain(FileIndex, PyMOLObjectNames, ChainID): 1364 """Setup groups and objects for chain.""" 1365 1366 PDBGroupName = PyMOLObjectNames["PDBGroup"] 1367 1368 PyMOLObjectNames["Chains"][ChainID] = {} 1369 PyMOLObjectNames["Ligands"][ChainID] = {} 1370 1371 # Set up chain group and chain objects... 1372 ChainGroupName = "%s.Chain%s" % (PDBGroupName, ChainID) 1373 PyMOLObjectNames["Chains"][ChainID]["ChainGroup"] = ChainGroupName 1374 PyMOLObjectNames["PDBGroupMembers"].append(ChainGroupName) 1375 PyMOLObjectNames["Chains"][ChainID]["ChainGroupMembers"] = [] 1376 1377 # Setup chain complex group and objects... 1378 ChainComplexGroupName = "%s.Complex" % (ChainGroupName) 1379 PyMOLObjectNames["Chains"][ChainID]["ChainComplexGroup"] = ChainComplexGroupName 1380 PyMOLObjectNames["Chains"][ChainID]["ChainGroupMembers"].append(ChainComplexGroupName) 1381 1382 PyMOLObjectNames["Chains"][ChainID]["ChainComplexGroupMembers"] = [] 1383 1384 Name = "%s.Complex" % (ChainComplexGroupName) 1385 PyMOLObjectNames["Chains"][ChainID]["ChainComplex"] = Name 1386 PyMOLObjectNames["Chains"][ChainID]["ChainComplexGroupMembers"].append(Name) 1387 1388 if OptionsInfo["SurfaceChainComplex"]: 1389 Name = "%s.Surface" % (ChainComplexGroupName) 1390 PyMOLObjectNames["Chains"][ChainID]["ChainComplexHydrophobicSurface"] = Name 1391 PyMOLObjectNames["Chains"][ChainID]["ChainComplexGroupMembers"].append(Name) 1392 1393 # Setup up a group for individual chains... 1394 ChainAloneGroupName = "%s.Chain" % (ChainGroupName) 1395 PyMOLObjectNames["Chains"][ChainID]["ChainAloneGroup"] = ChainAloneGroupName 1396 PyMOLObjectNames["Chains"][ChainID]["ChainGroupMembers"].append(ChainAloneGroupName) 1397 1398 PyMOLObjectNames["Chains"][ChainID]["ChainAloneGroupMembers"] = [] 1399 1400 Name = "%s.Chain" % (ChainAloneGroupName) 1401 PyMOLObjectNames["Chains"][ChainID]["ChainAlone"] = Name 1402 PyMOLObjectNames["Chains"][ChainID]["ChainAloneGroupMembers"].append(Name) 1403 1404 if GetChainAloneBFactorStatus(FileIndex, ChainID): 1405 # Setup B factor group and add it to chain alone group... 1406 BFactorGroupName = "%s.BFactor" % (ChainAloneGroupName) 1407 PyMOLObjectNames["Chains"][ChainID]["ChainAloneBFactorGroup"] = BFactorGroupName 1408 PyMOLObjectNames["Chains"][ChainID]["ChainAloneGroupMembers"].append(BFactorGroupName) 1409 1410 PyMOLObjectNames["Chains"][ChainID]["ChainAloneBFactorGroupMembers"] = [] 1411 1412 # Setup cartoon... 1413 Name = "%s.Cartoon" % (BFactorGroupName) 1414 PyMOLObjectNames["Chains"][ChainID]["ChainAloneBFactorCartoon"] = Name 1415 PyMOLObjectNames["Chains"][ChainID]["ChainAloneBFactorGroupMembers"].append(Name) 1416 1417 # Setup putty... 1418 Name = "%s.Putty" % (BFactorGroupName) 1419 PyMOLObjectNames["Chains"][ChainID]["ChainAloneBFactorPutty"] = Name 1420 PyMOLObjectNames["Chains"][ChainID]["ChainAloneBFactorGroupMembers"].append(Name) 1421 1422 if GetChainAloneContainsSelectionsStatus(FileIndex, ChainID): 1423 # Setup selections group and its subgroups.. 1424 SelectionsGroupName = "%s.Selections" % (ChainAloneGroupName) 1425 1426 SelectionsGroupIDPrefix = "ChainAloneSelections" 1427 SelectionsGroupID = "%sGroup" % SelectionsGroupIDPrefix 1428 1429 # Add selections group to chain alone group... 1430 PyMOLObjectNames["Chains"][ChainID][SelectionsGroupID] = SelectionsGroupName 1431 PyMOLObjectNames["Chains"][ChainID]["ChainAloneGroupMembers"].append(SelectionsGroupName) 1432 1433 # Initialize selections group members... 1434 SelectionsGroupMembersID = "%sGroupMembers" % SelectionsGroupIDPrefix 1435 PyMOLObjectNames["Chains"][ChainID][SelectionsGroupMembersID] = [] 1436 1437 # Setup selections name sub group and its members... 1438 for SelectionName in OptionsInfo["ChainSelectionsInfo"]["Names"]: 1439 SelectionNameGroupID = SelectionName 1440 1441 SelectionsNameGroupName = "%s.%s" % (SelectionsGroupName, SelectionName) 1442 SelectionsNameGroupID = "%s%sGroup" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 1443 1444 # Add selections name sub group to selections group... 1445 PyMOLObjectNames["Chains"][ChainID][SelectionsNameGroupID] = SelectionsNameGroupName 1446 PyMOLObjectNames["Chains"][ChainID][SelectionsGroupMembersID].append(SelectionsNameGroupName) 1447 1448 # Initialize selections names sub group members... 1449 SelectionsNameGroupMembersID = "%s%sGroupMembers" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 1450 PyMOLObjectNames["Chains"][ChainID][SelectionsNameGroupMembersID] = [] 1451 1452 # Add selection member to selections name group... 1453 SubGroupMemberName = "%s.Selection" % (SelectionsNameGroupName) 1454 SubGroupMemberID = "%s%sSelection" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 1455 1456 PyMOLObjectNames["Chains"][ChainID][SubGroupMemberID] = SubGroupMemberName 1457 PyMOLObjectNames["Chains"][ChainID][SelectionsNameGroupMembersID].append(SubGroupMemberName) 1458 1459 if GetChainAloneContainsChainSelectionSurfacesStatus(FileIndex, ChainID): 1460 # Setup a surface sub group and add it to selections name group... 1461 1462 SelectionsNameSurfaceGroupName = "%s.Surface" % (SelectionsNameGroupName) 1463 SelectionsNameSurfaceGroupID = "%s%sSurfaceGroup" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 1464 1465 # Add selection surface group to selection name group... 1466 PyMOLObjectNames["Chains"][ChainID][SelectionsNameSurfaceGroupID] = SelectionsNameSurfaceGroupName 1467 PyMOLObjectNames["Chains"][ChainID][SelectionsNameGroupMembersID].append(SelectionsNameSurfaceGroupName) 1468 1469 # Initialize surface names sub group members... 1470 SelectionsNameSurfaceGroupMembersID = "%s%sSurfaceGroupMembers" % (SelectionsGroupIDPrefix, SelectionNameGroupID) 1471 PyMOLObjectNames["Chains"][ChainID][SelectionsNameSurfaceGroupMembersID] = [] 1472 1473 # Setup a generic color surface... 1474 SubGroupMemberName = "%s.Surface" % (SelectionsNameSurfaceGroupName) 1475 SubGroupMemberID = "%s%s%sSurface" % (SelectionsGroupIDPrefix, SelectionNameGroupID, "Surface") 1476 PyMOLObjectNames["Chains"][ChainID][SubGroupMemberID] = SubGroupMemberName 1477 PyMOLObjectNames["Chains"][ChainID][SelectionsNameSurfaceGroupMembersID].append(SubGroupMemberName) 1478 1479 if GetChainAloneSurfaceChainSelectionStatus(FileIndex, ChainID): 1480 # Setup surfaces... 1481 for MemberType in ["Hydrophobicity", "Hydrophobicity_Charge"]: 1482 MemberID = re.sub("_", "", MemberType) 1483 1484 SubGroupMemberName = "%s.%s" % (SelectionsNameSurfaceGroupName, MemberType) 1485 SubGroupMemberID = "%s%s%s%s" % (SelectionsGroupIDPrefix, SelectionNameGroupID, "Surface", MemberID) 1486 1487 PyMOLObjectNames["Chains"][ChainID][SubGroupMemberID] = SubGroupMemberName 1488 PyMOLObjectNames["Chains"][ChainID][SelectionsNameSurfaceGroupMembersID].append(SubGroupMemberName) 1489 1490 if GetChainAloneResidueTypesStatus(FileIndex, ChainID): 1491 # Setup residue type group and its subgroups... 1492 ResiduesGroupName = "%s.Residues" % (ChainAloneGroupName) 1493 1494 ResiduesGroupIDPrefix = "ChainAloneResidues" 1495 ResiduesGroupID = "%sGroup" % ResiduesGroupIDPrefix 1496 1497 # Add residue group to chain alone group... 1498 PyMOLObjectNames["Chains"][ChainID][ResiduesGroupID] = ResiduesGroupName 1499 PyMOLObjectNames["Chains"][ChainID]["ChainAloneGroupMembers"].append(ResiduesGroupName) 1500 1501 # Initialize residue group members... 1502 ResiduesGroupMembersID = "%sGroupMembers" % ResiduesGroupIDPrefix 1503 PyMOLObjectNames["Chains"][ChainID][ResiduesGroupMembersID] = [] 1504 1505 # Setup residues sub groups and its members... 1506 for SubGroupType in ["Aromatic", "Hydrophobic", "Polar", "Positively_Charged", "Negatively_Charged", "Other"]: 1507 SubGroupID = re.sub("_", "", SubGroupType) 1508 1509 ResiduesSubGroupName = "%s.%s" % (ResiduesGroupName, SubGroupType) 1510 ResiduesSubGroupID = "%s%sGroup" % (ResiduesGroupIDPrefix, SubGroupID) 1511 1512 # Add sub group to residues group... 1513 PyMOLObjectNames["Chains"][ChainID][ResiduesSubGroupID] = ResiduesSubGroupName 1514 PyMOLObjectNames["Chains"][ChainID][ResiduesGroupMembersID].append(ResiduesSubGroupName) 1515 1516 # Initialize sub group members... 1517 ResiduesSubGroupMembersID = "%s%sGroupMembers" % (ResiduesGroupIDPrefix, SubGroupID) 1518 PyMOLObjectNames["Chains"][ChainID][ResiduesSubGroupMembersID] = [] 1519 1520 # Add sub group members to subgroup... 1521 for MemberType in ["Residues", "Surface"]: 1522 MemberID = re.sub("_", "", MemberType) 1523 1524 SubGroupMemberName = "%s.%s" % (ResiduesSubGroupName, MemberType) 1525 SubGroupMemberID = "%s%s%s" % (ResiduesGroupIDPrefix, SubGroupID, MemberID) 1526 1527 PyMOLObjectNames["Chains"][ChainID][SubGroupMemberID] = SubGroupMemberName 1528 PyMOLObjectNames["Chains"][ChainID][ResiduesSubGroupMembersID].append(SubGroupMemberName) 1529 1530 if GetChainAloneContainsSurfacesStatus(FileIndex, ChainID): 1531 # Setup a surface group and add it to chain alone group... 1532 SurfaceGroupName = "%s.Surface" % (ChainAloneGroupName) 1533 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSurfaceGroup"] = SurfaceGroupName 1534 PyMOLObjectNames["Chains"][ChainID]["ChainAloneGroupMembers"].append(SurfaceGroupName) 1535 1536 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSurfaceGroupMembers"] = [] 1537 1538 # Setup a generic color surface... 1539 Name = "%s.Surface" % (SurfaceGroupName) 1540 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSurface"] = Name 1541 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSurfaceGroupMembers"].append(Name) 1542 1543 if GetChainAloneSurfaceChainStatus(FileIndex, ChainID): 1544 # Setup hydrophobicity surface... 1545 Name = "%s.Hydrophobicity" % (SurfaceGroupName) 1546 PyMOLObjectNames["Chains"][ChainID]["ChainAloneHydrophobicSurface"] = Name 1547 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSurfaceGroupMembers"].append(Name) 1548 1549 # Setup hydrophobicity and charge surface... 1550 Name = "%s.Hydrophobicity_Charge" % (SurfaceGroupName) 1551 PyMOLObjectNames["Chains"][ChainID]["ChainAloneHydrophobicChargeSurface"] = Name 1552 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSurfaceGroupMembers"].append(Name) 1553 1554 if GetChainAloneSurfaceChainElectrostaticsStatus(FileIndex, ChainID): 1555 # Setup electrostatics group... 1556 GroupName = "%s.Vacuum_Electrostatics" % (SurfaceGroupName) 1557 PyMOLObjectNames["Chains"][ChainID]["ChainAloneElectrostaticsGroup"] = GroupName 1558 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSurfaceGroupMembers"].append(GroupName) 1559 1560 # Setup electrostatics group members... 1561 PyMOLObjectNames["Chains"][ChainID]["ChainAloneElectrostaticsGroupMembers"] = [] 1562 1563 for MemberType in ["Chain", "Contact_Potential", "Map", "Legend", "Volume"]: 1564 MemberID = re.sub("_", "", MemberType) 1565 1566 Name = "%s.%s" % (GroupName, MemberType) 1567 NameID = "ChainAloneElectrostaticsSurface%s" % MemberID 1568 1569 PyMOLObjectNames["Chains"][ChainID][NameID] = Name 1570 PyMOLObjectNames["Chains"][ChainID]["ChainAloneElectrostaticsGroupMembers"].append(Name) 1571 1572 if GetChainAloneDisulfideBondsStatus(FileIndex, ChainID): 1573 # Setup disulfide bonds group and add it to chain alone group... 1574 DisulfideBondsGroupName = "%s.Disulfide_Bonds" % (ChainAloneGroupName) 1575 PyMOLObjectNames["Chains"][ChainID]["ChainAloneDisulfideBondsGroup"] = DisulfideBondsGroupName 1576 PyMOLObjectNames["Chains"][ChainID]["ChainAloneGroupMembers"].append(DisulfideBondsGroupName) 1577 1578 PyMOLObjectNames["Chains"][ChainID]["ChainAloneDisulfideBondsGroupMembers"] = [] 1579 1580 # Setup a residues object for disulfide bonds... 1581 Name = "%s.Residues" % (DisulfideBondsGroupName) 1582 PyMOLObjectNames["Chains"][ChainID]["ChainAloneDisulfideBondsResidues"] = Name 1583 PyMOLObjectNames["Chains"][ChainID]["ChainAloneDisulfideBondsGroupMembers"].append(Name) 1584 1585 if GetChainAloneSaltBridgesStatus(FileIndex, ChainID): 1586 # Setup salt bridges group and add it to chain alone group... 1587 SaltBridgesGroupName = "%s.Salt_Bridges" % (ChainAloneGroupName) 1588 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesGroup"] = SaltBridgesGroupName 1589 PyMOLObjectNames["Chains"][ChainID]["ChainAloneGroupMembers"].append(SaltBridgesGroupName) 1590 1591 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesGroupMembers"] = [] 1592 1593 # Setup residues group and add it to salt bridges group... 1594 ResiduesGroupName = "%s.Residues" % (SaltBridgesGroupName) 1595 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesResiduesGroup"] = ResiduesGroupName 1596 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesGroupMembers"].append(ResiduesGroupName) 1597 1598 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesResiduesGroupMembers"] = [] 1599 1600 # Setup objects for residues group... 1601 Name = "%s.Positively_Charged" % (ResiduesGroupName) 1602 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesResiduesPositivelyCharged"] = Name 1603 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesResiduesGroupMembers"].append(Name) 1604 1605 Name = "%s.Negatively_Charged" % (ResiduesGroupName) 1606 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesResiduesNegativelyCharged"] = Name 1607 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesResiduesGroupMembers"].append(Name) 1608 1609 # Add contacts object to salt bridges group... 1610 Name = "%s.Contacts" % (SaltBridgesGroupName) 1611 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesContacts"] = Name 1612 PyMOLObjectNames["Chains"][ChainID]["ChainAloneSaltBridgesGroupMembers"].append(Name) 1613 1614 # Setup solvent and inorganic objects for chain... 1615 for NameID in ["Solvent", "Inorganic"]: 1616 Name = "%s.%s" % (ChainGroupName, NameID) 1617 PyMOLObjectNames["Chains"][ChainID][NameID] = Name 1618 PyMOLObjectNames["Chains"][ChainID]["ChainGroupMembers"].append(Name) 1619 1620 def SetupPyMOLObjectNamesForLigand(FileIndex, PyMOLObjectNames, ChainID, LigandID): 1621 """Stetup groups and objects for ligand.""" 1622 1623 PyMOLObjectNames["Ligands"][ChainID][LigandID] = {} 1624 1625 ChainGroupName = PyMOLObjectNames["Chains"][ChainID]["ChainGroup"] 1626 1627 # Setup a chain level ligand group... 1628 ChainLigandGroupName = "%s.Ligand%s" % (ChainGroupName, LigandID) 1629 PyMOLObjectNames["Ligands"][ChainID][LigandID]["ChainLigandGroup"] = ChainLigandGroupName 1630 PyMOLObjectNames["Chains"][ChainID]["ChainGroupMembers"].append(ChainLigandGroupName) 1631 1632 PyMOLObjectNames["Ligands"][ChainID][LigandID]["ChainLigandGroupMembers"] = [] 1633 1634 # Set up groups and objects for a specific ligand group... 1635 for GroupType in ["Ligand", "Pocket", "Pocket_Solvent", "Pocket_Inorganic"]: 1636 GroupID = re.sub("_", "", GroupType) 1637 GroupName = "%s.%s" % (ChainLigandGroupName, GroupType) 1638 1639 GroupNameID = "%sGroup" % (GroupID) 1640 GroupMembersID = "%sGroupMembers" % (GroupID) 1641 1642 PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupNameID] = GroupName 1643 PyMOLObjectNames["Ligands"][ChainID][LigandID]["ChainLigandGroupMembers"].append(GroupName) 1644 1645 GroupTypeObjectName = "%s.%s" % (GroupName, GroupType) 1646 GroupTypeObjectID = "%s" % (GroupID) 1647 PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupTypeObjectID] = GroupTypeObjectName 1648 1649 PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupMembersID] = [] 1650 PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupMembersID].append(GroupTypeObjectName) 1651 1652 if re.match("^Ligand$", GroupType, re.I): 1653 # Only need to add ball and stick... 1654 BallAndStickName = "%s.BallAndStick" % (GroupName) 1655 BallAndStickID = "%sBallAndStick" % (GroupID) 1656 PyMOLObjectNames["Ligands"][ChainID][LigandID][BallAndStickID] = BallAndStickName 1657 PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupMembersID].append(BallAndStickName) 1658 1659 if re.match("^(Pocket|Pocket_Solvent|Pocket_Inorganic)$", GroupType, re.I): 1660 PolarContactsName = "%s.Polar_Contacts" % (GroupName) 1661 PolarContactsID = "%sPolarContacts" % (GroupID) 1662 PyMOLObjectNames["Ligands"][ChainID][LigandID][PolarContactsID] = PolarContactsName 1663 PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupMembersID].append(PolarContactsName) 1664 1665 if re.match("^Pocket_Inorganic$", GroupType, re.I): 1666 PiCationContactsName = "%s.Pi_Cation_Contacts" % (GroupName) 1667 PiCationContactsID = "%sPiCationContacts" % (GroupID) 1668 PyMOLObjectNames["Ligands"][ChainID][LigandID][PiCationContactsID] = PiCationContactsName 1669 PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupMembersID].append(PiCationContactsName) 1670 1671 if re.match("^Pocket$", GroupType, re.I): 1672 HydrophobicContactsName = "%s.Hydrophobic_Contacts" % (GroupName) 1673 HydrophobicContactsID = "%sHydrophobicContacts" % (GroupID) 1674 PyMOLObjectNames["Ligands"][ChainID][LigandID][HydrophobicContactsID] = HydrophobicContactsName 1675 PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupMembersID].append(HydrophobicContactsName) 1676 1677 PiPiContactsName = "%s.Pi_Pi_Contacts" % (GroupName) 1678 PiPiContactsID = "%sPiPiContacts" % (GroupID) 1679 PyMOLObjectNames["Ligands"][ChainID][LigandID][PiPiContactsID] = PiPiContactsName 1680 PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupMembersID].append(PiPiContactsName) 1681 1682 PiCationContactsName = "%s.Pi_Cation_Contacts" % (GroupName) 1683 PiCationContactsID = "%sPiCationContacts" % (GroupID) 1684 PyMOLObjectNames["Ligands"][ChainID][LigandID][PiCationContactsID] = PiCationContactsName 1685 PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupMembersID].append(PiCationContactsName) 1686 1687 PiCationContactsName = "%s.Pi_Cation_Contacts" % (GroupName) 1688 PiCationContactsID = "%sPiCationContacts" % (GroupID) 1689 PyMOLObjectNames["Ligands"][ChainID][LigandID][PiCationContactsID] = PiCationContactsName 1690 PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupMembersID].append(PiCationContactsName) 1691 1692 HalogenContactsName = "%s.Halogen_Contacts" % (GroupName) 1693 HalogenContactsID = "%sHalogenContacts" % (GroupID) 1694 PyMOLObjectNames["Ligands"][ChainID][LigandID][HalogenContactsID] = HalogenContactsName 1695 PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupMembersID].append(HalogenContactsName) 1696 1697 if GetPocketContainsSelectionsStatus(FileIndex, ChainID, LigandID): 1698 # Setup selections group and its subgroups.. 1699 SelectionsGroupName = "%s.Selections" % (GroupName) 1700 SelectionsGroupID = "%sSelectionsGroup" % (GroupID) 1701 SelectionsGroupMembersID = "%sGroupMembers" % (SelectionsGroupID) 1702 1703 PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionsGroupID] = SelectionsGroupName 1704 PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupMembersID].append(SelectionsGroupName) 1705 1706 PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionsGroupMembersID] = [] 1707 1708 # Setup selections name sub group and its members... 1709 for SelectionName in OptionsInfo["PocketChainSelectionsInfo"]["Names"]: 1710 SelectionNameGroupID = SelectionName 1711 1712 SelectionsNameGroupName = "%s.%s" % (SelectionsGroupName, SelectionName) 1713 SelectionsNameGroupID = "%s%sGroup" % (SelectionsGroupID, SelectionNameGroupID) 1714 SelectionsNameGroupMembersID = "%s%sGroupMembers" % (SelectionsGroupID, SelectionNameGroupID) 1715 1716 # Add selections name sub group to selections group... 1717 PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionsNameGroupID] = SelectionsNameGroupName 1718 PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionsGroupMembersID].append(SelectionsNameGroupName) 1719 1720 # Initialize selections names sub group members... 1721 PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionsNameGroupMembersID] = [] 1722 1723 # Add selection member to selections name group... 1724 SubGroupMemberName = "%s.Selection" % (SelectionsNameGroupName) 1725 SubGroupMemberID = "%s%sSelection" % (SelectionsGroupID, SelectionNameGroupID) 1726 1727 PyMOLObjectNames["Ligands"][ChainID][LigandID][SubGroupMemberID] = SubGroupMemberName 1728 PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionsNameGroupMembersID].append(SubGroupMemberName) 1729 1730 if GetPocketSelectionSurfaceChainStatus(FileIndex, ChainID, LigandID): 1731 # Setup a surface sub group and add it to selections name group... 1732 SelectionsNameSurfaceGroupName = "%s.Surface" % (SelectionsNameGroupName) 1733 SelectionsNameSurfaceGroupID = "%s%sSurfaceGroup" % (SelectionsGroupID, SelectionNameGroupID) 1734 1735 # Add selection surface group to selection name group... 1736 PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionsNameSurfaceGroupID] = SelectionsNameSurfaceGroupName 1737 PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionsNameGroupMembersID].append(SelectionsNameSurfaceGroupName) 1738 1739 # Initialize surface names sub group members... 1740 SelectionsNameSurfaceGroupMembersID = "%s%sSurfaceGroupMembers" % (SelectionsGroupID, SelectionNameGroupID) 1741 PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionsNameSurfaceGroupMembersID] = [] 1742 1743 # Setup surfaces... 1744 for MemberType in ["Surface", "Hydrophobicity", "Hydrophobicity_Charge"]: 1745 MemberID = re.sub("_", "", MemberType) 1746 1747 SubGroupMemberName = "%s.%s" % (SelectionsNameSurfaceGroupName, MemberType) 1748 SubGroupMemberID = "%s%s%s%s" % (SelectionsGroupID, SelectionNameGroupID, "Surface", MemberID) 1749 1750 PyMOLObjectNames["Ligands"][ChainID][LigandID][SubGroupMemberID] = SubGroupMemberName 1751 PyMOLObjectNames["Ligands"][ChainID][LigandID][SelectionsNameSurfaceGroupMembersID].append(SubGroupMemberName) 1752 1753 if GetPocketResidueTypesStatus(FileIndex, ChainID, LigandID): 1754 # Setup residue type group and add to pocket group... 1755 ResiduesGroupName = "%s.Residues" % (GroupName) 1756 ResiduesGroupID = "%sResiduesGroup" % (GroupID) 1757 ResiduesGroupMembersID = "%sMembers" % (ResiduesGroupID) 1758 1759 PyMOLObjectNames["Ligands"][ChainID][LigandID][ResiduesGroupID] = ResiduesGroupName 1760 PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupMembersID].append(ResiduesGroupName) 1761 PyMOLObjectNames["Ligands"][ChainID][LigandID][ResiduesGroupMembersID] = [] 1762 1763 # Setup residue group subgroup and its members... 1764 for SubGroupType in ["Aromatic", "Hydrophobic", "Polar", "Positively_Charged", "Negatively_Charged", "Other"]: 1765 SubGroupID = re.sub("_", "", SubGroupType) 1766 ResiduesSubGroupName = "%s.%s" % (ResiduesGroupName, SubGroupType) 1767 ResiduesSubGroupID = "%s%sGroup" % (ResiduesGroupID, SubGroupID) 1768 ResiduesSubMembersGroupID = "%sMembers" % (ResiduesSubGroupID) 1769 1770 # Add sub group to residues group... 1771 PyMOLObjectNames["Ligands"][ChainID][LigandID][ResiduesSubGroupID] = ResiduesSubGroupName 1772 PyMOLObjectNames["Ligands"][ChainID][LigandID][ResiduesGroupMembersID].append(ResiduesSubGroupName) 1773 PyMOLObjectNames["Ligands"][ChainID][LigandID][ResiduesSubMembersGroupID] = [] 1774 1775 # Add sub group members to subgroup... 1776 for MemberType in ["Residues", "Surface"]: 1777 MemberID = re.sub("_", "", MemberType) 1778 SubGroupMemberName = "%s.%s" % (ResiduesSubGroupName, MemberType) 1779 SubGroupMemberID = "%s%s" % (ResiduesSubGroupID, MemberID) 1780 1781 PyMOLObjectNames["Ligands"][ChainID][LigandID][SubGroupMemberID] = SubGroupMemberName 1782 PyMOLObjectNames["Ligands"][ChainID][LigandID][ResiduesSubMembersGroupID].append(SubGroupMemberName) 1783 1784 if GetPocketContainsSurfaceStatus(FileIndex, ChainID, LigandID): 1785 # Setup a surfaces group and add it to pocket group... 1786 SurfacesGroupName = "%s.Surfaces" % (GroupName) 1787 SurfacesGroupID = "%sSurfacesGroup" % (GroupID) 1788 SurfacesGroupMembersID = "%sMembers" % (SurfacesGroupID) 1789 1790 PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfacesGroupID] = SurfacesGroupName 1791 PyMOLObjectNames["Ligands"][ChainID][LigandID][GroupMembersID].append(SurfacesGroupName) 1792 PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfacesGroupMembersID] = [] 1793 1794 # Setup surfaces subgroup and its members... 1795 for SubGroupType in ["Surface", "Cavity"]: 1796 SubGroupID = re.sub("_", "", SubGroupType) 1797 SurfacesSubGroupName = "%s.%s" % (SurfacesGroupName, SubGroupType) 1798 SurfacesSubGroupID = "%s%sGroup" % (SurfacesGroupID, SubGroupID) 1799 SurfacesSubGroupMembersID = "%sMembers" % (SurfacesSubGroupID) 1800 1801 # Add sub group to surfaces group... 1802 PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfacesSubGroupID] = SurfacesSubGroupName 1803 PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfacesGroupMembersID].append(SurfacesSubGroupName) 1804 PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfacesSubGroupMembersID] = [] 1805 1806 # Setup a generic color surface... 1807 SurfaceName = "%s.Surface" % (SurfacesSubGroupName) 1808 SurfaceID = "%sSurface" % (SurfacesSubGroupID) 1809 PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfaceID] = SurfaceName 1810 PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfacesSubGroupMembersID].append(SurfaceName) 1811 1812 if GetPocketSurfaceChainStatus(FileIndex, ChainID, LigandID): 1813 # Surface colored by hydrophobicity... 1814 HydrophobicSurfaceName = "%s.Hydrophobicity" % (SurfacesSubGroupName) 1815 HydrophobicSurfaceID = "%sHydrophobicSurface" % (SurfacesSubGroupID) 1816 PyMOLObjectNames["Ligands"][ChainID][LigandID][HydrophobicSurfaceID] = HydrophobicSurfaceName 1817 PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfacesSubGroupMembersID].append(HydrophobicSurfaceName) 1818 1819 # Surface colored by hydrophobicity and charge... 1820 HydrophobicChargeSurfaceName = "%s.Hydrophobicity_Charge" % (SurfacesSubGroupName) 1821 HydrophobicChargeSurfaceID = "%sHydrophobicChargeSurface" % (SurfacesSubGroupID) 1822 PyMOLObjectNames["Ligands"][ChainID][LigandID][HydrophobicChargeSurfaceID] = HydrophobicChargeSurfaceName 1823 PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfacesSubGroupMembersID].append(HydrophobicChargeSurfaceName) 1824 1825 if GetPocketSurfaceChainElectrostaticsStatus(FileIndex, ChainID, LigandID): 1826 ElectrostaticsGroupName = "%s.Vacuum_Electrostatics" % (SurfacesSubGroupName) 1827 ElectrostaticsGroupID = "%sElectrostaticsGroup" % (SurfacesSubGroupID) 1828 ElectrostaticsGroupMembersID = "%sElectrostaticsGroupMembers" % (SurfacesSubGroupID) 1829 1830 PyMOLObjectNames["Ligands"][ChainID][LigandID][ElectrostaticsGroupID] = ElectrostaticsGroupName 1831 PyMOLObjectNames["Ligands"][ChainID][LigandID][SurfacesSubGroupMembersID].append(ElectrostaticsGroupName) 1832 1833 # Setup electrostatics group members without the volume object... 1834 PyMOLObjectNames["Ligands"][ChainID][LigandID][ElectrostaticsGroupMembersID] = [] 1835 1836 for MemberType in ["Pocket", "Contact_Potential", "Map", "Legend"]: 1837 MemberID = re.sub("_", "", MemberType) 1838 1839 Name = "%s.%s" % (ElectrostaticsGroupName, MemberType) 1840 NameID = "%s%s" % (ElectrostaticsGroupID, MemberID) 1841 1842 PyMOLObjectNames["Ligands"][ChainID][LigandID][NameID] = Name 1843 PyMOLObjectNames["Ligands"][ChainID][LigandID][ElectrostaticsGroupMembersID].append(Name) 1844 1845 def SetupPyMOLObjectNamesForDockedPoses(FileIndex, PyMOLObjectNames, ChainID): 1846 """Stetup groups and objects for docked poses in input files for a chain.""" 1847 1848 PyMOLObjectNames["DockedPosesInputFile"][ChainID] = {} 1849 1850 if not GetChainAloneDockedPosesStatus(FileIndex, ChainID): 1851 return 1852 1853 # Setup group for docked poses... 1854 if "DockedPosesGroup" not in PyMOLObjectNames["Chains"][ChainID]: 1855 # Setup docked poses group at a chain level... 1856 ChainGroupName = PyMOLObjectNames["Chains"][ChainID]["ChainGroup"] 1857 DockedPosesGroupName = "%s.%s" % (ChainGroupName, OptionsInfo["DockedPosesGroupName"]) 1858 1859 PyMOLObjectNames["Chains"][ChainID]["DockedPosesGroup"] = DockedPosesGroupName 1860 PyMOLObjectNames["Chains"][ChainID]["ChainGroupMembers"].append(DockedPosesGroupName) 1861 PyMOLObjectNames["Chains"][ChainID]["DockedPosesGroupMembers"] = [] 1862 1863 SpecifiedChainsAndLigandsInfo = OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex] 1864 for InputFileIndex, InputFile in enumerate(SpecifiedChainsAndLigandsInfo["DockedPosesInputFiles"][ChainID]): 1865 SetupPyMOLObjectNamesForDockedPosesInputFile(FileIndex, PyMOLObjectNames, ChainID, InputFileIndex) 1866 1867 def SetupPyMOLObjectNamesForDockedPosesInputFile(PDBFileIndex, PyMOLObjectNames, ChainID, InputFileIndex): 1868 """Stetup groups and objects for docked poses in an input file for a chain.""" 1869 1870 DockedPosesInfo = OptionsInfo["DockedPosesInfo"] 1871 DockedPosesDistanceContactsInfo = OptionsInfo["DockedPosesDistanceContactsInfo"] 1872 1873 InputFileID = DockedPosesInfo["InputFilesIDs"][PDBFileIndex][InputFileIndex] 1874 1875 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID] = {} 1876 1877 DockedPosesGroupName = PyMOLObjectNames["Chains"][ChainID]["DockedPosesGroup"] 1878 1879 # Setup a docked poses level InputFile group... 1880 DockedPosesInputFileGroupName = "%s.%s" % (DockedPosesGroupName, InputFileID) 1881 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID]["DockedPosesGroupName"] = DockedPosesInputFileGroupName 1882 PyMOLObjectNames["Chains"][ChainID]["DockedPosesGroupMembers"].append(DockedPosesInputFileGroupName) 1883 1884 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID]["DockedPosesGroupMembers"] = [] 1885 1886 # Setup objects for docked poses... 1887 PosesName = "%s.%s" % (DockedPosesInputFileGroupName, OptionsInfo["DockedPosesName"]) 1888 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID]["Poses"] = PosesName 1889 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID]["DockedPosesGroupMembers"].append(PosesName) 1890 1891 for GroupType in ["Pocket", "Pocket_Solvent", "Pocket_Inorganic"]: 1892 GroupID = re.sub("_", "", GroupType) 1893 GroupName = "%s.%s" % (DockedPosesInputFileGroupName, GroupType) 1894 1895 GroupNameID = "%sGroup" % (GroupID) 1896 GroupMembersID = "%sGroupMembers" % (GroupID) 1897 1898 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][GroupNameID] = GroupName 1899 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID]["DockedPosesGroupMembers"].append(GroupName) 1900 1901 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][GroupMembersID] = [] 1902 1903 PocketID = "%sPocket" % GroupID 1904 PocketName = "%s.Pocket" % GroupName 1905 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][PocketID] = PocketName 1906 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][GroupMembersID].append(PocketName) 1907 1908 if DockedPosesInfo["DistanceContacts"] and re.match("^Pocket$", GroupType, re.I): 1909 # Setup distance contacts group and add it to pocket group... 1910 DistanceContactGroupName = "%s.Distance_Contacts" % GroupName 1911 1912 DistanceContactGroupNameID = "%sDistanceContactsGroup" % GroupID 1913 DistanceContactGroupMembersID = "%sDistanceContactsGroupMembers" % GroupID 1914 1915 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][DistanceContactGroupNameID] = DistanceContactGroupName 1916 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][GroupMembersID].append(DistanceContactGroupName) 1917 1918 # Setup distance contacts group members... 1919 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][DistanceContactGroupMembersID] = [] 1920 1921 for ContactID in DockedPosesDistanceContactsInfo["ContactIDs"]: 1922 DistanceContactID = "%sPocketDistanceContacts%s" % (GroupID, ContactID) 1923 DistanceContactName = "%s.Distance_Contacts.%s" % (GroupName, ContactID) 1924 1925 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][DistanceContactID] = DistanceContactName 1926 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][DistanceContactGroupMembersID].append(DistanceContactName) 1927 1928 PolarContactsID = "%sPolarContacts" % GroupID 1929 PolarContactsName = "%s.Polar_Contacts" % GroupName 1930 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][PolarContactsID] = PolarContactsName 1931 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][GroupMembersID].append(PolarContactsName) 1932 1933 if re.match("^Pocket_Inorganic$", GroupType, re.I): 1934 PiCationContactsID = "%sPiCationContacts" % GroupID 1935 PiCationContactsName = "%s.Pi_Cation_Contacts" % GroupName 1936 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][PiCationContactsID] = PiCationContactsName 1937 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][GroupMembersID].append(PiCationContactsName) 1938 1939 if re.match("^Pocket$", GroupType, re.I): 1940 HydrophobicContactsID = "%sHydrophobicContacts" % GroupID 1941 HydrophobicContactsName = "%s.Hydrophobic_Contacts" % GroupName 1942 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][HydrophobicContactsID] = HydrophobicContactsName 1943 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][GroupMembersID].append(HydrophobicContactsName) 1944 1945 PiPiContactsID = "%sPiPiContacts" % GroupID 1946 PiPiContactsName = "%s.Pi_Pi_Contacts" % GroupName 1947 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][PiPiContactsID] = PiPiContactsName 1948 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][GroupMembersID].append(PiPiContactsName) 1949 1950 PiCationContactsID = "%sPiCationContacts" % GroupID 1951 PiCationContactsName = "%s.Pi_Cation_Contacts" % GroupName 1952 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][PiCationContactsID] = PiCationContactsName 1953 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][GroupMembersID].append(PiCationContactsName) 1954 1955 HalogenContactsID = "%sHalogenContacts" % GroupID 1956 HalogenContactsName = "%s.Halogen_Contacts" % GroupName 1957 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][HalogenContactsID] = HalogenContactsName 1958 PyMOLObjectNames["DockedPosesInputFile"][ChainID][InputFileID][GroupMembersID].append(HalogenContactsName) 1959 1960 def RetrieveInfilesInfo(): 1961 """Retrieve information for input files.""" 1962 1963 InfilesInfo = {} 1964 1965 InfilesInfo["InfilesNames"] = [] 1966 InfilesInfo["InfilesRoots"] = [] 1967 InfilesInfo["ChainsAndLigandsInfo"] = [] 1968 1969 for Infile in OptionsInfo["InfilesNames"]: 1970 FileDir, FileName, FileExt = MiscUtil.ParseFileName(Infile) 1971 InfileRoot = FileName 1972 1973 ChainsAndLigandInfo = PyMOLUtil.GetChainsAndLigandsInfo(Infile, InfileRoot) 1974 1975 InfilesInfo["InfilesNames"].append(Infile) 1976 InfilesInfo["InfilesRoots"].append(InfileRoot) 1977 InfilesInfo["ChainsAndLigandsInfo"].append(ChainsAndLigandInfo) 1978 1979 OptionsInfo["InfilesInfo"] = InfilesInfo 1980 1981 def RetrieveRefFileInfo(): 1982 """Retrieve information for ref file.""" 1983 1984 RefFileInfo = {} 1985 if not OptionsInfo["Align"]: 1986 OptionsInfo["RefFileInfo"] = RefFileInfo 1987 return 1988 1989 RefFile = OptionsInfo["RefFileName"] 1990 1991 FileDir, FileName, FileExt = MiscUtil.ParseFileName(RefFile) 1992 RefFileRoot = FileName 1993 1994 if re.match("^FirstInputFile$", OptionsInfo["AlignRefFile"], re.I): 1995 ChainsAndLigandInfo = OptionsInfo["InfilesInfo"]["ChainsAndLigandsInfo"][0] 1996 else: 1997 MiscUtil.PrintInfo("\nRetrieving chain and ligand information for alignment reference file %s..." % RefFile) 1998 ChainsAndLigandInfo = PyMOLUtil.GetChainsAndLigandsInfo(RefFile, RefFileRoot) 1999 2000 RefFileInfo["RefFileName"] = RefFile 2001 RefFileInfo["RefFileRoot"] = RefFileRoot 2002 RefFileInfo["PyMOLObjectName"] = "AlignRef_%s" % RefFileRoot 2003 RefFileInfo["ChainsAndLigandsInfo"] = ChainsAndLigandInfo 2004 2005 OptionsInfo["RefFileInfo"] = RefFileInfo 2006 2007 def ProcessChainAndLigandIDs(): 2008 """Process specified chain and ligand IDs for infiles.""" 2009 2010 OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"] = [] 2011 2012 for FileIndex in range(0, len(OptionsInfo["InfilesInfo"]["InfilesNames"])): 2013 MiscUtil.PrintInfo("\nProcessing specified chain and ligand IDs for input file %s..." % OptionsInfo["InfilesInfo"]["InfilesNames"][FileIndex]) 2014 2015 ChainsAndLigandsInfo = OptionsInfo["InfilesInfo"]["ChainsAndLigandsInfo"][FileIndex] 2016 SpecifiedChainsAndLigandsInfo = PyMOLUtil.ProcessChainsAndLigandsOptionsInfo(ChainsAndLigandsInfo, "-c, --chainIDs", OptionsInfo["ChainIDs"], "-l, --ligandIDs", OptionsInfo["LigandIDs"]) 2017 ProcessResidueTypesAndSurfaceAndChainSelectionsOptions(FileIndex, SpecifiedChainsAndLigandsInfo) 2018 2019 OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"].append(SpecifiedChainsAndLigandsInfo) 2020 2021 CheckPresenceOfValidLigandIDs(ChainsAndLigandsInfo, SpecifiedChainsAndLigandsInfo) 2022 2023 def ProcessResidueTypesAndSurfaceAndChainSelectionsOptions(FileIndex, SpecifiedChainsAndLigandsInfo): 2024 """Process residue types, surface, and chian selections options for chains and pockets.""" 2025 2026 SpecifiedChainsAndLigandsInfo["ChainSurfaces"] = {} 2027 SpecifiedChainsAndLigandsInfo["SurfaceChain"] = {} 2028 SpecifiedChainsAndLigandsInfo["SurfaceChainElectrostatics"] = {} 2029 2030 SpecifiedChainsAndLigandsInfo["PocketChainSelections"] = {} 2031 SpecifiedChainsAndLigandsInfo["PocketChainSelectionsSurfaces"] = {} 2032 SpecifiedChainsAndLigandsInfo["SurfacePocketChainSelections"] = {} 2033 2034 SpecifiedChainsAndLigandsInfo["PocketSurfaces"] = {} 2035 SpecifiedChainsAndLigandsInfo["SurfacePocket"] = {} 2036 SpecifiedChainsAndLigandsInfo["SurfacePocketElectrostatics"] = {} 2037 2038 SpecifiedChainsAndLigandsInfo["ResidueTypesChain"] = {} 2039 SpecifiedChainsAndLigandsInfo["ResidueTypesPocket"] = {} 2040 2041 SpecifiedChainsAndLigandsInfo["ChainSelections"] = {} 2042 SpecifiedChainsAndLigandsInfo["ChainSelectionsSurfaces"] = {} 2043 SpecifiedChainsAndLigandsInfo["SurfaceChainSelections"] = {} 2044 2045 SpecifiedChainsAndLigandsInfo["DisulfideBondsChain"] = {} 2046 SpecifiedChainsAndLigandsInfo["SaltBridgesChain"] = {} 2047 2048 SpecifiedChainsAndLigandsInfo["BFactorChain"] = {} 2049 2050 # Load infile... 2051 Infile = OptionsInfo["InfilesInfo"]["InfilesNames"][FileIndex] 2052 MolName = OptionsInfo["InfilesInfo"]["InfilesRoots"][FileIndex] 2053 pymol.cmd.load(Infile, MolName) 2054 2055 for ChainID in SpecifiedChainsAndLigandsInfo["ChainIDs"]: 2056 AminoAcidsPresent = PyMOLUtil.AreAminoAcidResiduesPresent(MolName, ChainID) 2057 2058 # Process BFactors for chains... 2059 BFactorChain = True if re.match("^yes$", OptionsInfo["BFactorChain"], re.I) else False 2060 SpecifiedChainsAndLigandsInfo["BFactorChain"][ChainID] = BFactorChain 2061 2062 # Process surfaces for chains... 2063 if re.match("^auto$", OptionsInfo["SurfaceChain"], re.I): 2064 SurfaceChain = True if AminoAcidsPresent else False 2065 else: 2066 SurfaceChain = True if re.match("^yes$", OptionsInfo["SurfaceChain"], re.I) else False 2067 SpecifiedChainsAndLigandsInfo["SurfaceChain"][ChainID] = SurfaceChain 2068 2069 if re.match("^auto$", OptionsInfo["SurfaceChainElectrostatics"], re.I): 2070 SurfaceChainElectrostatics = True if AminoAcidsPresent else False 2071 else: 2072 SurfaceChainElectrostatics = True if re.match("^yes$", OptionsInfo["SurfaceChainElectrostatics"], re.I) else False 2073 SpecifiedChainsAndLigandsInfo["SurfaceChainElectrostatics"][ChainID] = SurfaceChainElectrostatics 2074 2075 SpecifiedChainsAndLigandsInfo["ChainSurfaces"][ChainID] = SurfaceChain 2076 2077 # Process disulfide bonds for chains... 2078 if re.match("^auto$", OptionsInfo["DisulfideBondsChain"], re.I): 2079 DisulfideBondsChain = True if AminoAcidsPresent else False 2080 else: 2081 DisulfideBondsChain = True if re.match("^yes$", OptionsInfo["DisulfideBondsChain"], re.I) else False 2082 SpecifiedChainsAndLigandsInfo["DisulfideBondsChain"][ChainID] = DisulfideBondsChain 2083 2084 # Process salt bridges bonds for chains... 2085 if re.match("^auto$", OptionsInfo["SaltBridgesChain"], re.I): 2086 SaltBridgesChain = True if AminoAcidsPresent else False 2087 else: 2088 SaltBridgesChain = True if re.match("^yes$", OptionsInfo["SaltBridgesChain"], re.I) else False 2089 SpecifiedChainsAndLigandsInfo["SaltBridgesChain"][ChainID] = SaltBridgesChain 2090 2091 # Process residue types for chains... 2092 if re.match("^auto$", OptionsInfo["ResidueTypesChain"], re.I): 2093 ResidueTypesChain = True if AminoAcidsPresent else False 2094 else: 2095 ResidueTypesChain = True if re.match("^yes$", OptionsInfo["ResidueTypesChain"], re.I) else False 2096 SpecifiedChainsAndLigandsInfo["ResidueTypesChain"][ChainID] = ResidueTypesChain 2097 2098 # Process chain selections... 2099 ChainSelections = True if len(OptionsInfo["ChainSelectionsInfo"]["Names"]) else False 2100 SpecifiedChainsAndLigandsInfo["ChainSelections"][ChainID] = ChainSelections 2101 2102 # Process surfaces for chain selections... 2103 if re.match("^auto$", OptionsInfo["SelectionsChainSurface"], re.I): 2104 SurfaceChainSelections = True if AminoAcidsPresent else False 2105 else: 2106 SurfaceChainSelections = True if re.match("^yes$", OptionsInfo["SelectionsChainSurface"], re.I) else False 2107 SpecifiedChainsAndLigandsInfo["SurfaceChainSelections"][ChainID] = SurfaceChainSelections 2108 2109 SpecifiedChainsAndLigandsInfo["ChainSelectionsSurfaces"][ChainID] = SurfaceChainSelections 2110 2111 # Process selections, residue types and surfaces for pockets... 2112 SpecifiedChainsAndLigandsInfo["PocketChainSelections"][ChainID] = {} 2113 SpecifiedChainsAndLigandsInfo["PocketChainSelectionsSurfaces"][ChainID] = {} 2114 SpecifiedChainsAndLigandsInfo["SurfacePocketChainSelections"][ChainID] = {} 2115 2116 SpecifiedChainsAndLigandsInfo["PocketSurfaces"][ChainID] = {} 2117 SpecifiedChainsAndLigandsInfo["SurfacePocket"][ChainID] = {} 2118 SpecifiedChainsAndLigandsInfo["SurfacePocketElectrostatics"][ChainID] = {} 2119 2120 SpecifiedChainsAndLigandsInfo["ResidueTypesPocket"][ChainID] = {} 2121 2122 for LigandID in SpecifiedChainsAndLigandsInfo["LigandIDs"][ChainID]: 2123 #Process pocket chain selections and surfaces... 2124 PocketChainSelections = True if len(OptionsInfo["PocketChainSelectionsInfo"]["Names"]) else False 2125 SpecifiedChainsAndLigandsInfo["PocketChainSelections"][ChainID][LigandID] = PocketChainSelections 2126 2127 # Process surfaces for chain selections... 2128 if re.match("^auto$", OptionsInfo["SelectionsPocketSurface"], re.I): 2129 PocketChainSelectionsSurface = True if AminoAcidsPresent else False 2130 else: 2131 PocketChainSelectionsSurface = True if re.match("^yes$", OptionsInfo["SelectionsPocketSurface"], re.I) else False 2132 2133 SpecifiedChainsAndLigandsInfo["PocketChainSelectionsSurfaces"][ChainID][LigandID] = PocketChainSelectionsSurface 2134 2135 SpecifiedChainsAndLigandsInfo["SurfacePocketChainSelections"][ChainID][LigandID] = PocketChainSelectionsSurface 2136 2137 #Process pocket surfaces... 2138 if re.match("^auto$", OptionsInfo["PocketSurface"], re.I): 2139 PocketSurface = True if AminoAcidsPresent else False 2140 else: 2141 PocketSurface = True if re.match("^yes$", OptionsInfo["PocketSurface"], re.I) else False 2142 SpecifiedChainsAndLigandsInfo["SurfacePocket"][ChainID][LigandID] = PocketSurface 2143 2144 if re.match("^auto$", OptionsInfo["PocketSurfaceElectrostatics"], re.I): 2145 PocketSurfaceElectrostatics = True if AminoAcidsPresent else False 2146 else: 2147 PocketSurfaceElectrostatics = True if re.match("^yes$", OptionsInfo["PocketSurfaceElectrostatics"], re.I) else False 2148 SpecifiedChainsAndLigandsInfo["SurfacePocketElectrostatics"][ChainID][LigandID] = PocketSurfaceElectrostatics 2149 2150 #Process pocket residue types... 2151 SpecifiedChainsAndLigandsInfo["PocketSurfaces"][ChainID][LigandID] = PocketSurface 2152 2153 if re.match("^auto$", OptionsInfo["PocketResidueTypes"], re.I): 2154 PocketResidueTypes = True if AminoAcidsPresent else False 2155 else: 2156 PocketResidueTypes = True if re.match("^yes$", OptionsInfo["PocketResidueTypes"], re.I) else False 2157 SpecifiedChainsAndLigandsInfo["ResidueTypesPocket"][ChainID][LigandID] = PocketResidueTypes 2158 2159 # Delete loaded object... 2160 pymol.cmd.delete(MolName) 2161 2162 def GetChainAloneResidueTypesStatus(FileIndex, ChainID): 2163 """Get status of residue types for chain alone object.""" 2164 2165 Status = OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["ResidueTypesChain"][ChainID] 2166 2167 return Status 2168 2169 def GetChainAloneBFactorStatus(FileIndex, ChainID): 2170 """Get status of B factors for chain alone object.""" 2171 2172 Status = OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["BFactorChain"][ChainID] 2173 2174 return Status 2175 2176 def GetChainAloneDisulfideBondsStatus(FileIndex, ChainID): 2177 """Get status of disulfide bonds for chain alone object.""" 2178 2179 Status = OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["DisulfideBondsChain"][ChainID] 2180 2181 return Status 2182 2183 def GetChainAloneSaltBridgesStatus(FileIndex, ChainID): 2184 """Get status of salt bridges for chain alone object.""" 2185 2186 Status = OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["SaltBridgesChain"][ChainID] 2187 2188 return Status 2189 2190 def GetChainAloneDockedPosesStatus(FileIndex, ChainID): 2191 """Get status of docked for chain alone object.""" 2192 2193 Status = OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["DockedPoses"][ChainID] 2194 2195 return Status 2196 2197 def GetTrajectoriesStatus(FileIndex): 2198 """Get status of trajectories for a PDB object.""" 2199 2200 if OptionsInfo["TrajectoriesInfo"] is None: 2201 return False 2202 2203 Status = True if FileIndex in OptionsInfo["TrajectoriesInfo"]["PDBFileIndices"] else False 2204 2205 return Status 2206 2207 def GetPocketResidueTypesStatus(FileIndex, ChainID, LigandID): 2208 """Get status of residue types for a pocket.""" 2209 2210 return OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["ResidueTypesPocket"][ChainID][LigandID] 2211 2212 def GetChainAloneContainsSurfacesStatus(FileIndex, ChainID): 2213 """Get status of surfaces present in chain alone object.""" 2214 2215 return OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["ChainSurfaces"][ChainID] 2216 2217 def GetPocketContainsSelectionsStatus(FileIndex, ChainID, LigandID): 2218 """Get status of selections present in a pocket.""" 2219 2220 return OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["PocketChainSelections"][ChainID][LigandID] 2221 2222 def GetPocketContainsSurfaceStatus(FileIndex, ChainID, LigandID): 2223 """Get status of surfaces present in a pocket.""" 2224 2225 return OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["PocketSurfaces"][ChainID][LigandID] 2226 2227 def GetChainAloneSurfaceChainStatus(FileIndex, ChainID): 2228 """Get status of hydrophobic surfaces for chain alone object.""" 2229 2230 return OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["SurfaceChain"][ChainID] 2231 2232 def GetChainAloneSurfaceChainElectrostaticsStatus(FileIndex, ChainID): 2233 """Get status of electrostatics surfaces for chain alone object.""" 2234 2235 return OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["SurfaceChainElectrostatics"][ChainID] 2236 2237 def GetPocketSelectionSurfaceChainStatus(FileIndex, ChainID, LigandID): 2238 """Get status of surfaces for a pocket selection in a chain.""" 2239 2240 return OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["SurfacePocketChainSelections"][ChainID][LigandID] 2241 2242 def GetPocketSurfaceChainStatus(FileIndex, ChainID, LigandID): 2243 """Get status of hydrophobic surfaces for a pocket.""" 2244 2245 return OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["SurfacePocket"][ChainID][LigandID] 2246 2247 def GetPocketSurfaceChainElectrostaticsStatus(FileIndex, ChainID, LigandID): 2248 """Get status of hydrophobic surfaces for a pocket.""" 2249 2250 return OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["SurfacePocketElectrostatics"][ChainID][LigandID] 2251 2252 def GetChainAloneContainsSelectionsStatus(FileIndex, ChainID): 2253 """Get status of selections present in chain alone object.""" 2254 return OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["ChainSelections"][ChainID] 2255 2256 def GetChainAloneContainsChainSelectionSurfacesStatus(FileIndex, ChainID): 2257 """Get status of chain selections surfaces present in chain alone object.""" 2258 return OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["ChainSelectionsSurfaces"][ChainID] 2259 2260 def GetChainAloneSurfaceChainSelectionStatus(FileIndex, ChainID): 2261 """Get status of hydrophobic surfaces for chain alone object.""" 2262 return OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex]["SurfaceChainSelections"][ChainID] 2263 2264 def CheckPresenceOfValidLigandIDs(ChainsAndLigandsInfo, SpecifiedChainsAndLigandsInfo): 2265 """Check presence of valid ligand IDs.""" 2266 2267 MiscUtil.PrintInfo("\nSpecified chain IDs: %s" % (", ".join(SpecifiedChainsAndLigandsInfo["ChainIDs"]))) 2268 2269 for ChainID in SpecifiedChainsAndLigandsInfo["ChainIDs"]: 2270 if len (SpecifiedChainsAndLigandsInfo["LigandIDs"][ChainID]): 2271 MiscUtil.PrintInfo("Chain ID: %s; Specified LigandIDs: %s" % (ChainID, ", ".join(SpecifiedChainsAndLigandsInfo["LigandIDs"][ChainID]))) 2272 else: 2273 MiscUtil.PrintInfo("Chain IDs: %s; Specified LigandIDs: None" % (ChainID)) 2274 MiscUtil.PrintWarning("No valid ligand IDs found for chain ID, %s. PyMOL groups and objects related to ligand and binding pockect won't be created." % (ChainID)) 2275 2276 def RetrieveFirstChainID(FileIndex): 2277 """Get first chain ID.""" 2278 2279 ChainsAndLigandsInfo = OptionsInfo["InfilesInfo"]["ChainsAndLigandsInfo"][FileIndex] 2280 2281 FirstChainID = None 2282 if len(ChainsAndLigandsInfo["ChainIDs"]): 2283 FirstChainID = ChainsAndLigandsInfo["ChainIDs"][0] 2284 2285 return FirstChainID 2286 2287 def ProcessDockedPoses(): 2288 """Process docked poses.""" 2289 2290 OptionsInfo["DockedPosesGroupName"] = Options["--dockedPosesGroupName"] 2291 OptionsInfo["DockedPosesName"] = Options["--dockedPosesName"] 2292 2293 DockedPosesInfo = ProcessDockedPosesOptionsInfo("--dockedPoses", OptionsInfo["DockedPoses"]) 2294 OptionsInfo["DockedPosesInfo"] = DockedPosesInfo 2295 2296 ProcessDockedPosesInfoForInfiles() 2297 2298 OptionsInfo["DockedPosesDistanceContactsCutoffs"] = Options["--dockedPosesDistanceContactsCutoffs"] 2299 OptionsInfo["DockedPosesDistanceContactsColor"] = Options["--dockedPosesDistanceContactsColor"] 2300 2301 DockedPosesDistanceContactsInfo = ProcessDockedPosesDistanceContactsOptionsInfo() 2302 OptionsInfo["DockedPosesDistanceContactsInfo"] = DockedPosesDistanceContactsInfo 2303 2304 # Setup distance conatcts status for dockes poses... 2305 if DockedPosesInfo is not None: 2306 DockedPosesInfo["DistanceContacts"] = False 2307 if DockedPosesDistanceContactsInfo is not None: 2308 if len(DockedPosesDistanceContactsInfo["ContactIDs"]): 2309 DockedPosesInfo["DistanceContacts"] = True 2310 2311 def ProcessDockedPosesInfoForInfiles(): 2312 """Process docked poses info for infiles.""" 2313 2314 DockedPosesInfo = OptionsInfo["DockedPosesInfo"] 2315 for FileIndex in range(0, len(OptionsInfo["InfilesInfo"]["InfilesNames"])): 2316 SpecifiedChainsAndLigandsInfo = OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][FileIndex] 2317 ProcessDockedPosesInfoForInfileAndChains(FileIndex, SpecifiedChainsAndLigandsInfo, DockedPosesInfo) 2318 2319 def ProcessDockedPosesInfoForInfileAndChains(FileIndex, SpecifiedChainsAndLigandsInfo, DockedPosesInfo): 2320 """Process docked poses info for a specific infile.""" 2321 2322 SpecifiedChainsAndLigandsInfo["DockedPoses"] = {} 2323 SpecifiedChainsAndLigandsInfo["DockedPosesInputFiles"] = {} 2324 2325 for ChainID in SpecifiedChainsAndLigandsInfo["ChainIDs"]: 2326 DockedPoses = False 2327 if DockedPosesInfo is not None: 2328 if FileIndex in DockedPosesInfo["PDBFileIndices"]: 2329 if ChainID == DockedPosesInfo['ChainID'][FileIndex]: 2330 DockedPoses = True 2331 2332 SpecifiedChainsAndLigandsInfo["DockedPoses"][ChainID] = DockedPoses 2333 2334 SpecifiedChainsAndLigandsInfo["DockedPosesInputFiles"][ChainID] = [] 2335 if DockedPoses: 2336 SpecifiedChainsAndLigandsInfo["DockedPosesInputFiles"][ChainID].extend(DockedPosesInfo['InputFiles'][FileIndex]) 2337 2338 def ProcessDockedPosesOptionsInfo(DockedPosesOptionName, DockedPosesOptionValue): 2339 """Process docked poses options info.""" 2340 2341 DockedPoses = DockedPosesOptionValue 2342 if re.match("^none$", DockedPoses, re.I): 2343 return None 2344 2345 MiscUtil.PrintInfo("\nProcessing docked poses...") 2346 2347 # Initialize docked poses info... 2348 DockedPosesInfo = {} 2349 DockedPosesInfo["PDBFileIndices"] = [] 2350 2351 DockedPosesInfo["PDBFile"] = {} 2352 DockedPosesInfo["ChainID"] = {} 2353 DockedPosesInfo["LigandID"] = {} 2354 DockedPosesInfo["UseInputFileAsLigandID"] = {} 2355 DockedPosesInfo["InputFiles"] = {} 2356 DockedPosesInfo["InputFilesRoots"] = {} 2357 DockedPosesInfo["InputFilesIDs"] = {} 2358 2359 # Parse docked poses values... 2360 DockedPosesWords = DockedPoses.split(",") 2361 if len(DockedPosesWords) % 4: 2362 MiscUtil.PrintError("The number of comma delimited docked poses values, %d, specified using \"%s\" option must be a multple of 4." % (len(DockedPosesWords), DockedPosesOptionName)) 2363 2364 # Validate and process specified values... 2365 for Index in range(0, len(DockedPosesWords), 4): 2366 PDBFile = DockedPosesWords[Index].strip() 2367 ChainID = DockedPosesWords[Index + 1].strip() 2368 LigandID = DockedPosesWords[Index + 2].strip() 2369 InputFiles = DockedPosesWords[Index + 3].strip() 2370 2371 InputFiles = re.sub("[ ]+", " ", InputFiles) 2372 InputFiles = InputFiles.split(" ") 2373 2374 # Process PDB file... 2375 MiscUtil.ValidateOptionFilePath("--dockedPoses", PDBFile) 2376 2377 PDBFileIndex = None 2378 for FileIndex in range(0, len(OptionsInfo["InfilesInfo"]["InfilesNames"])): 2379 PDBInfile = OptionsInfo["InfilesInfo"]["InfilesNames"][FileIndex] 2380 if PDBFile == PDBInfile: 2381 PDBFileIndex = FileIndex 2382 break 2383 if PDBFileIndex is None: 2384 MiscUtil.PrintError("The PDB file specified, %s, using option \"--dockedPoses\" is not valid. It must be specified as an input file." % (PDBFile)) 2385 2386 if PDBFileIndex in DockedPosesInfo['PDBFileIndices']: 2387 MiscUtil.PrintError("The PDB file specified, %s, using option \"--dockedPoses\" is not valid. It is a duplicate and has already been specified." % (PDBFile)) 2388 2389 # Process chain ID... 2390 SpecifiedChainsAndLigandsInfo = OptionsInfo["InfilesInfo"]["SpecifiedChainsAndLigandsInfo"][PDBFileIndex] 2391 if ChainID not in SpecifiedChainsAndLigandsInfo["ChainIDs"]: 2392 MiscUtil.PrintError("The chain ID, %s, specified for PDB file, %s, using option \"--dockedPoses\" is not valid. It must be present in valid chain IDs corresponding to option \"-c, --chainIDs\" ." % (ChainID, PDBFile)) 2393 2394 # Process ligand ID... 2395 UseInputFileAsLigandID = True if re.match("^UseInputFile$", LigandID, re.I) else False 2396 if not UseInputFileAsLigandID: 2397 if LigandID not in SpecifiedChainsAndLigandsInfo["LigandIDs"][ChainID]: 2398 MiscUtil.PrintError("The ligand ID, %s, specified for chain ID, %s, and PDB file, %s, using option \"--dockedPoses\" is not valid. It must be present in valid ligand IDs corresponding to option \"-l, --ligandIDs\" ." % (LigandID, ChainID, PDBFile)) 2399 2400 # Process input files... 2401 InputFilesRoots = [] 2402 InputFilesIDs = [] 2403 for InputFile in InputFiles: 2404 MiscUtil.ValidateOptionFilePath("--dockedPoses", InputFile) 2405 MiscUtil.ValidateOptionFileExt("--dockedPoses", InputFile, "sdf sd") 2406 2407 FileDir, FileName, FileExt = MiscUtil.ParseFileName(InputFile) 2408 InputFileRoot = FileName 2409 2410 # Clean up input file names for generating PyMOL object names... 2411 InputFileID = re.sub("[^a-zA-Z0-9]", "_", FileName) 2412 2413 if InputFileRoot in InputFilesRoots: 2414 MiscUtil.PrintError("The input file specified, %s, using option \"--dockedPoses\" is not valid. It is a duplicate and has already been specified for a PDB file." % (InputFile)) 2415 2416 InputFilesRoots.append(InputFileRoot) 2417 InputFilesIDs.append(InputFileID) 2418 2419 # Track values... 2420 DockedPosesInfo['PDBFileIndices'].append(PDBFileIndex) 2421 2422 DockedPosesInfo["PDBFile"][PDBFileIndex] = PDBFile 2423 DockedPosesInfo["ChainID"][PDBFileIndex] = ChainID 2424 2425 DockedPosesInfo["LigandID"][PDBFileIndex] = LigandID 2426 DockedPosesInfo["UseInputFileAsLigandID"][PDBFileIndex] = UseInputFileAsLigandID 2427 2428 DockedPosesInfo["InputFiles"][PDBFileIndex] = InputFiles 2429 DockedPosesInfo["InputFilesRoots"][PDBFileIndex] = InputFilesRoots 2430 DockedPosesInfo["InputFilesIDs"][PDBFileIndex] = InputFilesIDs 2431 2432 return DockedPosesInfo 2433 2434 def ProcessDockedPosesDistanceContactsOptionsInfo(): 2435 """Process dockes poses distance contacts info. """ 2436 2437 DistanceContactsCutoffs = OptionsInfo["DockedPosesDistanceContactsCutoffs"] 2438 if re.match("^none$", DistanceContactsCutoffs): 2439 return None 2440 2441 DistanceContactsInfo = {} 2442 DistanceContactsInfo["ContactIDs"] = [] 2443 DistanceContactsInfo["ContactCutoff"] = {} 2444 2445 DistanceContactsCutoffs = re.sub(" ", "", DistanceContactsCutoffs) 2446 if not DistanceContactsCutoffs: 2447 MiscUtil.PrintError("No value specified using \"--dockedPosesDistanceContactsCutoffs\" option.") 2448 2449 ContactCutoffValues = DistanceContactsCutoffs.split(",") 2450 for Index, ContactCutoff in enumerate(ContactCutoffValues): 2451 MiscUtil.ValidateOptionFloatValue("--dockedPosesDistanceContactsCutoffs", ContactCutoff, {">" : 0.0, "<=": OptionsInfo["PocketDistanceCutoff"]}) 2452 ContactCutoff = float(ContactCutoff.strip()) 2453 2454 ContactID = "Contact%s_At_%s" % ((Index + 1),ContactCutoff) 2455 ContactID = re.sub("\.", "pt", ContactID) 2456 2457 DistanceContactsInfo["ContactIDs"].append(ContactID) 2458 DistanceContactsInfo["ContactCutoff"][ContactID] = ContactCutoff 2459 2460 return DistanceContactsInfo 2461 2462 def ProcessTrajectories(): 2463 """Process trajectories.""" 2464 2465 TrajectoriesInfo = ProcessTrajectoriesOptionsInfo("--Trajectories", OptionsInfo["Trajectories"]) 2466 OptionsInfo["TrajectoriesInfo"] = TrajectoriesInfo 2467 2468 def ProcessTrajectoriesOptionsInfo(TrajectoriesOptionName, TrajectoriesOptionValue): 2469 """Process trajectories options info.""" 2470 2471 Trajectories = TrajectoriesOptionValue 2472 if re.match("^none$", Trajectories, re.I): 2473 return None 2474 2475 MiscUtil.PrintInfo("\nProcessing trajectories...") 2476 2477 # Initialize trajectories info... 2478 TrajectoriesInfo = {} 2479 TrajectoriesInfo["PDBFileIndices"] = [] 2480 2481 TrajectoriesInfo["PDBFile"] = {} 2482 TrajectoriesInfo["TrajFiles"] = {} 2483 TrajectoriesInfo["TrajFilesRoots"] = {} 2484 TrajectoriesInfo["TrajFilesIDs"] = {} 2485 2486 # Parse trajectories values... 2487 TrajectoriesWords = Trajectories.split(",") 2488 if len(TrajectoriesWords) % 2: 2489 MiscUtil.PrintError("The number of comma delimited trajectories values, %d, specified using \"%s\" option must be a multple of 2." % (len(TrajectoriesWords), TrajectoriesOptionName)) 2490 2491 # Validate and process specified values... 2492 for Index in range(0, len(TrajectoriesWords), 2): 2493 PDBFile = TrajectoriesWords[Index].strip() 2494 TrajFiles = TrajectoriesWords[Index + 1].strip() 2495 2496 TrajFiles = re.sub("[ ]+", " ", TrajFiles) 2497 TrajFiles = TrajFiles.split(" ") 2498 2499 # Process PDB file... 2500 MiscUtil.ValidateOptionFilePath(TrajectoriesOptionName, PDBFile) 2501 2502 PDBFileIndex = None 2503 for FileIndex in range(0, len(OptionsInfo["InfilesInfo"]["InfilesNames"])): 2504 PDBInfile = OptionsInfo["InfilesInfo"]["InfilesNames"][FileIndex] 2505 if PDBFile == PDBInfile: 2506 PDBFileIndex = FileIndex 2507 break 2508 if PDBFileIndex is None: 2509 MiscUtil.PrintError("The topology PDB file specified, %s, using option \"%s\" is not valid. It must be specified as an input file." % (PDBFile, TrajectoriesOptionName)) 2510 2511 if PDBFileIndex in TrajectoriesInfo['PDBFileIndices']: 2512 MiscUtil.PrintError("The topology PDB file specified, %s, using option \"%s\" is not valid. It is a duplicate and has already been specified." % (PDBFile, TrajectoriesOptionName)) 2513 2514 # Process trajectory files... 2515 TrajFilesRoots = [] 2516 TrajFilesIDs = [] 2517 for TrajFile in TrajFiles: 2518 MiscUtil.ValidateOptionFilePath(TrajectoriesOptionName, TrajFile) 2519 2520 FileDir, FileName, FileExt = MiscUtil.ParseFileName(TrajFile) 2521 TrajFileRoot = FileName 2522 2523 # Clean up trajectory file names for generating PyMOL object names... 2524 TrajFileID = re.sub("[^a-zA-Z0-9]", "_", FileName) 2525 2526 if TrajFileRoot in TrajFilesRoots: 2527 MiscUtil.PrintError("The trajectory file specified, %s, using option \"%s\" is not valid. It is a duplicate and has already been specified for a PDB file." % (TrajFile, TrajectoriesOptionName)) 2528 2529 TrajFilesRoots.append(TrajFileRoot) 2530 TrajFilesIDs.append(TrajFileID) 2531 2532 # Track values... 2533 TrajectoriesInfo['PDBFileIndices'].append(PDBFileIndex) 2534 2535 TrajectoriesInfo["PDBFile"][PDBFileIndex] = PDBFile 2536 2537 TrajectoriesInfo["TrajFiles"][PDBFileIndex] = TrajFiles 2538 TrajectoriesInfo["TrajFilesRoots"][PDBFileIndex] = TrajFilesRoots 2539 TrajectoriesInfo["TrajFilesIDs"][PDBFileIndex] = TrajFilesIDs 2540 2541 return TrajectoriesInfo 2542 2543 def ProcessResidueTypes(): 2544 """Process residue types.""" 2545 2546 ResidueTypesNamesInfo, ResidueTypesParamsInfo = PyMOLUtil.ProcessResidueTypesOptionsInfo("-r, --residueTypes", OptionsInfo["ResidueTypes"]) 2547 OptionsInfo["ResidueTypesNames"] = ResidueTypesNamesInfo 2548 OptionsInfo["ResidueTypesParams"] = ResidueTypesParamsInfo 2549 2550 def ProcessSaltBridgesChainResidues(): 2551 """Process salt bridges chain residues.""" 2552 2553 SaltBridgesChainResiduesInfo = PyMOLUtil.ProcessSaltBridgesChainResiduesOptionsInfo("--saltBridgesChainResidues", OptionsInfo["SaltBridgesChainResidues"]) 2554 OptionsInfo["SaltBridgesChainResiduesInfo"] = SaltBridgesChainResiduesInfo 2555 2556 def ProcessSurfaceAtomTypesColors(): 2557 """Process surface atom types colors.""" 2558 2559 AtomTypesColorNamesInfo = PyMOLUtil.ProcessSurfaceAtomTypesColorsOptionsInfo("--surfaceAtomTypesColors", OptionsInfo["SurfaceAtomTypesColors"]) 2560 OptionsInfo["AtomTypesColorNames"] = AtomTypesColorNamesInfo 2561 2562 def ProcessPockectChainSelections(): 2563 """Process custom selections for pocket chains.""" 2564 2565 PocketChainSelectionsInfo = PyMOLUtil.ProcessChainSelectionsOptionsInfo("--selectionsPocket", OptionsInfo["SelectionsPocket"]) 2566 OptionsInfo["PocketChainSelectionsInfo"] = PocketChainSelectionsInfo 2567 2568 def ProcessChainSelections(): 2569 """Process custom selections for chains.""" 2570 2571 ChainSelectionsInfo = PyMOLUtil.ProcessChainSelectionsOptionsInfo("--selectionsChain", OptionsInfo["SelectionsChain"]) 2572 OptionsInfo["ChainSelectionsInfo"] = ChainSelectionsInfo 2573 2574 def ProcessOptions(): 2575 """Process and validate command line arguments and options.""" 2576 2577 MiscUtil.PrintInfo("Processing options...") 2578 2579 # Validate options... 2580 ValidateOptions() 2581 2582 OptionsInfo["Align"] = True if re.match("^Yes$", Options["--align"], re.I) else False 2583 OptionsInfo["AlignMethod"] = Options["--alignMethod"].lower() 2584 OptionsInfo["AlignMode"] = Options["--alignMode"] 2585 2586 OptionsInfo["AllowEmptyObjects"] = True if re.match("^Yes$", Options["--allowEmptyObjects"], re.I) else False 2587 2588 OptionsInfo["BFactorChain"] = Options["--BFactorChain"] 2589 OptionsInfo["BFactorColorPalette"] = Options["--BFactorColorPalette"] 2590 2591 OptionsInfo["Infiles"] = Options["--infiles"] 2592 OptionsInfo["InfilesNames"] = Options["--infileNames"] 2593 2594 OptionsInfo["AlignRefFile"] = Options["--alignRefFile"] 2595 if re.match("^FirstInputFile$", Options["--alignRefFile"], re.I): 2596 OptionsInfo["RefFileName"] = OptionsInfo["InfilesNames"][0] 2597 else: 2598 OptionsInfo["RefFileName"] = Options["--alignRefFile"] 2599 2600 OptionsInfo["IgnoreHydrogens"] = True if re.match("^Yes$", Options["--ignoreHydrogens"], re.I) else False 2601 2602 OptionsInfo["Overwrite"] = Options["--overwrite"] 2603 OptionsInfo["PMLOut"] = True if re.match("^Yes$", Options["--PMLOut"], re.I) else False 2604 2605 OptionsInfo["Outfile"] = Options["--outfile"] 2606 FileDir, FileName, FileExt = MiscUtil.ParseFileName(OptionsInfo["Outfile"]) 2607 OptionsInfo["PSEOut"] = False 2608 if re.match("^pml$", FileExt, re.I): 2609 OptionsInfo["PMLOutfile"] = OptionsInfo["Outfile"] 2610 OptionsInfo["PMEOutfile"] = re.sub(".pml$", ".pme", OptionsInfo["Outfile"]) 2611 elif re.match("^pse$", FileExt, re.I): 2612 OptionsInfo["PSEOut"] = True 2613 OptionsInfo["PSEOutfile"] = OptionsInfo["Outfile"] 2614 OptionsInfo["PMLOutfile"] = re.sub(".pse$", ".pml", OptionsInfo["Outfile"]) 2615 if os.path.exists(OptionsInfo["PMLOutfile"]) and (not OptionsInfo["Overwrite"]): 2616 MiscUtil.PrintError("The intermediate output file to be generated, %s, already exist. Use option \"--ov\" or \"--overwrite\" and try again." % OptionsInfo["PMLOutfile"] ) 2617 2618 OptionsInfo["DisulfideBondsChain"] = Options["--disulfideBondsChain"] 2619 2620 OptionsInfo["LabelFontID"] = int(Options["--labelFontID"]) 2621 2622 OptionsInfo["PocketContactsLigandColor"] = Options["--pocketContactsLigandColor"] 2623 OptionsInfo["PocketContactsLigandHydrophobicColor"] = Options["--pocketContactsLigandHydrophobicColor"] 2624 OptionsInfo["PocketContactsLigandPiPiColor"] = Options["--pocketContactsLigandPiPiColor"] 2625 OptionsInfo["PocketContactsLigandPiCationColor"] = Options["--pocketContactsLigandPiCationColor"] 2626 OptionsInfo["PocketContactsLigandHalogenColor"] = Options["--pocketContactsLigandHalogenColor"] 2627 2628 OptionsInfo["PocketContactsSolventColor"] = Options["--pocketContactsSolventColor"] 2629 2630 OptionsInfo["PocketContactsInorganicColor"] = Options["--pocketContactsInorganicColor"] 2631 OptionsInfo["PocketContactsInorganicPiCationColor"] = Options["--pocketContactsInorganicPiCationColor"] 2632 2633 OptionsInfo["PocketContactsCutoff"] = float(Options["--pocketContactsCutoff"]) 2634 OptionsInfo["PocketDistanceCutoff"] = float(Options["--pocketDistanceCutoff"]) 2635 2636 OptionsInfo["PocketLabelColor"] = Options["--pocketLabelColor"] 2637 2638 OptionsInfo["PocketResidueTypes"] = Options["--pocketResidueTypes"] 2639 OptionsInfo["PocketSurface"] = Options["--pocketSurface"] 2640 OptionsInfo["PocketSurfaceElectrostatics"] = Options["--pocketSurfaceElectrostatics"] 2641 2642 OptionsInfo["ResidueTypesChain"] = Options["--residueTypesChain"] 2643 OptionsInfo["ResidueTypes"] = Options["--residueTypes"] 2644 ProcessResidueTypes() 2645 2646 OptionsInfo["SaltBridgesChain"] = Options["--saltBridgesChain"] 2647 OptionsInfo["SaltBridgesChainContactsColor"] = Options["--saltBridgesChainContactsColor"] 2648 OptionsInfo["SaltBridgesChainCutoff"] = float(Options["--saltBridgesChainCutoff"]) 2649 OptionsInfo["SaltBridgesChainResidues"] = Options["--saltBridgesChainResidues"] 2650 ProcessSaltBridgesChainResidues() 2651 2652 OptionsInfo["SelectionsChain"] = Options["--selectionsChain"] 2653 OptionsInfo["SelectionsChainSurface"] = Options["--selectionsChainSurface"] 2654 OptionsInfo["SelectionsChainStyle"] = Options["--selectionsChainStyle"] 2655 ProcessChainSelections() 2656 2657 OptionsInfo["SelectionsPocket"] = Options["--selectionsPocket"] 2658 OptionsInfo["SelectionsPocketSurface"] = Options["--selectionsPocketSurface"] 2659 OptionsInfo["SelectionsPocketStyle"] = Options["--selectionsPocketStyle"] 2660 ProcessPockectChainSelections() 2661 2662 OptionsInfo["SurfaceChain"] = Options["--surfaceChain"] 2663 OptionsInfo["SurfaceChainElectrostatics"] = Options["--surfaceChainElectrostatics"] 2664 2665 OptionsInfo["SurfaceChainComplex"] = True if re.match("^Yes$", Options["--surfaceChainComplex"], re.I) else False 2666 OptionsInfo["SurfaceComplex"] = True if re.match("^Yes$", Options["--surfaceComplex"], re.I) else False 2667 2668 OptionsInfo["SurfaceColor"] = Options["--surfaceColor"] 2669 OptionsInfo["SurfaceColorPalette"] = Options["--surfaceColorPalette"] 2670 OptionsInfo["SurfaceAtomTypesColors"] = Options["--surfaceAtomTypesColors"] 2671 ProcessSurfaceAtomTypesColors() 2672 2673 OptionsInfo["SurfaceTransparency"] = float(Options["--surfaceTransparency"]) 2674 2675 RetrieveInfilesInfo() 2676 RetrieveRefFileInfo() 2677 2678 OptionsInfo["ChainIDs"] = Options["--chainIDs"] 2679 OptionsInfo["LigandIDs"] = Options["--ligandIDs"] 2680 2681 ProcessChainAndLigandIDs() 2682 2683 OptionsInfo["DockedPoses"] = Options["--dockedPoses"] 2684 ProcessDockedPoses() 2685 2686 OptionsInfo["Trajectories"] = Options["--trajectories"] 2687 ProcessTrajectories() 2688 2689 def RetrieveOptions(): 2690 """Retrieve command line arguments and options.""" 2691 2692 # Get options... 2693 global Options 2694 Options = docopt(_docoptUsage_) 2695 2696 # Set current working directory to the specified directory... 2697 WorkingDir = Options["--workingdir"] 2698 if WorkingDir: 2699 os.chdir(WorkingDir) 2700 2701 # Handle examples option... 2702 if "--examples" in Options and Options["--examples"]: 2703 MiscUtil.PrintInfo(MiscUtil.GetExamplesTextFromDocOptText(_docoptUsage_)) 2704 sys.exit(0) 2705 2706 def ValidateOptions(): 2707 """Validate option values.""" 2708 2709 MiscUtil.ValidateOptionTextValue("--align", Options["--align"], "yes no") 2710 MiscUtil.ValidateOptionTextValue("--alignMethod", Options["--alignMethod"], "align cealign super") 2711 MiscUtil.ValidateOptionTextValue("--alignMode", Options["--alignMode"], "FirstChain Complex") 2712 2713 MiscUtil.ValidateOptionTextValue("--allowEmptyObjects", Options["--allowEmptyObjects"], "yes no") 2714 2715 MiscUtil.ValidateOptionTextValue("--BFactorChain", Options["--BFactorChain"], "yes no") 2716 2717 # Expand infiles to handle presence of multiple input files... 2718 InfileNames = MiscUtil.ExpandFileNames(Options["--infiles"], ",") 2719 if not len(InfileNames): 2720 MiscUtil.PrintError("No input files specified for \"-i, --infiles\" option") 2721 2722 # Validate file extensions... 2723 for Infile in InfileNames: 2724 MiscUtil.ValidateOptionFilePath("-i, --infiles", Infile) 2725 MiscUtil.ValidateOptionFileExt("-i, --infiles", Infile, "pdb cif") 2726 MiscUtil.ValidateOptionsDistinctFileNames("-i, --infiles", Infile, "-o, --outfile", Options["--outfile"]) 2727 Options["--infileNames"] = InfileNames 2728 2729 MiscUtil.ValidateOptionFileExt("-o, --outfile", Options["--outfile"], "pml pse") 2730 MiscUtil.ValidateOptionsOutputFileOverwrite("-o, --outfile", Options["--outfile"], "--overwrite", Options["--overwrite"]) 2731 2732 if re.match("^yes$", Options["--align"], re.I): 2733 if not re.match("^FirstInputFile$", Options["--alignRefFile"], re.I): 2734 AlignRefFile = Options["--alignRefFile"] 2735 MiscUtil.ValidateOptionFilePath("--alignRefFile", AlignRefFile) 2736 MiscUtil.ValidateOptionFileExt("--alignRefFile", AlignRefFile, "pdb cif") 2737 MiscUtil.ValidateOptionsDistinctFileNames("--AlignRefFile", AlignRefFile, "-o, --outfile", Options["--outfile"]) 2738 2739 MiscUtil.ValidateOptionTextValue("--disulfideBondsChain", Options["--disulfideBondsChain"], "yes no auto") 2740 2741 MiscUtil.ValidateOptionTextValue("--ignoreHydrogens", Options["--ignoreHydrogens"], "yes no") 2742 2743 MiscUtil.ValidateOptionTextValue("--PMLOut", Options["--PMLOut"], "yes no") 2744 MiscUtil.ValidateOptionIntegerValue("--labelFontID", Options["--labelFontID"], {}) 2745 2746 MiscUtil.ValidateOptionFloatValue("--pocketContactsCutoff", Options["--pocketContactsCutoff"], {">": 0.0}) 2747 MiscUtil.ValidateOptionFloatValue("--pocketDistanceCutoff", Options["--pocketDistanceCutoff"], {">": 0.0}) 2748 if (float(Options["--pocketContactsCutoff"]) > float(Options["--pocketDistanceCutoff"])): 2749 MiscUtil.PrintError("The value, %s, specified using option \"--pocketContactsCutoff\" must be less than value, %s, specified using \"-pocketDistanceCutoff\" option." % (Options["--pocketContactsCutoff"], Options["--pocketDistanceCutoff"])) 2750 2751 MiscUtil.ValidateOptionTextValue("--pocketResidueTypes", Options["--pocketResidueTypes"], "yes no auto") 2752 MiscUtil.ValidateOptionTextValue("--pocketSurface", Options["--pocketSurface"], "yes no auto") 2753 MiscUtil.ValidateOptionTextValue("--pocketSurfaceElectrostatics", Options["--pocketSurfaceElectrostatics"], "yes no auto") 2754 2755 MiscUtil.ValidateOptionTextValue("--residueTypesChain", Options["--residueTypesChain"], "yes no auto") 2756 2757 MiscUtil.ValidateOptionTextValue("--saltBridgesChain", Options["--saltBridgesChain"], "yes no auto") 2758 MiscUtil.ValidateOptionFloatValue("--saltBridgesChainCutoff", Options["--saltBridgesChainCutoff"], {">": 0.0}) 2759 2760 MiscUtil.ValidateOptionTextValue("--selectionsChainSurface", Options["--selectionsChainSurface"], "yes no auto") 2761 MiscUtil.ValidateOptionTextValue("--selectionsPocketSurface", Options["--selectionsPocketSurface"], "yes no auto") 2762 2763 MiscUtil.ValidateOptionTextValue("--surfaceComplex", Options["--surfaceComplex"], "yes no") 2764 MiscUtil.ValidateOptionTextValue("--surfaceChainComplex", Options["--surfaceChainComplex"], "yes no") 2765 MiscUtil.ValidateOptionTextValue("--surfaceChain", Options["--surfaceChain"], "yes no auto") 2766 MiscUtil.ValidateOptionTextValue("--surfaceChainElectrostatics", Options["--surfaceChainElectrostatics"], "yes no auto") 2767 2768 MiscUtil.ValidateOptionTextValue("--surfaceColorPalette", Options["--surfaceColorPalette"], "RedToWhite WhiteToGreen") 2769 MiscUtil.ValidateOptionFloatValue("--surfaceTransparency", Options["--surfaceTransparency"], {">=": 0.0, "<=": 1.0}) 2770 2771 # Setup a usage string for docopt... 2772 _docoptUsage_ = """ 2773 PyMOLVisualizeMacromolecules.py - Visualize macromolecules 2774 2775 Usage: 2776 PyMOLVisualizeMacromolecules.py [--align <yes or no>] [--alignMethod <align, cealign, super>] 2777 [--alignMode <FirstChain or Complex>] [--alignRefFile <filename>] 2778 [--allowEmptyObjects <yes or no>] [--BFactorChain <yes or no>] [--BFactorColorPalette <text>] 2779 [--chainIDs <First, All or ID1,ID2...>] [--disulfideBondsChain <yes or no>] 2780 [--dockedPoses <PDBFile,ChainID,LigandID,InputFiles,...>] [--dockedPosesDistanceContactsCutoffs <number1,number2...>] 2781 [--dockedPosesDistanceContactsColor <text>] [--dockedPosesGroupName <text>] 2782 [--dockedPosesName <text>] [--ignoreHydrogens <yes or no>] [--ligandIDs <Largest, All or ID1,ID2...>] 2783 [--labelFontID <number>] [--PMLOut <yes or no>] [--pocketContactsInorganicColor <text>] 2784 [--pocketContactsInorganicPiCationColor <text>] [--pocketContactsLigandColor <text>] 2785 [--pocketContactsLigandHydrophobicColor <text>] [--pocketContactsLigandHalogenColor <text>] 2786 [--pocketContactsLigandPiCationColor <text>] [--pocketContactsLigandPiPiColor <text>] 2787 [--pocketContactsSolventColor <text>] [--pocketContactsCutoff <number>] 2788 [--pocketDistanceCutoff <number>] [--pocketLabelColor <text>] [--pocketResidueTypes <yes or no>] 2789 [--pocketSurface <yes or no>] [--pocketSurfaceElectrostatics <yes or no>] 2790 [--residueTypes <Type,Color,ResNames,...>] [--residueTypesChain <yes or no>] 2791 [--saltBridgesChain <yes or no>] [--saltBridgesChainContactsColor <text>] 2792 [--saltBridgesChainCutoff <number>] [--saltBridgesChainResidues <Type, ResNames,...>] 2793 [--selectionsChain <ObjectName,SelectionSpec,...>] [--selectionsChainSurface <yes or no>] 2794 [--selectionsChainStyle <DisplayStyle>] [--selectionsPocket <ObjectName,SelectionSpec,...>] 2795 [--selectionsPocketSurface <yes or no>] [--selectionsPocketStyle <DisplayStyle>] 2796 [--surfaceChain <yes or no>] [--surfaceChainElectrostatics <yes or no>] 2797 [--surfaceChainComplex <yes or no>] [--surfaceComplex <yes or no>] 2798 [--surfaceColor <ColorName>] [--surfaceColorPalette <RedToWhite or WhiteToGreen>] 2799 [--surfaceAtomTypesColors <ColorType,ColorSpec,...>] 2800 [--surfaceTransparency <number>] [--trajectories <PDBToplogyFile,TrajFiles,...> ] 2801 [--overwrite] [-w <dir>] -i <infile1,infile2,infile3...> -o <outfile> 2802 PyMOLVisualizeMacromolecules.py -h | --help | -e | --examples 2803 2804 Description: 2805 Generate PyMOL visualization files for viewing surfaces, chains, ligands, ligand 2806 binding pockets, and interactions between ligands and binding pockets in 2807 macromolecules including proteins and nucleic acids. 2808 2809 The supported input file format are: PDB (.pdb), CIF (.cif) 2810 2811 The supported output file formats are: PyMOL script file (.pml), PyMOL session 2812 file (.pse) 2813 2814 A variety of PyMOL groups and objects may be created for visualization of 2815 macromolecules. These groups and objects correspond to complexes, surfaces, 2816 chains, ligands, inorganics, ligand binding pockets, pocket, polar interactions, 2817 and pocket hydrophobic surfaces. A complete hierarchy of all possible PyMOL 2818 groups and objects is shown below: 2819 2820 <PDBFileRoot> 2821 .Complex 2822 .Complex 2823 .Surface 2824 .Trajectories 2825 .Topology 2826 .<TrajFileID> 2827 .Trajectory 2828 .<TrajFileID> 2829 ... ... ... 2830 .<TrajFileID> 2831 ... ... ... 2832 .Chain<ID> 2833 .Complex 2834 .Complex 2835 .Surface 2836 .Chain 2837 .Chain 2838 .BFactor 2839 .Putty 2840 .Cartoon 2841 .Selections 2842 .<Name> 2843 .Selection 2844 .Surface 2845 .Surface 2846 .Hydrophobicity 2847 .Hydrophobicity_Charge 2848 .<Name> 2849 ... ... .. 2850 .Residues 2851 .Aromatic 2852 .Residues 2853 .Surface 2854 .Hydrophobic 2855 .Residues 2856 .Surface 2857 .Polar 2858 .Residues 2859 .Surface 2860 .Positively_Charged 2861 .Residues 2862 .Surface 2863 .Negatively_Charged 2864 .Residues 2865 .Surface 2866 .Other 2867 .Residues 2868 .Surface 2869 .Surface 2870 .Surface 2871 .Hydrophobicity 2872 .Hydrophobicity_Charge 2873 .Vacuum_Electrostatics 2874 .Contact_Potentials 2875 .Map 2876 .Legend 2877 .Volume 2878 .Disulfide_Bonds 2879 .Residues 2880 .Salt_Bridges 2881 .Residues 2882 .Positively_Charged 2883 .Negatively_Charged 2884 .Contacts 2885 .Solvent 2886 .Inorganic 2887 .Ligand<ID> 2888 .Ligand 2889 .Ligand 2890 .BallAndStick 2891 .Pocket 2892 .Pocket 2893 .Polar_Contacts 2894 .Hydrophobic_Contacts 2895 .Pi_Pi_Contacts 2896 .Pi_Cation_Contacts 2897 .Halogen_Contacts 2898 .Selections 2899 .<Name> 2900 .Selection 2901 .Surface 2902 .Surface 2903 .Hydrophobicity 2904 .Hydrophobicity_Charge 2905 .<Name> 2906 ... ... .. 2907 .Residues 2908 .Aromatic 2909 .Residues 2910 .Surface 2911 .Hydrophobic 2912 .Residues 2913 .Surface 2914 .Polar 2915 .Residues 2916 .Surface 2917 .Positively_Charged 2918 .Residues 2919 .Surface 2920 .Negatively_Charged 2921 .Residues 2922 .Surface 2923 .Other 2924 .Residues 2925 .Surface 2926 .Surfaces 2927 .Surface 2928 .Surface 2929 .Hydrophobicity 2930 .Hydrophobicity_Charge 2931 .Vacuum_Electrostatics 2932 .Contact_Potentials 2933 .Map 2934 .Legend 2935 .Cavity 2936 .Surface 2937 .Hydrophobicity 2938 .Hydrophobicity_Charge 2939 .Vacuum_Electrostatics 2940 .Contact_Potentials 2941 .Map 2942 .Legend 2943 .Pocket_Solvent 2944 .Pocket_Solvent 2945 .Polar_Contacts 2946 .Pocket_Inorganic 2947 .Pocket_Inorganic 2948 .Polar_Contacts 2949 .Pi_Cation_Contacts 2950 .Ligand<ID> 2951 .Ligand 2952 ... ... ... 2953 .Pocket 2954 ... ... ... 2955 .Pocket_Solvent 2956 ... ... ... 2957 .Pocket_Inorganic 2958 ... ... ... 2959 .Docked_Poses or <CustomLabel> 2960 .<InputFileID> 2961 .Poses or <CustomLabel> 2962 .Pocket 2963 .Pocket 2964 .Distance_Contacts 2965 .Contact1_At_<Distance> 2966 .Contact1_At_<Distance> 2967 ... ... ... 2968 .Polar_Contacts 2969 .Hydrophobic_Contacts 2970 .Pi_Pi_Contacts 2971 .Pi_Cation_Contacts 2972 .Halogen_Contacts 2973 .Pocket_Solvent 2974 .Pocket_Solvent 2975 .Polar_Contacts 2976 .Pocket_Inorganic 2977 .Polar_Contacts 2978 .Pi_Cation_Contacts 2979 .<InputFileID> 2980 ... ... ... 2981 .<InputFileID> 2982 ... ... ... 2983 .Chain<ID> 2984 ... ... ... 2985 .Ligand<ID> 2986 ... ... ... 2987 .Ligand<ID> 2988 ... ... ... 2989 .Chain<ID> 2990 ... ... ... 2991 <PDBFileRoot> 2992 .Complex 2993 ... ... ... 2994 .Chain<ID> 2995 ... ... ... 2996 .Ligand<ID> 2997 ... ... ... 2998 .Ligand<ID> 2999 ... ... ... 3000 .Chain<ID> 3001 ... ... ... 3002 3003 The hydrophobic and electrostatic surfaces are not created for complete complex 3004 and chain complex in input file(s) by default. A word to the wise: The creation of 3005 surface objects may slow down loading of PML file and generation of PSE file, based 3006 on the size of input complexes. The generation of PSE file may also fail. 3007 3008 Options: 3009 -a, --align <yes or no> [default: no] 3010 Align input files to a reference file before visualization. The docked poses 3011 and trajectories are not aligned. 3012 --alignMethod <align, cealign, super> [default: super] 3013 Alignment methodology to use for aligning input files to a 3014 reference file. 3015 --alignMode <FirstChain or Complex> [default: FirstChain] 3016 Portion of input and reference files to use for spatial alignment of 3017 input files against reference file. Possible values: FirstChain or 3018 Complex. 3019 3020 The FirstChain mode allows alignment of the first chain in each input 3021 file to the first chain in the reference file along with moving the rest 3022 of the complex to coordinate space of the reference file. The complete 3023 complex in each input file is aligned to the complete complex in reference 3024 file for the Complex mode. 3025 --alignRefFile <filename> [default: FirstInputFile] 3026 Reference input file name. The default is to use the first input file 3027 name specified using '-i, --infiles' option. 3028 --allowEmptyObjects <yes or no> [default: no] 3029 Allow creation of empty PyMOL objects corresponding to solvent and 3030 inorganic atom selections across chains and ligands in input file(s). By 3031 default, the empty objects are marked for deletion. 3032 -b, --BFactorChain <yes or no> [default: yes] 3033 A cartoon and putty around individual chains colored by an arbitrary set 3034 of B factor values. The minimum and maximum values for B factors are 3035 automatically detected. These values may indicate spread of electron 3036 density around atoms or correspond to any other property mapped to 3037 B factors in input file. 3038 --BFactorColorPalette <text> [default: blue_white_red] 3039 Color palette for coloring cartoon and putty around chains generated using B 3040 factor values. Any valid PyMOL color palette name is allowed. No validation is 3041 performed. The complete list of valid color palette names is a available 3042 at: pymolwiki.org/index.php/Spectrum. Examples: blue_white_red, 3043 blue_white_magenta, blue_red, green_white_red, green_red. 3044 -c, --chainIDs <First, All or ID1,ID2...> [default: First] 3045 List of chain IDs to use for visualizing macromolecules. Possible values: 3046 First, All, or a comma delimited list of chain IDs. The default is to use the 3047 chain ID for the first chain in each input file. 3048 -d --disulfideBondsChain <yes or no> [default: auto] 3049 Disulfide bonds for chains. By default, the disulfide bonds group is 3050 automatically created for chains containing amino acids and skipped for 3051 chains only containing nucleic acids. 3052 --dockedPoses <PDBFile,ChainID,LigandID,InputFiles,...> [default: none] 3053 PDB file name, pocket chain ID, ligand specification, and input files to use 3054 for creating pockets to visualize docked poses or any arbitrary set of 3055 molecules. Any valid PyMOL input file format is allowed. 3056 3057 It's a quartet of comma limited values corresponding to PDF file name, 3058 pocket chain ID, ligand ID, and input files. Multiple input file names are 3059 delimited by spaces. 3060 3061 The supported values for docked poses are shown below: 3062 3063 PDBFile: A valid PDB file name 3064 ChainID: A valid Chain ID 3065 LigandID: A valid Ligand ID or UseInputFile 3066 InputFiles: A space delimited list of input file names 3067 3068 All docked pose values must be specified. No default values are assigned. 3069 3070 The 'ChainID' and 'LigandID' are used for creating pocket to visualize docked 3071 poses. 3072 3073 The 'LigandID' must be a valid ligand ID in 'ChainID'. Alternatively, you may use 3074 input files by specifying 'UseInputFile' to select residues in 'ChainID' for creating 3075 pockets to visualize docked poses. 3076 --dockedPosesDistanceContactsCutoffs <number1,number2...> [default: none] 3077 A comma delimited list of distances in Angstroms for identifying and displaying 3078 distance contacts between heavy atoms in pocket residues and docked poses. A 3079 PyMOL distance contact object is created for each specified distance. You may 3080 find it helpful for identifying steric clashes between docked poses and pocket 3081 residues. The maximum distance cutoff value must be less than the specified 3082 value for '--pocketDistanceCutoff' option. 3083 --dockedPosesDistanceContactsColor <text> [default: red] 3084 Color for drawing distance contacts between docked poses and pocket residues. 3085 The specified value must be valid color. No validation is performed. 3086 --dockedPosesGroupName <text> [default: Docked_Poses] 3087 PyMOL object name for docked poses group. You may use an artbitray name 3088 to reflect data in input file(s) specified in '--dockedPoses' option. It must be a valid 3089 PyMOL object name. No validation is performed. 3090 --dockedPosesName <text> [default: Poses] 3091 PyMOL object name for docked poses object. You may use an artbitray name 3092 to reflect data in input file(s) specified in '--dockedPoses' option. It must be a 3093 valid PyMOL object name. No validation is performed. 3094 -e, --examples 3095 Print examples. 3096 -h, --help 3097 Print this help message. 3098 -i, --infiles <infile1,infile2,infile3...> 3099 Input file names. 3100 --ignoreHydrogens <yes or no> [default: yes] 3101 Ignore hydrogens for ligand, pocket, selection, and residue type views. 3102 -l, --ligandIDs <Largest, All or ID1,ID2...> [default: Largest] 3103 List of ligand IDs present in chains for visualizing macromolecules to 3104 highlight ligand interactions. Possible values: Largest, All, or a comma 3105 delimited list of ligand IDs. The default is to use the largest ligand present 3106 in all or specified chains in each input file. 3107 3108 Ligands are identified using organic selection operator available in PyMOL. 3109 It'll also identify buffer molecules as ligands. The largest ligand contains 3110 the highest number of heavy atoms. 3111 --labelFontID <number> [default: 7] 3112 Font ID for drawing labels. Default: 7 (Sans Bold). Valid values: 5 to 16. 3113 The specified value must be a valid PyMOL font ID. No validation is 3114 performed. The complete lists of valid font IDs is available at: 3115 pymolwiki.org/index.php/Label_font_id. Examples: 5 - Sans; 3116 7 - Sans Bold; 9 - Serif; 10 - Serif Bold. 3117 -o, --outfile <outfile> 3118 Output file name. 3119 -p, --PMLOut <yes or no> [default: yes] 3120 Save PML file during generation of PSE file. 3121 --pocketContactsInorganicColor <text> [default: deepsalmon] 3122 Color for drawing polar contacts between inorganic and pocket residues. 3123 The specified value must be valid color. No validation is performed. 3124 --pocketContactsInorganicPiCationColor <text> [default: limon] 3125 Color for drawing pi cation contacts between inorganic and pocket residues. 3126 The specified value must be valid color. No validation is performed. The pi 3127 cation contacts are drawn using PyMOL distance command with support for 3128 mode 7 and may require incentive version of PyMOL. 3129 --pocketContactsLigandColor <text> [default: orange] 3130 Color for drawing polar contacts between ligand and pocket residues. 3131 The specified value must be valid color. No validation is performed. 3132 --pocketContactsLigandHalogenColor <text> [default: magenta] 3133 Color for drawing halogen contacts between ligand and pocket residues. 3134 The specified value must be valid color. No validation is performed. 3135 --pocketContactsLigandHydrophobicColor <text> [default: purpleblue] 3136 Color for drawing hydrophobic contacts between ligand and pocket residues. 3137 The specified value must be valid color. No validation is performed. The 3138 hydrophobic contacts are shown between pairs of carbon atoms not 3139 connected to hydrogen bond donor or acceptors atoms as identified 3140 by PyMOL. 3141 --pocketContactsLigandPiCationColor <text> [default: yelloworange] 3142 Color for drawing pi cation contacts between ligand and pocket residues. 3143 The specified value must be valid color. No validation is performed. The pi 3144 cation contacts are drawn using PyMOL distance command with support for 3145 mode 7 and may require incentive version of PyMOL. 3146 --pocketContactsLigandPiPiColor <text> [default: cyan] 3147 Color for drawing pi pi contacts between ligand and pocket residues. 3148 The specified value must be valid color. No validation is performed. The pi 3149 pi contacts are drawn using PyMOL distance command with support for 3150 mode 6 and may require incentive version of PyMOL. 3151 --pocketContactsSolventColor <text> [default: marine] 3152 Color for drawing polar contacts between solvent and pocket residues.. 3153 The specified value must be valid color. No validation is performed. 3154 --pocketContactsCutoff <number> [default: 4.0] 3155 Distance in Angstroms for identifying polar, hyrdophobic contacts, pi pi, 3156 pi cation, and halogen contacts between atoms in pocket residues and 3157 ligands. 3158 --pocketDistanceCutoff <number> [default: 5.0] 3159 Distance in Angstroms for identifying pocket residues around ligands. 3160 --pocketLabelColor <text> [default: magenta] 3161 Color for drawing residue or atom level labels for a pocket. The specified 3162 value must be valid color. No validation is performed. 3163 --pocketResidueTypes <yes or no> [default: auto] 3164 Pocket residue types. The residue groups are generated using residue types, 3165 colors, and names specified by '--residueTypes' option. It is only valid for 3166 amino acids. By default, the residue type groups are automatically created 3167 for pockets containing amino acids and skipped for chains only containing 3168 nucleic acids. 3169 --pocketSurface <yes or no> [default: auto] 3170 Surfaces around pocket residues colored by hydrophobicity alone and 3171 both hydrophobicity and charge. The hydrophobicity surface is colored 3172 at residue level using Eisenberg hydrophobicity scale for residues and color 3173 gradient specified by '--surfaceColorPalette' option. The hydrophobicity and 3174 charge surface is colored [ Ref 140 ] at atom level using colors specified for 3175 groups of atoms by '--surfaceAtomTypesColors' option. This scheme allows 3176 simultaneous mapping of hyrophobicity and charge values on the surfaces. 3177 3178 The cavity surfaces around ligands are also generated. These surfaces are 3179 colored by hydrophobicity along and both hydrophobicity and charge. 3180 3181 This option is only valid for amino acids. By default, both surfaces are 3182 automatically created for pockets containing amino acids and skipped for 3183 pockets containing only nucleic acids. 3184 --pocketSurfaceElectrostatics <yes or no> [default: no] 3185 Vacuum electrostatics contact potential surface around pocket residues. 3186 A word to the wise from PyMOL documentation: The computed protein 3187 contact potentials are only qualitatively useful, due to short cutoffs, 3188 truncation, and lack of solvent "screening". 3189 3190 The cavity surface around ligands is also generated. This surface is 3191 colored by vacuum electrostatics contact potential. 3192 3193 This option is only valid for amino acids. By default, the electrostatics surface 3194 is automatically created for chains containing amino acids and skipped for chains 3195 containing only nucleic acids. 3196 -r, --residueTypes <Type,Color,ResNames,...> [default: auto] 3197 Residue types, colors, and names to generate for residue groups during 3198 '--pocketResidueTypes' and '--residueTypesChain' option. It is only 3199 valid for amino acids. 3200 3201 It is a triplet of comma delimited list of amino acid residues type, residues 3202 color, and a space delimited list three letter residue names. 3203 3204 The default values for residue type, color, and name triplets are shown 3205 below: 3206 3207 Aromatic,brightorange,HIS PHE TRP TYR, 3208 Hydrophobic,orange,ALA GLY VAL LEU ILE PRO MET, 3209 Polar,palegreen,ASN GLN SER THR CYS, 3210 Positively_Charged,marine,ARG LYS, 3211 Negatively_Charged,red,ASP GLU 3212 3213 The color name must be a valid PyMOL name. No validation is performed. 3214 An amino acid name may appear across multiple residue types. All other 3215 residues are grouped under 'Other'. 3216 --residueTypesChain <yes or no> [default: auto] 3217 Chain residue types. The residue groups are generated using residue types, 3218 colors, and names specified by '--residueTypes' option. It is only valid for 3219 amino acids. By default, the residue type groups are automatically created 3220 for chains containing amino acids and skipped for chains only containing 3221 nucleic acids. 3222 --saltBridgesChain <yes or no> [default: auto] 3223 Salt bridges for chains. By default, the salt bridges group is automatically 3224 created for chains containing amino acids and skipped for chains only 3225 containing nucleic acids. The salt bridges correspond to polar contacts 3226 between positively and negatively charges residues in a chain. 3227 --saltBridgesChainContactsColor <text> [default: brightorange] 3228 Color for drawing polar contacts between positively and negatively 3229 charged residues involved in salt bridges. The specified value must 3230 be valid color. No validation is performed. 3231 --saltBridgesChainCutoff <number> [default: 4.0] 3232 Distance in Angstroms for identifying polar contacts between positively 3233 and negatively charged residues involved in salt bridges in a chain. 3234 --saltBridgesChainResidues <Type, ResNames,...> [default: auto] 3235 Residue types and names to use for identifying positively and negatively 3236 charged residues involved in salt bridges. 3237 3238 It is a pair of comma delimited list of amino acid residue types and a space 3239 delimited list three letter residue names. 3240 3241 The default values for residue type and name pairs are shown below: 3242 3243 Positively_Charged,ARG LYS HIS HSP 3244 Negatively_Charged,ASP GLU 3245 3246 The residue names must be valid names. No validation is performed. 3247 --selectionsChain <ObjectName,SelectionSpec,...> [default: none] 3248 Custom selections for chains. It is a pairwise list of comma delimited values 3249 corresponding to PyMOL object names and selection specifications. The 3250 selection specification must be a valid PyMOL specification. No validation is 3251 performed. 3252 3253 The PyMOL objects are created for each chain corresponding to the 3254 specified selections. The display style for PyMOL objects is set using 3255 value of '--selectionsChainStyle' option. 3256 3257 The specified selection specification is automatically appended to appropriate 3258 chain specification before creating PyMOL objects. 3259 3260 For example, the following specification for '--selectionsChain' option will 3261 generate PyMOL objects for chains containing Cysteines and Serines: 3262 3263 Cysteines,resn CYS,Serines,resn SER 3264 3265 --selectionsChainSurface <yes or no> [default: auto] 3266 Surfaces around individual chain selections colored by hydrophobicity alone 3267 and both hydrophobicity and charge. This option is similar to '--surfaceChain' 3268 options for creating surfaces for chain. Additional details are available in the 3269 documentation section for '--surfaceChain' options. 3270 --selectionsChainStyle <DisplayStyle> [default: sticks] 3271 Display style for PyMOL objects created for '--selectionsChain' option. It 3272 must be a valid PyMOL display style. No validation is performed. 3273 --selectionsPocket <ObjectName,SelectionSpec,...> [default: none] 3274 Custom selections for pocket residues. It is a pairwise list of comma delimited 3275 values corresponding to PyMOL object names and selection specifications. The 3276 selection specification must be a valid PyMOL specification. No validation is 3277 performed. 3278 3279 The PyMOL objects are created for each pocket corresponding to the 3280 specified selections. The display style for PyMOL objects is set using 3281 value of '--selectionsChainStyle' option. 3282 3283 The specified selection specification is automatically appended to appropriate 3284 pocket specification before creating PyMOL objects. 3285 3286 For example, the following specification for '--selectionsPocket' option will 3287 generate PyMOL objects for pockets containing Tyrosines and Serines: 3288 3289 Tyrosines,resn TYR,Serines,resn SER 3290 3291 --selectionsPocketSurface <yes or no> [default: auto] 3292 Surfaces around individual pocket chain selections colored by hydrophobicity 3293 alone and both hydrophobicity and charge. This option is similar to '--surfaceChain' 3294 options for creating surfaces for chain. Additional details are available in the 3295 documentation section for '--surfaceChain' options. 3296 --selectionsPocketStyle <DisplayStyle> [default: sticks] 3297 Display style for PyMOL objects created for '--selectionsPocket' option. It 3298 must be a valid PyMOL display style. No validation is performed. 3299 --surfaceChain <yes or no> [default: auto] 3300 Surfaces around individual chain colored by hydrophobicity alone and 3301 both hydrophobicity and charge. The hydrophobicity surface is colored 3302 at residue level using Eisenberg hydrophobicity scale for residues and color 3303 gradient specified by '--surfaceColorPalette' option. The hydrophobicity and 3304 charge surface is colored [ Ref 140 ] at atom level using colors specified for 3305 groups of atoms by '--surfaceAtomTypesColors' option. This scheme allows 3306 simultaneous mapping of hyrophobicity and charge values on the surfaces. 3307 3308 This option is only valid for amino acids. By default, both surfaces are 3309 automatically created for chains containing amino acids and skipped for 3310 chains containing only nucleic acids. 3311 --surfaceChainElectrostatics <yes or no> [default: no] 3312 Vacuum electrostatics contact potential surface and volume around individual 3313 chain. A word to the wise from PyMOL documentation: The computed protein 3314 contact potentials are only qualitatively useful, due to short cutoffs, 3315 truncation, and lack of solvent "screening". 3316 3317 This option is only valid for amino acids. By default, the electrostatics surface 3318 and volume are automatically created for chains containing amino acids and 3319 skipped for chains containing only nucleic acids. 3320 --surfaceChainComplex <yes or no> [default: no] 3321 Hydrophobic surface around chain complex. The surface is colored by 3322 hydrophobicity. It is only valid for amino acids. 3323 --surfaceComplex <yes or no> [default: no] 3324 Hydrophobic surface around complete complex. The surface is colored by 3325 hydrophobicity. It is only valid for amino acids. 3326 --surfaceAtomTypesColors <ColorType,ColorSpec,...> [default: auto] 3327 Atom colors for generating surfaces colored by hyrophobicity and charge 3328 around chains and pockets in proteins. It's a pairwise comma delimited list 3329 of atom color type and color specification for goups of atoms. 3330 3331 The default values for color types [ Ref 140 ] along wth color specifications 3332 are shown below: 3333 3334 HydrophobicAtomsColor, yellow, 3335 NegativelyChargedAtomsColor, red, 3336 PositivelyChargedAtomsColor, blue, 3337 OtherAtomsColor, gray90 3338 3339 The color names must be valid PyMOL names. 3340 3341 The color values may also be specified as space delimited RGB triplets: 3342 3343 HydrophobicAtomsColor, 0.95 0.78 0.0, 3344 NegativelyChargedAtomsColor, 1.0 0.4 0.4, 3345 PositivelyChargedAtomsColor, 0.2 0.5 0.8, 3346 OtherAtomsColor, 0.95 0.95 0.95 3347 3348 --surfaceColor <ColorName> [default: lightblue] 3349 Color name for surfaces around chains and pockets. This color is not used 3350 for surfaces colored by hydrophobicity and charge. The color name must be 3351 a valid PyMOL name. 3352 --surfaceColorPalette <RedToWhite or WhiteToGreen> [default: RedToWhite] 3353 Color palette for hydrophobic surfaces around chains and pockets in proteins. 3354 Possible values: RedToWhite or WhiteToGreen from most hydrophobic amino 3355 acid to least hydrophobic. The colors values for amino acids are taken from 3356 color_h script available as part of the Script Library at PyMOL Wiki. 3357 --surfaceTransparency <number> [default: 0.25] 3358 Surface transparency for molecular surfaces. 3359 -t, --trajectories <PDBToplogyFile,TrajFiles,...> [default: none] 3360 PDB topology file name and MD trajectories files for visualizing trajectories 3361 for PDB files. 3362 3363 It's a pair of comma limited values corresponding to a PDB file name and 3364 MD trajectory files. Multiple trajectory file names are delimited by spaces. 3365 3366 The supported values for trajectories are shown below: 3367 3368 PDBTopologyFile: A valid PDB file name 3369 TrajFiles: A space delimited list of MD trajectory file names 3370 3371 The trajectory files must correspond to the specified PDB topology file. In 3372 addition, the format of trajectory files must be a valid PyMOL format. PyMOL 3373 uses Molfile Plugin, which supports a variety of trajectory file formats. For 3374 example: HARMM, NAMD, X-PLOR (.dcd), Gromacs TRR/XTC (.trr, .xtc), 3375 XYZ (.xyz) etc. 3376 --overwrite 3377 Overwrite existing files. 3378 -w, --workingdir <dir> 3379 Location of working directory which defaults to the current directory. 3380 3381 Examples: 3382 To visualize the first chain, the largest ligand in the first chain, and ligand 3383 binding pockets to highlight ligand interaction with pocket resiudes, solvents 3384 and inorganics, in a PDB file, and generate a PML file, type: 3385 3386 % PyMOLVisualizeMacromolecules.py -i Sample4.pdb -o Sample4.pml 3387 3388 To visualize the first chain along with all cysteines and serines, the largest 3389 ligand in the first chain, and ligand binding pockets to highlight ligand 3390 interaction with pocket resiudes, solvents and inorganics, in a PDB file, 3391 and generate a PML file, type: 3392 3393 % PyMOLVisualizeMacromolecules.py -i Sample4.pdb -o Sample4.pml 3394 --selectionsChain "Cysteines,resn cys,Serines,resn ser" 3395 3396 To visualize the first chain along with all serines and tyrosines in binding 3397 pockets, the largest ligand in the first chain, and ligand binding pockets 3398 to highlight ligand interaction with pocket resiudes, solvents and inorganics, 3399 in a PDB file, and generate a PML file, type: 3400 3401 % PyMOLVisualizeMacromolecules.py -i Sample4.pdb -o Sample4.pml 3402 --selectionsPocket "Serines,resn ser,Tyrosines,resn tyr" 3403 3404 To visualize docking poses from a SD file in a pocket corresponding to a SD file 3405 for a chain, along with visualization of other information, in a PDB file, 3406 and generate a PML file, type: 3407 3408 % PyMOLVisualizeMacromolecules.py -c All -l "N3" -i SampleMpro6LU7.pdb 3409 -o SampleMpro6LU7.pml --dockedPoses "SampleMpro6LU7.pdb,A,UseInputFile, 3410 SampleMproDockedPosesTop100.sdf" 3411 3412 To visualize docking poses from a SD file in a pocket corresponding to SD file 3413 for a chain, along with visualization of distance contacts at 3.0 and 3.5 Angstroms, 3414 in a PDB file, and generate a PML file, type: 3415 3416 % PyMOLVisualizeMacromolecules.py -c All -l "N3" -i SampleMpro6LU7.pdb 3417 -o SampleMpro6LU7.pml --dockedPoses "SampleMpro6LU7.pdb,A,UseInputFile, 3418 SampleMproDockedPosesTop100.sdf" 3419 --dockedPosesDistanceContactsCutoffs "3.0, 3.5" 3420 3421 To visualize docking poses from a SD file in a pocket corresponding to a specific 3422 ligand a chain, along with visualization of other information, in a PDB file, 3423 and generate a PML file, type: 3424 3425 % PyMOLVisualizeMacromolecules.py -c All -l "N3" -i SampleMpro6LU7.pdb 3426 -o SampleMpro6LU7.pml --dockedPoses "SampleMpro6LU7.pdb,A,N3, 3427 SampleMproDockedPosesTop100.sdf" 3428 3429 To visualize docking poses from multiple SDs file in a pocket corresponding SD file 3430 a for a chain, along with visualization of other information, in a PDB file, and 3431 generate a PML file, type: 3432 3433 % PyMOLVisualizeMacromolecules.py -c All -l "N3" -i SampleMpro6LU7.pdb 3434 -o SampleMpro6LU7.pml --dockedPoses "SampleMpro6LU7.pdb,A,UseInputFile, 3435 SampleMproDockedPosesTop100.sdf SampleMproDockedPosesDiverse100.sdf" 3436 3437 To visualize trajectory from a DCD file, along with visualization of other 3438 information, corresponding to a PDB topology file and generate a PML file, 3439 type: 3440 3441 % PyMOLVisualizeMacromolecules.py -t "Sample10.pdb, Sample10.dcd" 3442 -i Sample10.pdb -o Sample10.pml 3443 3444 To visualize all chains, all ligands in all chains, and all ligand binding pockets to 3445 highlight ligand interaction with pocket resiudes, solvents and inorganics, in a 3446 PDB file, and generate a PML file, type: 3447 3448 % PyMOLVisualizeMacromolecules.py -c All -l All -i Sample4.pdb -o 3449 Sample4.pml 3450 3451 To visualize all chains, ligands, and ligand binding pockets along with displaying 3452 all hydrophibic surfaces and chain electrostatic surface, in a PDB file, and 3453 generate a PML file, type: 3454 3455 % PyMOLVisualizeMacromolecules.py -c All -l All 3456 --surfaceChainElectrostatics yes --surfaceChainComplex yes 3457 --surfaceComplex yes -i Sample4.pdb -o Sample4.pml 3458 3459 To visualize chain E, ligand ADP in chain E, and ligand binding pockets to 3460 highlight ligand interaction with pocket resiudes, solvents and inorganics, 3461 in a PDB file, and generate a PML file, type: 3462 3463 % PyMOLVisualizeMacromolecules.py -c E -l ADP -i Sample3.pdb 3464 -o Sample3.pml 3465 3466 To visualize chain E, ligand ADP in chain E, and ligand binding pockets to 3467 highlight ligand interaction with pocket resiudes, solvents and inorganics, 3468 in a PDB file, and generate a PSE file, type: 3469 3470 % PyMOLVisualizeMacromolecules.py -c E -l ADP -i Sample3.pdb 3471 -o Sample3.pse 3472 3473 To visualize the first chain, the largest ligand in the first chain, and ligand 3474 binding pockets to highlight ligand interaction with pocket resiudes, solvents 3475 and inorganics, in PDB files, along with aligning first chain in each input file to 3476 the first chain in first input file, and generate a PML file, type: 3477 3478 % PyMOLVisualizeMacromolecules.py --align yes -i 3479 "Sample5.pdb,Sample6.pdb,Sample7.pdb" -o SampleOut.pml 3480 3481 To visualize all chains, all ligands in all chains, and all ligand binding pockets to 3482 highlight ligand interaction with pocket resiudes, solvents and inorganics, in 3483 PDB files, along with aligning first chain in each input file to the first chain in 3484 first input file, and generate a PML file, type: 3485 3486 % PyMOLVisualizeMacromolecules.py --align yes -c All -l All -i 3487 "Sample5.pdb,Sample6.pdb,Sample7.pdb" -o SampleOut.pml 3488 3489 To visualize all chains, all ligands in all chains, and all ligand binding pockets to 3490 highlight ligand interaction with pocket resiudes, solvents and inorganics, in 3491 PDB files, along with aligning first chain in each input file to the first chain in a 3492 specified PDB file using a specified alignment method, and generate a PML 3493 file, type: 3494 3495 % PyMOLVisualizeMacromolecules.py --align yes --alignMode FirstChain 3496 --alignRefFile Sample5.pdb --alignMethod super -c All -l All -i 3497 "Sample5.pdb,Sample6.pdb,Sample7.pdb" -o SampleOut.pml 3498 3499 Author: 3500 Manish Sud(msud@san.rr.com) 3501 3502 See also: 3503 DownloadPDBFiles.pl, PyMOLVisualizeCavities.py, 3504 PyMOLVisualizeCryoEMDensity.py, PyMOLVisualizeElectronDensity.py, 3505 PyMOLVisualizeInterfaces.py, PyMOLVisualizeSurfaceAndBuriedResidues.py 3506 3507 Copyright: 3508 Copyright (C) 2024 Manish Sud. All rights reserved. 3509 3510 The functionality available in this script is implemented using PyMOL, a 3511 molecular visualization system on an open source foundation originally 3512 developed by Warren DeLano. 3513 3514 This file is part of MayaChemTools. 3515 3516 MayaChemTools is free software; you can redistribute it and/or modify it under 3517 the terms of the GNU Lesser General Public License as published by the Free 3518 Software Foundation; either version 3 of the License, or (at your option) any 3519 later version. 3520 3521 """ 3522 3523 if __name__ == "__main__": 3524 main()