Exemplo n.º 1
0
    
if __name__ == "__main__":
    # Parse options.
    parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, prog='pa_checkjob', epilog=desc3)
    parser.add_argument('-j', '--jobID', help='job ID', action='store', dest='jobID', default=None)
    parser.add_argument('--ujs-url', help='url for user and job state service', action='store', dest='ujsURL', default='https://kbase.us/services/userandjobstate/')
    usage = parser.format_usage()
    parser.description = desc1 + '      ' + usage + desc2
    parser.usage = argparse.SUPPRESS
    args = parser.parse_args()
    
    # Get the list of jobs for the user.
    if 'KB_AUTH_USER_ID' in os.environ:
        userID = os.environ.get('KB_AUTH_USER_ID')
    else:
        auth = _read_inifile()
        userID = auth['user_id']
    ujsClient = UserAndJobState(args.ujsURL)
    try:
        jobList = ujsClient.list_jobs([ userID ], 'RCE')
    except JobStateServerError as e:
        print e.message
        exit(1)
    
    # See if the user has any jobs in the list.
    if len(jobList) == 0:
        print 'There are no jobs for you.'
        exit(1)

    # Print info about the specific job if requested.
    if args.jobID is not None:
 def __init__(self, args):
     _authdata = _read_inifile()
     self.wsClient = workspaceService("http://kbase.us/services/workspace/")
     self.token = _authdata['token']
     self.args = args
Exemplo n.º 3
0
                        default=None)
    parser.add_argument('--ujs-url',
                        help='url for user and job state service',
                        action='store',
                        dest='ujsURL',
                        default='https://kbase.us/services/userandjobstate/')
    usage = parser.format_usage()
    parser.description = desc1 + '      ' + usage + desc2
    parser.usage = argparse.SUPPRESS
    args = parser.parse_args()

    # Get the list of jobs for the user.
    if 'KB_AUTH_USER_ID' in os.environ:
        userID = os.environ.get('KB_AUTH_USER_ID')
    else:
        auth = _read_inifile()
        userID = auth['user_id']
    ujsClient = UserAndJobState(args.ujsURL)
    try:
        jobList = ujsClient.list_jobs([userID], 'RCE')
    except JobStateServerError as e:
        print 'Error getting job list: ' + e.message
        exit(1)

    # See if the user has any jobs in the list.
    if len(jobList) == 0:
        print 'There are no jobs for you.'
        exit(1)

    # Print info about the specific job if requested.
    if args.jobID is not None:
                        default='http://kbase.us/services/workspace/')
    args = parser.parse_args()

    if args.probanno is None:
        args.probanno = args.genome + '.probanno'
    if args.probannows is None:
        args.probannows = args.workspace
    if args.rxnprobs is None:
        args.rxnprobs = args.genome + '.rxnprobs'
    if args.rxnprobsws is None:
        args.rxnprobsws = args.workspace
    if args.phenosimsetws is None:
        args.phenosimsetws = args.workspace

    # Create the clients for the services we need.
    authdata = _read_inifile()
    token = authdata['token']
    wsClient = workspaceService(args.wsurl)

    # Build roles to reactions dictionary.
    step = 1
    print "+++ Step %d: Build reactions to roles dictionary +++" % (step)
    if not os.path.exists(rolesToRxnsFileName):
        os.system(
            "all_roles_used_in_models | roles_to_complexes | get_relationship_HasStep -to id >%s"
            % (rolesToRxnsFileName))
    rolesToReactions = dict()
    reactionsToRoles = dict()
    # Each line of the file has four fields: (1) role, (2) hypothetical flag, (3) complex id, (4) reaction id
    rolesToRxnsFile = open(rolesToRxnsFileName, 'r')
    for line in rolesToRxnsFile:
 parser.add_argument('--ws-url', help='url for workspace service', action='store', dest='wsurl', default='http://kbase.us/services/workspace/')
 args = parser.parse_args()
 
 if args.probanno is None:
     args.probanno = args.genome + '.probanno'
 if args.probannows is None:
     args.probannows = args.workspace
 if args.rxnprobs is None:
     args.rxnprobs = args.genome + '.rxnprobs'
 if args.rxnprobsws is None:
     args.rxnprobsws = args.workspace
 if args.phenosimsetws is None:
     args.phenosimsetws = args.workspace
     
 # Create the clients for the services we need.
 authdata = _read_inifile()
 token = authdata['token']
 wsClient = workspaceService(args.wsurl)
 
 # Build roles to reactions dictionary.
 step = 1
 print "+++ Step %d: Build reactions to roles dictionary +++" %(step)
 if not os.path.exists(rolesToRxnsFileName):
     os.system("all_roles_used_in_models | roles_to_complexes | get_relationship_HasStep -to id >%s" %(rolesToRxnsFileName))
 rolesToReactions = dict()
 reactionsToRoles = dict()
 # Each line of the file has four fields: (1) role, (2) hypothetical flag, (3) complex id, (4) reaction id
 rolesToRxnsFile = open(rolesToRxnsFileName, 'r')
 for line in rolesToRxnsFile:
     fields = line.strip('\r\n').split('\t')
     reaction = fields[3]