elif object_version_number and object_id: contig_set = ws_client.get_objects([{"workspace":workspace_name,"objid":object_id, "ver":object_version_number}])[0] else: contig_set = ws_client.get_objects([{"workspace":workspace_name,"objid":object_id}])[0] except Exception, e: logger.exception("Unable to retrieve workspace object from {0}:{1}.".format(workspace_service_url,workspace_name)) logger.exception(e) raise shock_id = None if "fasta_ref" in contig_set["data"]: shock_id = contig_set["data"]["fasta_ref"] logger.info("Retrieving data from Shock.") script_utils.download_file_from_shock(logger = logger, shock_service_url = shock_service_url, shock_id = shock_id, directory = working_directory, token = token) else: ws_object_name = contig_set["info"][1] logger.info("getting info {0}".format(ws_object_name)) valid_chars = "-_.(){0}{1}".format(string.ascii_letters, string.digits) temp_file_name = "" filename_chars = list() for character in ws_object_name: if character in valid_chars: filename_chars.append(character) else: filename_chars.append("_")
try: ws_client = biokbase.workspace.client.Workspace('https://ci.kbase.us/services/ws') except Exception,e: raise Exception("Could not create workspace client") if object_type in ("SingleEnd"): print "entering if" single_end_library = ws_client.get_objects([{'workspace':workspace_name,'name':object_name}])[0]['data'] shock_id = None if "handle" in single_end_library and "id" in single_end_library['handle']: shock_id = single_end_library['handle']['id'] print shock_id if shock_id is None: raise Exception("There was not shock id found.") try: script_utils.download_file_from_shock(logger, shock_service_url, shock_id, working_directory, token) except Exception,e: print e raise Exception( "Unable to download shock file , {0}".format(e)) logger.info("Conversion completed.") elif object_type in ("PairedEnd"): paired_end_library = ws_client.get_objects([{'workspace':workspace_name,'name':object_name}])[0]['data'] shock_id1 = None shock_id2 = None if "handle_1" in paired_end_library and "id" in paired_end_library['handle']: shock_id1 = paired_end_library['handle_1']['id'] if shock_id1 is None: raise Exception("Handle1 there was not shock id found.") if "handle_2" in paired_end_library and "id" in paired_end_library['handle']: shock_id2 = paired_end_library['handle_2']['id']
print "entering if" single_end_library = ws_client.get_objects([{ 'workspace': workspace_name, 'name': object_name }])[0]['data'] shock_id = None if "handle" in single_end_library and "id" in single_end_library[ 'handle']: shock_id = single_end_library['handle']['id'] print shock_id if shock_id is None: raise Exception("There was not shock id found.") try: script_utils.download_file_from_shock(logger, shock_service_url, shock_id, working_directory, token) except Exception, e: print e raise Exception("Unable to download shock file , {0}".format(e)) logger.info("Conversion completed.") elif object_type in ("PairedEnd"): paired_end_library = ws_client.get_objects([{ 'workspace': workspace_name, 'name': object_name }])[0]['data'] shock_id1 = None shock_id2 = None if "handle_1" in paired_end_library and "id" in paired_end_library[ 'handle']: