Esempio n. 1
0
    def afterAddingToNetwork(self):
        masterNet = self.macroNetwork
        from NetworkEditor.macros import MacroNode
        MacroNode.afterAddingToNetwork(self)
        from WebServices.VisionInterface.WSNodes import wslib
        from Vision.StandardNodes import stdlib
        ## building macro network ##
        ComputeGrids_18 = self
        from traceback import print_exc
        from WebServices.VisionInterface.WSNodes import wslib
        from Vision.StandardNodes import stdlib
        masterNet.getEditor().addLibraryInstance(
            wslib, "WebServices.VisionInterface.WSNodes", "wslib")
        from WebServices.VisionInterface.WSNodes import addOpalServerAsCategory
        try:
            addOpalServerAsCategory("http://kryptonite.nbcr.net/opal2",
                                    replace=False)
        except:
            pass
        try:
            ## saving node input Ports ##
            input_Ports_19 = self.macroNetwork.ipNode
            apply(input_Ports_19.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print "WARNING: failed to restore MacroInputNode named input Ports in network self.macroNetwork"
            print_exc()
            input_Ports_19 = None

        try:
            ## saving node output Ports ##
            output_Ports_20 = self.macroNetwork.opNode
            apply(output_Ports_20.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
            output_Ports_20.move(217, 471)
        except:
            print "WARNING: failed to restore MacroOutputNode named output Ports in network self.macroNetwork"
            print_exc()
            output_Ports_20 = None

        try:
            ## saving node GetComputeGridsInputs ##
            from Vision.StandardNodes import Generic
            GetComputeGridsInputs_21 = Generic(constrkw={},
                                               name='GetComputeGridsInputs',
                                               library=stdlib)
            self.macroNetwork.addNode(GetComputeGridsInputs_21, 217, 79)
            apply(
                GetComputeGridsInputs_21.addInputPort, (), {
                    'singleConnection': True,
                    'name': 'ligands',
                    'cast': True,
                    'datatype': 'LigandDB',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'rect',
                    'color': '#FFCCFF',
                    'originalDatatype': 'None'
                })
            apply(
                GetComputeGridsInputs_21.addInputPort, (), {
                    'singleConnection': True,
                    'name': 'receptor_pdbqt',
                    'cast': True,
                    'datatype': 'receptor_prepared',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'triangle',
                    'color': '#009900',
                    'originalDatatype': 'None'
                })
            apply(
                GetComputeGridsInputs_21.addInputPort, (), {
                    'singleConnection': True,
                    'name': 'gpf_obj',
                    'cast': True,
                    'datatype': 'gpf_template',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'triangle',
                    'color': '#FF3333',
                    'originalDatatype': 'None'
                })
            apply(
                GetComputeGridsInputs_21.addOutputPort, (), {
                    'name': 'gpf_template_path',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            apply(
                GetComputeGridsInputs_21.addOutputPort, (), {
                    'name': 'filter_file',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            apply(
                GetComputeGridsInputs_21.addOutputPort, (), {
                    'name': 'ligand_lib',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            apply(
                GetComputeGridsInputs_21.addOutputPort, (), {
                    'name': 'prepared_receptor',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            code = """def doit(self, ligands, receptor_pdbqt, gpf_obj):
        gpf_path = gpf_obj.fullpath

        if not(os.path.exists(gpf_path)):
            print "ERROR: GPF template " + gpf_path + " does not exist!"
            return '''stop'''

        filter_file = ligands.filter_file
        ligand_lib = ligands.loc
        prepared_receptor = receptor_pdbqt.path

        pass

        self.outputData(gpf_template_path=gpf_path, filter_file=filter_file, ligand_lib=ligand_lib, prepared_receptor=prepared_receptor)

## to ouput data on port gpf_template_path use
## self.outputData(gpf_template_path=data)
## to ouput data on port filter_file use
## self.outputData(filter_file=data)
## to ouput data on port ligand_lib use
## self.outputData(ligand_lib=data)
## to ouput data on port prepared_receptor use
## self.outputData(prepared_receptor=data)






"""
            GetComputeGridsInputs_21.configure(function=code)
            apply(GetComputeGridsInputs_21.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print "WARNING: failed to restore Generic named GetComputeGridsInputs in network self.macroNetwork"
            print_exc()
            GetComputeGridsInputs_21 = None

        try:
            ## saving node prepareGPF_kryptonite_nbcr_net ##
            from NetworkEditor.items import FunctionNode
            prepareGPF_kryptonite_nbcr_net_22 = FunctionNode(
                functionOrString='prepareGPF_kryptonite_nbcr_net',
                host="http://kryptonite.nbcr.net/opal2",
                namedArgs={
                    'singlelib': '',
                    'r_url': '',
                    'zpoints': '',
                    'filter_file_url': '',
                    'lib': '',
                    'ypoints': '',
                    'filter_file': '',
                    'gpf': '',
                    'xcenter': 'auto',
                    'urllib': '',
                    'p': '',
                    'r': '',
                    'o': '',
                    'zcenter': 'auto',
                    'v': False,
                    'userlib': '',
                    'xpoints': '',
                    'localRun': False,
                    'ycenter': 'auto',
                    'execPath': ''
                },
                constrkw={
                    'functionOrString': "'prepareGPF_kryptonite_nbcr_net'",
                    'host': '"http://kryptonite.nbcr.net/opal2"',
                    'namedArgs': {
                        'singlelib': '',
                        'r_url': '',
                        'zpoints': '',
                        'filter_file_url': '',
                        'lib': '',
                        'ypoints': '',
                        'filter_file': '',
                        'gpf': '',
                        'xcenter': 'auto',
                        'urllib': '',
                        'p': '',
                        'r': '',
                        'o': '',
                        'zcenter': 'auto',
                        'v': False,
                        'userlib': '',
                        'xpoints': '',
                        'localRun': False,
                        'ycenter': 'auto',
                        'execPath': ''
                    }
                },
                name='prepareGPF_kryptonite_nbcr_net',
                library=wslib)
            self.macroNetwork.addNode(prepareGPF_kryptonite_nbcr_net_22, 217,
                                      141)
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['singlelib'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['r_url'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['zpoints'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.
                inputPortByName['filter_file_url'].configure, (),
                {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['lib'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['ypoints'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.
                inputPortByName['filter_file'].configure, (),
                {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['gpf'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['xcenter'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['urllib'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['p'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['r'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['o'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['zcenter'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['v'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['userlib'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['xpoints'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['localRun'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['ycenter'].
                configure, (), {'defaultValue': None})
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['execPath'].
                configure, (), {'defaultValue': None})
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'singlelib'].widget.set(r"", run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'r_url'].widget.set(r"", run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'zpoints'].widget.set(r"", run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'filter_file_url'].widget.set(r"", run=False)
            apply(
                prepareGPF_kryptonite_nbcr_net_22.inputPortByName['lib'].
                widget.configure, (), {
                    'choices':
                    ('sample', 'NCIDS_SC', 'NCI_DS1', 'NCI_DS2', 'oldNCI',
                     'human_metabolome', 'chembridge_building_blocks',
                     'drugbank_nutraceutics', 'drugbank_smallmol',
                     'fda_approved')
                })
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'lib'].widget.set(r"", run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'ypoints'].widget.set(r"", run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'filter_file'].rebindWidget()
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'filter_file'].widget.set(r"", run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'filter_file'].unbindWidget()
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'gpf'].rebindWidget()
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'gpf'].widget.set(r"", run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'gpf'].unbindWidget()
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'xcenter'].widget.set(r"auto", run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'urllib'].rebindWidget()
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'urllib'].widget.set(r"", run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'urllib'].unbindWidget()
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName['p'].widget.set(
                r"", run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'r'].rebindWidget()
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName['r'].widget.set(
                r"", run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'r'].unbindWidget()
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName['o'].widget.set(
                r"", run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'zcenter'].widget.set(r"auto", run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName['v'].widget.set(
                0, run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'userlib'].widget.set(r"", run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'xpoints'].widget.set(r"", run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'localRun'].widget.set(0, run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'ycenter'].widget.set(r"auto", run=False)
            prepareGPF_kryptonite_nbcr_net_22.inputPortByName[
                'execPath'].widget.set(r"", run=False)
            apply(prepareGPF_kryptonite_nbcr_net_22.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print "WARNING: failed to restore FunctionNode named prepareGPF_kryptonite_nbcr_net in network self.macroNetwork"
            print_exc()
            prepareGPF_kryptonite_nbcr_net_22 = None

        try:
            ## saving node autogrid_kryptonite_nbcr_net ##
            from NetworkEditor.items import FunctionNode
            autogrid_kryptonite_nbcr_net_23 = FunctionNode(
                functionOrString='autogrid_kryptonite_nbcr_net',
                host="http://kryptonite.nbcr.net/opal2",
                namedArgs={
                    'p_url': '',
                    'infile_url': '',
                    'l': 'output.glg',
                    'o': False,
                    'p': '',
                    'localRun': False,
                    'inFile': '',
                    'execPath': ''
                },
                constrkw={
                    'functionOrString': "'autogrid_kryptonite_nbcr_net'",
                    'host': '"http://kryptonite.nbcr.net/opal2"',
                    'namedArgs': {
                        'p_url': '',
                        'infile_url': '',
                        'l': 'output.glg',
                        'o': False,
                        'p': '',
                        'localRun': False,
                        'inFile': '',
                        'execPath': ''
                    }
                },
                name='autogrid_kryptonite_nbcr_net',
                library=wslib)
            self.macroNetwork.addNode(autogrid_kryptonite_nbcr_net_23, 251,
                                      292)
            apply(
                autogrid_kryptonite_nbcr_net_23.inputPortByName['p_url'].
                configure, (), {'defaultValue': None})
            apply(
                autogrid_kryptonite_nbcr_net_23.inputPortByName['infile_url'].
                configure, (), {'defaultValue': None})
            apply(
                autogrid_kryptonite_nbcr_net_23.inputPortByName['l'].configure,
                (), {'defaultValue': None})
            apply(
                autogrid_kryptonite_nbcr_net_23.inputPortByName['o'].configure,
                (), {'defaultValue': None})
            apply(
                autogrid_kryptonite_nbcr_net_23.inputPortByName['p'].configure,
                (), {'defaultValue': None})
            apply(
                autogrid_kryptonite_nbcr_net_23.inputPortByName['localRun'].
                configure, (), {'defaultValue': None})
            apply(
                autogrid_kryptonite_nbcr_net_23.inputPortByName['inFile'].
                configure, (), {'defaultValue': None})
            apply(
                autogrid_kryptonite_nbcr_net_23.inputPortByName['execPath'].
                configure, (), {'defaultValue': None})
            autogrid_kryptonite_nbcr_net_23.inputPortByName[
                'p_url'].rebindWidget()
            autogrid_kryptonite_nbcr_net_23.inputPortByName[
                'p_url'].widget.set(r"", run=False)
            autogrid_kryptonite_nbcr_net_23.inputPortByName[
                'p_url'].unbindWidget()
            autogrid_kryptonite_nbcr_net_23.inputPortByName[
                'infile_url'].widget.set(r"", run=False)
            autogrid_kryptonite_nbcr_net_23.inputPortByName['l'].widget.set(
                r"output.glg", run=False)
            autogrid_kryptonite_nbcr_net_23.inputPortByName['o'].widget.set(
                0, run=False)
            autogrid_kryptonite_nbcr_net_23.inputPortByName['p'].widget.set(
                r"", run=False)
            autogrid_kryptonite_nbcr_net_23.inputPortByName[
                'localRun'].widget.set(0, run=False)
            autogrid_kryptonite_nbcr_net_23.inputPortByName[
                'inFile'].rebindWidget()
            autogrid_kryptonite_nbcr_net_23.inputPortByName[
                'inFile'].widget.set(r"", run=False)
            autogrid_kryptonite_nbcr_net_23.inputPortByName[
                'inFile'].unbindWidget()
            autogrid_kryptonite_nbcr_net_23.inputPortByName[
                'execPath'].widget.set(r"", run=False)
            apply(autogrid_kryptonite_nbcr_net_23.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print "WARNING: failed to restore FunctionNode named autogrid_kryptonite_nbcr_net in network self.macroNetwork"
            print_exc()
            autogrid_kryptonite_nbcr_net_23 = None

        try:
            ## saving node GetMainURLFromList ##
            from WebServices.VisionInterface.WSNodes import GetMainURLFromListNode
            GetMainURLFromList_24 = GetMainURLFromListNode(
                constrkw={}, name='GetMainURLFromList', library=wslib)
            self.macroNetwork.addNode(GetMainURLFromList_24, 251, 348)
            apply(GetMainURLFromList_24.inputPortByName['urls'].configure, (),
                  {'defaultValue': None})
            apply(GetMainURLFromList_24.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print "WARNING: failed to restore GetMainURLFromListNode named GetMainURLFromList in network self.macroNetwork"
            print_exc()
            GetMainURLFromList_24 = None

        try:
            ## saving node MakeAutogridResultObj ##
            from Vision.StandardNodes import Generic
            MakeAutogridResultObj_25 = Generic(constrkw={},
                                               name='MakeAutogridResultObj',
                                               library=stdlib)
            self.macroNetwork.addNode(MakeAutogridResultObj_25, 121, 402)
            apply(
                MakeAutogridResultObj_25.addInputPort, (), {
                    'singleConnection': True,
                    'name': 'autogrid_result_url',
                    'cast': True,
                    'datatype': 'string',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white',
                    'originalDatatype': 'None'
                })
            apply(
                MakeAutogridResultObj_25.addOutputPort, (), {
                    'name': 'autogrid_result_obj',
                    'datatype': 'autogrid_results',
                    'height': 8,
                    'width': 12,
                    'shape': 'triangle',
                    'color': '#FF33CC'
                })
            code = """def doit(self, autogrid_result_url):
        from AutoDockTools.VisionInterface.Adt.autogrid_results import autogrid_results

        agro = autogrid_results(autogrid_result_url, '''url''')
        
	pass
## to ouput data on port autogrid_result_obj use
        self.outputData(autogrid_result_obj=agro)

"""
            MakeAutogridResultObj_25.configure(function=code)
            apply(MakeAutogridResultObj_25.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print "WARNING: failed to restore Generic named MakeAutogridResultObj in network self.macroNetwork"
            print_exc()
            MakeAutogridResultObj_25 = None

        try:
            ## saving node GetURLFromList ##
            from WebServices.VisionInterface.WSNodes import GetURLFromListNode
            GetURLFromList_26 = GetURLFromListNode(constrkw={},
                                                   name='GetURLFromList',
                                                   library=wslib)
            self.macroNetwork.addNode(GetURLFromList_26, 110, 198)
            apply(GetURLFromList_26.inputPortByName['urllist'].configure, (),
                  {'defaultValue': None})
            apply(GetURLFromList_26.inputPortByName['ext'].configure, (),
                  {'defaultValue': None})
            GetURLFromList_26.inputPortByName['ext'].widget.set(r"gpf",
                                                                run=False)
            apply(GetURLFromList_26.configure, (), {'paramPanelImmediate': 1})
        except:
            print "WARNING: failed to restore GetURLFromListNode named GetURLFromList in network self.macroNetwork"
            print_exc()
            GetURLFromList_26 = None

        #self.macroNetwork.run()
        self.macroNetwork.freeze()

        ## saving connections for network ComputeGrids ##
        input_Ports_19 = self.macroNetwork.ipNode
        if input_Ports_19 is not None and GetComputeGridsInputs_21 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_19,
                    GetComputeGridsInputs_21,
                    "new",
                    "ligands",
                    blocking=True,
                    splitratio=[0.25038057532685992, 0.40242243717082576])
            except:
                print "WARNING: failed to restore connection between input_Ports_19 and GetComputeGridsInputs_21 in network self.macroNetwork"
        if input_Ports_19 is not None and GetComputeGridsInputs_21 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_19,
                    GetComputeGridsInputs_21,
                    "new",
                    "receptor_pdbqt",
                    blocking=True,
                    splitratio=[0.31642654296910228, 0.49356822236979669])
            except:
                print "WARNING: failed to restore connection between input_Ports_19 and GetComputeGridsInputs_21 in network self.macroNetwork"
        if input_Ports_19 is not None and GetComputeGridsInputs_21 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_19,
                    GetComputeGridsInputs_21,
                    "new",
                    "gpf_obj",
                    blocking=True,
                    splitratio=[0.57570983312901203, 0.33826779179418875])
            except:
                print "WARNING: failed to restore connection between input_Ports_19 and GetComputeGridsInputs_21 in network self.macroNetwork"
        if GetComputeGridsInputs_21 is not None and prepareGPF_kryptonite_nbcr_net_22 is not None:
            try:
                self.macroNetwork.connectNodes(
                    GetComputeGridsInputs_21,
                    prepareGPF_kryptonite_nbcr_net_22,
                    "gpf_template_path",
                    "gpf",
                    blocking=True,
                    splitratio=[0.37911517364560754, 0.49588454022594075])
            except:
                print "WARNING: failed to restore connection between GetComputeGridsInputs_21 and prepareGPF_kryptonite_nbcr_net_22 in network self.macroNetwork"
        if GetComputeGridsInputs_21 is not None and prepareGPF_kryptonite_nbcr_net_22 is not None:
            try:
                self.macroNetwork.connectNodes(
                    GetComputeGridsInputs_21,
                    prepareGPF_kryptonite_nbcr_net_22,
                    "filter_file",
                    "filter_file",
                    blocking=True,
                    splitratio=[0.51555458245420727, 0.58910990532612562])
            except:
                print "WARNING: failed to restore connection between GetComputeGridsInputs_21 and prepareGPF_kryptonite_nbcr_net_22 in network self.macroNetwork"
        if GetComputeGridsInputs_21 is not None and prepareGPF_kryptonite_nbcr_net_22 is not None:
            try:
                self.macroNetwork.connectNodes(
                    GetComputeGridsInputs_21,
                    prepareGPF_kryptonite_nbcr_net_22,
                    "ligand_lib",
                    "urllib",
                    blocking=True,
                    splitratio=[0.45378244060628786, 0.49829462092378918])
            except:
                print "WARNING: failed to restore connection between GetComputeGridsInputs_21 and prepareGPF_kryptonite_nbcr_net_22 in network self.macroNetwork"
        if GetComputeGridsInputs_21 is not None and prepareGPF_kryptonite_nbcr_net_22 is not None:
            try:
                self.macroNetwork.connectNodes(
                    GetComputeGridsInputs_21,
                    prepareGPF_kryptonite_nbcr_net_22,
                    "prepared_receptor",
                    "r",
                    blocking=True,
                    splitratio=[0.30158184825681655, 0.46256232709378253])
            except:
                print "WARNING: failed to restore connection between GetComputeGridsInputs_21 and prepareGPF_kryptonite_nbcr_net_22 in network self.macroNetwork"
        if GetComputeGridsInputs_21 is not None and autogrid_kryptonite_nbcr_net_23 is not None:
            try:
                self.macroNetwork.connectNodes(
                    GetComputeGridsInputs_21,
                    autogrid_kryptonite_nbcr_net_23,
                    "prepared_receptor",
                    "inFile",
                    blocking=True,
                    splitratio=[0.63016045430148715, 0.62091422998177115])
            except:
                print "WARNING: failed to restore connection between GetComputeGridsInputs_21 and autogrid_kryptonite_nbcr_net_23 in network self.macroNetwork"
        if autogrid_kryptonite_nbcr_net_23 is not None and GetMainURLFromList_24 is not None:
            try:
                self.macroNetwork.connectNodes(
                    autogrid_kryptonite_nbcr_net_23,
                    GetMainURLFromList_24,
                    "result",
                    "urls",
                    blocking=True,
                    splitratio=[0.4713453370864038, 0.73699665503637379])
            except:
                print "WARNING: failed to restore connection between autogrid_kryptonite_nbcr_net_23 and GetMainURLFromList_24 in network self.macroNetwork"
        if GetMainURLFromList_24 is not None and MakeAutogridResultObj_25 is not None:
            try:
                self.macroNetwork.connectNodes(
                    GetMainURLFromList_24,
                    MakeAutogridResultObj_25,
                    "newurl",
                    "autogrid_result_url",
                    blocking=True,
                    splitratio=[0.37530325590010172, 0.67260462300696811])
            except:
                print "WARNING: failed to restore connection between GetMainURLFromList_24 and MakeAutogridResultObj_25 in network self.macroNetwork"
        output_Ports_20 = self.macroNetwork.opNode
        if MakeAutogridResultObj_25 is not None and output_Ports_20 is not None:
            try:
                self.macroNetwork.connectNodes(
                    MakeAutogridResultObj_25,
                    output_Ports_20,
                    "autogrid_result_obj",
                    "new",
                    blocking=True,
                    splitratio=[0.54860274312929591, 0.61692487705230459])
            except:
                print "WARNING: failed to restore connection between MakeAutogridResultObj_25 and output_Ports_20 in network self.macroNetwork"
        if GetMainURLFromList_24 is not None and output_Ports_20 is not None:
            try:
                self.macroNetwork.connectNodes(
                    GetMainURLFromList_24,
                    output_Ports_20,
                    "newurl",
                    "new",
                    blocking=True,
                    splitratio=[0.56961778623989434, 0.55443680742298707])
            except:
                print "WARNING: failed to restore connection between GetMainURLFromList_24 and output_Ports_20 in network self.macroNetwork"
        if prepareGPF_kryptonite_nbcr_net_22 is not None and GetURLFromList_26 is not None:
            try:
                self.macroNetwork.connectNodes(
                    prepareGPF_kryptonite_nbcr_net_22,
                    GetURLFromList_26,
                    "result",
                    "urllist",
                    blocking=True,
                    splitratio=[0.38550670487593142, 0.45424125807822219])
            except:
                print "WARNING: failed to restore connection between prepareGPF_kryptonite_nbcr_net_22 and GetURLFromList_26 in network self.macroNetwork"
        if GetURLFromList_26 is not None and autogrid_kryptonite_nbcr_net_23 is not None:
            try:
                self.macroNetwork.connectNodes(
                    GetURLFromList_26,
                    autogrid_kryptonite_nbcr_net_23,
                    "url",
                    "p_url",
                    blocking=True,
                    splitratio=[0.65566147293832433, 0.57782517914212228])
            except:
                print "WARNING: failed to restore connection between GetURLFromList_26 and autogrid_kryptonite_nbcr_net_23 in network self.macroNetwork"
        self.macroNetwork.runOnNewData.value = False

        ## modifying MacroInputNode dynamic ports
        input_Ports_19 = self.macroNetwork.ipNode
        input_Ports_19.outputPorts[1].configure(
            name='GetComputeGridsInputs_ligands')
        input_Ports_19.outputPorts[2].configure(
            name='GetComputeGridsInputs_receptor_pdbqt')
        input_Ports_19.outputPorts[3].configure(
            name='GetComputeGridsInputs_gpf_obj')

        ## modifying MacroOutputNode dynamic ports
        output_Ports_20 = self.macroNetwork.opNode
        output_Ports_20.inputPorts[1].configure(singleConnection='auto')
        output_Ports_20.inputPorts[2].configure(singleConnection='auto')
        output_Ports_20.inputPorts[1].configure(
            name='MakeAutogridResultObj_autogrid_result_obj')
        output_Ports_20.inputPorts[2].configure(
            name='GetMainURLFromList_newurl')
        ## configure MacroNode input ports
        ComputeGrids_18.inputPorts[0].configure(
            name='GetComputeGridsInputs_ligands')
        ComputeGrids_18.inputPorts[0].configure(datatype='LigandDB')
        ComputeGrids_18.inputPorts[1].configure(
            name='GetComputeGridsInputs_receptor_pdbqt')
        ComputeGrids_18.inputPorts[1].configure(datatype='receptor_prepared')
        ComputeGrids_18.inputPorts[2].configure(
            name='GetComputeGridsInputs_gpf_obj')
        ComputeGrids_18.inputPorts[2].configure(datatype='gpf_template')
        ## configure MacroNode output ports
        ComputeGrids_18.outputPorts[0].configure(
            name='MakeAutogridResultObj_autogrid_result_obj')
        ComputeGrids_18.outputPorts[0].configure(datatype='autogrid_results')
        ComputeGrids_18.outputPorts[1].configure(
            name='GetMainURLFromList_newurl')
        ComputeGrids_18.outputPorts[1].configure(datatype='string')

        ComputeGrids_18.shrink()

        ## reset modifications ##
        ComputeGrids_18.resetTags()
        ComputeGrids_18.buildOriginalList()
Esempio n. 2
0
    def afterAddingToNetwork(self):
        masterNet = self.macroNetwork
        from NetworkEditor.macros import MacroNode
        MacroNode.afterAddingToNetwork(self)
        from WebServices.VisionInterface.WSNodes import wslib
        from Vision.StandardNodes import stdlib
        ## building macro network ##
        TrajQR_0 = self
        from traceback import print_exc
        from WebServices.VisionInterface.WSNodes import wslib
        from Vision.StandardNodes import stdlib
        masterNet.getEditor().addLibraryInstance(
            wslib, "WebServices.VisionInterface.WSNodes", "wslib")
        from WebServices.VisionInterface.WSNodes import addOpalServerAsCategory
        try:
            addOpalServerAsCategory("http://kryptonite.nbcr.net/opal2",
                                    replace=False)
        except:
            pass
        try:
            ## saving node input Ports ##
            input_Ports_1 = self.macroNetwork.ipNode
            apply(input_Ports_1.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print "WARNING: failed to restore MacroInputNode named input Ports in network self.macroNetwork"
            print_exc()
            input_Ports_1 = None

        try:
            ## saving node output Ports ##
            output_Ports_2 = self.macroNetwork.opNode
            apply(output_Ports_2.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
            output_Ports_2.move(183, 405)
        except:
            print "WARNING: failed to restore MacroOutputNode named output Ports in network self.macroNetwork"
            print_exc()
            output_Ports_2 = None

        try:
            ## saving node Make_Zip_File ##
            from Vision.StandardNodes import MakeZipFileNE
            Make_Zip_File_3 = MakeZipFileNE(constrkw={},
                                            name='Make_Zip_File',
                                            library=stdlib)
            self.macroNetwork.addNode(Make_Zip_File_3, 47, 75)
            apply(Make_Zip_File_3.inputPortByName['input_directory'].configure,
                  (), {'defaultValue': None})
            apply(
                Make_Zip_File_3.inputPortByName['output_directory'].configure,
                (), {'defaultValue': None})
            apply(Make_Zip_File_3.inputPortByName['output_name'].configure, (),
                  {'defaultValue': None})
            apply(Make_Zip_File_3.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print "WARNING: failed to restore MakeZipFileNE named Make_Zip_File in network self.macroNetwork"
            print_exc()
            Make_Zip_File_3 = None

        try:
            ## saving node TrajQR_kryptonite_nbcr_net ##
            from NetworkEditor.items import FunctionNode
            TrajQR_kryptonite_nbcr_net_4 = FunctionNode(
                functionOrString='TrajQR_kryptonite_nbcr_net',
                host="http://kryptonite.nbcr.net/opal2",
                namedArgs={
                    'license': False,
                    'rmsd': '',
                    'qh_filename': 'qh.tre',
                    'qr_filename': 'qr.out',
                    'compressed_pdbs': '',
                    'localRun': False,
                    'execPath': ''
                },
                constrkw={
                    'functionOrString': "'TrajQR_kryptonite_nbcr_net'",
                    'host': '"http://kryptonite.nbcr.net/opal2"',
                    'namedArgs': {
                        'license': False,
                        'rmsd': '',
                        'qh_filename': 'qh.tre',
                        'qr_filename': 'qr.out',
                        'compressed_pdbs': '',
                        'localRun': False,
                        'execPath': ''
                    }
                },
                name='TrajQR_kryptonite_nbcr_net',
                library=wslib)
            self.macroNetwork.addNode(TrajQR_kryptonite_nbcr_net_4, 279, 135)
            apply(
                TrajQR_kryptonite_nbcr_net_4.inputPortByName['license'].
                configure, (), {'defaultValue': None})
            apply(
                TrajQR_kryptonite_nbcr_net_4.inputPortByName['rmsd'].configure,
                (), {
                    'defaultValue': None,
                    'required': True
                })
            apply(
                TrajQR_kryptonite_nbcr_net_4.inputPortByName['qh_filename'].
                configure, (), {'defaultValue': None})
            apply(
                TrajQR_kryptonite_nbcr_net_4.inputPortByName['qr_filename'].
                configure, (), {'defaultValue': None})
            apply(
                TrajQR_kryptonite_nbcr_net_4.
                inputPortByName['compressed_pdbs'].configure, (), {
                    'defaultValue': None,
                    'required': True
                })
            apply(
                TrajQR_kryptonite_nbcr_net_4.inputPortByName['localRun'].
                configure, (), {'defaultValue': None})
            apply(
                TrajQR_kryptonite_nbcr_net_4.inputPortByName['execPath'].
                configure, (), {'defaultValue': None})
            TrajQR_kryptonite_nbcr_net_4.inputPortByName['license'].widget.set(
                0, run=False)
            TrajQR_kryptonite_nbcr_net_4.inputPortByName['rmsd'].rebindWidget()
            TrajQR_kryptonite_nbcr_net_4.inputPortByName['rmsd'].widget.set(
                r"", run=False)
            TrajQR_kryptonite_nbcr_net_4.inputPortByName['rmsd'].unbindWidget()
            TrajQR_kryptonite_nbcr_net_4.inputPortByName[
                'qh_filename'].widget.set(r"qh.tre", run=False)
            TrajQR_kryptonite_nbcr_net_4.inputPortByName[
                'qr_filename'].widget.set(r"qr.out", run=False)
            TrajQR_kryptonite_nbcr_net_4.inputPortByName[
                'compressed_pdbs'].rebindWidget()
            TrajQR_kryptonite_nbcr_net_4.inputPortByName[
                'compressed_pdbs'].widget.set(r"", run=False)
            TrajQR_kryptonite_nbcr_net_4.inputPortByName[
                'compressed_pdbs'].unbindWidget()
            TrajQR_kryptonite_nbcr_net_4.inputPortByName[
                'localRun'].widget.set(0, run=False)
            TrajQR_kryptonite_nbcr_net_4.inputPortByName[
                'execPath'].widget.set(r"", run=False)
            apply(TrajQR_kryptonite_nbcr_net_4.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print "WARNING: failed to restore FunctionNode named TrajQR_kryptonite_nbcr_net in network self.macroNetwork"
            print_exc()
            TrajQR_kryptonite_nbcr_net_4 = None

        try:
            ## saving node SelectOnExtension ##
            from Vision.StandardNodes import SelectOnExtension
            SelectOnExtension_5 = SelectOnExtension(constrkw={},
                                                    name='SelectOnExtension',
                                                    library=stdlib)
            self.macroNetwork.addNode(SelectOnExtension_5, 279, 192)
            apply(SelectOnExtension_5.inputPortByName['filenames'].configure,
                  (), {'defaultValue': None})
            apply(SelectOnExtension_5.inputPortByName['extension'].configure,
                  (), {'defaultValue': None})
            SelectOnExtension_5.inputPortByName['extension'].widget.set(
                r".out", run=False)
            apply(SelectOnExtension_5.configure, (),
                  {'paramPanelImmediate': 1})
        except:
            print "WARNING: failed to restore SelectOnExtension named SelectOnExtension in network self.macroNetwork"
            print_exc()
            SelectOnExtension_5 = None

        try:
            ## saving node Index ##
            from Vision.StandardNodes import Index
            Index_6 = Index(constrkw={}, name='Index', library=stdlib)
            self.macroNetwork.addNode(Index_6, 123, 281)
            apply(
                Index_6.inputPortByName['data'].configure, (), {
                    'datatype': 'list',
                    'defaultValue': None,
                    'originalDatatype': 'None'
                })
            apply(Index_6.inputPortByName['index'].configure, (),
                  {'defaultValue': None})
            apply(Index_6.outputPortByName['data'].configure, (),
                  {'datatype': 'string'})
            apply(Index_6.inputPortByName['index'].widget.configure, (), {
                'max': 0,
                'min': -1
            })
            Index_6.inputPortByName['index'].widget.set(0, run=False)
            apply(Index_6.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print "WARNING: failed to restore Index named Index in network self.macroNetwork"
            print_exc()
            Index_6 = None

        try:
            ## saving node GetSelectedPDBs ##
            from Vision.StandardNodes import Generic
            GetSelectedPDBs_7 = Generic(constrkw={},
                                        name='GetSelectedPDBs',
                                        library=stdlib)
            self.macroNetwork.addNode(GetSelectedPDBs_7, 200, 346)
            apply(
                GetSelectedPDBs_7.addInputPort, (), {
                    'singleConnection': True,
                    'name': 'trajqr_url',
                    'cast': True,
                    'datatype': 'string',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white',
                    'originalDatatype': 'None'
                })
            apply(
                GetSelectedPDBs_7.addInputPort, (), {
                    'singleConnection': True,
                    'name': 'pdb_in_dir',
                    'cast': True,
                    'datatype': 'string',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white',
                    'originalDatatype': 'None'
                })
            apply(
                GetSelectedPDBs_7.addInputPort, (), {
                    'singleConnection': True,
                    'name': 'pdb_out_dir',
                    'cast': True,
                    'datatype': 'string',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white',
                    'originalDatatype': 'None'
                })
            apply(
                GetSelectedPDBs_7.addOutputPort, (), {
                    'name': 'pdb_out_dir',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            code = """def doit(self, trajqr_url, pdb_in_dir, pdb_out_dir):
        pdb_in_dir = os.path.abspath(pdb_in_dir)
        pdb_out_dir = os.path.abspath(pdb_out_dir)
        import urllib
        import shutil
        pdb_list = []

        f = urllib.urlopen(trajqr_url)

        for i in f.readlines():
            pdb_file = i.strip('''
''')+'''.pdb'''
            infile = pdb_in_dir + os.sep + pdb_file
            outfile = pdb_out_dir + os.sep + pdb_file
            shutil.copyfile(infile, outfile)
        
        f.close
	pass
## to ouput data on port pdb_list use
        self.outputData(pdb_out_dir=pdb_out_dir)


"""
            GetSelectedPDBs_7.configure(function=code)
            apply(GetSelectedPDBs_7.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print "WARNING: failed to restore Generic named GetSelectedPDBs in network self.macroNetwork"
            print_exc()
            GetSelectedPDBs_7 = None

        #self.macroNetwork.run()
        self.macroNetwork.freeze()

        ## saving connections for network TrajQR ##
        input_Ports_1 = self.macroNetwork.ipNode
        if input_Ports_1 is not None and Make_Zip_File_3 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_1,
                    Make_Zip_File_3,
                    "new",
                    "input_directory",
                    blocking=True,
                    splitratio=[0.67469172328672133, 0.50941480178765064])
            except:
                print "WARNING: failed to restore connection between input_Ports_1 and Make_Zip_File_3 in network self.macroNetwork"
        if input_Ports_1 is not None and TrajQR_kryptonite_nbcr_net_4 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_1,
                    TrajQR_kryptonite_nbcr_net_4,
                    "new",
                    "rmsd",
                    blocking=True,
                    splitratio=[0.45681934134493246, 0.33803410340720857])
            except:
                print "WARNING: failed to restore connection between input_Ports_1 and TrajQR_kryptonite_nbcr_net_4 in network self.macroNetwork"
        if Make_Zip_File_3 is not None and TrajQR_kryptonite_nbcr_net_4 is not None:
            try:
                self.macroNetwork.connectNodes(
                    Make_Zip_File_3,
                    TrajQR_kryptonite_nbcr_net_4,
                    "zipfile",
                    "compressed_pdbs",
                    blocking=True,
                    splitratio=[0.71081093868178202, 0.43908686250860129])
            except:
                print "WARNING: failed to restore connection between Make_Zip_File_3 and TrajQR_kryptonite_nbcr_net_4 in network self.macroNetwork"
        if TrajQR_kryptonite_nbcr_net_4 is not None and SelectOnExtension_5 is not None:
            try:
                self.macroNetwork.connectNodes(
                    TrajQR_kryptonite_nbcr_net_4,
                    SelectOnExtension_5,
                    "result",
                    "filenames",
                    blocking=True,
                    splitratio=[0.63533198718963335, 0.2560040659014205])
            except:
                print "WARNING: failed to restore connection between TrajQR_kryptonite_nbcr_net_4 and SelectOnExtension_5 in network self.macroNetwork"
        if SelectOnExtension_5 is not None and Index_6 is not None:
            try:
                self.macroNetwork.connectNodes(
                    SelectOnExtension_5,
                    Index_6,
                    "matching",
                    "data",
                    blocking=True,
                    splitratio=[0.65832290589891362, 0.21624347250969889])
            except:
                print "WARNING: failed to restore connection between SelectOnExtension_5 and Index_6 in network self.macroNetwork"
        if Index_6 is not None and GetSelectedPDBs_7 is not None:
            try:
                self.macroNetwork.connectNodes(
                    Index_6,
                    GetSelectedPDBs_7,
                    "data",
                    "trajqr_url",
                    blocking=True,
                    splitratio=[0.51754619993986595, 0.63949220525823236])
            except:
                print "WARNING: failed to restore connection between Index_6 and GetSelectedPDBs_7 in network self.macroNetwork"
        if input_Ports_1 is not None and GetSelectedPDBs_7 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_1,
                    GetSelectedPDBs_7,
                    "Make_Zip_File_input_directory",
                    "pdb_in_dir",
                    blocking=True,
                    splitratio=[0.7121964126696847, 0.42697952864467786])
            except:
                print "WARNING: failed to restore connection between input_Ports_1 and GetSelectedPDBs_7 in network self.macroNetwork"
        if input_Ports_1 is not None and GetSelectedPDBs_7 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_1,
                    GetSelectedPDBs_7,
                    "new",
                    "pdb_out_dir",
                    blocking=True,
                    splitratio=[0.62460995639428174, 0.60275185701976297])
            except:
                print "WARNING: failed to restore connection between input_Ports_1 and GetSelectedPDBs_7 in network self.macroNetwork"
        output_Ports_2 = self.macroNetwork.opNode
        if GetSelectedPDBs_7 is not None and output_Ports_2 is not None:
            try:
                self.macroNetwork.connectNodes(
                    GetSelectedPDBs_7,
                    output_Ports_2,
                    "pdb_out_dir",
                    "new",
                    blocking=True,
                    splitratio=[0.7431176169343523, 0.73697976585137526])
            except:
                print "WARNING: failed to restore connection between GetSelectedPDBs_7 and output_Ports_2 in network self.macroNetwork"
        self.macroNetwork.runOnNewData.value = True

        ## modifying MacroInputNode dynamic ports
        input_Ports_1 = self.macroNetwork.ipNode
        input_Ports_1.outputPorts[1].configure(
            name='Make_Zip_File_input_directory')
        input_Ports_1.outputPorts[2].configure(
            name='TrajQR_kryptonite_nbcr_net_rmsd')
        input_Ports_1.outputPorts[3].configure(
            name='GetSelectedPDBs_pdb_out_dir')

        ## modifying MacroOutputNode dynamic ports
        output_Ports_2 = self.macroNetwork.opNode
        output_Ports_2.inputPorts[1].configure(singleConnection='auto')
        output_Ports_2.inputPorts[1].configure(
            name='GetSelectedPDBs_pdb_out_dir')
        ## configure MacroNode input ports
        TrajQR_0.inputPorts[0].configure(name='Make_Zip_File_input_directory')
        TrajQR_0.inputPorts[0].configure(datatype='string')
        TrajQR_0.inputPorts[1].configure(
            name='TrajQR_kryptonite_nbcr_net_rmsd')
        TrajQR_0.inputPorts[1].configure(datatype='string')
        TrajQR_0.inputPorts[2].configure(name='GetSelectedPDBs_pdb_out_dir')
        TrajQR_0.inputPorts[2].configure(datatype='string')
        ## configure MacroNode output ports
        TrajQR_0.outputPorts[0].configure(name='GetSelectedPDBs_pdb_out_dir')
        TrajQR_0.outputPorts[0].configure(datatype='string')

        TrajQR_0.shrink()

        ## reset modifications ##
        TrajQR_0.resetTags()
        TrajQR_0.buildOriginalList()
Esempio n. 3
0
    def afterAddingToNetwork(self):
        from NetworkEditor.macros import MacroNode
        MacroNode.afterAddingToNetwork(self)
        ## loading libraries ##
        from MolKit.VisionInterface.MolKitNodes import molkitlib
        from Vision.StandardNodes import stdlib
        ## building macro network ##
        recluster_11 = self
        from traceback import print_exc

        ## loading libraries ##
        from MolKit.VisionInterface.MolKitNodes import molkitlib
        self.macroNetwork.getEditor().addLibraryInstance(
            molkitlib, "MolKit.VisionInterface.MolKitNodes", "molkitlib")

        from Vision.StandardNodes import stdlib
        self.macroNetwork.getEditor().addLibraryInstance(
            stdlib, "Vision.StandardNodes", "stdlib")

        try:
            ## saving node input Ports ##
            input_Ports_12 = self.macroNetwork.ipNode
            input_Ports_12.move(172, 137)
        except:
            print "WARNING: failed to restore MacroInputNode named input Ports in network self.macroNetwork"
            print_exc()
            input_Ports_12 = None

        try:
            ## saving node output Ports ##
            output_Ports_13 = self.macroNetwork.opNode
            output_Ports_13.move(172, 479)
        except:
            print "WARNING: failed to restore MacroOutputNode named output Ports in network self.macroNetwork"
            print_exc()
            output_Ports_13 = None

        try:
            ## saving node Docking ##
            from Vision.StandardNodes import Generic
            Docking_16 = Generic(constrkw={}, name='Docking', library=stdlib)
            self.macroNetwork.addNode(Docking_16, 189, 250)
            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'
                })
            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'
                })
            apply(
                Docking_16.addOutputPort, (), {
                    'name': 'docking',
                    'datatype': 'None',
                    'balloon': 'docking instance',
                    'height': 8,
                    'width': 12,
                    'shape': 'diamond',
                    'color': 'white'
                })
            code = """def doit(self, docking_logs, rmsTool):
        from AutoDockTools.Docking import Docking
        d = Docking()
        for f in docking_logs:
                d.readDlg(f)
        d.clusterer.rmsTool = rmsTool
        self.outputData(docking = d)           
                    
        
## to ouput data on port docking use
## self.outputData(docking=data)


"""
            Docking_16.configure(function=code)
        except:
            print "WARNING: failed to restore Generic named Docking in network self.macroNetwork"
            print_exc()
            Docking_16 = None

        try:
            ## saving node rmsTool ##
            from Vision.StandardNodes import Generic
            rmsTool_17 = Generic(constrkw={}, name='rmsTool', library=stdlib)
            self.macroNetwork.addNode(rmsTool_17, 206, 197)
            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'
                })
            apply(
                rmsTool_17.addOutputPort, (), {
                    'name': 'rmsTool',
                    'datatype': 'None',
                    'balloon': 'rmsTool created using crds as reference',
                    'height': 8,
                    'width': 12,
                    'shape': 'diamond',
                    'color': 'white'
                })
            code = """def doit(self, crds):
	from  mglutil.math.rmsd  import RMSDCalculator
	rmsTool = RMSDCalculator(crds)
	self.outputData(rmsTool = rmsTool)
	
"""
            rmsTool_17.configure(function=code)
        except:
            print "WARNING: failed to restore Generic named rmsTool in network self.macroNetwork"
            print_exc()
            rmsTool_17 = None

        try:
            ## saving node Read Molecule ##
            from MolKit.VisionInterface.MolKitNodes import ReadMolecule
            Read_Molecule_18 = ReadMolecule(constrkw={},
                                            name='Read Molecule',
                                            library=molkitlib)
            self.macroNetwork.addNode(Read_Molecule_18, 243, 16)
            apply(Read_Molecule_18.inputPortByName['filename'].configure, (), {
                'color': 'white',
                'cast': True,
                'shape': 'oval'
            })
            apply(Read_Molecule_18.outputPortByName['MolSets'].configure, (), {
                'color': '#c64e70',
                'shape': 'oval'
            })
            Read_Molecule_18.inputPortByName['filename'].widget.set(
                "ind.pdbqt", run=False)
        except:
            print "WARNING: failed to restore ReadMolecule named Read Molecule in network self.macroNetwork"
            print_exc()
            Read_Molecule_18 = None

        try:
            ## saving node Index ##
            from Vision.StandardNodes import Index
            Index_19 = Index(constrkw={}, name='Index', library=stdlib)
            self.macroNetwork.addNode(Index_19, 243, 66)
            apply(
                Index_19.inputPortByName['data'].configure, (), {
                    'datatype': 'MoleculeSet',
                    'cast': True,
                    'shape': 'oval',
                    'color': '#c64e70'
                })
            apply(Index_19.inputPortByName['index'].configure, (), {
                'color': 'yellow',
                'cast': True,
                'shape': 'circle'
            })
            apply(Index_19.outputPortByName['data'].configure, (), {
                'color': 'white',
                'shape': 'diamond'
            })
        except:
            print "WARNING: failed to restore Index named Index in network self.macroNetwork"
            print_exc()
            Index_19 = None

        try:
            ## saving node Get allAtoms.coords ##
            from Vision.StandardNodes import GetAttr
            Get_allAtoms_coords_20 = GetAttr(constrkw={},
                                             name='Get allAtoms.coords',
                                             library=stdlib)
            self.macroNetwork.addNode(Get_allAtoms_coords_20, 243, 115)
            apply(Get_allAtoms_coords_20.inputPortByName['objects'].configure,
                  (), {
                      'color': 'white',
                      'cast': True,
                      'shape': 'diamond'
                  })
            apply(Get_allAtoms_coords_20.inputPortByName['attr'].configure, (),
                  {
                      'color': 'white',
                      'cast': True,
                      'shape': 'oval'
                  })
            apply(Get_allAtoms_coords_20.outputPortByName['attrs'].configure,
                  (), {
                      'color': 'cyan',
                      'shape': 'oval'
                  })
            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')
                })
            Get_allAtoms_coords_20.inputPortByName['attr'].widget.set(
                "allAtoms.coords", run=False)
            apply(Get_allAtoms_coords_20.configure, (), {'expanded': True})
        except:
            print "WARNING: failed to restore GetAttr named Get allAtoms.coords in network self.macroNetwork"
            print_exc()
            Get_allAtoms_coords_20 = None

        try:
            ## saving node Get clusterer ##
            from Vision.StandardNodes import GetAttr
            Get_clusterer_21 = GetAttr(constrkw={},
                                       name='Get clusterer',
                                       library=stdlib)
            self.macroNetwork.addNode(Get_clusterer_21, 189, 306)
            apply(Get_clusterer_21.inputPortByName['objects'].configure, (), {
                'color': 'white',
                'cast': True,
                'shape': 'diamond'
            })
            apply(Get_clusterer_21.inputPortByName['attr'].configure, (), {
                'color': 'white',
                'cast': True,
                'shape': 'oval'
            })
            apply(Get_clusterer_21.outputPortByName['attrs'].configure, (), {
                'color': 'cyan',
                'shape': 'oval'
            })
            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')
                })
            Get_clusterer_21.inputPortByName['attr'].widget.set("clusterer",
                                                                run=False)
            apply(Get_clusterer_21.configure, (), {'expanded': True})
        except:
            print "WARNING: failed to restore GetAttr named Get clusterer in network self.macroNetwork"
            print_exc()
            Get_clusterer_21 = None

        try:
            ## saving node Index ##
            from Vision.StandardNodes import Index
            Index_22 = Index(constrkw={}, name='Index', library=stdlib)
            self.macroNetwork.addNode(Index_22, 188, 383)
            apply(Index_22.inputPortByName['data'].configure, (), {
                'datatype': 'list',
                'cast': True,
                'shape': 'oval',
                'color': 'cyan'
            })
            apply(Index_22.inputPortByName['index'].configure, (), {
                'color': 'yellow',
                'cast': True,
                'shape': 'circle'
            })
            apply(Index_22.outputPortByName['data'].configure, (), {
                'color': 'white',
                'shape': 'diamond'
            })
        except:
            print "WARNING: failed to restore Index named Index in network self.macroNetwork"
            print_exc()
            Index_22 = None

        try:
            ## saving node make clustering ##
            from Vision.StandardNodes import Generic
            make_clustering_23 = Generic(constrkw={},
                                         name='make clustering',
                                         library=stdlib)
            self.macroNetwork.addNode(make_clustering_23, 189, 432)
            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'
                })
            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'
                })
            apply(
                make_clustering_23.addOutputPort, (), {
                    'name': 'clustering',
                    'datatype': 'None',
                    'balloon': 'clustering at newest rms',
                    'height': 8,
                    'width': 12,
                    'shape': 'diamond',
                    'color': 'white'
                })
            code = """def doit(self, clusterer, tolerance):
	clusterer.make_clustering(tolerance)
	self.outputData(clustering = clusterer.clustering_dict[tolerance])
"""
            make_clustering_23.configure(function=code)
        except:
            print "WARNING: failed to restore Generic named make clustering in network self.macroNetwork"
            print_exc()
            make_clustering_23 = None

        try:
            ## saving node Dial ##
            from Vision.StandardNodes import DialNE
            Dial_24 = DialNE(constrkw={}, name='Dial', library=stdlib)
            self.macroNetwork.addNode(Dial_24, 233, 380)
            apply(Dial_24.inputPortByName['dial'].configure, (), {
                'color': 'green',
                'cast': True,
                'shape': 'circle'
            })
            apply(Dial_24.inputPortByName['mini'].configure, (), {
                'color': 'green',
                'cast': True,
                'shape': 'circle'
            })
            apply(Dial_24.inputPortByName['maxi'].configure, (), {
                'color': 'green',
                'cast': True,
                'shape': 'circle'
            })
            apply(Dial_24.outputPortByName['value'].configure, (), {
                'color': 'green',
                'shape': 'circle'
            })
            Dial_24.inputPortByName['dial'].widget.set(3.0, run=False)
            apply(Dial_24.configure, (), {'expanded': False})
        except:
            print "WARNING: failed to restore DialNE named Dial in network self.macroNetwork"
            print_exc()
            Dial_24 = None

        self.macroNetwork.freeze()

        ## saving connections for network recluster ##
        if rmsTool_17 is not None and Docking_16 is not None:
            try:
                self.macroNetwork.connectNodes(rmsTool_17,
                                               Docking_16,
                                               "rmsTool",
                                               "rmsTool",
                                               blocking=True)
            except:
                print "WARNING: failed to restore connection between rmsTool_17 and Docking_16 in network self.macroNetwork"
        if Read_Molecule_18 is not None and Index_19 is not None:
            try:
                self.macroNetwork.connectNodes(Read_Molecule_18,
                                               Index_19,
                                               "MolSets",
                                               "data",
                                               blocking=True)
            except:
                print "WARNING: failed to restore connection between Read_Molecule_18 and Index_19 in network self.macroNetwork"
        if Index_19 is not None and Get_allAtoms_coords_20 is not None:
            try:
                self.macroNetwork.connectNodes(Index_19,
                                               Get_allAtoms_coords_20,
                                               "data",
                                               "objects",
                                               blocking=True)
            except:
                print "WARNING: failed to restore connection between Index_19 and Get_allAtoms_coords_20 in network self.macroNetwork"
        if Get_allAtoms_coords_20 is not None and rmsTool_17 is not None:
            try:
                self.macroNetwork.connectNodes(Get_allAtoms_coords_20,
                                               rmsTool_17,
                                               "attrs",
                                               "crds",
                                               blocking=True)
            except:
                print "WARNING: failed to restore connection between Get_allAtoms_coords_20 and rmsTool_17 in network self.macroNetwork"
        if Docking_16 is not None and Get_clusterer_21 is not None:
            try:
                self.macroNetwork.connectNodes(Docking_16,
                                               Get_clusterer_21,
                                               "docking",
                                               "objects",
                                               blocking=True)
            except:
                print "WARNING: failed to restore connection between Docking_16 and Get_clusterer_21 in network self.macroNetwork"
        if Get_clusterer_21 is not None and Index_22 is not None:
            try:
                self.macroNetwork.connectNodes(Get_clusterer_21,
                                               Index_22,
                                               "attrs",
                                               "data",
                                               blocking=True)
            except:
                print "WARNING: failed to restore connection between Get_clusterer_21 and Index_22 in network self.macroNetwork"
        if Index_22 is not None and make_clustering_23 is not None:
            try:
                self.macroNetwork.connectNodes(Index_22,
                                               make_clustering_23,
                                               "data",
                                               "clusterer",
                                               blocking=True)
            except:
                print "WARNING: failed to restore connection between Index_22 and make_clustering_23 in network self.macroNetwork"
        if Dial_24 is not None and make_clustering_23 is not None:
            try:
                self.macroNetwork.connectNodes(Dial_24,
                                               make_clustering_23,
                                               "value",
                                               "tolerance",
                                               blocking=True)
            except:
                print "WARNING: failed to restore connection between Dial_24 and make_clustering_23 in network self.macroNetwork"
        output_Ports_13 = self.macroNetwork.opNode
        if make_clustering_23 is not None and output_Ports_13 is not None:
            try:
                self.macroNetwork.connectNodes(make_clustering_23,
                                               output_Ports_13,
                                               "clustering",
                                               "new",
                                               blocking=True)
            except:
                print "WARNING: failed to restore connection between make_clustering_23 and output_Ports_13 in network self.macroNetwork"
        input_Ports_12 = self.macroNetwork.ipNode
        if input_Ports_12 is not None and Docking_16 is not None:
            try:
                self.macroNetwork.connectNodes(input_Ports_12,
                                               Docking_16,
                                               "new",
                                               "docking_logs",
                                               blocking=True)
            except:
                print "WARNING: failed to restore connection between input_Ports_12 and Docking_16 in network self.macroNetwork"
        self.macroNetwork.unfreeze()

        recluster_11.shrink()

        ## reset modifications ##
        recluster_11.resetTags()
        recluster_11.buildOriginalList()
Esempio n. 4
0
    def afterAddingToNetwork(self):
        masterNet = self.macroNetwork
        from NetworkEditor.macros import MacroNode
        MacroNode.afterAddingToNetwork(self)
        from WebServices.VisionInterface.WSNodes import wslib
        from Vision.StandardNodes import stdlib
        ## building macro network ##
        PrepareReceptor_0 = self
        from traceback import print_exc
        from WebServices.VisionInterface.WSNodes import wslib
        from Vision.StandardNodes import stdlib
        masterNet.getEditor().addLibraryInstance(wslib,"WebServices.VisionInterface.WSNodes", "wslib")
        from WebServices.VisionInterface.WSNodes import addOpalServerAsCategory
        try:
            addOpalServerAsCategory("http://ws.nbcr.net/opal2", replace=False)
        except:
            pass
        try:
            ## saving node input Ports ##
            input_Ports_1 = self.macroNetwork.ipNode
            input_Ports_1.configure(*(), **{'paramPanelImmediate': 1, 'expanded': False})
        except:
            print("WARNING: failed to restore MacroInputNode named input Ports in network self.macroNetwork")
            print_exc()
            input_Ports_1=None

        try:
            ## saving node output Ports ##
            output_Ports_2 = self.macroNetwork.opNode
            output_Ports_2.configure(*(), **{'paramPanelImmediate': 1, 'expanded': False})
        except:
            print("WARNING: failed to restore MacroOutputNode named output Ports in network self.macroNetwork")
            print_exc()
            output_Ports_2=None

        try:
            ## saving node Pdb2pqrWS ##
            from NetworkEditor.macros import MacroNode
            Pdb2pqrWS_3 = MacroNode(name='Pdb2pqrWS')
            self.macroNetwork.addNode(Pdb2pqrWS_3, 153, 86)
            input_Ports_4 = Pdb2pqrWS_3.macroNetwork.ipNode
            input_Ports_4.configure(*(), **{'paramPanelImmediate': 1, 'expanded': False})
            input_Ports_4.move(65, 10)
            output_Ports_5 = Pdb2pqrWS_3.macroNetwork.opNode
            output_Ports_5.configure(*(), **{'paramPanelImmediate': 1, 'expanded': False})
            output_Ports_5.move(65, 310)
            from Vision.StandardNodes import Generic
            CheckFileFormat_6 = Generic(constrkw={}, name='CheckFileFormat', library=stdlib)
            Pdb2pqrWS_3.macroNetwork.addNode(CheckFileFormat_6,82,62)
            CheckFileFormat_6.addInputPort(*(), **{'singleConnection': True, 'name': 'value', 'cast': True, 'datatype': 'receptor', 'defaultValue': None, 'required': True, 'height': 8, 'width': 12, 'shape': 'triangle', 'color': '#99FF33', 'originalDatatype': 'None'})
            CheckFileFormat_6.addOutputPort(*(), **{'name': 'receptor_obj', 'datatype': 'receptor', 'height': 8, 'width': 12, 'shape': 'triangle', 'color': '#99FF33'})
            CheckFileFormat_6.addOutputPort(*(), **{'name': 'pqr_name', 'datatype': 'string', 'height': 8, 'width': 12, 'shape': 'oval', 'color': 'white'})
            CheckFileFormat_6.addOutputPort(*(), **{'name': 'pdb_path', 'datatype': 'string', 'height': 8, 'width': 12, 'shape': 'oval', 'color': 'white'})
            code = """def doit(self, value):
    if value.get_ext_loc('''pqr''') != None or value.get_ext_loc('''pdbqt''') != None:
        self.outputData(receptor_obj=value)
        self.scheduleChildren(portList=[self.getOutputPortByName('''receptor_obj''')])
    else:
        pqr_name = value.get_id() + '''.pqr'''
        pdb_path = value.get_ext_loc('''pdb''')

        self.outputData(receptor_obj=value, pqr_name=pqr_name, pdb_path=pdb_path)
        self.scheduleChildren(portList=[self.getOutputPortByName('''receptor_obj'''), self.getOutputPortByName('''pqr_name'''), self.getOutputPortByName('''pdb_path''')])

"""
            CheckFileFormat_6.configure(function=code)
            CheckFileFormat_6.configure(*(), **{'paramPanelImmediate': 1, 'expanded': False})
            from NetworkEditor.items import FunctionNode
            Pdb2pqrOpalService_ws_nbcr_net_7 = FunctionNode(functionOrString='Pdb2pqrOpalService_ws_nbcr_net', host="http://ws.nbcr.net/opal2", namedArgs={'noopt': False, 'phi': False, 'psi': False, 'verbose': True, 'chain': False, 'nodebump': False, 'chi': False, 'output_file': '', 'ligand': '', 'hbond': False, 'inFile': '', 'with_ph': '', 'forcefield': 'AMBER', 'clean': False, 'inId': '', 'apbs_input': False, 'ffout': '', 'localRun': False, 'rama': False, 'execPath': '', 'assign_only': False}, constrkw={'functionOrString': "'Pdb2pqrOpalService_ws_nbcr_net'", 'host': '"http://ws.nbcr.net/opal2"', 'namedArgs': {'noopt': False, 'phi': False, 'psi': False, 'verbose': True, 'chain': False, 'nodebump': False, 'chi': False, 'output_file': '', 'ligand': '', 'hbond': False, 'inFile': '', 'with_ph': '', 'forcefield': 'AMBER', 'clean': False, 'inId': '', 'apbs_input': False, 'ffout': '', 'localRun': False, 'rama': False, 'execPath': '', 'assign_only': False}}, name='Pdb2pqrOpalService_ws_nbcr_net', library=wslib)
            Pdb2pqrWS_3.macroNetwork.addNode(Pdb2pqrOpalService_ws_nbcr_net_7,99,115)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['output_file'].configure(*(), **{'defaultValue': None, 'required': True})
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['inFile'].configure(*(), **{'defaultValue': None, 'required': True})
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['noopt'].widget.set(0, run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['phi'].widget.set(0, run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['psi'].widget.set(0, run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['verbose'].widget.set(1, run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['chain'].widget.set(0, run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['nodebump'].widget.set(0, run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['chi'].widget.set(0, run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['output_file'].rebindWidget()
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['output_file'].widget.set(r"", run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['output_file'].unbindWidget()
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['ligand'].widget.set(r"", run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['hbond'].widget.set(0, run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['inFile'].rebindWidget()
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['inFile'].widget.set(r"", run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['inFile'].unbindWidget()
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['with_ph'].widget.set(r"", run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['forcefield'].widget.configure(*(), **{'choices': ('AMBER', 'CHARMM', 'PARSE', 'TYL06')})
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['forcefield'].widget.set(r"AMBER", run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['clean'].widget.set(0, run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['inId'].widget.set(r"", run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['apbs_input'].widget.set(0, run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['ffout'].widget.configure(*(), **{'choices': ('AMBER', 'CHARMM', 'PARSE', 'TYL06')})
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['ffout'].widget.set(r"", run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['localRun'].widget.set(0, run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['rama'].widget.set(0, run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['execPath'].widget.set(r"", run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.inputPortByName['assign_only'].widget.set(0, run=False)
            Pdb2pqrOpalService_ws_nbcr_net_7.configure(*(), **{'paramPanelImmediate': 1, 'expanded': False})
            from WebServices.VisionInterface.WSNodes import GetURLFromListNode
            GetURLFromList_8 = GetURLFromListNode(constrkw={}, name='GetURLFromList', library=wslib)
            Pdb2pqrWS_3.macroNetwork.addNode(GetURLFromList_8,117,169)
            GetURLFromList_8.inputPortByName['ext'].widget.set(r"pqr", run=False)
            GetURLFromList_8.configure(*(), **{'paramPanelImmediate': 1})
            from Vision.StandardNodes import Generic
            UpdateReceptor_9 = Generic(constrkw={}, name='UpdateReceptor', library=stdlib)
            Pdb2pqrWS_3.macroNetwork.addNode(UpdateReceptor_9,82,256)
            UpdateReceptor_9.addInputPort(*(), **{'singleConnection': True, 'name': 'receptor_obj', 'cast': True, 'datatype': 'receptor', 'defaultValue': None, 'required': True, 'height': 8, 'width': 12, 'shape': 'triangle', 'color': '#99FF33', 'originalDatatype': 'None'})
            UpdateReceptor_9.addInputPort(*(), **{'singleConnection': True, 'name': 'pqr', 'cast': True, 'datatype': 'string', 'defaultValue': None, 'required': False, 'height': 8, 'width': 12, 'shape': 'oval', 'color': 'white', 'originalDatatype': 'None'})
            UpdateReceptor_9.addOutputPort(*(), **{'name': 'receptor_obj', 'datatype': 'receptor', 'height': 8, 'width': 12, 'shape': 'triangle', 'color': '#99FF33'})
            UpdateReceptor_9.addOutputPort(*(), **{'name': 'pdb2pqr_result', 'datatype': 'string', 'height': 8, 'width': 12, 'shape': 'oval', 'color': 'white'})
            code = """def doit(self, receptor_obj, pqr):
        if pqr != '''no data yet''':
            pdb2pqr_result = pqr
            receptor_obj.set_ext_loc(pqr)
        else:
            pdbqt = receptor_obj.get_ext_loc('''pdbqt''')
            pqr = receptor_obj.get_ext_loc('''pqr''')

            if pdbqt != None:
                pdb2pqr_result = pdbqt
            elif pqr != None:
                pdb2pqr_result = pqr

        pass
        self.outputData(receptor_obj=receptor_obj, pdb2pqr_result=pdb2pqr_result)





"""
            UpdateReceptor_9.configure(function=code)
            UpdateReceptor_9.configure(*(), **{'paramPanelImmediate': 1, 'expanded': False})

            ## saving connections for network Pdb2pqrWS ##
            Pdb2pqrWS_3.macroNetwork.freeze()
            if CheckFileFormat_6 is not None and Pdb2pqrOpalService_ws_nbcr_net_7 is not None:
                try:
                    Pdb2pqrWS_3.macroNetwork.connectNodes(
                        CheckFileFormat_6, Pdb2pqrOpalService_ws_nbcr_net_7, "pqr_name", "output_file", blocking=True
                        , splitratio=[0.43278717885693868, 0.65281492247209427])
                except:
                    print("WARNING: failed to restore connection between CheckFileFormat_6 and Pdb2pqrOpalService_ws_nbcr_net_7 in network Pdb2pqrWS_3.macroNetwork")
            if CheckFileFormat_6 is not None and Pdb2pqrOpalService_ws_nbcr_net_7 is not None:
                try:
                    Pdb2pqrWS_3.macroNetwork.connectNodes(
                        CheckFileFormat_6, Pdb2pqrOpalService_ws_nbcr_net_7, "pdb_path", "inFile", blocking=True
                        , splitratio=[0.61978340673276544, 0.69977512898866912])
                except:
                    print("WARNING: failed to restore connection between CheckFileFormat_6 and Pdb2pqrOpalService_ws_nbcr_net_7 in network Pdb2pqrWS_3.macroNetwork")
            if Pdb2pqrOpalService_ws_nbcr_net_7 is not None and GetURLFromList_8 is not None:
                try:
                    Pdb2pqrWS_3.macroNetwork.connectNodes(
                        Pdb2pqrOpalService_ws_nbcr_net_7, GetURLFromList_8, "result", "urllist", blocking=True
                        , splitratio=[0.73247388879852338, 0.69014271703344965])
                except:
                    print("WARNING: failed to restore connection between Pdb2pqrOpalService_ws_nbcr_net_7 and GetURLFromList_8 in network Pdb2pqrWS_3.macroNetwork")
            if GetURLFromList_8 is not None and UpdateReceptor_9 is not None:
                try:
                    Pdb2pqrWS_3.macroNetwork.connectNodes(
                        GetURLFromList_8, UpdateReceptor_9, "url", "pqr", blocking=True
                        , splitratio=[0.35224914715245104, 0.47693375858097758])
                except:
                    print("WARNING: failed to restore connection between GetURLFromList_8 and UpdateReceptor_9 in network Pdb2pqrWS_3.macroNetwork")
            if CheckFileFormat_6 is not None and UpdateReceptor_9 is not None:
                try:
                    Pdb2pqrWS_3.macroNetwork.connectNodes(
                        CheckFileFormat_6, UpdateReceptor_9, "receptor_obj", "receptor_obj", blocking=True
                        , splitratio=[0.57865377076653579, 0.45824116584600394])
                except:
                    print("WARNING: failed to restore connection between CheckFileFormat_6 and UpdateReceptor_9 in network Pdb2pqrWS_3.macroNetwork")
            input_Ports_4 = Pdb2pqrWS_3.macroNetwork.ipNode
            if input_Ports_4 is not None and CheckFileFormat_6 is not None:
                try:
                    Pdb2pqrWS_3.macroNetwork.connectNodes(
                        input_Ports_4, CheckFileFormat_6, "new", "value", blocking=True
                        , splitratio=[0.28291581858817416, 0.70581213384962171])
                except:
                    print("WARNING: failed to restore connection between input_Ports_4 and CheckFileFormat_6 in network Pdb2pqrWS_3.macroNetwork")
            output_Ports_5 = Pdb2pqrWS_3.macroNetwork.opNode
            if UpdateReceptor_9 is not None and output_Ports_5 is not None:
                try:
                    Pdb2pqrWS_3.macroNetwork.connectNodes(
                        UpdateReceptor_9, output_Ports_5, "receptor_obj", "new", blocking=True
                        , splitratio=[0.24354423773729619, 0.72115604180615911])
                except:
                    print("WARNING: failed to restore connection between UpdateReceptor_9 and output_Ports_5 in network Pdb2pqrWS_3.macroNetwork")
            if UpdateReceptor_9 is not None and output_Ports_5 is not None:
                try:
                    Pdb2pqrWS_3.macroNetwork.connectNodes(
                        UpdateReceptor_9, output_Ports_5, "pdb2pqr_result", "new", blocking=True
                        , splitratio=[0.31141907324539131, 0.41794097665671487])
                except:
                    print("WARNING: failed to restore connection between UpdateReceptor_9 and output_Ports_5 in network Pdb2pqrWS_3.macroNetwork")
            Pdb2pqrWS_3.macroNetwork.unfreeze()

            ## modifying MacroInputNode dynamic ports
            input_Ports_4.outputPorts[1].configure(name='CheckFileFormat_value')

            ## modifying MacroOutputNode dynamic ports
            output_Ports_5.inputPorts[1].configure(singleConnection='auto')
            output_Ports_5.inputPorts[2].configure(singleConnection='auto')
            output_Ports_5.inputPorts[1].configure(name='UpdateReceptor_receptor_obj')
            output_Ports_5.inputPorts[2].configure(name='UpdateReceptor_pdb2pqr_result')
            Pdb2pqrWS_3.inputPorts[0].configure(name='CheckFileFormat_value')
            Pdb2pqrWS_3.inputPorts[0].configure(datatype='receptor')
            ## configure MacroNode input ports
            Pdb2pqrWS_3.outputPorts[0].configure(name='UpdateReceptor_receptor_obj')
            Pdb2pqrWS_3.outputPorts[0].configure(datatype='receptor')
            Pdb2pqrWS_3.outputPorts[1].configure(name='UpdateReceptor_pdb2pqr_result')
            Pdb2pqrWS_3.outputPorts[1].configure(datatype='string')
            ## configure MacroNode output ports
            Pdb2pqrWS_3.shrink()
            Pdb2pqrWS_3.configure(*(), **{'paramPanelImmediate': 1, 'expanded': False})
        except:
            print("WARNING: failed to restore MacroNode named Pdb2pqrWS in network self.macroNetwork")
            print_exc()
            Pdb2pqrWS_3=None

        try:
            ## saving node PrepareReceptorWS ##
            from NetworkEditor.macros import MacroNode
            PrepareReceptorWS_10 = MacroNode(name='PrepareReceptorWS')
            self.macroNetwork.addNode(PrepareReceptorWS_10, 217, 140)
            input_Ports_11 = PrepareReceptorWS_10.macroNetwork.ipNode
            input_Ports_11.configure(*(), **{'paramPanelImmediate': 1, 'expanded': False})
            input_Ports_11.move(145, 8)
            output_Ports_12 = PrepareReceptorWS_10.macroNetwork.opNode
            output_Ports_12.configure(*(), **{'paramPanelImmediate': 1, 'expanded': False})
            output_Ports_12.move(29, 412)
            from Vision.StandardNodes import Generic
            CheckFileFormat_13 = Generic(constrkw={}, name='CheckFileFormat', library=stdlib)
            PrepareReceptorWS_10.macroNetwork.addNode(CheckFileFormat_13,46,64)
            CheckFileFormat_13.addInputPort(*(), **{'singleConnection': True, 'name': 'value', 'cast': True, 'datatype': 'receptor', 'defaultValue': None, 'required': True, 'height': 8, 'width': 12, 'shape': 'triangle', 'color': '#99FF33', 'originalDatatype': 'None'})
            CheckFileFormat_13.addOutputPort(*(), **{'name': 'receptor_obj', 'datatype': 'receptor', 'height': 8, 'width': 12, 'shape': 'triangle', 'color': '#99FF33'})
            CheckFileFormat_13.addOutputPort(*(), **{'name': 'receptor_url', 'datatype': 'string', 'height': 8, 'width': 12, 'shape': 'oval', 'color': 'white'})
            CheckFileFormat_13.addOutputPort(*(), **{'name': 'receptor_local', 'datatype': 'string', 'height': 8, 'width': 12, 'shape': 'oval', 'color': 'white'})
            CheckFileFormat_13.addOutputPort(*(), **{'name': 'download_loc', 'datatype': 'string', 'height': 8, 'width': 12, 'shape': 'oval', 'color': 'white'})
            code = """def doit(self, value):
    if value.get_ext_loc('''pdbqt''') != None:
        self.outputData(receptor_obj=value)
        self.scheduleChildren(portList=[self.getOutputPortByName('''receptor_obj''')])
    else:
        pqr = value.get_ext_loc('''pqr''')
        pdb = value.get_ext_loc('''pdb''')
        download_loc = value.get_workdir() + os.sep + value.get_id() + '''.pdbqt'''

        if pqr != None:
            if value.get_ext_type('''pqr''') == '''url''':
                receptor_url = pqr
                receptor_local = ""
            else:
                receptor_url = ""
                receptor_local = pqr
        elif pdb != None:
            if value.get_ext_type('''pdb''') == '''url''':
                receptor_url = pdb
                receptor_local = ""
            else:
                receptor_url = ""
                receptor_local = pdb
        else:
            print "*** ERROR: pqr and pqr both missing from receptor object"
            print receptor_obj.ext_loc
            return '''stop'''

        self.outputData(receptor_obj=value, receptor_url=receptor_url, receptor_local=receptor_local, download_loc=download_loc)
        self.scheduleChildren(portList=[self.getOutputPortByName('''receptor_obj'''), self.getOutputPortByName('''receptor_url'''), self.getOutputPortByName('''receptor_local'''), self.getOutputPortByName('''download_loc''')])





"""
            CheckFileFormat_13.configure(function=code)
            CheckFileFormat_13.configure(*(), **{'paramPanelImmediate': 1, 'expanded': False})
            from NetworkEditor.items import FunctionNode
            PrepareReceptorOpalService_ws_nbcr_net_14 = FunctionNode(functionOrString='PrepareReceptorOpalService_ws_nbcr_net', host="http://ws.nbcr.net/opal2", namedArgs={'C': False, 'url': '', 'o': '', 'r': '', 'v': False, 'localRun': False, 'execPath': ''}, constrkw={'functionOrString': "'PrepareReceptorOpalService_ws_nbcr_net'", 'host': '"http://ws.nbcr.net/opal2"', 'namedArgs': {'C': False, 'url': '', 'o': '', 'r': '', 'v': False, 'localRun': False, 'execPath': ''}}, name='PrepareReceptorOpalService_ws_nbcr_net', library=wslib)
            PrepareReceptorWS_10.macroNetwork.addNode(PrepareReceptorOpalService_ws_nbcr_net_14,180,128)
            PrepareReceptorOpalService_ws_nbcr_net_14.inputPortByName['C'].configure(*(), **{'defaultValue': None})
            PrepareReceptorOpalService_ws_nbcr_net_14.inputPortByName['url'].configure(*(), **{'defaultValue': None, 'required': True})
            PrepareReceptorOpalService_ws_nbcr_net_14.inputPortByName['r'].configure(*(), **{'defaultValue': None, 'required': True})
            PrepareReceptorOpalService_ws_nbcr_net_14.inputPortByName['C'].rebindWidget()
            PrepareReceptorOpalService_ws_nbcr_net_14.inputPortByName['C'].widget.set(0, run=False)
            PrepareReceptorOpalService_ws_nbcr_net_14.inputPortByName['C'].unbindWidget()
            PrepareReceptorOpalService_ws_nbcr_net_14.inputPortByName['url'].rebindWidget()
            PrepareReceptorOpalService_ws_nbcr_net_14.inputPortByName['url'].widget.set(r"", run=False)
            PrepareReceptorOpalService_ws_nbcr_net_14.inputPortByName['url'].unbindWidget()
            PrepareReceptorOpalService_ws_nbcr_net_14.inputPortByName['o'].widget.set(r"", run=False)
            PrepareReceptorOpalService_ws_nbcr_net_14.inputPortByName['r'].rebindWidget()
            PrepareReceptorOpalService_ws_nbcr_net_14.inputPortByName['r'].widget.set(r"", run=False)
            PrepareReceptorOpalService_ws_nbcr_net_14.inputPortByName['r'].unbindWidget()
            PrepareReceptorOpalService_ws_nbcr_net_14.inputPortByName['v'].widget.set(0, run=False)
            PrepareReceptorOpalService_ws_nbcr_net_14.inputPortByName['localRun'].widget.set(0, run=False)
            PrepareReceptorOpalService_ws_nbcr_net_14.inputPortByName['execPath'].widget.set(r"", run=False)
            PrepareReceptorOpalService_ws_nbcr_net_14.configure(*(), **{'paramPanelImmediate': 1, 'expanded': False})
            from WebServices.VisionInterface.WSNodes import GetURLFromListNode
            GetURLFromList_15 = GetURLFromListNode(constrkw={}, name='GetURLFromList', library=wslib)
            PrepareReceptorWS_10.macroNetwork.addNode(GetURLFromList_15,180,186)
            GetURLFromList_15.inputPortByName['ext'].widget.set(r"pdbqt", run=False)
            GetURLFromList_15.configure(*(), **{'paramPanelImmediate': 1})
            from WebServices.VisionInterface.WSNodes import DownloadToFileNode
            DownloadToFile_16 = DownloadToFileNode(constrkw={}, name='DownloadToFile', library=wslib)
            PrepareReceptorWS_10.macroNetwork.addNode(DownloadToFile_16,80,272)
            DownloadToFile_16.inputPortByName['url'].configure(*(), **{'defaultValue': None})
            DownloadToFile_16.inputPortByName['filename'].configure(*(), **{'defaultValue': None})
            DownloadToFile_16.inputPortByName['url'].rebindWidget()
            DownloadToFile_16.inputPortByName['url'].widget.set(r"", run=False)
            DownloadToFile_16.inputPortByName['url'].unbindWidget()
            DownloadToFile_16.inputPortByName['filename'].rebindWidget()
            DownloadToFile_16.inputPortByName['filename'].widget.set(r"", run=False)
            DownloadToFile_16.inputPortByName['filename'].unbindWidget()
            DownloadToFile_16.inputPortByName['overwrite'].widget.set(1, run=False)
            DownloadToFile_16.configure(*(), **{'paramPanelImmediate': 1})
            from Vision.StandardNodes import Generic
            UpdateReceptor_17 = Generic(constrkw={}, name='UpdateReceptor', library=stdlib)
            PrepareReceptorWS_10.macroNetwork.addNode(UpdateReceptor_17,46,358)
            UpdateReceptor_17.addInputPort(*(), **{'singleConnection': True, 'name': 'receptor_obj', 'cast': True, 'datatype': 'receptor', 'defaultValue': None, 'required': True, 'height': 8, 'width': 12, 'shape': 'triangle', 'color': '#99FF33', 'originalDatatype': 'None'})
            UpdateReceptor_17.addInputPort(*(), **{'singleConnection': True, 'name': 'pdbqt', 'cast': True, 'datatype': 'string', 'defaultValue': None, 'required': False, 'height': 8, 'width': 12, 'shape': 'oval', 'color': 'white', 'originalDatatype': 'None'})
            UpdateReceptor_17.addOutputPort(*(), **{'name': 'receptor_prepared_obj', 'datatype': 'receptor_prepared', 'height': 8, 'width': 12, 'shape': 'triangle', 'color': '#009900'})
            UpdateReceptor_17.addOutputPort(*(), **{'name': 'receptor_result', 'datatype': 'string', 'height': 8, 'width': 12, 'shape': 'oval', 'color': 'white'})
            code = """def doit(self, receptor_obj, pdbqt):
        from AutoDockTools.VisionInterface.Adt.receptor_prepared import receptor_prepared
        if pdbqt != '''no data yet''':
            receptor_prepared_obj = receptor_prepared(pdbqt)
            receptor_obj.set_ext_loc(pdbqt)
            receptor_result = pdbqt
        else:
            pdbqt_org = receptor_obj.get_ext_loc('''pdbqt''')
            receptor_prepared_obj = receptor_prepared(pdbqt_org)
            receptor_result = pdbqt_org
        
        pass

        self.outputData(receptor_prepared_obj = receptor_prepared_obj, receptor_result=receptor_result)



"""
            UpdateReceptor_17.configure(function=code)
            UpdateReceptor_17.configure(*(), **{'paramPanelImmediate': 1, 'expanded': False})

            ## saving connections for network PrepareReceptorWS ##
            PrepareReceptorWS_10.macroNetwork.freeze()
            input_Ports_11 = PrepareReceptorWS_10.macroNetwork.ipNode
            if input_Ports_11 is not None and CheckFileFormat_13 is not None:
                try:
                    PrepareReceptorWS_10.macroNetwork.connectNodes(
                        input_Ports_11, CheckFileFormat_13, "new", "value", blocking=True
                        , splitratio=[0.64907843562020084, 0.47057253960060474])
                except:
                    print("WARNING: failed to restore connection between input_Ports_11 and CheckFileFormat_13 in network PrepareReceptorWS_10.macroNetwork")
            if CheckFileFormat_13 is not None and PrepareReceptorOpalService_ws_nbcr_net_14 is not None:
                try:
                    PrepareReceptorWS_10.macroNetwork.connectNodes(
                        CheckFileFormat_13, PrepareReceptorOpalService_ws_nbcr_net_14, "receptor_url", "url", blocking=True
                        , splitratio=[0.6171192646814192, 0.42883431331137822])
                except:
                    print("WARNING: failed to restore connection between CheckFileFormat_13 and PrepareReceptorOpalService_ws_nbcr_net_14 in network PrepareReceptorWS_10.macroNetwork")
            if CheckFileFormat_13 is not None and PrepareReceptorOpalService_ws_nbcr_net_14 is not None:
                try:
                    PrepareReceptorWS_10.macroNetwork.connectNodes(
                        CheckFileFormat_13, PrepareReceptorOpalService_ws_nbcr_net_14, "receptor_local", "r", blocking=True
                        , splitratio=[0.66136144381723583, 0.28482114514549767])
                except:
                    print("WARNING: failed to restore connection between CheckFileFormat_13 and PrepareReceptorOpalService_ws_nbcr_net_14 in network PrepareReceptorWS_10.macroNetwork")
            if input_Ports_11 is not None and PrepareReceptorOpalService_ws_nbcr_net_14 is not None:
                try:
                    PrepareReceptorWS_10.macroNetwork.connectNodes(
                        input_Ports_11, PrepareReceptorOpalService_ws_nbcr_net_14, "new", "C", blocking=True
                        , splitratio=[0.53817543437956172, 0.61119702937572407])
                except:
                    print("WARNING: failed to restore connection between input_Ports_11 and PrepareReceptorOpalService_ws_nbcr_net_14 in network PrepareReceptorWS_10.macroNetwork")
            if PrepareReceptorOpalService_ws_nbcr_net_14 is not None and GetURLFromList_15 is not None:
                try:
                    PrepareReceptorWS_10.macroNetwork.connectNodes(
                        PrepareReceptorOpalService_ws_nbcr_net_14, GetURLFromList_15, "result", "urllist", blocking=True
                        , splitratio=[0.43369347916867251, 0.26566786648658042])
                except:
                    print("WARNING: failed to restore connection between PrepareReceptorOpalService_ws_nbcr_net_14 and GetURLFromList_15 in network PrepareReceptorWS_10.macroNetwork")
            if GetURLFromList_15 is not None and DownloadToFile_16 is not None:
                try:
                    PrepareReceptorWS_10.macroNetwork.connectNodes(
                        GetURLFromList_15, DownloadToFile_16, "url", "url", blocking=True
                        , splitratio=[0.70502483723033316, 0.71683158018466053])
                except:
                    print("WARNING: failed to restore connection between GetURLFromList_15 and DownloadToFile_16 in network PrepareReceptorWS_10.macroNetwork")
            if CheckFileFormat_13 is not None and DownloadToFile_16 is not None:
                try:
                    PrepareReceptorWS_10.macroNetwork.connectNodes(
                        CheckFileFormat_13, DownloadToFile_16, "download_loc", "filename", blocking=True
                        , splitratio=[0.60455581032885575, 0.35606890231085681])
                except:
                    print("WARNING: failed to restore connection between CheckFileFormat_13 and DownloadToFile_16 in network PrepareReceptorWS_10.macroNetwork")
            if CheckFileFormat_13 is not None and UpdateReceptor_17 is not None:
                try:
                    PrepareReceptorWS_10.macroNetwork.connectNodes(
                        CheckFileFormat_13, UpdateReceptor_17, "receptor_obj", "receptor_obj", blocking=True
                        , splitratio=[0.74908230670336207, 0.38226563370205602])
                except:
                    print("WARNING: failed to restore connection between CheckFileFormat_13 and UpdateReceptor_17 in network PrepareReceptorWS_10.macroNetwork")
            if DownloadToFile_16 is not None and UpdateReceptor_17 is not None:
                try:
                    PrepareReceptorWS_10.macroNetwork.connectNodes(
                        DownloadToFile_16, UpdateReceptor_17, "filename", "pdbqt", blocking=True
                        , splitratio=[0.38698393490575966, 0.2874426709930199])
                except:
                    print("WARNING: failed to restore connection between DownloadToFile_16 and UpdateReceptor_17 in network PrepareReceptorWS_10.macroNetwork")
            output_Ports_12 = PrepareReceptorWS_10.macroNetwork.opNode
            if UpdateReceptor_17 is not None and output_Ports_12 is not None:
                try:
                    PrepareReceptorWS_10.macroNetwork.connectNodes(
                        UpdateReceptor_17, output_Ports_12, "receptor_prepared_obj", "new", blocking=True
                        , splitratio=[0.69589857263374943, 0.59566078506240416])
                except:
                    print("WARNING: failed to restore connection between UpdateReceptor_17 and output_Ports_12 in network PrepareReceptorWS_10.macroNetwork")
            if UpdateReceptor_17 is not None and output_Ports_12 is not None:
                try:
                    PrepareReceptorWS_10.macroNetwork.connectNodes(
                        UpdateReceptor_17, output_Ports_12, "receptor_result", "new", blocking=True
                        , splitratio=[0.44926362052272689, 0.38628711158860896])
                except:
                    print("WARNING: failed to restore connection between UpdateReceptor_17 and output_Ports_12 in network PrepareReceptorWS_10.macroNetwork")
            PrepareReceptorWS_10.macroNetwork.unfreeze()

            ## modifying MacroInputNode dynamic ports
            input_Ports_11.outputPorts[1].configure(name='CheckFileFormat_value')
            input_Ports_11.outputPorts[2].configure(name='PrepareReceptorOpalService_ws_nbcr_net_C')

            ## modifying MacroOutputNode dynamic ports
            output_Ports_12.inputPorts[1].configure(singleConnection='auto')
            output_Ports_12.inputPorts[2].configure(singleConnection='auto')
            output_Ports_12.inputPorts[1].configure(name='UpdateReceptor_receptor_prepared_obj')
            output_Ports_12.inputPorts[2].configure(name='UpdateReceptor_receptor_result')
            PrepareReceptorWS_10.inputPorts[0].configure(name='CheckFileFormat_value')
            PrepareReceptorWS_10.inputPorts[0].configure(datatype='receptor')
            PrepareReceptorWS_10.inputPorts[1].configure(name='PrepareReceptorOpalService_ws_nbcr_net_C')
            PrepareReceptorWS_10.inputPorts[1].configure(datatype='boolean')
            ## configure MacroNode input ports
            PrepareReceptorWS_10.outputPorts[0].configure(name='UpdateReceptor_receptor_prepared_obj')
            PrepareReceptorWS_10.outputPorts[0].configure(datatype='receptor_prepared')
            PrepareReceptorWS_10.outputPorts[1].configure(name='UpdateReceptor_receptor_result')
            PrepareReceptorWS_10.outputPorts[1].configure(datatype='string')
            ## configure MacroNode output ports
            PrepareReceptorWS_10.shrink()
            PrepareReceptorWS_10.configure(*(), **{'paramPanelImmediate': 1, 'expanded': False})
        except:
            print("WARNING: failed to restore MacroNode named PrepareReceptorWS in network self.macroNetwork")
            print_exc()
            PrepareReceptorWS_10=None

        #self.macroNetwork.run()
        self.macroNetwork.freeze()

        ## saving connections for network PrepareReceptor ##
        input_Ports_1 = self.macroNetwork.ipNode
        Pdb2pqrWS_3 = self.macroNetwork.nodes[2]
        if input_Ports_1 is not None and Pdb2pqrWS_3 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_1, Pdb2pqrWS_3, "new", "CheckFileFormat_value", blocking=True
                    , splitratio=[0.73531020066010289, 0.24042404972613104])
            except:
                print("WARNING: failed to restore connection between input_Ports_1 and Pdb2pqrWS_3 in network self.macroNetwork")
        PrepareReceptorWS_10 = self.macroNetwork.nodes[3]
        if Pdb2pqrWS_3 is not None and PrepareReceptorWS_10 is not None:
            try:
                self.macroNetwork.connectNodes(
                    Pdb2pqrWS_3, PrepareReceptorWS_10, "UpdateReceptor_receptor_obj", "CheckFileFormat_value", blocking=True
                    , splitratio=[0.54479169827535734, 0.4847384502006486])
            except:
                print("WARNING: failed to restore connection between Pdb2pqrWS_3 and PrepareReceptorWS_10 in network self.macroNetwork")
        if input_Ports_1 is not None and PrepareReceptorWS_10 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_1, PrepareReceptorWS_10, "new", "PrepareReceptorOpalService_ws_nbcr_net_C", blocking=True
                    , splitratio=[0.37730151685222141, 0.48897820190498614])
            except:
                print("WARNING: failed to restore connection between input_Ports_1 and PrepareReceptorWS_10 in network self.macroNetwork")
        output_Ports_2 = self.macroNetwork.opNode
        if PrepareReceptorWS_10 is not None and output_Ports_2 is not None:
            try:
                self.macroNetwork.connectNodes(
                    PrepareReceptorWS_10, output_Ports_2, "UpdateReceptor_receptor_prepared_obj", "new", blocking=True
                    , splitratio=[0.64110508898616414, 0.45535290355389196])
            except:
                print("WARNING: failed to restore connection between PrepareReceptorWS_10 and output_Ports_2 in network self.macroNetwork")
        if PrepareReceptorWS_10 is not None and output_Ports_2 is not None:
            try:
                self.macroNetwork.connectNodes(
                    PrepareReceptorWS_10, output_Ports_2, "UpdateReceptor_receptor_result", "new", blocking=True
                    , splitratio=[0.45846842546122241, 0.44240009354017412])
            except:
                print("WARNING: failed to restore connection between PrepareReceptorWS_10 and output_Ports_2 in network self.macroNetwork")
        self.macroNetwork.runOnNewData.value = False

        ## modifying MacroInputNode dynamic ports
        input_Ports_1 = self.macroNetwork.ipNode
        input_Ports_1.outputPorts[1].configure(name='Pdb2pqrWS_CheckFileFormat_value')
        input_Ports_1.outputPorts[2].configure(name='PrepareReceptorWS_PrepareReceptorOpalService_ws_nbcr_net_C')

        ## modifying MacroOutputNode dynamic ports
        output_Ports_2 = self.macroNetwork.opNode
        output_Ports_2.inputPorts[1].configure(singleConnection='auto')
        output_Ports_2.inputPorts[2].configure(singleConnection='auto')
        output_Ports_2.inputPorts[1].configure(name='PrepareReceptorWS_UpdateReceptor_receptor_prepared_obj')
        output_Ports_2.inputPorts[2].configure(name='PrepareReceptorWS_UpdateReceptor_receptor_result')
        ## configure MacroNode input ports
        PrepareReceptor_0.inputPorts[0].configure(name='Pdb2pqrWS_CheckFileFormat_value')
        PrepareReceptor_0.inputPorts[0].configure(datatype='receptor')
        PrepareReceptor_0.inputPorts[1].configure(name='PrepareReceptorWS_PrepareReceptorOpalService_ws_nbcr_net_C')
        PrepareReceptor_0.inputPorts[1].configure(datatype='boolean')
        ## configure MacroNode output ports
        PrepareReceptor_0.outputPorts[0].configure(name='PrepareReceptorWS_UpdateReceptor_receptor_prepared_obj')
        PrepareReceptor_0.outputPorts[0].configure(datatype='receptor_prepared')
        PrepareReceptor_0.outputPorts[1].configure(name='PrepareReceptorWS_UpdateReceptor_receptor_result')
        PrepareReceptor_0.outputPorts[1].configure(datatype='string')

        PrepareReceptor_0.shrink()

        ## reset modifications ##
        PrepareReceptor_0.resetTags()
        PrepareReceptor_0.buildOriginalList()
Esempio n. 5
0
    FileWithCommandOrdering_0 = FileBrowserNE(constrkw={},
                                              name='FileWithCommandOrdering',
                                              library=stdlib)
    masterNet.addNode(FileWithCommandOrdering_0, 30, 10)
    FileWithCommandOrdering_0.inputPortByName['filename'].widget.set(
        r"NAMDTeragridGPU_0.1_input/order.txt", run=False)
    apply(FileWithCommandOrdering_0.configure, (), {'paramPanelImmediate': 1})
except:
    print "WARNING: failed to restore FileBrowserNE named FileWithCommandOrdering in network masterNet"
    print_exc()
    FileWithCommandOrdering_0 = None

try:
    ## saving node GetOrdering ##
    from Vision.StandardNodes import Generic
    GetOrdering_1 = Generic(constrkw={}, name='GetOrdering', library=stdlib)
    masterNet.addNode(GetOrdering_1, 30, 107)
    apply(
        GetOrdering_1.addInputPort, (), {
            'singleConnection': True,
            'name': 'order_file',
            'cast': True,
            'datatype': 'string',
            'defaultValue': None,
            'required': True,
            'height': 8,
            'width': 12,
            'shape': 'oval',
            'color': 'white',
            'originalDatatype': 'None'
        })
Esempio n. 6
0
    def afterAddingToNetwork(self):
        masterNet = self.macroNetwork
        from NetworkEditor.macros import MacroNode
        MacroNode.afterAddingToNetwork(self)
        from WebServices.VisionInterface.WSNodes import wslib
        from Vision.StandardNodes import stdlib
        ## building macro network ##
        AutodockVsCSF_0 = self
        from traceback import print_exc
        from WebServices.VisionInterface.WSNodes import wslib
        from Vision.StandardNodes import stdlib
        masterNet.getEditor().addLibraryInstance(
            wslib, "WebServices.VisionInterface.WSNodes", "wslib")
        from WebServices.VisionInterface.WSNodes import addOpalServerAsCategory
        try:
            addOpalServerAsCategory(
                "http://oolitevm.calit2.optiputer.net/opal2", replace=False)
        except:
            pass
        try:
            addOpalServerAsCategory("http://kryptonite.nbcr.net/opal2",
                                    replace=False)
        except:
            pass
        try:
            ## saving node input Ports ##
            input_Ports_1 = self.macroNetwork.ipNode
            apply(input_Ports_1.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print "WARNING: failed to restore MacroInputNode named input Ports in network self.macroNetwork"
            print_exc()
            input_Ports_1 = None

        try:
            ## saving node output Ports ##
            output_Ports_2 = self.macroNetwork.opNode
            apply(output_Ports_2.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
            output_Ports_2.move(183, 363)
        except:
            print "WARNING: failed to restore MacroOutputNode named output Ports in network self.macroNetwork"
            print_exc()
            output_Ports_2 = None

        try:
            ## saving node PrepareADVSInputs ##
            from Vision.StandardNodes import Generic
            PrepareADVSInputs_3 = Generic(constrkw={},
                                          name='PrepareADVSInputs',
                                          library=stdlib)
            self.macroNetwork.addNode(PrepareADVSInputs_3, 217, 76)
            apply(
                PrepareADVSInputs_3.addInputPort, (), {
                    'singleConnection': True,
                    'name': 'ligands',
                    'cast': True,
                    'datatype': 'LigandDB',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'rect',
                    'color': '#FFCCFF',
                    'originalDatatype': 'None'
                })
            apply(
                PrepareADVSInputs_3.addInputPort, (), {
                    'singleConnection': True,
                    'name': 'autogrid_results',
                    'cast': True,
                    'datatype': 'autogrid_results',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'triangle',
                    'color': '#FF33CC',
                    'originalDatatype': 'None'
                })
            apply(
                PrepareADVSInputs_3.addInputPort, (), {
                    'singleConnection': True,
                    'name': 'dpf_template_obj',
                    'cast': True,
                    'datatype': 'dpf_template',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'triangle',
                    'color': '#9933FF',
                    'originalDatatype': 'None'
                })
            apply(
                PrepareADVSInputs_3.addOutputPort, (), {
                    'name': 'filter_file',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            apply(
                PrepareADVSInputs_3.addOutputPort, (), {
                    'name': 'ligand_lib',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            apply(
                PrepareADVSInputs_3.addOutputPort, (), {
                    'name': 'dpf_template_file',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            apply(
                PrepareADVSInputs_3.addOutputPort, (), {
                    'name': 'autogrid_res_url',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            apply(
                PrepareADVSInputs_3.addOutputPort, (), {
                    'name': 'autogrid_res_local',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            code = """def doit(self, ligands, autogrid_results, dpf_template_obj):
        dpf = dpf_template_obj.fullpath

        if not(os.path.exists(dpf)):
            print "ERROR: DPF template " + dpf + " does not exist!"
            return '''stop'''
    
        filter_file = ligands.filter_file
        
        if autogrid_results.type == '''url''':
            autogrid_result_url = autogrid_results.path
            autogrid_result_local = ""
        else:
            autogrid_result_url = ""
            autogrid_result_local = autogrid_results.path
        
        ligand_lib = ligands.loc
        
	pass

        self.outputData(filter_file=filter_file, ligand_lib=ligand_lib, dpf_template_file=dpf, autogrid_res_url=autogrid_result_url, autogrid_res_local=autogrid_result_local)

## to ouput data on port filter_file use
## self.outputData(filter_file=data)
## to ouput data on port ligand_lib use
## self.outputData(ligand_lib=data)
## to ouput data on port dpf_template_file use
## self.outputData(dpf_template_file=data)
## to ouput data on port autogrid_res_url use
## self.outputData(autogrid_res_url=data)
## to ouput data on port autogrid_res_local use
## self.outputData(autogrid_res_local=data)









"""
            PrepareADVSInputs_3.configure(function=code)
            apply(PrepareADVSInputs_3.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print "WARNING: failed to restore Generic named PrepareADVSInputs in network self.macroNetwork"
            print_exc()
            PrepareADVSInputs_3 = None

        try:
            ## saving node autodock_kryptonite_nbcr_net ##
            from NetworkEditor.items import FunctionNode
            autodock_kryptonite_nbcr_net_4 = FunctionNode(
                functionOrString='autodock_kryptonite_nbcr_net',
                host="http://kryptonite.nbcr.net/opal2",
                namedArgs={
                    'ga_run': '',
                    'lib': '',
                    'filter_file_url': '',
                    'ga_num_evals': '',
                    'filter_file': '',
                    'sched': 'SGE',
                    'urllib': '',
                    'ga_num_generations': '',
                    'dpf': '',
                    'u': '',
                    'utar': '',
                    'userlib': '',
                    'ga_pop_size': '',
                    'localRun': False,
                    'email': '',
                    'execPath': ''
                },
                constrkw={
                    'functionOrString': "'autodock_kryptonite_nbcr_net'",
                    'host': '"http://kryptonite.nbcr.net/opal2"',
                    'namedArgs': {
                        'ga_run': '',
                        'lib': '',
                        'filter_file_url': '',
                        'ga_num_evals': '',
                        'filter_file': '',
                        'sched': 'SGE',
                        'urllib': '',
                        'ga_num_generations': '',
                        'dpf': '',
                        'u': '',
                        'utar': '',
                        'userlib': '',
                        'ga_pop_size': '',
                        'localRun': False,
                        'email': '',
                        'execPath': ''
                    }
                },
                name='autodock_kryptonite_nbcr_net',
                library=wslib)
            self.macroNetwork.addNode(autodock_kryptonite_nbcr_net_4, 217, 132)
            apply(
                autodock_kryptonite_nbcr_net_4.inputPortByName['ga_run'].
                configure, (), {'defaultValue': None})
            apply(
                autodock_kryptonite_nbcr_net_4.inputPortByName['lib'].
                configure, (), {'defaultValue': None})
            apply(
                autodock_kryptonite_nbcr_net_4.
                inputPortByName['filter_file_url'].configure, (),
                {'defaultValue': None})
            apply(
                autodock_kryptonite_nbcr_net_4.inputPortByName['ga_num_evals'].
                configure, (), {'defaultValue': None})
            apply(
                autodock_kryptonite_nbcr_net_4.inputPortByName['filter_file'].
                configure, (), {'defaultValue': None})
            apply(
                autodock_kryptonite_nbcr_net_4.inputPortByName['sched'].
                configure, (), {'defaultValue': None})
            apply(
                autodock_kryptonite_nbcr_net_4.inputPortByName['urllib'].
                configure, (), {'defaultValue': None})
            apply(
                autodock_kryptonite_nbcr_net_4.
                inputPortByName['ga_num_generations'].configure, (),
                {'defaultValue': None})
            apply(
                autodock_kryptonite_nbcr_net_4.inputPortByName['dpf'].
                configure, (), {'defaultValue': None})
            apply(
                autodock_kryptonite_nbcr_net_4.inputPortByName['u'].configure,
                (), {'defaultValue': None})
            apply(
                autodock_kryptonite_nbcr_net_4.inputPortByName['utar'].
                configure, (), {'defaultValue': None})
            apply(
                autodock_kryptonite_nbcr_net_4.inputPortByName['userlib'].
                configure, (), {'defaultValue': None})
            apply(
                autodock_kryptonite_nbcr_net_4.inputPortByName['ga_pop_size'].
                configure, (), {'defaultValue': None})
            apply(
                autodock_kryptonite_nbcr_net_4.inputPortByName['localRun'].
                configure, (), {'defaultValue': None})
            apply(
                autodock_kryptonite_nbcr_net_4.inputPortByName['email'].
                configure, (), {'defaultValue': None})
            apply(
                autodock_kryptonite_nbcr_net_4.inputPortByName['execPath'].
                configure, (), {'defaultValue': None})
            autodock_kryptonite_nbcr_net_4.inputPortByName[
                'ga_run'].widget.set(r"", run=False)
            apply(
                autodock_kryptonite_nbcr_net_4.inputPortByName['lib'].widget.
                configure, (), {
                    'choices':
                    ('sample', 'NCIDS_SC', 'NCI_DS1', 'NCI_DS2',
                     'human_metabolome', 'chembridge_building_blocks',
                     'drugbank_nutraceutics', 'drugbank_smallmol',
                     'fda_approved')
                })
            autodock_kryptonite_nbcr_net_4.inputPortByName['lib'].widget.set(
                r"", run=False)
            autodock_kryptonite_nbcr_net_4.inputPortByName[
                'filter_file_url'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_4.inputPortByName[
                'ga_num_evals'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_4.inputPortByName[
                'filter_file'].rebindWidget()
            autodock_kryptonite_nbcr_net_4.inputPortByName[
                'filter_file'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_4.inputPortByName[
                'filter_file'].unbindWidget()
            apply(
                autodock_kryptonite_nbcr_net_4.inputPortByName['sched'].widget.
                configure, (), {'choices': ('SGE', 'CSF')})
            autodock_kryptonite_nbcr_net_4.inputPortByName['sched'].widget.set(
                r"CSF", run=False)
            autodock_kryptonite_nbcr_net_4.inputPortByName[
                'urllib'].rebindWidget()
            autodock_kryptonite_nbcr_net_4.inputPortByName[
                'urllib'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_4.inputPortByName[
                'urllib'].unbindWidget()
            autodock_kryptonite_nbcr_net_4.inputPortByName[
                'ga_num_generations'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_4.inputPortByName['dpf'].rebindWidget(
            )
            autodock_kryptonite_nbcr_net_4.inputPortByName['dpf'].widget.set(
                r"", run=False)
            autodock_kryptonite_nbcr_net_4.inputPortByName['dpf'].unbindWidget(
            )
            autodock_kryptonite_nbcr_net_4.inputPortByName['u'].rebindWidget()
            autodock_kryptonite_nbcr_net_4.inputPortByName['u'].widget.set(
                r"", run=False)
            autodock_kryptonite_nbcr_net_4.inputPortByName['u'].unbindWidget()
            autodock_kryptonite_nbcr_net_4.inputPortByName[
                'utar'].rebindWidget()
            autodock_kryptonite_nbcr_net_4.inputPortByName['utar'].widget.set(
                r"", run=False)
            autodock_kryptonite_nbcr_net_4.inputPortByName[
                'utar'].unbindWidget()
            autodock_kryptonite_nbcr_net_4.inputPortByName[
                'userlib'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_4.inputPortByName[
                'ga_pop_size'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_4.inputPortByName[
                'localRun'].widget.set(0, run=False)
            autodock_kryptonite_nbcr_net_4.inputPortByName['email'].widget.set(
                r"", run=False)
            autodock_kryptonite_nbcr_net_4.inputPortByName[
                'execPath'].widget.set(r"", run=False)
            apply(autodock_kryptonite_nbcr_net_4.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print "WARNING: failed to restore FunctionNode named autodock_kryptonite_nbcr_net in network self.macroNetwork"
            print_exc()
            autodock_kryptonite_nbcr_net_4 = None

        try:
            ## saving node GetMainURLFromList ##
            from WebServices.VisionInterface.WSNodes import GetMainURLFromListNode
            GetMainURLFromList_5 = GetMainURLFromListNode(
                constrkw={}, name='GetMainURLFromList', library=wslib)
            self.macroNetwork.addNode(GetMainURLFromList_5, 217, 188)
            apply(GetMainURLFromList_5.inputPortByName['urls'].configure, (),
                  {'defaultValue': None})
            apply(GetMainURLFromList_5.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print "WARNING: failed to restore GetMainURLFromListNode named GetMainURLFromList in network self.macroNetwork"
            print_exc()
            GetMainURLFromList_5 = None

        try:
            ## saving node GetMainURLFromList ##
            from WebServices.VisionInterface.WSNodes import GetMainURLFromListNode
            GetMainURLFromList_7 = GetMainURLFromListNode(
                constrkw={}, name='GetMainURLFromList', library=wslib)
            self.macroNetwork.addNode(GetMainURLFromList_7, 201, 301)
            apply(GetMainURLFromList_7.inputPortByName['urls'].configure, (),
                  {'defaultValue': None})
            apply(GetMainURLFromList_7.configure, (), {
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print "WARNING: failed to restore GetMainURLFromListNode named GetMainURLFromList in network self.macroNetwork"
            print_exc()
            GetMainURLFromList_7 = None

        try:
            ## saving node AutodockSlice_oolitevm_calit2_optiputer_net ##
            from NetworkEditor.items import FunctionNode
            AutodockSlice_oolitevm_calit2_optiputer_net_8 = FunctionNode(
                functionOrString='AutodockSlice_oolitevm_calit2_optiputer_net',
                host="http://oolitevm.calit2.optiputer.net/opal2",
                namedArgs={
                    'execPath': '',
                    'localRun': False,
                    'divisor': '',
                    'lib': '',
                    'input_url': ''
                },
                constrkw={
                    'functionOrString':
                    "'AutodockSlice_oolitevm_calit2_optiputer_net'",
                    'host': '"http://oolitevm.calit2.optiputer.net/opal2"',
                    'namedArgs': {
                        'execPath': '',
                        'localRun': False,
                        'divisor': '',
                        'lib': '',
                        'input_url': ''
                    }
                },
                name='AutodockSlice_oolitevm_calit2_optiputer_net',
                library=wslib)
            self.macroNetwork.addNode(
                AutodockSlice_oolitevm_calit2_optiputer_net_8, 200, 240)
            apply(
                AutodockSlice_oolitevm_calit2_optiputer_net_8.
                inputPortByName['execPath'].configure, (),
                {'defaultValue': None})
            apply(
                AutodockSlice_oolitevm_calit2_optiputer_net_8.
                inputPortByName['localRun'].configure, (),
                {'defaultValue': None})
            apply(
                AutodockSlice_oolitevm_calit2_optiputer_net_8.
                inputPortByName['divisor'].configure, (),
                {'defaultValue': None})
            apply(
                AutodockSlice_oolitevm_calit2_optiputer_net_8.
                inputPortByName['lib'].configure, (), {'defaultValue': None})
            apply(
                AutodockSlice_oolitevm_calit2_optiputer_net_8.
                inputPortByName['input_url'].configure, (),
                {'defaultValue': None})
            AutodockSlice_oolitevm_calit2_optiputer_net_8.inputPortByName[
                'execPath'].widget.set(r"", run=False)
            AutodockSlice_oolitevm_calit2_optiputer_net_8.inputPortByName[
                'localRun'].widget.set(0, run=False)
            AutodockSlice_oolitevm_calit2_optiputer_net_8.inputPortByName[
                'divisor'].widget.set(r"", run=False)
            AutodockSlice_oolitevm_calit2_optiputer_net_8.inputPortByName[
                'lib'].rebindWidget()
            AutodockSlice_oolitevm_calit2_optiputer_net_8.inputPortByName[
                'lib'].widget.set(r"", run=False)
            AutodockSlice_oolitevm_calit2_optiputer_net_8.inputPortByName[
                'lib'].unbindWidget()
            AutodockSlice_oolitevm_calit2_optiputer_net_8.inputPortByName[
                'input_url'].rebindWidget()
            AutodockSlice_oolitevm_calit2_optiputer_net_8.inputPortByName[
                'input_url'].widget.set(r"", run=False)
            AutodockSlice_oolitevm_calit2_optiputer_net_8.inputPortByName[
                'input_url'].unbindWidget()
            apply(AutodockSlice_oolitevm_calit2_optiputer_net_8.configure, (),
                  {
                      'paramPanelImmediate': 1,
                      'expanded': False
                  })
        except:
            print "WARNING: failed to restore FunctionNode named AutodockSlice_oolitevm_calit2_optiputer_net in network self.macroNetwork"
            print_exc()
            AutodockSlice_oolitevm_calit2_optiputer_net_8 = None

        #self.macroNetwork.run()
        self.macroNetwork.freeze()

        ## saving connections for network AutodockVsCSF ##
        if autodock_kryptonite_nbcr_net_4 is not None and GetMainURLFromList_5 is not None:
            try:
                self.macroNetwork.connectNodes(
                    autodock_kryptonite_nbcr_net_4,
                    GetMainURLFromList_5,
                    "result",
                    "urls",
                    blocking=True,
                    splitratio=[0.36974288957131424, 0.63465596053596318])
            except:
                print "WARNING: failed to restore connection between autodock_kryptonite_nbcr_net_4 and GetMainURLFromList_5 in network self.macroNetwork"
        if PrepareADVSInputs_3 is not None and autodock_kryptonite_nbcr_net_4 is not None:
            try:
                self.macroNetwork.connectNodes(
                    PrepareADVSInputs_3,
                    autodock_kryptonite_nbcr_net_4,
                    "filter_file",
                    "filter_file",
                    blocking=True,
                    splitratio=[0.33230642287344903, 0.65770700108889613])
            except:
                print "WARNING: failed to restore connection between PrepareADVSInputs_3 and autodock_kryptonite_nbcr_net_4 in network self.macroNetwork"
        if PrepareADVSInputs_3 is not None and autodock_kryptonite_nbcr_net_4 is not None:
            try:
                self.macroNetwork.connectNodes(
                    PrepareADVSInputs_3,
                    autodock_kryptonite_nbcr_net_4,
                    "ligand_lib",
                    "urllib",
                    blocking=True,
                    splitratio=[0.50680104599665787, 0.51414170500293577])
            except:
                print "WARNING: failed to restore connection between PrepareADVSInputs_3 and autodock_kryptonite_nbcr_net_4 in network self.macroNetwork"
        if PrepareADVSInputs_3 is not None and autodock_kryptonite_nbcr_net_4 is not None:
            try:
                self.macroNetwork.connectNodes(
                    PrepareADVSInputs_3,
                    autodock_kryptonite_nbcr_net_4,
                    "dpf_template_file",
                    "dpf",
                    blocking=True,
                    splitratio=[0.51615646597598808, 0.25661305528484007])
            except:
                print "WARNING: failed to restore connection between PrepareADVSInputs_3 and autodock_kryptonite_nbcr_net_4 in network self.macroNetwork"
        if PrepareADVSInputs_3 is not None and autodock_kryptonite_nbcr_net_4 is not None:
            try:
                self.macroNetwork.connectNodes(
                    PrepareADVSInputs_3,
                    autodock_kryptonite_nbcr_net_4,
                    "autogrid_res_url",
                    "u",
                    blocking=True,
                    splitratio=[0.5760732944947704, 0.2032376887917188])
            except:
                print "WARNING: failed to restore connection between PrepareADVSInputs_3 and autodock_kryptonite_nbcr_net_4 in network self.macroNetwork"
        if PrepareADVSInputs_3 is not None and autodock_kryptonite_nbcr_net_4 is not None:
            try:
                self.macroNetwork.connectNodes(
                    PrepareADVSInputs_3,
                    autodock_kryptonite_nbcr_net_4,
                    "autogrid_res_local",
                    "utar",
                    blocking=True,
                    splitratio=[0.52802808938949819, 0.66978534572736881])
            except:
                print "WARNING: failed to restore connection between PrepareADVSInputs_3 and autodock_kryptonite_nbcr_net_4 in network self.macroNetwork"
        input_Ports_1 = self.macroNetwork.ipNode
        if input_Ports_1 is not None and PrepareADVSInputs_3 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_1,
                    PrepareADVSInputs_3,
                    "new",
                    "ligands",
                    blocking=True,
                    splitratio=[0.23314258225660414, 0.72184112037432979])
            except:
                print "WARNING: failed to restore connection between input_Ports_1 and PrepareADVSInputs_3 in network self.macroNetwork"
        if input_Ports_1 is not None and PrepareADVSInputs_3 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_1,
                    PrepareADVSInputs_3,
                    "new",
                    "autogrid_results",
                    blocking=True,
                    splitratio=[0.56916626620432731, 0.43089669830392019])
            except:
                print "WARNING: failed to restore connection between input_Ports_1 and PrepareADVSInputs_3 in network self.macroNetwork"
        if input_Ports_1 is not None and PrepareADVSInputs_3 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_1,
                    PrepareADVSInputs_3,
                    "new",
                    "dpf_template_obj",
                    blocking=True,
                    splitratio=[0.26502286453989665, 0.3911248444502638])
            except:
                print "WARNING: failed to restore connection between input_Ports_1 and PrepareADVSInputs_3 in network self.macroNetwork"
        output_Ports_2 = self.macroNetwork.opNode
        if GetMainURLFromList_7 is not None and output_Ports_2 is not None:
            try:
                self.macroNetwork.connectNodes(
                    GetMainURLFromList_7,
                    output_Ports_2,
                    "newurl",
                    "new",
                    blocking=True,
                    splitratio=[0.2408747073082603, 0.22897876889044461])
            except:
                print "WARNING: failed to restore connection between GetMainURLFromList_7 and output_Ports_2 in network self.macroNetwork"
        if PrepareADVSInputs_3 is not None and AutodockSlice_oolitevm_calit2_optiputer_net_8 is not None:
            try:
                self.macroNetwork.connectNodes(
                    PrepareADVSInputs_3,
                    AutodockSlice_oolitevm_calit2_optiputer_net_8,
                    "ligand_lib",
                    "lib",
                    blocking=True,
                    splitratio=[0.36439875698533941, 0.58443612376117082])
            except:
                print "WARNING: failed to restore connection between PrepareADVSInputs_3 and AutodockSlice_oolitevm_calit2_optiputer_net_8 in network self.macroNetwork"
        if GetMainURLFromList_5 is not None and AutodockSlice_oolitevm_calit2_optiputer_net_8 is not None:
            try:
                self.macroNetwork.connectNodes(
                    GetMainURLFromList_5,
                    AutodockSlice_oolitevm_calit2_optiputer_net_8,
                    "newurl",
                    "input_url",
                    blocking=True,
                    splitratio=[0.32808833199778697, 0.69237553555389719])
            except:
                print "WARNING: failed to restore connection between GetMainURLFromList_5 and AutodockSlice_oolitevm_calit2_optiputer_net_8 in network self.macroNetwork"
        if AutodockSlice_oolitevm_calit2_optiputer_net_8 is not None and GetMainURLFromList_7 is not None:
            try:
                self.macroNetwork.connectNodes(
                    AutodockSlice_oolitevm_calit2_optiputer_net_8,
                    GetMainURLFromList_7,
                    "result",
                    "urls",
                    blocking=True,
                    splitratio=[0.69930142895840763, 0.2984777644803871])
            except:
                print "WARNING: failed to restore connection between AutodockSlice_oolitevm_calit2_optiputer_net_8 and GetMainURLFromList_7 in network self.macroNetwork"
        self.macroNetwork.runOnNewData.value = True

        ## modifying MacroInputNode dynamic ports
        input_Ports_1 = self.macroNetwork.ipNode
        input_Ports_1.outputPorts[1].configure(
            name='PrepareADVSInputs_ligands')
        input_Ports_1.outputPorts[2].configure(
            name='PrepareADVSInputs_autogrid_results')
        input_Ports_1.outputPorts[3].configure(
            name='PrepareADVSInputs_dpf_template_obj')

        ## modifying MacroOutputNode dynamic ports
        output_Ports_2 = self.macroNetwork.opNode
        output_Ports_2.inputPorts[1].configure(singleConnection='auto')
        output_Ports_2.inputPorts[1].configure(
            name='GetMainURLFromList_newurl')
        ## configure MacroNode input ports
        AutodockVsCSF_0.inputPorts[0].configure(
            name='PrepareADVSInputs_ligands')
        AutodockVsCSF_0.inputPorts[0].configure(datatype='LigandDB')
        AutodockVsCSF_0.inputPorts[1].configure(
            name='PrepareADVSInputs_autogrid_results')
        AutodockVsCSF_0.inputPorts[1].configure(datatype='autogrid_results')
        AutodockVsCSF_0.inputPorts[2].configure(
            name='PrepareADVSInputs_dpf_template_obj')
        AutodockVsCSF_0.inputPorts[2].configure(datatype='dpf_template')
        ## configure MacroNode output ports
        AutodockVsCSF_0.outputPorts[0].configure(
            name='GetMainURLFromList_newurl')
        AutodockVsCSF_0.outputPorts[0].configure(datatype='string')

        AutodockVsCSF_0.shrink()

        ## reset modifications ##
        AutodockVsCSF_0.resetTags()
        AutodockVsCSF_0.buildOriginalList()
Esempio n. 7
0
 AutodockVina_Screening_kryptonite_nbcr_net_24.inputPortByName[
     'ligand_db'].widget.set(r"", run=False)
 apply(
     AutodockVina_Screening_kryptonite_nbcr_net_24.inputPortByName['cpu'].
     widget.configure, (), {'choices': ('1', '2')})
 AutodockVina_Screening_kryptonite_nbcr_net_24.inputPortByName[
     'cpu'].widget.set(r"", run=False)
 AutodockVina_Screening_kryptonite_nbcr_net_24.inputPortByName[
     'execPath'].widget.set(r"", run=False)
 apply(AutodockVina_Screening_kryptonite_nbcr_net_24.configure, (), {
     'paramPanelImmediate': 1,
     'expanded': False
 })
 from Vision.StandardNodes import Generic
 PrepareVinaInputs_25 = Generic(constrkw={},
                                name='PrepareVinaInputs',
                                library=stdlib)
 Vina_21.macroNetwork.addNode(PrepareVinaInputs_25, 140, 107)
 apply(
     PrepareVinaInputs_25.addInputPort, (), {
         'singleConnection': True,
         'name': 'receptor_obj',
         'cast': True,
         'datatype': 'receptor_prepared',
         'defaultValue': None,
         'required': True,
         'height': 8,
         'width': 12,
         'shape': 'triangle',
         'color': '#009900',
         'originalDatatype': 'None'
Esempio n. 8
0
    def afterAddingToNetwork(self):
        from NetworkEditor.macros import MacroNode
        MacroNode.afterAddingToNetwork(self)
        ## loading libraries ##
        from MolKit.VisionInterface.MolKitNodes import molkitlib
        from DejaVu.VisionInterface.DejaVuNodes import vizlib
        from Vision.StandardNodes import stdlib
        ## building macro network ##
        WebMSMS = self
        from traceback import print_exc

        ## loading libraries ##
        from MolKit.VisionInterface.MolKitNodes import molkitlib
        self.macroNetwork.getEditor().addLibraryInstance(
            molkitlib, "MolKit.VisionInterface.MolKitNodes", "molkitlib")

        from DejaVu.VisionInterface.DejaVuNodes import vizlib
        self.macroNetwork.getEditor().addLibraryInstance(
            vizlib, "DejaVu.VisionInterface.DejaVuNodes", "vizlib")

        from Vision.StandardNodes import stdlib
        self.macroNetwork.getEditor().addLibraryInstance(
            stdlib, "Vision.StandardNodes", "stdlib")

        try:

            ## saving node input Ports ##
            input_Ports = self.macroNetwork.ipNode
            input_Ports.move(13, 4)
        except:
            print "WARNING: failed to restore MacroInputNode named input Ports in network self.macroNetwork"
            print_exc()
            input_Ports = None
        try:

            ## saving node output Ports ##
            output_Ports = self.macroNetwork.opNode
            output_Ports.move(256, 220)
        except:
            print "WARNING: failed to restore MacroOutputNode named output Ports in network self.macroNetwork"
            print_exc()
            output_Ports = None
        try:

            ## saving node Assign Radii ##
            from MolKit.VisionInterface.MolKitNodes import AssignRadii
            Assign_Radii = AssignRadii(constrkw={},
                                       name='Assign Radii',
                                       library=molkitlib)
            self.macroNetwork.addNode(Assign_Radii, 30, 68)
            apply(
                Assign_Radii.getInputPortByName('molecules').configure, (), {
                    'color': '#c64e70',
                    'cast': True,
                    'shape': 'oval'
                })
            apply(
                Assign_Radii.getInputPortByName('united').configure, (), {
                    'color': 'yellow',
                    'cast': True,
                    'shape': 'circle'
                })
            apply(
                Assign_Radii.getOutputPortByName('molecules').configure, (), {
                    'color': '#c64e70',
                    'shape': 'oval'
                })
            apply(
                Assign_Radii.getOutputPortByName('radii').configure, (), {
                    'color': 'cyan',
                    'shape': 'oval'
                })
        except:
            print "WARNING: failed to restore AssignRadii named Assign Radii in network self.macroNetwork"
            print_exc()
            Assign_Radii = None
        try:

            ## saving node Select Nodes ##
            from MolKit.VisionInterface.MolKitNodes import NodeSelector
            Select_Nodes = NodeSelector(constrkw={},
                                        name='Select Nodes',
                                        library=molkitlib)
            self.macroNetwork.addNode(Select_Nodes, 29, 135)
            apply(
                Select_Nodes.getInputPortByName('nodes').configure, (), {
                    'color': '#c64e70',
                    'cast': True,
                    'shape': 'oval'
                })
            apply(
                Select_Nodes.getInputPortByName('nodeType').configure, (), {
                    'color': 'white',
                    'cast': True,
                    'shape': 'oval'
                })
            apply(
                Select_Nodes.getInputPortByName('selectionString').configure,
                (), {
                    'color': 'white',
                    'cast': True,
                    'shape': 'oval'
                })
            apply(
                Select_Nodes.getOutputPortByName('nodes').configure, (), {
                    'color': '#fe92a0',
                    'shape': 'oval'
                })
            Select_Nodes.getInputPortByName("selectionString").widget.set(".*")
        except:
            print "WARNING: failed to restore NodeSelector named Select Nodes in network self.macroNetwork"
            print_exc()
            Select_Nodes = None
        try:

            ## saving node Get xyzr ##
            from Vision.StandardNodes import Generic
            Get_xyzr = Generic(constrkw={}, name='Get xyzr', library=stdlib)
            self.macroNetwork.addNode(Get_xyzr, 30, 194)
            apply(
                Get_xyzr.addInputPort, (), {
                    'name': 'atoms',
                    'cast': True,
                    'datatype': 'AtomSet',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': '#fe92a0'
                })
            apply(
                Get_xyzr.addOutputPort, (), {
                    'name': 'output',
                    'datatype': 'string',
                    'height': 12,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            code = """def doit(self, atoms):
    lines = ''
    for atom in atoms:
        lines += str(atom.coords[0]) + ' ' + str(atom.coords[1]) + ' ' + str(atom.coords[2]) + ' '+ str(atom.radius)
        lines += "\\n"
    self.outputData(output=lines)
"""

            Get_xyzr.configure(function=code)
        except:
            print "WARNING: failed to restore Generic named Get xyzr in network self.macroNetwork"
            print_exc()
            Get_xyzr = None
        try:

            ## saving node IndexedPolygons ##
            from DejaVu.VisionInterface.GeometryNode import IndexedPolygonsNE
            IndexedPolygons = IndexedPolygonsNE(constrkw={},
                                                name='IndexedPolygons',
                                                library=vizlib)
            self.macroNetwork.addNode(IndexedPolygons, 273, 147)
            apply(
                IndexedPolygons.getInputPortByName('coords').configure, (), {
                    'color': 'purple',
                    'cast': True,
                    'shape': 'circle'
                })
            apply(
                IndexedPolygons.getInputPortByName('indices').configure, (), {
                    'color': 'yellow',
                    'cast': True,
                    'shape': 'circle'
                })
            apply(
                IndexedPolygons.getInputPortByName('vnormals').configure, (), {
                    'cast': True,
                    'shape': 'circle'
                })
            apply(
                IndexedPolygons.getInputPortByName('colors').configure, (), {
                    'cast': True,
                    'shape': 'circle'
                })
            apply(
                IndexedPolygons.getInputPortByName('name').configure, (), {
                    'color': 'white',
                    'cast': True,
                    'shape': 'oval'
                })
            apply(
                IndexedPolygons.getInputPortByName(
                    'instanceMatrices').configure, (), {'cast': True})
            apply(
                IndexedPolygons.getInputPortByName('geomOptions').configure,
                (), {
                    'color': 'cyan',
                    'cast': True,
                    'shape': 'oval'
                })
            apply(
                IndexedPolygons.getInputPortByName('parent').configure, (), {
                    'color': 'red',
                    'cast': True,
                    'shape': 'rect'
                })
            apply(
                IndexedPolygons.getOutputPortByName(
                    'indexedPolygons').configure, (), {
                        'color': 'red',
                        'shape': 'rect'
                    })
            apply(
                IndexedPolygons.getOutputPortByName('allGeometries').configure,
                (), {
                    'color': 'red',
                    'shape': 'rect'
                })
        except:
            print "WARNING: failed to restore IndexedPolygonsNE named IndexedPolygons in network self.macroNetwork"
            print_exc()
            IndexedPolygons = None
        try:

            ## saving node MSMS WS ##
            from Vision.StandardNodes import Generic
            MSMS_WS = Generic(constrkw={}, name='MSMS WS', library=stdlib)

            self.macroNetwork.addNode(MSMS_WS, 273, 37)
            apply(
                MSMS_WS.addInputPort, (), {
                    'name': 'input_str',
                    'cast': True,
                    'datatype': 'string',
                    'height': 12,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            apply(MSMS_WS.addInputPort, (), {
                'name': 'density',
                'datatype': 'float',
                'required': False
            })
            apply(
                MSMS_WS.getInputPortByName('density').createWidget, (), {
                    'descr': {
                        'initialValue': 1.0,
                        'increment': 0.1,
                        'type': 'float',
                        'master': 'ParamPanel',
                        'oneTurn': 10,
                        'min': 1.0,
                        'labelCfg': {
                            'text': 'density'
                        },
                        'class': 'NEDial'
                    }
                })
            apply(MSMS_WS.addInputPort, (), {
                'name': 'probe_radius',
                'datatype': 'float',
                'required': False
            })
            apply(
                MSMS_WS.getInputPortByName('probe_radius').createWidget, (), {
                    'descr': {
                        'initialValue': 1.5,
                        'increment': 0.1,
                        'type': 'float',
                        'master': 'ParamPanel',
                        'oneTurn': 10,
                        'min': 0.5,
                        'labelCfg': {
                            'text': 'probe radius'
                        },
                        'class': 'NEDial'
                    }
                })
            apply(MSMS_WS.addInputPort, (), {
                'name': 'allComp',
                'datatype': 'int',
                'required': False
            })
            apply(
                MSMS_WS.getInputPortByName('allComp').createWidget, (), {
                    'descr': {
                        'initialValue': 0,
                        'master': 'ParamPanel',
                        'labelCfg': {
                            'text': 'all components'
                        },
                        'class': 'NECheckButton'
                    }
                })
            apply(MSMS_WS.addInputPort, (), {
                'name': 'getfile',
                'datatype': 'boolean'
            })
            apply(
                MSMS_WS.getInputPortByName('getfile').createWidget, (), {
                    'descr': {
                        'master': 'ParamPanel',
                        'labelCfg': {
                            'text': 'upload output'
                        },
                        'class': 'NECheckButton',
                        'initialValue': True
                    }
                })

            apply(
                MSMS_WS.addOutputPort, (), {
                    'name': 'vertices',
                    'datatype': 'coordinates3D',
                    'height': 8,
                    'width': 12,
                    'shape': 'rect',
                    'color': 'green'
                })
            apply(
                MSMS_WS.addOutputPort, (), {
                    'name': 'indices',
                    'datatype': 'faceIndices',
                    'height': 8,
                    'width': 12,
                    'shape': 'rect',
                    'color': 'purple'
                })
            apply(
                MSMS_WS.addOutputPort, (), {
                    'name': 'vnormals',
                    'datatype': 'normals3D',
                    'height': 8,
                    'width': 12,
                    'shape': 'rect',
                    'color': 'blue'
                })
            MSMS_WS.host = self.host
            MSMS_WS.opal_service = self.opal_service

            code = """def doit(self, input_str, probe_radius, density, allComp, getfile):
    self.opal_service.inputFile.Set_name('msms.xyzr')
    self.opal_service.inputFile.Set_contents(input_str)
    options = '-if msms.xyzr -of ws_out '
    options += '-probe_radius ' + str(probe_radius)
    options += ' -density ' + str(density)
    if allComp:
        options += ' -all_components'
    self.opal_service.req._argList = options
    inputFiles = []
    inputFiles.append(self.opal_service.inputFile)
    self.opal_service.req._inputFile = inputFiles
    resp = self.opal_service.run('msmsServicePort')
    if resp:
        for files in resp._outputFile:
            if files._url.split('/')[-1] == 'ws_out.face':
                face_file = files._url
            if files._url.split('/')[-1] == 'ws_out.vert':
                vert_file = files._url
        if getfile:           
            from Pmv.msmsParser import MSMSParser
            msmsParser = MSMSParser()
            import urllib
            opener = urllib.FancyURLopener({})
            in_file = opener.open(face_file)
            msmsParser.getFaces(in_file.readlines())
            in_file = opener.open(vert_file)
            msmsParser.getVert(in_file.readlines())
            self.outputData(vertices = msmsParser.vertices, indices = msmsParser.faces,
                          vnormals = msmsParser.normals)
        else:
            self.outputData(vertices = vert_file, indices = face_file,
                          vnormals = None)
"""
            MSMS_WS.configure(function=code)
        except:
            print "WARNING: failed to restore Generic named MSMS WS in network self.macroNetwork"
            print_exc()
            MSMS_WS = None
        self.macroNetwork.freeze()

        ## saving connections for network WebMSMS ##
        if Assign_Radii is not None and Select_Nodes is not None:
            self.macroNetwork.connectNodes(Assign_Radii,
                                           Select_Nodes,
                                           "molecules",
                                           "nodes",
                                           blocking=True)
        if Select_Nodes is not None and Get_xyzr is not None:
            self.macroNetwork.connectNodes(Select_Nodes,
                                           Get_xyzr,
                                           "nodes",
                                           "atoms",
                                           blocking=True)
        if Get_xyzr is not None and MSMS_WS is not None:
            self.macroNetwork.connectNodes(Get_xyzr,
                                           MSMS_WS,
                                           "output",
                                           "input_str",
                                           blocking=True)
        if MSMS_WS is not None and IndexedPolygons is not None:
            self.macroNetwork.connectNodes(MSMS_WS,
                                           IndexedPolygons,
                                           "vertices",
                                           "coords",
                                           blocking=True)
        if MSMS_WS is not None and IndexedPolygons is not None:
            self.macroNetwork.connectNodes(MSMS_WS,
                                           IndexedPolygons,
                                           "indices",
                                           "indices",
                                           blocking=True)
        if MSMS_WS is not None and IndexedPolygons is not None:
            self.macroNetwork.connectNodes(MSMS_WS,
                                           IndexedPolygons,
                                           "vnormals",
                                           "vnormals",
                                           blocking=True)
        output_Ports = self.macroNetwork.opNode
        if IndexedPolygons is not None and output_Ports is not None:
            self.macroNetwork.connectNodes(IndexedPolygons,
                                           output_Ports,
                                           "indexedPolygons",
                                           "new",
                                           blocking=True)
        input_Ports = self.macroNetwork.ipNode
        if input_Ports is not None and Assign_Radii is not None:
            self.macroNetwork.connectNodes(input_Ports,
                                           Assign_Radii,
                                           "new",
                                           "molecules",
                                           blocking=True)
        self.macroNetwork.unfreeze()

        WebMSMS.shrink()

        ## reset modifications ##
        WebMSMS.resetTags()
        WebMSMS.buildOriginalList()
    from Vision.StandardNodes import CheckButtonNE
    Preserve_charges__19 = CheckButtonNE(constrkw={},
                                         name='Preserve charges?',
                                         library=stdlib)
    masterNet.addNode(Preserve_charges__19, 458, 43)
    Preserve_charges__19.inputPortByName['button'].widget.set(0, run=False)
    apply(Preserve_charges__19.configure, (), {'paramPanelImmediate': 1})
except:
    print "WARNING: failed to restore CheckButtonNE named Preserve charges? in network masterNet"
    print_exc()
    Preserve_charges__19 = None

try:
    ## saving node SaveReceptor ##
    from Vision.StandardNodes import Generic
    SaveReceptor_20 = Generic(constrkw={}, name='SaveReceptor', library=stdlib)
    masterNet.addNode(SaveReceptor_20, 424, 278)
    apply(
        SaveReceptor_20.addInputPort, (), {
            'singleConnection': True,
            'name': 'r',
            'cast': True,
            'datatype': 'string',
            'defaultValue': None,
            'required': True,
            'height': 8,
            'width': 12,
            'shape': 'oval',
            'color': 'white',
            'originalDatatype': 'None'
        })
Esempio n. 10
0
    def afterAddingToNetwork(self):
        masterNet = self.macroNetwork
        from NetworkEditor.macros import MacroNode
        MacroNode.afterAddingToNetwork(self)
        from Vision.StandardNodes import stdlib
        from WebServices.VisionInterface.WSNodes import wslib
        ## building macro network ##
        Vina_30 = self
        from traceback import print_exc
        from Vision.StandardNodes import stdlib
        from WebServices.VisionInterface.WSNodes import wslib
        masterNet.getEditor().addLibraryInstance(
            wslib, "WebServices.VisionInterface.WSNodes", "wslib")
        from WebServices.VisionInterface.WSNodes import addOpalServerAsCategory
        try:
            addOpalServerAsCategory("http://kryptonite.nbcr.net/opal2",
                                    replace=False)
        except:
            pass
        try:
            ## saving node input Ports ##
            input_Ports_31 = self.macroNetwork.ipNode
            input_Ports_31.configure(
                *(), **{
                    'paramPanelImmediate': 1,
                    'expanded': False
                })
        except:
            print(
                "WARNING: failed to restore MacroInputNode named input Ports in network self.macroNetwork"
            )
            print_exc()
            input_Ports_31 = None

        try:
            ## saving node output Ports ##
            output_Ports_32 = self.macroNetwork.opNode
            output_Ports_32.configure(
                *(), **{
                    'paramPanelImmediate': 1,
                    'expanded': False
                })
        except:
            print(
                "WARNING: failed to restore MacroOutputNode named output Ports in network self.macroNetwork"
            )
            print_exc()
            output_Ports_32 = None

        try:
            ## saving node AutodockVina_Screening_kryptonite_nbcr_net ##
            from NetworkEditor.items import FunctionNode
            AutodockVina_Screening_kryptonite_nbcr_net_33 = FunctionNode(
                functionOrString='AutodockVina_Screening_kryptonite_nbcr_net',
                host="http://kryptonite.nbcr.net/opal2",
                namedArgs={
                    'num_modes': '',
                    'energy_range': '',
                    'seed': '',
                    'receptor': '',
                    'size_y': '',
                    'size_z': '',
                    'out': '',
                    'log': '',
                    'urllib': '',
                    'exhaustiveness': '',
                    'localRun': False,
                    'flex': '',
                    'center_z': '',
                    'center_x': '',
                    'center_y': '',
                    'userlib': '',
                    'size_x': '',
                    'config': '',
                    'filter': '',
                    'ligand_db': '',
                    'cpu': '',
                    'execPath': ''
                },
                constrkw={
                    'functionOrString':
                    "'AutodockVina_Screening_kryptonite_nbcr_net'",
                    'host': '"http://kryptonite.nbcr.net/opal2"',
                    'namedArgs': {
                        'num_modes': '',
                        'energy_range': '',
                        'seed': '',
                        'receptor': '',
                        'size_y': '',
                        'size_z': '',
                        'out': '',
                        'log': '',
                        'urllib': '',
                        'exhaustiveness': '',
                        'localRun': False,
                        'flex': '',
                        'center_z': '',
                        'center_x': '',
                        'center_y': '',
                        'userlib': '',
                        'size_x': '',
                        'config': '',
                        'filter': '',
                        'ligand_db': '',
                        'cpu': '',
                        'execPath': ''
                    }
                },
                name='AutodockVina_Screening_kryptonite_nbcr_net',
                library=wslib)
            self.macroNetwork.addNode(
                AutodockVina_Screening_kryptonite_nbcr_net_33, 217, 185)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'num_modes'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'energy_range'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'seed'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'receptor'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'size_y'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'size_z'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'out'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'log'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'urllib'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'exhaustiveness'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'localRun'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'flex'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'center_z'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'center_x'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'center_y'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'userlib'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'size_x'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'config'].configure(*(), **{
                    'defaultValue': None,
                    'required': True
                })
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'filter'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'ligand_db'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'cpu'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'execPath'].configure(*(), **{'defaultValue': None})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'num_modes'].widget.configure(
                    *(), **{
                        'choices':
                        ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10')
                    })
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'num_modes'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'energy_range'].widget.configure(
                    *(), **{'choices': ('1', '2', '3')})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'energy_range'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'seed'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'receptor'].rebindWidget()
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'receptor'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'receptor'].unbindWidget()
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'size_y'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'size_z'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'out'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'log'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'urllib'].rebindWidget()
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'urllib'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'urllib'].unbindWidget()
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'exhaustiveness'].widget.configure(
                    *(),
                    **{'choices': ('1', '2', '3', '4', '5', '6', '7', '8')})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'exhaustiveness'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'localRun'].widget.set(0, run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'flex'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'center_z'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'center_x'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'center_y'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'userlib'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'size_x'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'config'].rebindWidget()
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'config'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'config'].unbindWidget()
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'filter'].rebindWidget()
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'filter'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'filter'].unbindWidget()
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'ligand_db'].widget.configure(
                    *(), **{
                        'choices':
                        ('sample', 'NCIDS_SC', 'NCI_DS1', 'NCI_DS2',
                         'human_metabolome', 'chembridge_building_blocks',
                         'drugbank_nutraceutics', 'drugbank_smallmol',
                         'asinex', 'fda_approved', 'otava',
                         'zinc_natural_products')
                    })
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'ligand_db'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'cpu'].widget.configure(*(), **{'choices': ('1', '2')})
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'cpu'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.inputPortByName[
                'execPath'].widget.set(r"", run=False)
            AutodockVina_Screening_kryptonite_nbcr_net_33.configure(
                *(), **{
                    'paramPanelImmediate': 1,
                    'expanded': False
                })
        except:
            print(
                "WARNING: failed to restore FunctionNode named AutodockVina_Screening_kryptonite_nbcr_net in network self.macroNetwork"
            )
            print_exc()
            AutodockVina_Screening_kryptonite_nbcr_net_33 = None

        try:
            ## saving node PrepareVinaInputs ##
            from Vision.StandardNodes import Generic
            PrepareVinaInputs_34 = Generic(constrkw={},
                                           name='PrepareVinaInputs',
                                           library=stdlib)
            self.macroNetwork.addNode(PrepareVinaInputs_34, 140, 107)
            PrepareVinaInputs_34.addInputPort(
                *(), **{
                    'singleConnection': True,
                    'name': 'receptor_obj',
                    'cast': True,
                    'datatype': 'receptor_prepared',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'triangle',
                    'color': '#009900',
                    'originalDatatype': 'None'
                })
            PrepareVinaInputs_34.addInputPort(
                *(), **{
                    'singleConnection': True,
                    'name': 'ligand_obj',
                    'cast': True,
                    'datatype': 'LigandDB',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'rect',
                    'color': '#FFCCFF',
                    'originalDatatype': 'None'
                })
            PrepareVinaInputs_34.addOutputPort(
                *(), **{
                    'name': 'receptor_file',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            PrepareVinaInputs_34.addOutputPort(
                *(), **{
                    'name': 'ligand_lib',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            PrepareVinaInputs_34.addOutputPort(
                *(), **{
                    'name': 'filter_file',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            code = """def doit(self, receptor_obj, ligand_obj):
        receptor_file = receptor_obj.path
        filter_file = ligand_obj.filter_file
        ligand_lib = ligand_obj.loc

        if receptor_obj.type == "local":
            if not(os.path.exists(receptor_file)):
                print "ERROR: receptor_file " + receptor_file + " does not exist"
                return '''stop'''
        
	pass
        self.outputData(receptor_file=receptor_file, ligand_lib=ligand_lib, filter_file=filter_file)
## to ouput data on port receptor_file use
## self.outputData(receptor_file=data)
## to ouput data on port ligand_lib use
## self.outputData(ligand_lib=data)
## to ouput data on port filter_file use
## self.outputData(filter_file=data)






"""
            PrepareVinaInputs_34.configure(function=code)
            PrepareVinaInputs_34.configure(
                *(), **{
                    'paramPanelImmediate': 1,
                    'expanded': False
                })
        except:
            print(
                "WARNING: failed to restore Generic named PrepareVinaInputs in network self.macroNetwork"
            )
            print_exc()
            PrepareVinaInputs_34 = None

        try:
            ## saving node GetMainURLFromList ##
            from WebServices.VisionInterface.WSNodes import GetMainURLFromListNode
            GetMainURLFromList_35 = GetMainURLFromListNode(
                constrkw={}, name='GetMainURLFromList', library=wslib)
            self.macroNetwork.addNode(GetMainURLFromList_35, 217, 248)
            GetMainURLFromList_35.inputPortByName['urls'].configure(
                *(), **{'defaultValue': None})
            GetMainURLFromList_35.configure(
                *(), **{
                    'paramPanelImmediate': 1,
                    'expanded': False
                })
        except:
            print(
                "WARNING: failed to restore GetMainURLFromListNode named GetMainURLFromList in network self.macroNetwork"
            )
            print_exc()
            GetMainURLFromList_35 = None

        #self.macroNetwork.run()
        self.macroNetwork.freeze()

        ## saving connections for network Vina ##
        if PrepareVinaInputs_34 is not None and AutodockVina_Screening_kryptonite_nbcr_net_33 is not None:
            try:
                self.macroNetwork.connectNodes(
                    PrepareVinaInputs_34,
                    AutodockVina_Screening_kryptonite_nbcr_net_33,
                    "receptor_file",
                    "receptor",
                    blocking=True,
                    splitratio=[0.48630431331124768, 0.72717758735716731])
            except:
                print(
                    "WARNING: failed to restore connection between PrepareVinaInputs_34 and AutodockVina_Screening_kryptonite_nbcr_net_33 in network self.macroNetwork"
                )
        if PrepareVinaInputs_34 is not None and AutodockVina_Screening_kryptonite_nbcr_net_33 is not None:
            try:
                self.macroNetwork.connectNodes(
                    PrepareVinaInputs_34,
                    AutodockVina_Screening_kryptonite_nbcr_net_33,
                    "ligand_lib",
                    "urllib",
                    blocking=True,
                    splitratio=[0.61963739449043087, 0.74955133389937689])
            except:
                print(
                    "WARNING: failed to restore connection between PrepareVinaInputs_34 and AutodockVina_Screening_kryptonite_nbcr_net_33 in network self.macroNetwork"
                )
        if PrepareVinaInputs_34 is not None and AutodockVina_Screening_kryptonite_nbcr_net_33 is not None:
            try:
                self.macroNetwork.connectNodes(
                    PrepareVinaInputs_34,
                    AutodockVina_Screening_kryptonite_nbcr_net_33,
                    "filter_file",
                    "filter",
                    blocking=True,
                    splitratio=[0.32670226336274166, 0.25123642944789149])
            except:
                print(
                    "WARNING: failed to restore connection between PrepareVinaInputs_34 and AutodockVina_Screening_kryptonite_nbcr_net_33 in network self.macroNetwork"
                )
        if AutodockVina_Screening_kryptonite_nbcr_net_33 is not None and GetMainURLFromList_35 is not None:
            try:
                self.macroNetwork.connectNodes(
                    AutodockVina_Screening_kryptonite_nbcr_net_33,
                    GetMainURLFromList_35,
                    "result",
                    "urls",
                    blocking=True,
                    splitratio=[0.23401196873379349, 0.68593608346615742])
            except:
                print(
                    "WARNING: failed to restore connection between AutodockVina_Screening_kryptonite_nbcr_net_33 and GetMainURLFromList_35 in network self.macroNetwork"
                )
        output_Ports_32 = self.macroNetwork.opNode
        if GetMainURLFromList_35 is not None and output_Ports_32 is not None:
            try:
                self.macroNetwork.connectNodes(
                    GetMainURLFromList_35,
                    output_Ports_32,
                    "newurl",
                    "new",
                    blocking=True,
                    splitratio=[0.26588001265563421, 0.34355863787969732])
            except:
                print(
                    "WARNING: failed to restore connection between GetMainURLFromList_35 and output_Ports_32 in network self.macroNetwork"
                )
        input_Ports_31 = self.macroNetwork.ipNode
        if input_Ports_31 is not None and PrepareVinaInputs_34 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_31,
                    PrepareVinaInputs_34,
                    "new",
                    "receptor_obj",
                    blocking=True,
                    splitratio=[0.59193136382656331, 0.41134942510734418])
            except:
                print(
                    "WARNING: failed to restore connection between input_Ports_31 and PrepareVinaInputs_34 in network self.macroNetwork"
                )
        if input_Ports_31 is not None and PrepareVinaInputs_34 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_31,
                    PrepareVinaInputs_34,
                    "new",
                    "ligand_obj",
                    blocking=True,
                    splitratio=[0.29092159940560591, 0.60619808825531374])
            except:
                print(
                    "WARNING: failed to restore connection between input_Ports_31 and PrepareVinaInputs_34 in network self.macroNetwork"
                )
        if input_Ports_31 is not None and AutodockVina_Screening_kryptonite_nbcr_net_33 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_31,
                    AutodockVina_Screening_kryptonite_nbcr_net_33,
                    "new",
                    "config",
                    blocking=True,
                    splitratio=[0.24239548372031838, 0.55842775396640953])
            except:
                print(
                    "WARNING: failed to restore connection between input_Ports_31 and AutodockVina_Screening_kryptonite_nbcr_net_33 in network self.macroNetwork"
                )
        self.macroNetwork.runOnNewData.value = True

        ## modifying MacroInputNode dynamic ports
        input_Ports_31 = self.macroNetwork.ipNode
        input_Ports_31.outputPorts[1].configure(
            name='PrepareVinaInputs_receptor_obj')
        input_Ports_31.outputPorts[2].configure(
            name='PrepareVinaInputs_ligand_obj')
        input_Ports_31.outputPorts[3].configure(
            name='AutodockVina_Screening_kryptonite_nbcr_net_config')

        ## modifying MacroOutputNode dynamic ports
        output_Ports_32 = self.macroNetwork.opNode
        output_Ports_32.inputPorts[1].configure(singleConnection='auto')
        output_Ports_32.inputPorts[1].configure(
            name='GetMainURLFromList_newurl')
        ## configure MacroNode input ports
        Vina_30.inputPorts[0].configure(name='PrepareVinaInputs_receptor_obj')
        Vina_30.inputPorts[0].configure(datatype='receptor_prepared')
        Vina_30.inputPorts[1].configure(name='PrepareVinaInputs_ligand_obj')
        Vina_30.inputPorts[1].configure(datatype='LigandDB')
        Vina_30.inputPorts[2].configure(
            name='AutodockVina_Screening_kryptonite_nbcr_net_config')
        Vina_30.inputPorts[2].configure(datatype='string')
        ## configure MacroNode output ports
        Vina_30.outputPorts[0].configure(name='GetMainURLFromList_newurl')
        Vina_30.outputPorts[0].configure(datatype='string')

        Vina_30.shrink()

        ## reset modifications ##
        Vina_30.resetTags()
        Vina_30.buildOriginalList()
Esempio n. 11
0
    def afterAddingToNetwork(self):
        from NetworkEditor.macros import MacroNode
        MacroNode.afterAddingToNetwork(self)
        ## loading libraries ##
        from symserv.VisionInterface.SymservNodes import symlib
        from Vision.StandardNodes import stdlib
        from DejaVu.VisionInterface.DejaVuNodes import vizlib
        ## building macro network ##
        RotateScene_0 = self
        from traceback import print_exc

        ## loading libraries ##
        from symserv.VisionInterface.SymservNodes import symlib
        self.macroNetwork.getEditor().addLibraryInstance(symlib,"symserv.VisionInterface.SymservNodes", "symlib")

        from Vision.StandardNodes import stdlib
        self.macroNetwork.getEditor().addLibraryInstance(stdlib,"Vision.StandardNodes", "stdlib")

        from DejaVu.VisionInterface.DejaVuNodes import vizlib
        self.macroNetwork.getEditor().addLibraryInstance(vizlib,"DejaVu.VisionInterface.DejaVuNodes", "vizlib")

        try:
            ## saving node input Ports ##
            input_Ports_1 = self.macroNetwork.ipNode
            input_Ports_1.move(45, 17)
        except:
            print "WARNING: failed to restore MacroInputNode named input Ports in network self.macroNetwork"
            print_exc()
            input_Ports_1=None

        try:
            ## saving node output Ports ##
            output_Ports_2 = self.macroNetwork.opNode
            output_Ports_2.move(228, 460)
        except:
            print "WARNING: failed to restore MacroOutputNode named output Ports in network self.macroNetwork"
            print_exc()
            output_Ports_2=None

        try:
            ## saving node Rotate ##
            from symserv.VisionInterface.SymservNodes import SymRotNE
            Rotate_3 = SymRotNE(constrkw = {}, name='Rotate', library=symlib)
            self.macroNetwork.addNode(Rotate_3,543,101)
            apply(Rotate_3.inputPortByName['matrices'].configure, (), {'color': 'cyan', 'cast': True, 'shape': 'rect'})
            apply(Rotate_3.inputPortByName['vector'].configure, (), {'datatype': 'list', 'cast': True, 'shape': 'oval', 'color': 'cyan', 'height': 8})
            apply(Rotate_3.inputPortByName['point'].configure, (), {'color': 'white', 'cast': True, 'shape': 'diamond'})
            apply(Rotate_3.inputPortByName['angle'].configure, (), {'color': 'green', 'cast': True, 'shape': 'circle'})
            apply(Rotate_3.inputPortByName['identity'].configure, (), {'color': 'yellow', 'cast': True, 'shape': 'circle'})
            apply(Rotate_3.outputPortByName['outMatrices'].configure, (), {'color': 'cyan', 'shape': 'rect'})
            Rotate_3.inputPortByName['vector'].unbindWidget()
            Rotate_3.inputPortByName['angle'].widget.set(0.0, run=False)
            Rotate_3.inputPortByName['angle'].unbindWidget()
        except:
            print "WARNING: failed to restore SymRotNE named Rotate in network self.macroNetwork"
            print_exc()
            Rotate_3=None

        try:
            ## saving node One Redraw ##
            from DejaVu.VisionInterface.DejaVuNodes import OneRedraw
            One_Redraw_4 = OneRedraw(constrkw = {}, name='One Redraw', library=vizlib)
            self.macroNetwork.addNode(One_Redraw_4,22,452)
            apply(One_Redraw_4.inputPortByName['viewer'].configure, (), {'color': 'yellow', 'cast': True, 'shape': 'rect'})
            apply(One_Redraw_4.inputPortByName['trigger'].configure, (), {'color': 'white', 'cast': True, 'shape': 'diamond'})
        except:
            print "WARNING: failed to restore OneRedraw named One Redraw in network self.macroNetwork"
            print_exc()
            One_Redraw_4=None

        try:
            ## saving node Choose Geom ##
            from DejaVu.VisionInterface.DejaVuNodes import SelectGeometry
            Choose_Geom_5 = SelectGeometry(constrkw = {}, name='Choose Geom', library=vizlib)
            self.macroNetwork.addNode(Choose_Geom_5,412,220)
            apply(Choose_Geom_5.inputPortByName['viewer'].configure, (), {'color': 'yellow', 'cast': True, 'shape': 'rect'})
            apply(Choose_Geom_5.inputPortByName['geomName'].configure, (), {'color': 'white', 'cast': True, 'shape': 'oval'})
            apply(Choose_Geom_5.outputPortByName['geometry'].configure, (), {'color': 'red', 'shape': 'rect'})
            apply(Choose_Geom_5.inputPortByName['geomName'].widget.configure, (), {'autoList': False, 'choices': ('root',)})
            Choose_Geom_5.inputPortByName['geomName'].widget.set("root", run=False)
        except:
            print "WARNING: failed to restore SelectGeometry named Choose Geom in network self.macroNetwork"
            print_exc()
            Choose_Geom_5=None

        try:
            ## saving node range ##
            from Vision.StandardNodes import Range
            range_6 = Range(constrkw = {}, name='range', library=stdlib)
            self.macroNetwork.addNode(range_6,246,147)
            apply(range_6.inputPortByName['fromInd'].configure, (), {'color': 'yellow', 'cast': True, 'shape': 'circle'})
            apply(range_6.inputPortByName['toInd'].configure, (), {'color': 'yellow', 'cast': True, 'shape': 'circle'})
            apply(range_6.inputPortByName['step'].configure, (), {'color': 'yellow', 'cast': True, 'shape': 'circle'})
            apply(range_6.outputPortByName['data'].configure, (), {'color': 'cyan', 'shape': 'oval'})
            range_6.inputPortByName['toInd'].unbindWidget()
        except:
            print "WARNING: failed to restore Range named range in network self.macroNetwork"
            print_exc()
            range_6=None

        try:
            ## saving node iterate ##
            from Vision.StandardNodes import Iterate
            iterate_7 = Iterate(constrkw = {}, name='iterate', library=stdlib)
            self.macroNetwork.addNode(iterate_7,283,204)
            apply(iterate_7.inputPortByName['listToLoopOver'].configure, (), {'color': 'cyan', 'cast': True, 'shape': 'oval'})
            apply(iterate_7.outputPortByName['oneItem'].configure, (), {'color': 'white', 'shape': 'diamond'})
            apply(iterate_7.outputPortByName['iter'].configure, (), {'color': 'yellow', 'shape': 'circle'})
            apply(iterate_7.outputPortByName['begin'].configure, (), {'color': 'yellow', 'shape': 'rect'})
            apply(iterate_7.outputPortByName['end'].configure, (), {'color': 'yellow', 'shape': 'rect'})
            apply(iterate_7.outputPortByName['maxIter'].configure, (), {'color': 'yellow', 'shape': 'circle'})
        except:
            print "WARNING: failed to restore Iterate named iterate in network self.macroNetwork"
            print_exc()
            iterate_7=None

        try:
            ## saving node flattenRotation ##
            from Vision.StandardNodes import Generic
            flattenRotation_8 = Generic(constrkw = {}, name='flattenRotation', library=stdlib)
            self.macroNetwork.addNode(flattenRotation_8,560,200)
            apply(flattenRotation_8.addInputPort, (), {'name': 'in0', 'cast': True, 'datatype': 'instancemat(0)', 'height': 8, 'width': 12, 'shape': 'rect', 'color': 'cyan'})
            apply(flattenRotation_8.addOutputPort, (), {'name': 'out0', 'datatype': 'float(16)', 'height': 10, 'width': 10, 'shape': 'rect', 'color': 'white'})
            code = """def doit(self, in0):
    self.outputData(out0=in0[0].ravel())
"""
            flattenRotation_8.configure(function=code)
        except:
            print "WARNING: failed to restore Generic named flattenRotation in network self.macroNetwork"
            print_exc()
            flattenRotation_8=None

        try:
            ## saving node Pass ##
            from Vision.StandardNodes import Pass
            Pass_9 = Pass(constrkw = {}, name='Pass', library=stdlib)
            self.macroNetwork.addNode(Pass_9,333,339)
            apply(Pass_9.inputPortByName['in1'].configure, (), {'color': 'white', 'cast': True, 'shape': 'diamond'})
            apply(Pass_9.outputPortByName['out1'].configure, (), {'color': 'white', 'shape': 'diamond'})
            apply(Pass_9.configure, (), {'specialPortsVisible': True})
        except:
            print "WARNING: failed to restore Pass named Pass in network self.macroNetwork"
            print_exc()
            Pass_9=None

        try:
            ## saving node angle ##
            from Vision.StandardNodes import DialNE
            angle_10 = DialNE(constrkw = {}, name='angle', library=stdlib)
            self.macroNetwork.addNode(angle_10,244,5)
            apply(angle_10.inputPortByName['dial'].configure, (), {'color': 'green', 'cast': True, 'shape': 'circle'})
            apply(angle_10.inputPortByName['mini'].configure, (), {'datatype': 'int', 'cast': True, 'shape': 'circle', 'color': 'yellow'})
            apply(angle_10.inputPortByName['maxi'].configure, (), {'datatype': 'int', 'cast': True, 'shape': 'circle', 'color': 'yellow'})
            apply(angle_10.outputPortByName['value'].configure, (), {'datatype': 'int', 'color': 'yellow', 'shape': 'circle'})
            apply(angle_10.inputPortByName['dial'].widget.configure, (), {'type': 'int', 'oneTurn': 100.0})
            angle_10.inputPortByName['dial'].widget.set(360, run=False)
        except:
            print "WARNING: failed to restore DialNE named angle in network self.macroNetwork"
            print_exc()
            angle_10=None

        try:
            ## saving node nbSteps ##
            from Vision.StandardNodes import DialNE
            nbSteps_11 = DialNE(constrkw = {}, name='nbSteps', library=stdlib)
            self.macroNetwork.addNode(nbSteps_11,634,7)
            apply(nbSteps_11.inputPortByName['dial'].configure, (), {'color': 'green', 'cast': True, 'shape': 'circle'})
            apply(nbSteps_11.inputPortByName['mini'].configure, (), {'color': 'green', 'cast': True, 'shape': 'circle'})
            apply(nbSteps_11.inputPortByName['maxi'].configure, (), {'color': 'green', 'cast': True, 'shape': 'circle'})
            apply(nbSteps_11.outputPortByName['value'].configure, (), {'color': 'green', 'shape': 'circle'})
            apply(nbSteps_11.inputPortByName['dial'].widget.configure, (), {'oneTurn': 10.0})
            nbSteps_11.inputPortByName['dial'].widget.set(1.0, run=False)
        except:
            print "WARNING: failed to restore DialNE named nbSteps in network self.macroNetwork"
            print_exc()
            nbSteps_11=None

        try:
            ## saving node select axis ##
            from DejaVu.VisionInterface.DejaVuNodes import SelectAxis
            select_axis_12 = SelectAxis(constrkw = {}, name='select axis', library=stdlib)
            self.macroNetwork.addNode(select_axis_12,528,40)
            apply(select_axis_12.inputPortByName['x-axis'].configure, (), {'color': 'yellow', 'cast': True, 'shape': 'rect'})
            apply(select_axis_12.inputPortByName['y-axis'].configure, (), {'color': 'yellow', 'cast': True, 'shape': 'rect'})
            apply(select_axis_12.inputPortByName['z-axis'].configure, (), {'color': 'yellow', 'cast': True, 'shape': 'rect'})
            apply(select_axis_12.outputPortByName['rotationAxis'].configure, (), {'color': 'cyan', 'shape': 'oval'})
        except:
            print "WARNING: failed to restore SelectAxis named select axis in network self.macroNetwork"
            print_exc()
            select_axis_12=None

        try:
            ## saving node call method ##
            from Vision.StandardNodes import CallMethod
            call_method_13 = CallMethod(constrkw = {}, name='call method', library=stdlib)
            self.macroNetwork.addNode(call_method_13,412,339)
            apply(call_method_13.inputPortByName['objects'].configure, (), {'datatype': 'geom', 'cast': True, 'shape': 'rect', 'color': 'red'})
            apply(call_method_13.inputPortByName['signature'].configure, (), {'color': 'white', 'cast': True, 'shape': 'oval'})
            apply(call_method_13.addInputPort, (), {'name': 'mat', 'cast': True, 'datatype': 'None', 'height': 8, 'width': 12, 'shape': 'diamond', 'color': 'white'})
            apply(call_method_13.outputPortByName['objects'].configure, (), {'color': 'white', 'shape': 'diamond'})
            apply(call_method_13.outputPortByName['results'].configure, (), {'color': 'white', 'shape': 'diamond'})
            call_method_13.inputPortByName['signature'].widget.set("ConcatRotation %mat", run=False)
            apply(call_method_13.configure, (), {'specialPortsVisible': True})
        except:
            print "WARNING: failed to restore CallMethod named call method in network self.macroNetwork"
            print_exc()
            call_method_13=None

        self.macroNetwork.freeze()

        ## saving connections for network RotateScene ##
        if range_6 is not None and iterate_7 is not None:
            try:
                self.macroNetwork.connectNodes(
                    range_6, iterate_7, "data", "listToLoopOver", blocking=True)
            except:
                print "WARNING: failed to restore connection between range_6 and iterate_7 in network self.macroNetwork"
        if Rotate_3 is not None and flattenRotation_8 is not None:
            try:
                self.macroNetwork.connectNodes(
                    Rotate_3, flattenRotation_8, "outMatrices", "in0", blocking=True)
            except:
                print "WARNING: failed to restore connection between Rotate_3 and flattenRotation_8 in network self.macroNetwork"
        if iterate_7 is not None and Pass_9 is not None:
            try:
                self.macroNetwork.connectNodes(
                    iterate_7, Pass_9, "oneItem", "in1", blocking=True)
            except:
                print "WARNING: failed to restore connection between iterate_7 and Pass_9 in network self.macroNetwork"
        if angle_10 is not None and range_6 is not None:
            try:
                self.macroNetwork.connectNodes(
                    angle_10, range_6, "value", "toInd", blocking=True)
            except:
                print "WARNING: failed to restore connection between angle_10 and range_6 in network self.macroNetwork"
        if nbSteps_11 is not None and Rotate_3 is not None:
            try:
                self.macroNetwork.connectNodes(
                    nbSteps_11, Rotate_3, "value", "angle", blocking=True)
            except:
                print "WARNING: failed to restore connection between nbSteps_11 and Rotate_3 in network self.macroNetwork"
        if select_axis_12 is not None and Rotate_3 is not None:
            try:
                self.macroNetwork.connectNodes(
                    select_axis_12, Rotate_3, "rotationAxis", "vector", blocking=True)
            except:
                print "WARNING: failed to restore connection between select_axis_12 and Rotate_3 in network self.macroNetwork"
        output_Ports_2 = self.macroNetwork.opNode
        if iterate_7 is not None and output_Ports_2 is not None:
            try:
                self.macroNetwork.connectNodes(
                    iterate_7, output_Ports_2, "oneItem", "new", blocking=True)
            except:
                print "WARNING: failed to restore connection between iterate_7 and output_Ports_2 in network self.macroNetwork"
        if Choose_Geom_5 is not None and call_method_13 is not None:
            try:
                self.macroNetwork.connectNodes(
                    Choose_Geom_5, call_method_13, "geometry", "objects", blocking=True)
            except:
                print "WARNING: failed to restore connection between Choose_Geom_5 and call_method_13 in network self.macroNetwork"
        if Pass_9 is not None and call_method_13 is not None:
            try:
                self.macroNetwork.specialConnectNodes(
                    Pass_9, call_method_13, "trigger", "runNode", blocking=True)
            except:
                print "WARNING: failed to restore connection between Pass_9 and call_method_13 in network self.macroNetwork"
        if flattenRotation_8 is not None and call_method_13 is not None:
            try:
                self.macroNetwork.connectNodes(
                    flattenRotation_8, call_method_13, "out0", "mat", blocking=True)
            except:
                print "WARNING: failed to restore connection between flattenRotation_8 and call_method_13 in network self.macroNetwork"
        if call_method_13 is not None and One_Redraw_4 is not None:
            try:
                self.macroNetwork.connectNodes(
                    call_method_13, One_Redraw_4, "objects", "trigger", blocking=True)
            except:
                print "WARNING: failed to restore connection between call_method_13 and One_Redraw_4 in network self.macroNetwork"
        input_Ports_1 = self.macroNetwork.ipNode
        if input_Ports_1 is not None and One_Redraw_4 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_1, One_Redraw_4, "new", "viewer", blocking=True)
            except:
                print "WARNING: failed to restore connection between input_Ports_1 and One_Redraw_4 in network self.macroNetwork"
        if input_Ports_1 is not None and Choose_Geom_5 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_1, Choose_Geom_5, "One Redraw_viewer", "viewer", blocking=True)
            except:
                print "WARNING: failed to restore connection between input_Ports_1 and Choose_Geom_5 in network self.macroNetwork"
        self.macroNetwork.unfreeze()

        ## modifying MacroOutputNode dynamic ports
        output_Ports_2 = self.macroNetwork.opNode
        output_Ports_2.inputPorts[1].configure(singleConnection=True)

        RotateScene_0.shrink()

        ## reset modifications ##
        RotateScene_0.resetTags()
        RotateScene_0.buildOriginalList()
Esempio n. 12
0
    def afterAddingToNetwork(self):
        masterNet = self.macroNetwork
        from NetworkEditor.macros import MacroNode
        MacroNode.afterAddingToNetwork(self)
        from WebServices.VisionInterface.WSNodes import wslib
        from Vision.StandardNodes import stdlib
        ## building macro network ##
        AutodockVS_9 = self
        from traceback import print_exc
        from WebServices.VisionInterface.WSNodes import wslib
        from Vision.StandardNodes import stdlib
        masterNet.getEditor().addLibraryInstance(
            wslib, "WebServices.VisionInterface.WSNodes", "wslib")
        from WebServices.VisionInterface.WSNodes import addOpalServerAsCategory
        try:
            addOpalServerAsCategory("http://kryptonite.nbcr.net/opal2",
                                    replace=False)
        except:
            pass
        try:
            ## saving node input Ports ##
            input_Ports_10 = self.macroNetwork.ipNode
            input_Ports_10.configure(
                *(), **{
                    'paramPanelImmediate': 1,
                    'expanded': False
                })
        except:
            print(
                "WARNING: failed to restore MacroInputNode named input Ports in network self.macroNetwork"
            )
            print_exc()
            input_Ports_10 = None

        try:
            ## saving node output Ports ##
            output_Ports_11 = self.macroNetwork.opNode
            output_Ports_11.configure(
                *(), **{
                    'paramPanelImmediate': 1,
                    'expanded': False
                })
        except:
            print(
                "WARNING: failed to restore MacroOutputNode named output Ports in network self.macroNetwork"
            )
            print_exc()
            output_Ports_11 = None

        try:
            ## saving node PrepareADVSInputs ##
            from Vision.StandardNodes import Generic
            PrepareADVSInputs_12 = Generic(constrkw={},
                                           name='PrepareADVSInputs',
                                           library=stdlib)
            self.macroNetwork.addNode(PrepareADVSInputs_12, 217, 76)
            PrepareADVSInputs_12.addInputPort(
                *(), **{
                    'singleConnection': True,
                    'name': 'ligands',
                    'cast': True,
                    'datatype': 'LigandDB',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'rect',
                    'color': '#FFCCFF',
                    'originalDatatype': 'None'
                })
            PrepareADVSInputs_12.addInputPort(
                *(), **{
                    'singleConnection': True,
                    'name': 'autogrid_results',
                    'cast': True,
                    'datatype': 'autogrid_results',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'triangle',
                    'color': '#FF33CC',
                    'originalDatatype': 'None'
                })
            PrepareADVSInputs_12.addInputPort(
                *(), **{
                    'singleConnection': True,
                    'name': 'dpf_template_obj',
                    'cast': True,
                    'datatype': 'dpf_template',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'triangle',
                    'color': '#9933FF',
                    'originalDatatype': 'None'
                })
            PrepareADVSInputs_12.addOutputPort(
                *(), **{
                    'name': 'filter_file',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            PrepareADVSInputs_12.addOutputPort(
                *(), **{
                    'name': 'ligand_lib',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            PrepareADVSInputs_12.addOutputPort(
                *(), **{
                    'name': 'dpf_template_file',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            PrepareADVSInputs_12.addOutputPort(
                *(), **{
                    'name': 'autogrid_res_url',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            PrepareADVSInputs_12.addOutputPort(
                *(), **{
                    'name': 'autogrid_res_local',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            code = """def doit(self, ligands, autogrid_results, dpf_template_obj):
        dpf = dpf_template_obj.fullpath

        if not(os.path.exists(dpf)):
            print "ERROR: DPF template " + dpf + " does not exist!"
            return '''stop'''
    
        filter_file = ligands.filter_file
        
        if autogrid_results.type == '''url''':
            autogrid_result_url = autogrid_results.path
            autogrid_result_local = ""
        else:
            autogrid_result_url = ""
            autogrid_result_local = autogrid_results.path
        
        ligand_lib = ligands.loc
        
	pass

        self.outputData(filter_file=filter_file, ligand_lib=ligand_lib, dpf_template_file=dpf, autogrid_res_url=autogrid_result_url, autogrid_res_local=autogrid_result_local)

## to ouput data on port filter_file use
## self.outputData(filter_file=data)
## to ouput data on port ligand_lib use
## self.outputData(ligand_lib=data)
## to ouput data on port dpf_template_file use
## self.outputData(dpf_template_file=data)
## to ouput data on port autogrid_res_url use
## self.outputData(autogrid_res_url=data)
## to ouput data on port autogrid_res_local use
## self.outputData(autogrid_res_local=data)









"""
            PrepareADVSInputs_12.configure(function=code)
            PrepareADVSInputs_12.configure(
                *(), **{
                    'paramPanelImmediate': 1,
                    'expanded': False
                })
        except:
            print(
                "WARNING: failed to restore Generic named PrepareADVSInputs in network self.macroNetwork"
            )
            print_exc()
            PrepareADVSInputs_12 = None

        try:
            ## saving node autodock_kryptonite_nbcr_net ##
            from NetworkEditor.items import FunctionNode
            autodock_kryptonite_nbcr_net_13 = FunctionNode(
                functionOrString='autodock_kryptonite_nbcr_net',
                host="http://kryptonite.nbcr.net/opal2",
                namedArgs={
                    'ga_run': '',
                    'lib': '',
                    'filter_file_url': '',
                    'ga_num_evals': '',
                    'filter_file': '',
                    'sched': 'SGE',
                    'urllib': '',
                    'ga_num_generations': '',
                    'dpf': '',
                    'u': '',
                    'utar': '',
                    'userlib': '',
                    'ga_pop_size': '',
                    'localRun': False,
                    'email': '',
                    'execPath': ''
                },
                constrkw={
                    'functionOrString': "'autodock_kryptonite_nbcr_net'",
                    'host': '"http://kryptonite.nbcr.net/opal2"',
                    'namedArgs': {
                        'ga_run': '',
                        'lib': '',
                        'filter_file_url': '',
                        'ga_num_evals': '',
                        'filter_file': '',
                        'sched': 'SGE',
                        'urllib': '',
                        'ga_num_generations': '',
                        'dpf': '',
                        'u': '',
                        'utar': '',
                        'userlib': '',
                        'ga_pop_size': '',
                        'localRun': False,
                        'email': '',
                        'execPath': ''
                    }
                },
                name='autodock_kryptonite_nbcr_net',
                library=wslib)
            self.macroNetwork.addNode(autodock_kryptonite_nbcr_net_13, 217,
                                      132)
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'ga_run'].configure(*(), **{'defaultValue': None})
            autodock_kryptonite_nbcr_net_13.inputPortByName['lib'].configure(
                *(), **{'defaultValue': None})
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'filter_file_url'].configure(*(), **{'defaultValue': None})
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'ga_num_evals'].configure(*(), **{'defaultValue': None})
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'filter_file'].configure(*(), **{'defaultValue': None})
            autodock_kryptonite_nbcr_net_13.inputPortByName['sched'].configure(
                *(), **{'defaultValue': None})
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'urllib'].configure(*(), **{'defaultValue': None})
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'ga_num_generations'].configure(*(), **{'defaultValue': None})
            autodock_kryptonite_nbcr_net_13.inputPortByName['dpf'].configure(
                *(), **{'defaultValue': None})
            autodock_kryptonite_nbcr_net_13.inputPortByName['u'].configure(
                *(), **{'defaultValue': None})
            autodock_kryptonite_nbcr_net_13.inputPortByName['utar'].configure(
                *(), **{'defaultValue': None})
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'userlib'].configure(*(), **{'defaultValue': None})
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'ga_pop_size'].configure(*(), **{'defaultValue': None})
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'localRun'].configure(*(), **{'defaultValue': None})
            autodock_kryptonite_nbcr_net_13.inputPortByName['email'].configure(
                *(), **{'defaultValue': None})
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'execPath'].configure(*(), **{'defaultValue': None})
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'ga_run'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'lib'].widget.configure(
                    *(), **{
                        'choices':
                        ('sample', 'NCIDS_SC', 'NCI_DS1', 'NCI_DS2',
                         'human_metabolome', 'chembridge_building_blocks',
                         'drugbank_nutraceutics', 'drugbank_smallmol',
                         'fda_approved')
                    })
            autodock_kryptonite_nbcr_net_13.inputPortByName['lib'].widget.set(
                r"", run=False)
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'filter_file_url'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'ga_num_evals'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'filter_file'].rebindWidget()
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'filter_file'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'filter_file'].unbindWidget()
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'sched'].widget.configure(*(), **{'choices': ('SGE', 'CSF')})
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'sched'].widget.set(r"SGE", run=False)
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'urllib'].rebindWidget()
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'urllib'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'urllib'].unbindWidget()
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'ga_num_generations'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'dpf'].rebindWidget()
            autodock_kryptonite_nbcr_net_13.inputPortByName['dpf'].widget.set(
                r"", run=False)
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'dpf'].unbindWidget()
            autodock_kryptonite_nbcr_net_13.inputPortByName['u'].rebindWidget()
            autodock_kryptonite_nbcr_net_13.inputPortByName['u'].widget.set(
                r"", run=False)
            autodock_kryptonite_nbcr_net_13.inputPortByName['u'].unbindWidget()
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'utar'].rebindWidget()
            autodock_kryptonite_nbcr_net_13.inputPortByName['utar'].widget.set(
                r"", run=False)
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'utar'].unbindWidget()
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'userlib'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'ga_pop_size'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'localRun'].widget.set(0, run=False)
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'email'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_13.inputPortByName[
                'execPath'].widget.set(r"", run=False)
            autodock_kryptonite_nbcr_net_13.configure(
                *(), **{
                    'paramPanelImmediate': 1,
                    'expanded': False
                })
        except:
            print(
                "WARNING: failed to restore FunctionNode named autodock_kryptonite_nbcr_net in network self.macroNetwork"
            )
            print_exc()
            autodock_kryptonite_nbcr_net_13 = None

        try:
            ## saving node GetMainURLFromList ##
            from WebServices.VisionInterface.WSNodes import GetMainURLFromListNode
            GetMainURLFromList_14 = GetMainURLFromListNode(
                constrkw={}, name='GetMainURLFromList', library=wslib)
            self.macroNetwork.addNode(GetMainURLFromList_14, 217, 188)
            GetMainURLFromList_14.inputPortByName['urls'].configure(
                *(), **{'defaultValue': None})
            GetMainURLFromList_14.configure(
                *(), **{
                    'paramPanelImmediate': 1,
                    'expanded': False
                })
        except:
            print(
                "WARNING: failed to restore GetMainURLFromListNode named GetMainURLFromList in network self.macroNetwork"
            )
            print_exc()
            GetMainURLFromList_14 = None

        #self.macroNetwork.run()
        self.macroNetwork.freeze()

        ## saving connections for network AutodockVS ##
        input_Ports_10 = self.macroNetwork.ipNode
        if input_Ports_10 is not None and PrepareADVSInputs_12 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_10,
                    PrepareADVSInputs_12,
                    "new",
                    "ligands",
                    blocking=True,
                    splitratio=[0.60597534741634829, 0.41083180453223428])
            except:
                print(
                    "WARNING: failed to restore connection between input_Ports_10 and PrepareADVSInputs_12 in network self.macroNetwork"
                )
        if input_Ports_10 is not None and PrepareADVSInputs_12 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_10,
                    PrepareADVSInputs_12,
                    "new",
                    "autogrid_results",
                    blocking=True,
                    splitratio=[0.64561658610430228, 0.21974682015753622])
            except:
                print(
                    "WARNING: failed to restore connection between input_Ports_10 and PrepareADVSInputs_12 in network self.macroNetwork"
                )
        if input_Ports_10 is not None and PrepareADVSInputs_12 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_10,
                    PrepareADVSInputs_12,
                    "new",
                    "dpf_template_obj",
                    blocking=True,
                    splitratio=[0.52491295380143521, 0.32751034461281114])
            except:
                print(
                    "WARNING: failed to restore connection between input_Ports_10 and PrepareADVSInputs_12 in network self.macroNetwork"
                )
        if autodock_kryptonite_nbcr_net_13 is not None and GetMainURLFromList_14 is not None:
            try:
                self.macroNetwork.connectNodes(
                    autodock_kryptonite_nbcr_net_13,
                    GetMainURLFromList_14,
                    "result",
                    "urls",
                    blocking=True,
                    splitratio=[0.36974288957131424, 0.63465596053596318])
            except:
                print(
                    "WARNING: failed to restore connection between autodock_kryptonite_nbcr_net_13 and GetMainURLFromList_14 in network self.macroNetwork"
                )
        output_Ports_11 = self.macroNetwork.opNode
        if GetMainURLFromList_14 is not None and output_Ports_11 is not None:
            try:
                self.macroNetwork.connectNodes(
                    GetMainURLFromList_14,
                    output_Ports_11,
                    "newurl",
                    "new",
                    blocking=True,
                    splitratio=[0.34850477186787743, 0.35637513198385085])
            except:
                print(
                    "WARNING: failed to restore connection between GetMainURLFromList_14 and output_Ports_11 in network self.macroNetwork"
                )
        if PrepareADVSInputs_12 is not None and autodock_kryptonite_nbcr_net_13 is not None:
            try:
                self.macroNetwork.connectNodes(
                    PrepareADVSInputs_12,
                    autodock_kryptonite_nbcr_net_13,
                    "filter_file",
                    "filter_file",
                    blocking=True,
                    splitratio=[0.33230642287344903, 0.65770700108889613])
            except:
                print(
                    "WARNING: failed to restore connection between PrepareADVSInputs_12 and autodock_kryptonite_nbcr_net_13 in network self.macroNetwork"
                )
        if PrepareADVSInputs_12 is not None and autodock_kryptonite_nbcr_net_13 is not None:
            try:
                self.macroNetwork.connectNodes(
                    PrepareADVSInputs_12,
                    autodock_kryptonite_nbcr_net_13,
                    "ligand_lib",
                    "urllib",
                    blocking=True,
                    splitratio=[0.50680104599665787, 0.51414170500293577])
            except:
                print(
                    "WARNING: failed to restore connection between PrepareADVSInputs_12 and autodock_kryptonite_nbcr_net_13 in network self.macroNetwork"
                )
        if PrepareADVSInputs_12 is not None and autodock_kryptonite_nbcr_net_13 is not None:
            try:
                self.macroNetwork.connectNodes(
                    PrepareADVSInputs_12,
                    autodock_kryptonite_nbcr_net_13,
                    "dpf_template_file",
                    "dpf",
                    blocking=True,
                    splitratio=[0.51615646597598808, 0.25661305528484007])
            except:
                print(
                    "WARNING: failed to restore connection between PrepareADVSInputs_12 and autodock_kryptonite_nbcr_net_13 in network self.macroNetwork"
                )
        if PrepareADVSInputs_12 is not None and autodock_kryptonite_nbcr_net_13 is not None:
            try:
                self.macroNetwork.connectNodes(
                    PrepareADVSInputs_12,
                    autodock_kryptonite_nbcr_net_13,
                    "autogrid_res_url",
                    "u",
                    blocking=True,
                    splitratio=[0.5760732944947704, 0.2032376887917188])
            except:
                print(
                    "WARNING: failed to restore connection between PrepareADVSInputs_12 and autodock_kryptonite_nbcr_net_13 in network self.macroNetwork"
                )
        if PrepareADVSInputs_12 is not None and autodock_kryptonite_nbcr_net_13 is not None:
            try:
                self.macroNetwork.connectNodes(
                    PrepareADVSInputs_12,
                    autodock_kryptonite_nbcr_net_13,
                    "autogrid_res_local",
                    "utar",
                    blocking=True,
                    splitratio=[0.52802808938949819, 0.66978534572736881])
            except:
                print(
                    "WARNING: failed to restore connection between PrepareADVSInputs_12 and autodock_kryptonite_nbcr_net_13 in network self.macroNetwork"
                )
        self.macroNetwork.runOnNewData.value = False

        ## modifying MacroInputNode dynamic ports
        input_Ports_10 = self.macroNetwork.ipNode
        input_Ports_10.outputPorts[1].configure(
            name='PrepareADVSInputs_ligands')
        input_Ports_10.outputPorts[2].configure(
            name='PrepareADVSInputs_autogrid_results')
        input_Ports_10.outputPorts[3].configure(
            name='PrepareADVSInputs_dpf_template_obj')

        ## modifying MacroOutputNode dynamic ports
        output_Ports_11 = self.macroNetwork.opNode
        output_Ports_11.inputPorts[1].configure(singleConnection='auto')
        output_Ports_11.inputPorts[1].configure(
            name='GetMainURLFromList_newurl')
        ## configure MacroNode input ports
        AutodockVS_9.inputPorts[0].configure(name='PrepareADVSInputs_ligands')
        AutodockVS_9.inputPorts[0].configure(datatype='LigandDB')
        AutodockVS_9.inputPorts[1].configure(
            name='PrepareADVSInputs_autogrid_results')
        AutodockVS_9.inputPorts[1].configure(datatype='autogrid_results')
        AutodockVS_9.inputPorts[2].configure(
            name='PrepareADVSInputs_dpf_template_obj')
        AutodockVS_9.inputPorts[2].configure(datatype='dpf_template')
        ## configure MacroNode output ports
        AutodockVS_9.outputPorts[0].configure(name='GetMainURLFromList_newurl')
        AutodockVS_9.outputPorts[0].configure(datatype='string')

        AutodockVS_9.shrink()

        ## reset modifications ##
        AutodockVS_9.resetTags()
        AutodockVS_9.buildOriginalList()
Esempio n. 13
0
                                  name='Map Pot On Geom',
                                  library=vizlib)
 masterNet.addNode(Map_Pot_On_Geom_4, 250, 181)
 Offset_9 = Map_Pot_On_Geom_4.macroNetwork.nodes[4]
 Offset_9.inputPortByName['dial'].widget.set(1.0, run=False)
 call_method_13 = Map_Pot_On_Geom_4.macroNetwork.nodes[8]
 call_method_13.inputPortByName['signature'].widget.set(
     "Set materials inheritMaterial", run=False)
 Get_viewer_17 = Map_Pot_On_Geom_4.macroNetwork.nodes[12]
 apply(Get_viewer_17.inputPortByName['attr'].widget.configure, (),
       {'choices': ('viewer', )})
 Get_viewer_17.inputPortByName['attr'].widget.set("viewer", run=False)
 Slice_Data_18 = Map_Pot_On_Geom_4.macroNetwork.nodes[13]
 Slice_Data_18.inputPortByName['_slice'].widget.set("[0]", run=False)
 from Vision.StandardNodes import Generic
 Generic_22 = Generic(constrkw={}, name='Generic', library=stdlib)
 Map_Pot_On_Geom_4.macroNetwork.addNode(Generic_22, 510, 484)
 apply(
     Generic_22.addInputPort, (), {
         'name': 'surf',
         'cast': True,
         'datatype': 'geom',
         'height': 8,
         'width': 12,
         'shape': 'rect',
         'color': 'red'
     })
 apply(
     Generic_22.addInputPort, (), {
         'name': 'colors',
         'cast': True,
try:
    ## saving node AutoDock VS Result Directory ##
    from Vision.StandardNodes import DirBrowserNE
    AutoDock_VS_Result_Directory_28 = DirBrowserNE(constrkw={}, name='AutoDock VS Result Directory', library=stdlib)
    masterNet.addNode(AutoDock_VS_Result_Directory_28,47,27)
    AutoDock_VS_Result_Directory_28.inputPortByName['directory'].widget.set(r"visualization_0.1.1_input", run=False)
    apply(AutoDock_VS_Result_Directory_28.configure, (), {'paramPanelImmediate': 1})
except:
    print "WARNING: failed to restore DirBrowserNE named AutoDock VS Result Directory in network masterNet"
    print_exc()
    AutoDock_VS_Result_Directory_28=None

try:
    ## saving node GetReceptors ##
    from Vision.StandardNodes import Generic
    GetReceptors_29 = Generic(constrkw={}, name='GetReceptors', library=stdlib)
    masterNet.addNode(GetReceptors_29,47,123)
    apply(GetReceptors_29.addInputPort, (), {'singleConnection': True, 'name': 'dir', 'cast': True, 'datatype': 'string', 'defaultValue': None, 'required': True, 'height': 8, 'width': 12, 'shape': 'oval', 'color': 'white', 'originalDatatype': 'None'})
    apply(GetReceptors_29.addOutputPort, (), {'name': 'receptors', 'datatype': 'list', 'height': 12, 'width': 12, 'shape': 'oval', 'color': 'cyan'})
    apply(GetReceptors_29.addOutputPort, (), {'name': 'receptor_paths', 'datatype': 'list', 'height': 12, 'width': 12, 'shape': 'oval', 'color': 'cyan'})
    code = """def doit(self, dir):
    import glob, os
    match_str = '''*'''
    if dir is not None:
        cwd = os.getcwd()
        os.chdir(dir)
    try:
        pdirs = glob.glob(match_str)
        receptors = []

        for i in pdirs:
Esempio n. 15
0
try:
    ## saving node VolumeStats ##
    from Volume.VisionInterface.VolumeNodes import VolumeStats
    VolumeStats_1 = VolumeStats(constrkw={},
                                name='VolumeStats',
                                library=vollib)
    masterNet.addNode(VolumeStats_1, 271, 173)
except:
    print "WARNING: failed to restore VolumeStats named VolumeStats in network masterNet"
    print_exc()
    VolumeStats_1 = None

try:
    ## saving node GenSurf ##
    from Vision.StandardNodes import Generic
    GenSurf_2 = Generic(constrkw={}, name='GenSurf', library=stdlib)
    masterNet.addNode(GenSurf_2, 411, 235)
    apply(
        GenSurf_2.addInputPort, (), {
            'name': 'value',
            'cast': True,
            'datatype': 'float',
            'height': 12,
            'width': 12,
            'shape': 'circle',
            'color': 'green'
        })
    apply(
        GenSurf_2.addInputPort, (), {
            'name': 'geom1',
            'cast': True,
    def afterAddingToNetwork(self):
        masterNet = self.macroNetwork
        from NetworkEditor.macros import MacroNode
        MacroNode.afterAddingToNetwork(self)
        from WebServices.VisionInterface.WSNodes import wslib
        from Vision.StandardNodes import stdlib
        ## building macro network ##
        LocalLigandDirectory_0 = self
        from traceback import print_exc
        from WebServices.VisionInterface.WSNodes import wslib
        from Vision.StandardNodes import stdlib
        masterNet.getEditor().addLibraryInstance(
            wslib, "WebServices.VisionInterface.WSNodes", "wslib")
        from WebServices.VisionInterface.WSNodes import addOpalServerAsCategory
        try:
            addOpalServerAsCategory("http://kryptonite.nbcr.net/opal2",
                                    replace=False)
        except:
            pass
        try:
            ## saving node input Ports ##
            input_Ports_1 = self.macroNetwork.ipNode
            input_Ports_1.configure(
                *(), **{
                    'paramPanelImmediate': 1,
                    'expanded': False
                })
        except:
            print(
                "WARNING: failed to restore MacroInputNode named input Ports in network self.macroNetwork"
            )
            print_exc()
            input_Ports_1 = None

        try:
            ## saving node output Ports ##
            output_Ports_2 = self.macroNetwork.opNode
            output_Ports_2.configure(
                *(), **{
                    'paramPanelImmediate': 1,
                    'expanded': False
                })
            output_Ports_2.move(294, 448)
        except:
            print(
                "WARNING: failed to restore MacroOutputNode named output Ports in network self.macroNetwork"
            )
            print_exc()
            output_Ports_2 = None

        try:
            ## saving node Make Zip File ##
            from Vision.StandardNodes import MakeZipFileNE
            Make_Zip_File_3 = MakeZipFileNE(constrkw={},
                                            name='Make Zip File',
                                            library=stdlib)
            self.macroNetwork.addNode(Make_Zip_File_3, 136, 158)
            Make_Zip_File_3.inputPortByName['input_directory'].configure(
                *(), **{'defaultValue': None})
            Make_Zip_File_3.inputPortByName['output_directory'].configure(
                *(), **{'defaultValue': None})
            Make_Zip_File_3.inputPortByName['output_name'].configure(
                *(), **{'defaultValue': None})
            Make_Zip_File_3.configure(
                *(), **{
                    'paramPanelImmediate': 1,
                    'expanded': False
                })
        except:
            print(
                "WARNING: failed to restore MakeZipFileNE named Make Zip File in network self.macroNetwork"
            )
            print_exc()
            Make_Zip_File_3 = None

        try:
            ## saving node Entry ##
            from Vision.StandardNodes import EntryNE
            Entry_4 = EntryNE(constrkw={}, name='Entry', library=stdlib)
            self.macroNetwork.addNode(Entry_4, 312, 18)
            Entry_4.inputPortByName['entry'].configure(
                *(), **{'defaultValue': None})
            Entry_4.inputPortByName['entry'].widget.set(r"my_ligands.zip",
                                                        run=False)
            Entry_4.configure(*(), **{'paramPanelImmediate': 1})
        except:
            print(
                "WARNING: failed to restore EntryNE named Entry in network self.macroNetwork"
            )
            print_exc()
            Entry_4 = None

        try:
            ## saving node LigandDBUpload_kryptonite_nbcr_net ##
            from NetworkEditor.items import FunctionNode
            LigandDBUpload_kryptonite_nbcr_net_5 = FunctionNode(
                functionOrString='LigandDBUpload_kryptonite_nbcr_net',
                host="http://kryptonite.nbcr.net/opal2",
                namedArgs={
                    'username': '',
                    'userlib': '',
                    'password': '',
                    'localRun': False,
                    'execPath': '',
                    'desc': ''
                },
                constrkw={
                    'functionOrString': "'LigandDBUpload_kryptonite_nbcr_net'",
                    'host': '"http://kryptonite.nbcr.net/opal2"',
                    'namedArgs': {
                        'username': '',
                        'userlib': '',
                        'password': '',
                        'localRun': False,
                        'execPath': '',
                        'desc': ''
                    }
                },
                name='LigandDBUpload_kryptonite_nbcr_net',
                library=wslib)
            self.macroNetwork.addNode(LigandDBUpload_kryptonite_nbcr_net_5,
                                      136, 216)
            LigandDBUpload_kryptonite_nbcr_net_5.inputPortByName[
                'username'].configure(*(), **{'defaultValue': None})
            LigandDBUpload_kryptonite_nbcr_net_5.inputPortByName[
                'userlib'].configure(*(), **{'defaultValue': None})
            LigandDBUpload_kryptonite_nbcr_net_5.inputPortByName[
                'password'].configure(*(), **{'defaultValue': None})
            LigandDBUpload_kryptonite_nbcr_net_5.inputPortByName[
                'localRun'].configure(*(), **{'defaultValue': None})
            LigandDBUpload_kryptonite_nbcr_net_5.inputPortByName[
                'execPath'].configure(*(), **{'defaultValue': None})
            LigandDBUpload_kryptonite_nbcr_net_5.inputPortByName[
                'desc'].configure(*(), **{'defaultValue': None})
            LigandDBUpload_kryptonite_nbcr_net_5.inputPortByName[
                'username'].widget.set(r"", run=False)
            LigandDBUpload_kryptonite_nbcr_net_5.inputPortByName[
                'userlib'].rebindWidget()
            LigandDBUpload_kryptonite_nbcr_net_5.inputPortByName[
                'userlib'].widget.set(r"", run=False)
            LigandDBUpload_kryptonite_nbcr_net_5.inputPortByName[
                'userlib'].unbindWidget()
            LigandDBUpload_kryptonite_nbcr_net_5.inputPortByName[
                'password'].widget.set(r"", run=False)
            LigandDBUpload_kryptonite_nbcr_net_5.inputPortByName[
                'localRun'].widget.set(0, run=False)
            LigandDBUpload_kryptonite_nbcr_net_5.inputPortByName[
                'execPath'].widget.set(r"", run=False)
            LigandDBUpload_kryptonite_nbcr_net_5.inputPortByName[
                'desc'].widget.set(r"", run=False)
            LigandDBUpload_kryptonite_nbcr_net_5.configure(
                *(), **{
                    'paramPanelImmediate': 1,
                    'expanded': False
                })
        except:
            print(
                "WARNING: failed to restore FunctionNode named LigandDBUpload_kryptonite_nbcr_net in network self.macroNetwork"
            )
            print_exc()
            LigandDBUpload_kryptonite_nbcr_net_5 = None

        try:
            ## saving node Index ##
            from Vision.StandardNodes import Index
            Index_6 = Index(constrkw={}, name='Index', library=stdlib)
            self.macroNetwork.addNode(Index_6, 136, 273)
            Index_6.inputPortByName['data'].configure(*(),
                                                      **{'defaultValue': None})
            Index_6.inputPortByName['index'].configure(
                *(), **{'defaultValue': None})
            Index_6.outputPortByName['data'].configure(
                *(), **{'datatype': 'string'})
            Index_6.inputPortByName['index'].widget.configure(
                *(), **{
                    'max': 7,
                    'min': -8
                })
            Index_6.inputPortByName['index'].widget.set(0, run=False)
            Index_6.configure(*(), **{
                'paramPanelImmediate': 1,
                'expanded': False
            })
        except:
            print(
                "WARNING: failed to restore Index named Index in network self.macroNetwork"
            )
            print_exc()
            Index_6 = None

        try:
            ## saving node ReplaceURL ##
            from WebServices.VisionInterface.WSNodes import ReplaceURLNode
            ReplaceURL_7 = ReplaceURLNode(constrkw={},
                                          name='ReplaceURL',
                                          library=wslib)
            self.macroNetwork.addNode(ReplaceURL_7, 328, 327)
            ReplaceURL_7.inputPortByName['url'].configure(
                *(), **{'defaultValue': None})
            ReplaceURL_7.inputPortByName['newfilename'].configure(
                *(), **{'defaultValue': None})
            ReplaceURL_7.inputPortByName['url'].rebindWidget()
            ReplaceURL_7.inputPortByName['url'].widget.set(r"", run=False)
            ReplaceURL_7.inputPortByName['url'].unbindWidget()
            ReplaceURL_7.configure(*(), **{'paramPanelImmediate': 1})
        except:
            print(
                "WARNING: failed to restore ReplaceURLNode named ReplaceURL in network self.macroNetwork"
            )
            print_exc()
            ReplaceURL_7 = None

        try:
            ## saving node CreateLigandDBObj ##
            from Vision.StandardNodes import Generic
            CreateLigandDBObj_8 = Generic(constrkw={},
                                          name='CreateLigandDBObj',
                                          library=stdlib)
            self.macroNetwork.addNode(CreateLigandDBObj_8, 217, 385)
            CreateLigandDBObj_8.addInputPort(
                *(), **{
                    'singleConnection': True,
                    'name': 'ligand_lib_url',
                    'cast': True,
                    'datatype': 'string',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white',
                    'originalDatatype': 'None'
                })
            CreateLigandDBObj_8.addInputPort(
                *(), **{
                    'singleConnection': True,
                    'name': 'log_file',
                    'cast': True,
                    'datatype': 'string',
                    'defaultValue': None,
                    'required': False,
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white',
                    'originalDatatype': 'None'
                })
            CreateLigandDBObj_8.addOutputPort(
                *(), **{
                    'name': 'ligand_db_obj',
                    'datatype': 'LigandDB',
                    'height': 8,
                    'width': 12,
                    'shape': 'rect',
                    'color': '#FFCCFF'
                })
            code = """def doit(self, ligand_lib_url, log_file):
        if log_file == None:
            log_file = "ligand_lib_uploads.log"

        log_file = os.path.abspath(log_file)

        if log_file != None:
            from time import strftime
            now = strftime("%Y-%m-%d %H:%M:%S")
            
            log_str = '''On ''' + now + ''', you uploaded a ligand library to: \n'''
            log_str = log_str + ligand_lib_url + '''\n\n'''

            f = open(log_file, '''a''')
            f.write(log_str)
            print "This ligand library upload has been recorded in " + log_file

        from AutoDockTools.VisionInterface.Adt.LigandDB import LigandDB
        ligand_db_obj = LigandDB(url_lib=ligand_lib_url)
	pass
## to ouput data on port ligand_db_obj use
        self.outputData(ligand_db_obj=ligand_db_obj)






















"""
            CreateLigandDBObj_8.configure(function=code)
            CreateLigandDBObj_8.configure(
                *(), **{
                    'paramPanelImmediate': 1,
                    'expanded': False
                })
        except:
            print(
                "WARNING: failed to restore Generic named CreateLigandDBObj in network self.macroNetwork"
            )
            print_exc()
            CreateLigandDBObj_8 = None

        try:
            ## saving node get_paths ##
            from Vision.StandardNodes import Generic
            get_paths_9 = Generic(constrkw={},
                                  name='get_paths',
                                  library=stdlib)
            self.macroNetwork.addNode(get_paths_9, 136, 105)
            get_paths_9.addInputPort(
                *(), **{
                    'singleConnection': True,
                    'name': 'directory',
                    'cast': True,
                    'datatype': 'string',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white',
                    'originalDatatype': 'None'
                })
            get_paths_9.addInputPort(
                *(), **{
                    'singleConnection': True,
                    'name': 'zip_name',
                    'cast': True,
                    'datatype': 'string',
                    'defaultValue': None,
                    'required': True,
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white',
                    'originalDatatype': 'None'
                })
            get_paths_9.addOutputPort(
                *(), **{
                    'name': 'input_directory',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            get_paths_9.addOutputPort(
                *(), **{
                    'name': 'output_directory',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            get_paths_9.addOutputPort(
                *(), **{
                    'name': 'output_name',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            get_paths_9.addOutputPort(
                *(), **{
                    'name': 'output_basedir',
                    'datatype': 'string',
                    'height': 8,
                    'width': 12,
                    'shape': 'oval',
                    'color': 'white'
                })
            code = """def doit(self, directory, zip_name):
        input_directory = os.path.abspath(directory)

        if not(os.path.exists(input_directory)):
            print "ERROR: ligand input directory " + input_directory + " does not exist"
            return '''stop'''

        output_directory = os.path.abspath('''.''')
        output_name = zip_name
        output_basedir = zip_name.rstrip('''.zip''')
	pass
        self.outputData(input_directory=input_directory, output_directory=output_directory, output_name=zip_name, output_basedir=output_basedir)
## to ouput data on port input_directory use
## self.outputData(input_directory=data)
## to ouput data on port output_directory use
## self.outputData(output_directory=data)


## to ouput data on port output_name use
## self.outputData(output_name=data)

## to ouput data on port output_basedir use
## self.outputData(output_basedir=data)

"""
            get_paths_9.configure(function=code)
            get_paths_9.configure(
                *(), **{
                    'paramPanelImmediate': 1,
                    'expanded': False
                })
        except:
            print(
                "WARNING: failed to restore Generic named get_paths in network self.macroNetwork"
            )
            print_exc()
            get_paths_9 = None

        #self.macroNetwork.run()
        self.macroNetwork.freeze()

        ## saving connections for network LocalLigandDirectory ##
        if Make_Zip_File_3 is not None and LigandDBUpload_kryptonite_nbcr_net_5 is not None:
            try:
                self.macroNetwork.connectNodes(
                    Make_Zip_File_3,
                    LigandDBUpload_kryptonite_nbcr_net_5,
                    "zipfile",
                    "userlib",
                    blocking=True,
                    splitratio=[0.67700056401206909, 0.41786522052018427])
            except:
                print(
                    "WARNING: failed to restore connection between Make_Zip_File_3 and LigandDBUpload_kryptonite_nbcr_net_5 in network self.macroNetwork"
                )
        if LigandDBUpload_kryptonite_nbcr_net_5 is not None and Index_6 is not None:
            try:
                self.macroNetwork.connectNodes(
                    LigandDBUpload_kryptonite_nbcr_net_5,
                    Index_6,
                    "result",
                    "data",
                    blocking=True,
                    splitratio=[0.27868065815947218, 0.69101010116597561])
            except:
                print(
                    "WARNING: failed to restore connection between LigandDBUpload_kryptonite_nbcr_net_5 and Index_6 in network self.macroNetwork"
                )
        if Index_6 is not None and ReplaceURL_7 is not None:
            try:
                self.macroNetwork.connectNodes(
                    Index_6,
                    ReplaceURL_7,
                    "data",
                    "url",
                    blocking=True,
                    splitratio=[0.0, 0.50910496731074983])
            except:
                print(
                    "WARNING: failed to restore connection between Index_6 and ReplaceURL_7 in network self.macroNetwork"
                )
        if ReplaceURL_7 is not None and CreateLigandDBObj_8 is not None:
            try:
                self.macroNetwork.connectNodes(
                    ReplaceURL_7,
                    CreateLigandDBObj_8,
                    "newurl",
                    "ligand_lib_url",
                    blocking=True,
                    splitratio=[0.7375258387145982, 0.34433018843468416])
            except:
                print(
                    "WARNING: failed to restore connection between ReplaceURL_7 and CreateLigandDBObj_8 in network self.macroNetwork"
                )
        output_Ports_2 = self.macroNetwork.opNode
        if CreateLigandDBObj_8 is not None and output_Ports_2 is not None:
            try:
                self.macroNetwork.connectNodes(
                    CreateLigandDBObj_8,
                    output_Ports_2,
                    "ligand_db_obj",
                    "new",
                    blocking=True,
                    splitratio=[0.25450332220506922, 0.49254602433654382])
            except:
                print(
                    "WARNING: failed to restore connection between CreateLigandDBObj_8 and output_Ports_2 in network self.macroNetwork"
                )
        input_Ports_1 = self.macroNetwork.ipNode
        if input_Ports_1 is not None and get_paths_9 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_1,
                    get_paths_9,
                    "new",
                    "directory",
                    blocking=True,
                    splitratio=[0.73592256661833422, 0.40050624233195609])
            except:
                print(
                    "WARNING: failed to restore connection between input_Ports_1 and get_paths_9 in network self.macroNetwork"
                )
        if Entry_4 is not None and get_paths_9 is not None:
            try:
                self.macroNetwork.connectNodes(
                    Entry_4,
                    get_paths_9,
                    "string",
                    "zip_name",
                    blocking=True,
                    splitratio=[0.74641701362897139, 0.56047721560743557])
            except:
                print(
                    "WARNING: failed to restore connection between Entry_4 and get_paths_9 in network self.macroNetwork"
                )
        if get_paths_9 is not None and Make_Zip_File_3 is not None:
            try:
                self.macroNetwork.connectNodes(
                    get_paths_9,
                    Make_Zip_File_3,
                    "input_directory",
                    "input_directory",
                    blocking=True,
                    splitratio=[0.24975092021298884, 0.59053364249853169])
            except:
                print(
                    "WARNING: failed to restore connection between get_paths_9 and Make_Zip_File_3 in network self.macroNetwork"
                )
        if get_paths_9 is not None and Make_Zip_File_3 is not None:
            try:
                self.macroNetwork.connectNodes(
                    get_paths_9,
                    Make_Zip_File_3,
                    "output_name",
                    "output_name",
                    blocking=True,
                    splitratio=[0.44934886807300634, 0.5145630699734256])
            except:
                print(
                    "WARNING: failed to restore connection between get_paths_9 and Make_Zip_File_3 in network self.macroNetwork"
                )
        if get_paths_9 is not None and Make_Zip_File_3 is not None:
            try:
                self.macroNetwork.connectNodes(
                    get_paths_9,
                    Make_Zip_File_3,
                    "output_directory",
                    "output_directory",
                    blocking=True,
                    splitratio=[0.65054191214838031, 0.31030412383438832])
            except:
                print(
                    "WARNING: failed to restore connection between get_paths_9 and Make_Zip_File_3 in network self.macroNetwork"
                )
        if get_paths_9 is not None and ReplaceURL_7 is not None:
            try:
                self.macroNetwork.connectNodes(
                    get_paths_9,
                    ReplaceURL_7,
                    "output_basedir",
                    "newfilename",
                    blocking=True,
                    splitratio=[0.5380996717918376, 0.39023381726820411])
            except:
                print(
                    "WARNING: failed to restore connection between get_paths_9 and ReplaceURL_7 in network self.macroNetwork"
                )
        if input_Ports_1 is not None and CreateLigandDBObj_8 is not None:
            try:
                self.macroNetwork.connectNodes(
                    input_Ports_1,
                    CreateLigandDBObj_8,
                    "new",
                    "log_file",
                    blocking=True,
                    splitratio=[0.49268182912115838, 0.67412763774649975])
            except:
                print(
                    "WARNING: failed to restore connection between input_Ports_1 and CreateLigandDBObj_8 in network self.macroNetwork"
                )
        if ReplaceURL_7 is not None and output_Ports_2 is not None:
            try:
                self.macroNetwork.connectNodes(
                    ReplaceURL_7,
                    output_Ports_2,
                    "newurl",
                    "new",
                    blocking=True,
                    splitratio=[0.67446600768034171, 0.74989471765767979])
            except:
                print(
                    "WARNING: failed to restore connection between ReplaceURL_7 and output_Ports_2 in network self.macroNetwork"
                )
        self.macroNetwork.runOnNewData.value = False

        ## modifying MacroInputNode dynamic ports
        input_Ports_1 = self.macroNetwork.ipNode
        input_Ports_1.outputPorts[1].configure(
            name='Make_Zip_File_input_directory')
        input_Ports_1.outputPorts[2].configure(
            name='CreateLigandDBObj_log_file')

        ## modifying MacroOutputNode dynamic ports
        output_Ports_2 = self.macroNetwork.opNode
        output_Ports_2.inputPorts[1].configure(singleConnection='auto')
        output_Ports_2.inputPorts[2].configure(singleConnection='auto')
        output_Ports_2.inputPorts[1].configure(
            name='CreateLigandDBObj_ligand_db_obj')
        output_Ports_2.inputPorts[2].configure(name='ReplaceURL_newurl')
        ## configure MacroNode input ports
        LocalLigandDirectory_0.inputPorts[0].configure(
            name='Make_Zip_File_input_directory')
        LocalLigandDirectory_0.inputPorts[0].configure(datatype='string')
        LocalLigandDirectory_0.inputPorts[1].configure(
            name='CreateLigandDBObj_log_file')
        LocalLigandDirectory_0.inputPorts[1].configure(datatype='string')
        ## configure MacroNode output ports
        LocalLigandDirectory_0.outputPorts[0].configure(
            name='CreateLigandDBObj_ligand_db_obj')
        LocalLigandDirectory_0.outputPorts[0].configure(datatype='LigandDB')
        LocalLigandDirectory_0.outputPorts[1].configure(
            name='ReplaceURL_newurl')
        LocalLigandDirectory_0.outputPorts[1].configure(datatype='string')

        LocalLigandDirectory_0.shrink()

        ## reset modifications ##
        LocalLigandDirectory_0.resetTags()
        LocalLigandDirectory_0.buildOriginalList()
Esempio n. 17
0
    FileWithCommandOrdering_87 = FileBrowserNE(constrkw={},
                                               name='FileWithCommandOrdering',
                                               library=stdlib)
    masterNet.addNode(FileWithCommandOrdering_87, 30, 10)
    FileWithCommandOrdering_87.inputPortByName['filename'].widget.set(
        r"NAMDNBCR_0.1_input/order.txt", run=False)
    apply(FileWithCommandOrdering_87.configure, (), {'paramPanelImmediate': 1})
except:
    print "WARNING: failed to restore FileBrowserNE named FileWithCommandOrdering in network masterNet"
    print_exc()
    FileWithCommandOrdering_87 = None

try:
    ## saving node GetOrdering ##
    from Vision.StandardNodes import Generic
    GetOrdering_88 = Generic(constrkw={}, name='GetOrdering', library=stdlib)
    masterNet.addNode(GetOrdering_88, 30, 107)
    apply(
        GetOrdering_88.addInputPort, (), {
            'singleConnection': True,
            'name': 'order_file',
            'cast': True,
            'datatype': 'string',
            'defaultValue': None,
            'required': True,
            'height': 8,
            'width': 12,
            'shape': 'oval',
            'color': 'white',
            'originalDatatype': 'None'
        })