def test_calculate(self): ''' Run pa-calculate on a valid ProbAnno object and verify that the job runs and returns a valid RxnProbs object.''' # Run the calculate() function to generate a RxnProbs object. paClient = ProbabilisticAnnotation(self._config["probanno_url"], token=self._token) rxnprobsMetadata = paClient.calculate( { "probanno": self._config["probannoid"], "probanno_workspace": self._config["test_ws"], "rxnprobs": self._config["rxnprobsid"], "rxnprobs_workspace": self._config["test_ws"] } ) # Look for the RxnProbs object in the test workspace. wsClient = Workspace(self._config["workspace_url"], token=self._token) try: rxnprobsObjectId = { 'workspace': self._config['test_ws'], 'name': self._config['rxnprobsid'] } objectList = wsClient.get_objects( [ rxnprobsObjectId ] ) rxnprobsObject = objectList[0] self.assertEqual(rxnprobsObject['info'][1], self._config['rxnprobsid'], 'RxnProbs object id %s is not %s' %(rxnprobsObject['info'][1], self._config['rxnprobsid'])) except WorkspaceServerError as e: traceback.print_exc(file=sys.stderr) self.fail(msg = "The expected object %s did not get created in the workspace %s!\n" %(self._config["rxnprobsid"], self._config["test_ws"]))
def test_calculate(self): ''' Run pa-calculate on a valid ProbAnno object and verify that the job runs and returns a valid RxnProbs object.''' # Run the calculate() function to generate a RxnProbs object. paClient = ProbabilisticAnnotation(self._config["probanno_url"], token=self._token) rxnprobsMetadata = paClient.calculate({ "probanno": self._config["probannoid"], "probanno_workspace": self._config["test_ws"], "rxnprobs": self._config["rxnprobsid"], "rxnprobs_workspace": self._config["test_ws"] }) # Look for the RxnProbs object in the test workspace. wsClient = Workspace(self._config["workspace_url"], token=self._token) try: rxnprobsObjectId = { 'workspace': self._config['test_ws'], 'name': self._config['rxnprobsid'] } objectList = wsClient.get_objects([rxnprobsObjectId]) rxnprobsObject = objectList[0] self.assertEqual( rxnprobsObject['info'][1], self._config['rxnprobsid'], 'RxnProbs object id %s is not %s' % (rxnprobsObject['info'][1], self._config['rxnprobsid'])) except WorkspaceServerError as e: traceback.print_exc(file=sys.stderr) self.fail( msg= "The expected object %s did not get created in the workspace %s!\n" % (self._config["rxnprobsid"], self._config["test_ws"]))
input['probanno'] = args.probanno input['rxnprobs'] = args.rxnprobs if args.probannows is None: input['probanno_workspace'] = user_workspace() else: input['probanno_workspace'] = args.probannows if args.rxnprobsws is None: input['rxnprobs_workspace'] = user_workspace() else: input['rxnprobs_workspace'] = args.rxnprobsws input['template_model'] = args.template input['template_workspace'] = args.templatews # Create a probabilistic annotation client. if args.url is None: args.url = get_url() paClient = ProbabilisticAnnotation(url=args.url) # Calculate reaction probabilities from probabilistic annotation. try: objectInfo = paClient.calculate(input) print 'RxnProbs successfully generated in workspace:' printObjectInfo(objectInfo) except Exception as e: print 'Error calculating reaction probabilities: %s' %(e.message) if args.showError: traceback.print_exc(file=sys.stdout) exit(1) exit(0)