Package AutoDockTools :: Package VisionInterface :: Module recluster
[hide private]
[frames] | no frames]

Source Code for Module AutoDockTools.VisionInterface.recluster

  1  ######################################################################## 
  2  # 
  3  #    Vision Macro - Python source code - file generated by vision 
  4  #    Tuesday 25 July 2006 11:59:24  
  5  #     
  6  #       The Scripps Research Institute (TSRI) 
  7  #       Molecular Graphics Lab 
  8  #       La Jolla, CA 92037, USA 
  9  # 
 10  # Copyright: Daniel Stoffler, Michel Sanner and TSRI 
 11  #    
 12  # revision: Guillaume Vareille 
 13  #   
 14  ######################################################################### 
 15  # 
 16  # $Header: /opt/cvs/python/packages/share1.5/AutoDockTools/VisionInterface/recluster.py,v 1.1 2006/07/25 23:35:30 rhuey Exp $ 
 17  # 
 18  # $Id: recluster.py,v 1.1 2006/07/25 23:35:30 rhuey Exp $ 
 19  # 
 20   
 21  from NetworkEditor.macros import MacroNode 
22 -class recluster(MacroNode):
23
24 - def __init__(self, constrkw={}, name='recluster', **kw):
25 kw['name'] = name 26 apply( MacroNode.__init__, (self,), kw)
27
28 - def beforeAddingToNetwork(self, net):
29 MacroNode.beforeAddingToNetwork(self, net) 30 ## loading libraries ## 31 from MolKit.VisionInterface.MolKitNodes import molkitlib 32 net.editor.addLibraryInstance(molkitlib,"MolKit.VisionInterface.MolKitNodes", "molkitlib") 33 34 from Vision.StandardNodes import stdlib 35 net.editor.addLibraryInstance(stdlib,"Vision.StandardNodes", "stdlib")
36 37
38 - def afterAddingToNetwork(self):
39 from NetworkEditor.macros import MacroNode 40 MacroNode.afterAddingToNetwork(self) 41 ## loading libraries ## 42 from MolKit.VisionInterface.MolKitNodes import molkitlib 43 from Vision.StandardNodes import stdlib 44 ## building macro network ## 45 recluster_11 = self 46 from traceback import print_exc 47 48 ## loading libraries ## 49 from MolKit.VisionInterface.MolKitNodes import molkitlib 50 self.macroNetwork.getEditor().addLibraryInstance(molkitlib,"MolKit.VisionInterface.MolKitNodes", "molkitlib") 51 52 from Vision.StandardNodes import stdlib 53 self.macroNetwork.getEditor().addLibraryInstance(stdlib,"Vision.StandardNodes", "stdlib") 54 55 try: 56 ## saving node input Ports ## 57 input_Ports_12 = self.macroNetwork.ipNode 58 input_Ports_12.move(172, 137) 59 except: 60 print "WARNING: failed to restore MacroInputNode named input Ports in network self.macroNetwork" 61 print_exc() 62 input_Ports_12=None 63 64 try: 65 ## saving node output Ports ## 66 output_Ports_13 = self.macroNetwork.opNode 67 output_Ports_13.move(172, 479) 68 except: 69 print "WARNING: failed to restore MacroOutputNode named output Ports in network self.macroNetwork" 70 print_exc() 71 output_Ports_13=None 72 73 try: 74 ## saving node Docking ## 75 from Vision.StandardNodes import Generic 76 Docking_16 = Generic(constrkw = {}, name='Docking', library=stdlib) 77 self.macroNetwork.addNode(Docking_16,189,250) 78 apply(Docking_16.addInputPort, (), {'name': 'docking_logs', 'cast': True, 'datatype': 'list', 'balloon': 'list of docking log files to be read into as a single Docking', 'height': 12, 'width': 12, 'shape': 'oval', 'color': 'cyan'}) 79 apply(Docking_16.addInputPort, (), {'name': 'rmsTool', 'cast': True, 'datatype': 'None', 'balloon': 'rmsTool to be used for clustering', 'required': False, 'height': 8, 'width': 12, 'shape': 'diamond', 'color': 'white'}) 80 apply(Docking_16.addOutputPort, (), {'name': 'docking', 'datatype': 'None', 'balloon': 'docking instance', 'height': 8, 'width': 12, 'shape': 'diamond', 'color': 'white'}) 81 code = """def doit(self, docking_logs, rmsTool): 82 from AutoDockTools.Docking import Docking 83 d = Docking() 84 for f in docking_logs: 85 d.readDlg(f) 86 d.clusterer.rmsTool = rmsTool 87 self.outputData(docking = d) 88 89 90 ## to ouput data on port docking use 91 ## self.outputData(docking=data) 92 93 94 """ 95 Docking_16.configure(function=code) 96 except: 97 print "WARNING: failed to restore Generic named Docking in network self.macroNetwork" 98 print_exc() 99 Docking_16=None 100 101 try: 102 ## saving node rmsTool ## 103 from Vision.StandardNodes import Generic 104 rmsTool_17 = Generic(constrkw = {}, name='rmsTool', library=stdlib) 105 self.macroNetwork.addNode(rmsTool_17,206,197) 106 apply(rmsTool_17.addInputPort, (), {'name': 'crds', 'cast': True, 'datatype': 'coordinates3D', 'balloon': 'coordinates to use as reference for rms calculation.', 'height': 8, 'width': 12, 'shape': 'rect', 'color': 'green'}) 107 apply(rmsTool_17.addOutputPort, (), {'name': 'rmsTool', 'datatype': 'None', 'balloon': 'rmsTool created using crds as reference', 'height': 8, 'width': 12, 'shape': 'diamond', 'color': 'white'}) 108 code = """def doit(self, crds): 109 from mglutil.math.rmsd import RMSDCalculator 110 rmsTool = RMSDCalculator(crds) 111 self.outputData(rmsTool = rmsTool) 112 113 """ 114 rmsTool_17.configure(function=code) 115 except: 116 print "WARNING: failed to restore Generic named rmsTool in network self.macroNetwork" 117 print_exc() 118 rmsTool_17=None 119 120 try: 121 ## saving node Read Molecule ## 122 from MolKit.VisionInterface.MolKitNodes import ReadMolecule 123 Read_Molecule_18 = ReadMolecule(constrkw = {}, name='Read Molecule', library=molkitlib) 124 self.macroNetwork.addNode(Read_Molecule_18,243,16) 125 apply(Read_Molecule_18.inputPortByName['filename'].configure, (), {'color': 'white', 'cast': True, 'shape': 'oval'}) 126 apply(Read_Molecule_18.outputPortByName['MolSets'].configure, (), {'color': '#c64e70', 'shape': 'oval'}) 127 Read_Molecule_18.inputPortByName['filename'].widget.set("ind.pdbqt", run=False) 128 except: 129 print "WARNING: failed to restore ReadMolecule named Read Molecule in network self.macroNetwork" 130 print_exc() 131 Read_Molecule_18=None 132 133 try: 134 ## saving node Index ## 135 from Vision.StandardNodes import Index 136 Index_19 = Index(constrkw = {}, name='Index', library=stdlib) 137 self.macroNetwork.addNode(Index_19,243,66) 138 apply(Index_19.inputPortByName['data'].configure, (), {'datatype': 'MoleculeSet', 'cast': True, 'shape': 'oval', 'color': '#c64e70'}) 139 apply(Index_19.inputPortByName['index'].configure, (), {'color': 'yellow', 'cast': True, 'shape': 'circle'}) 140 apply(Index_19.outputPortByName['data'].configure, (), {'color': 'white', 'shape': 'diamond'}) 141 except: 142 print "WARNING: failed to restore Index named Index in network self.macroNetwork" 143 print_exc() 144 Index_19=None 145 146 try: 147 ## saving node Get allAtoms.coords ## 148 from Vision.StandardNodes import GetAttr 149 Get_allAtoms_coords_20 = GetAttr(constrkw = {}, name='Get allAtoms.coords', library=stdlib) 150 self.macroNetwork.addNode(Get_allAtoms_coords_20,243,115) 151 apply(Get_allAtoms_coords_20.inputPortByName['objects'].configure, (), {'color': 'white', 'cast': True, 'shape': 'diamond'}) 152 apply(Get_allAtoms_coords_20.inputPortByName['attr'].configure, (), {'color': 'white', 'cast': True, 'shape': 'oval'}) 153 apply(Get_allAtoms_coords_20.outputPortByName['attrs'].configure, (), {'color': 'cyan', 'shape': 'oval'}) 154 apply(Get_allAtoms_coords_20.inputPortByName['attr'].widget.configure, (), {'choices': ('AAradii', 'AtomRadiiPatterns', 'NodesFromName', 'ROOT', 'TORSDOF', '_MarkTree', '__cmp__', '__doc__', '__eq__', '__hash__', '__init__', '__module__', '__ne__', '__repr__', '__str__', '_atomRadius', '_copyNode', '_copy_atom_attr', '_fit_atom_into_tree', '_numberOfDeletedNodes', 'addBond', 'adopt', 'allAtoms', 'assignUniqIndex', 'atmNum', 'attach_nonbonded_fragments', 'bonds', 'bondsflag', 'buildBondsBhtree', 'buildBondsByDistance', 'buildBondsByDistanceOnAtoms', 'buildBrokenBonds', 'chains', 'childByName', 'children', 'childrenName', 'childrenSetClass', 'closerThan', 'compare', 'compiled_patterns', 'configureProgressBar', 'copy', 'defaultRadii', 'deleteSubTree', 'dump', 'elementType', 'findLevels', 'findType', 'full_name', 'get', 'getAtoms', 'getCenter', 'getNext', 'getParentOfType', 'getPrevious', 'getRoot', 'getTypeList', 'hasBonds', 'hasSS', 'isAbove', 'isBelow', 'levels', 'makeNameUniq', 'merge', 'mergeNPH', 'name', 'ndihe', 'p', 'parent', 'parser', 'read', 'remove', 'removeAllHydrogens', 'removeBond', 'secondaryStructure', 'secondaryStructureFromFile', 'secondaryStructureFromStride', 'setClass', 'split', 'subTree', 'top', 'torTree', 'updateProgressBar', 'write')}) 155 Get_allAtoms_coords_20.inputPortByName['attr'].widget.set("allAtoms.coords", run=False) 156 apply(Get_allAtoms_coords_20.configure, (), {'expanded': True}) 157 except: 158 print "WARNING: failed to restore GetAttr named Get allAtoms.coords in network self.macroNetwork" 159 print_exc() 160 Get_allAtoms_coords_20=None 161 162 try: 163 ## saving node Get clusterer ## 164 from Vision.StandardNodes import GetAttr 165 Get_clusterer_21 = GetAttr(constrkw = {}, name='Get clusterer', library=stdlib) 166 self.macroNetwork.addNode(Get_clusterer_21,189,306) 167 apply(Get_clusterer_21.inputPortByName['objects'].configure, (), {'color': 'white', 'cast': True, 'shape': 'diamond'}) 168 apply(Get_clusterer_21.inputPortByName['attr'].configure, (), {'color': 'white', 'cast': True, 'shape': 'oval'}) 169 apply(Get_clusterer_21.outputPortByName['attrs'].configure, (), {'color': 'cyan', 'shape': 'oval'}) 170 apply(Get_clusterer_21.inputPortByName['attr'].widget.configure, (), {'choices': ('__doc__', '__init__', '__module__', 'addConformations', 'ch', 'clusterer', 'clusterer_dict', 'defaultParser', 'dlo_list', 'flex_res', 'ligMol', 'parser', 'readDlg', 'readEntropiaResults', 'readXMLResults', 'set_ligand', 'version', 'warnings', 'writeConformation', 'write_current_conformation')}) 171 Get_clusterer_21.inputPortByName['attr'].widget.set("clusterer", run=False) 172 apply(Get_clusterer_21.configure, (), {'expanded': True}) 173 except: 174 print "WARNING: failed to restore GetAttr named Get clusterer in network self.macroNetwork" 175 print_exc() 176 Get_clusterer_21=None 177 178 try: 179 ## saving node Index ## 180 from Vision.StandardNodes import Index 181 Index_22 = Index(constrkw = {}, name='Index', library=stdlib) 182 self.macroNetwork.addNode(Index_22,188,383) 183 apply(Index_22.inputPortByName['data'].configure, (), {'datatype': 'list', 'cast': True, 'shape': 'oval', 'color': 'cyan'}) 184 apply(Index_22.inputPortByName['index'].configure, (), {'color': 'yellow', 'cast': True, 'shape': 'circle'}) 185 apply(Index_22.outputPortByName['data'].configure, (), {'color': 'white', 'shape': 'diamond'}) 186 except: 187 print "WARNING: failed to restore Index named Index in network self.macroNetwork" 188 print_exc() 189 Index_22=None 190 191 try: 192 ## saving node make clustering ## 193 from Vision.StandardNodes import Generic 194 make_clustering_23 = Generic(constrkw = {}, name='make clustering', library=stdlib) 195 self.macroNetwork.addNode(make_clustering_23,189,432) 196 apply(make_clustering_23.addInputPort, (), {'name': 'clusterer', 'cast': True, 'datatype': 'None', 'balloon': 'clusterer which will make the new clustering', 'height': 8, 'width': 12, 'shape': 'diamond', 'color': 'white'}) 197 apply(make_clustering_23.addInputPort, (), {'name': 'tolerance', 'cast': True, 'datatype': 'float', 'balloon': 'rms tolerance for the new clustering', 'height': 12, 'width': 12, 'shape': 'circle', 'color': 'green'}) 198 apply(make_clustering_23.addOutputPort, (), {'name': 'clustering', 'datatype': 'None', 'balloon': 'clustering at newest rms', 'height': 8, 'width': 12, 'shape': 'diamond', 'color': 'white'}) 199 code = """def doit(self, clusterer, tolerance): 200 clusterer.make_clustering(tolerance) 201 self.outputData(clustering = clusterer.clustering_dict[tolerance]) 202 """ 203 make_clustering_23.configure(function=code) 204 except: 205 print "WARNING: failed to restore Generic named make clustering in network self.macroNetwork" 206 print_exc() 207 make_clustering_23=None 208 209 try: 210 ## saving node Dial ## 211 from Vision.StandardNodes import DialNE 212 Dial_24 = DialNE(constrkw = {}, name='Dial', library=stdlib) 213 self.macroNetwork.addNode(Dial_24,233,380) 214 apply(Dial_24.inputPortByName['dial'].configure, (), {'color': 'green', 'cast': True, 'shape': 'circle'}) 215 apply(Dial_24.inputPortByName['mini'].configure, (), {'color': 'green', 'cast': True, 'shape': 'circle'}) 216 apply(Dial_24.inputPortByName['maxi'].configure, (), {'color': 'green', 'cast': True, 'shape': 'circle'}) 217 apply(Dial_24.outputPortByName['value'].configure, (), {'color': 'green', 'shape': 'circle'}) 218 Dial_24.inputPortByName['dial'].widget.set(3.0, run=False) 219 apply(Dial_24.configure, (), {'expanded': False}) 220 except: 221 print "WARNING: failed to restore DialNE named Dial in network self.macroNetwork" 222 print_exc() 223 Dial_24=None 224 225 self.macroNetwork.freeze() 226 227 ## saving connections for network recluster ## 228 if rmsTool_17 is not None and Docking_16 is not None: 229 try: 230 self.macroNetwork.connectNodes( 231 rmsTool_17, Docking_16, "rmsTool", "rmsTool", blocking=True) 232 except: 233 print "WARNING: failed to restore connection between rmsTool_17 and Docking_16 in network self.macroNetwork" 234 if Read_Molecule_18 is not None and Index_19 is not None: 235 try: 236 self.macroNetwork.connectNodes( 237 Read_Molecule_18, Index_19, "MolSets", "data", blocking=True) 238 except: 239 print "WARNING: failed to restore connection between Read_Molecule_18 and Index_19 in network self.macroNetwork" 240 if Index_19 is not None and Get_allAtoms_coords_20 is not None: 241 try: 242 self.macroNetwork.connectNodes( 243 Index_19, Get_allAtoms_coords_20, "data", "objects", blocking=True) 244 except: 245 print "WARNING: failed to restore connection between Index_19 and Get_allAtoms_coords_20 in network self.macroNetwork" 246 if Get_allAtoms_coords_20 is not None and rmsTool_17 is not None: 247 try: 248 self.macroNetwork.connectNodes( 249 Get_allAtoms_coords_20, rmsTool_17, "attrs", "crds", blocking=True) 250 except: 251 print "WARNING: failed to restore connection between Get_allAtoms_coords_20 and rmsTool_17 in network self.macroNetwork" 252 if Docking_16 is not None and Get_clusterer_21 is not None: 253 try: 254 self.macroNetwork.connectNodes( 255 Docking_16, Get_clusterer_21, "docking", "objects", blocking=True) 256 except: 257 print "WARNING: failed to restore connection between Docking_16 and Get_clusterer_21 in network self.macroNetwork" 258 if Get_clusterer_21 is not None and Index_22 is not None: 259 try: 260 self.macroNetwork.connectNodes( 261 Get_clusterer_21, Index_22, "attrs", "data", blocking=True) 262 except: 263 print "WARNING: failed to restore connection between Get_clusterer_21 and Index_22 in network self.macroNetwork" 264 if Index_22 is not None and make_clustering_23 is not None: 265 try: 266 self.macroNetwork.connectNodes( 267 Index_22, make_clustering_23, "data", "clusterer", blocking=True) 268 except: 269 print "WARNING: failed to restore connection between Index_22 and make_clustering_23 in network self.macroNetwork" 270 if Dial_24 is not None and make_clustering_23 is not None: 271 try: 272 self.macroNetwork.connectNodes( 273 Dial_24, make_clustering_23, "value", "tolerance", blocking=True) 274 except: 275 print "WARNING: failed to restore connection between Dial_24 and make_clustering_23 in network self.macroNetwork" 276 output_Ports_13 = self.macroNetwork.opNode 277 if make_clustering_23 is not None and output_Ports_13 is not None: 278 try: 279 self.macroNetwork.connectNodes( 280 make_clustering_23, output_Ports_13, "clustering", "new", blocking=True) 281 except: 282 print "WARNING: failed to restore connection between make_clustering_23 and output_Ports_13 in network self.macroNetwork" 283 input_Ports_12 = self.macroNetwork.ipNode 284 if input_Ports_12 is not None and Docking_16 is not None: 285 try: 286 self.macroNetwork.connectNodes( 287 input_Ports_12, Docking_16, "new", "docking_logs", blocking=True) 288 except: 289 print "WARNING: failed to restore connection between input_Ports_12 and Docking_16 in network self.macroNetwork" 290 self.macroNetwork.unfreeze() 291 292 recluster_11.shrink() 293 294 ## reset modifications ## 295 recluster_11.resetTags() 296 recluster_11.buildOriginalList()
297