def test_get_rxnprobs(self):
     ''' Verify that we can successfully get a list of rxnprobs data from a valid RxnProbs object.'''
     paClient = ProbabilisticAnnotation(self._config["probanno_url"], token=self._token)
     rxnProbsData = paClient.get_rxnprobs( {
             "rxnprobs":           self._config["rxnprobsid"],
             "rxnprobs_workspace": self._config["test_ws"]
             })
     self.assertNotEqual(len(rxnProbsData), 0, 'Length of output array is zero')
 def test_get_rxnprobs(self):
     ''' Verify that we can successfully get a list of rxnprobs data from a valid RxnProbs object.'''
     paClient = ProbabilisticAnnotation(self._config["probanno_url"],
                                        token=self._token)
     rxnProbsData = paClient.get_rxnprobs({
         "rxnprobs":
         self._config["rxnprobsid"],
         "rxnprobs_workspace":
         self._config["test_ws"]
     })
     self.assertNotEqual(len(rxnProbsData), 0,
                         'Length of output array is zero')
示例#3
0
    input['rxnprobs'] = args.rxnprobs
    if args.rxnprobsws is None:
        input['rxnprobs_workspace'] = user_workspace()
    else:
        input['rxnprobs_workspace'] = args.rxnprobsws
    input['rxnprobs_version'] = args.rxnprobsver
    input['sort_field'] = args.sortField

    # Create a probabilistic annotation client.
    if args.url is None:
        args.url = get_url()
    paClient = ProbabilisticAnnotation(url=args.url)

    # Get the raw data from the server.
    try:
        output = paClient.get_rxnprobs(input)
    except Exception as e:
        print 'Error getting RxnProbs object: %s' % (e.message)
        if args.showError:
            traceback.print_exc(file=sys.stdout)
        exit(1)

    # Format the data as a table of tab delimited fields.
    print '\t'.join([
        'reaction_id', 'probability', 'complex_diagnostic', 'complex_details',
        'putative_GPR'
    ])
    for rxnprob in output:
        print '%s\t%f\t%s\t%s\t%s' % (rxnprob[0], rxnprob[1], rxnprob[2],
                                      rxnprob[3], rxnprob[4])
    input['rxnprobs'] = args.rxnprobs
    if args.rxnprobsws is None:
        input['rxnprobs_workspace'] = user_workspace()
    else:
        input['rxnprobs_workspace'] = args.rxnprobsws
    input['rxnprobs_version'] = args.rxnprobsver
    input['sort_field'] = args.sortField
                
    # Create a probabilistic annotation client.
    if args.url is None:
        args.url = get_url()
    paClient = ProbabilisticAnnotation(url=args.url)

    # Get the raw data from the server.
    try:
        output = paClient.get_rxnprobs(input)
    except Exception as e:
        print 'Error getting RxnProbs object: %s' %(e.message)
        if args.showError:
            traceback.print_exc(file=sys.stdout)
        exit(1)

    # Format the data as a table of tab delimited fields.
    print '\t'.join(['reaction_id', 'probability', 'complex_diagnostic', 'complex_details', 'putative_GPR'])
    for rxnprob in output:
        print '%s\t%f\t%s\t%s\t%s' %(rxnprob[0], rxnprob[1], rxnprob[2], rxnprob[3], rxnprob[4]) 

    exit(0)