def register_session(server, username, password): """ Register a new GenePattern server session for the provided server, username and password. Return the session. :param server: :param username: :param password: :return: """ # Create the session session = gp.GPServer(server, username, password) # Validate username if not empty valid_username = username != "" and username is not None # Validate that the server is not already registered index = get_session_index(server) new_server = index == -1 # Add the new session to the list if valid_username and new_server: sessions.append(session) # Replace old session is one exists if valid_username and not new_server: sessions[index] = session return session
def get_task(self, line): args = line.split(" ") # GPServer, task name or lsid if len(args) != 4: return 'Incorrect number of args. Need 4: Server URL, username, password, task name or LSID' server = gp.GPServer(args[0], args[1], args[2]) task = gp.GPTask(server, args[3]) return task
def get_job(self, line): args = line.split(" ") # GPServer, job number if len(args) != 4: return 'Incorrect number of args. Need 4: Server URL, username, password, job number' server = gp.GPServer(args[0], args[1], args[2]) job = gp.GPJob(server, int(args[3])) return job
def test_odf_load_gpfile(): gpfile = gp.GPFile(gp.GPServer('http://genepattern.broadinstitute.org/gp', '', ''), 'https://software.broadinstitute.org/cancer/software/genepattern/data/protocols/all_aml_test.preprocessed.comp.marker.odf') odf = gp.data.ODF(gpfile) odf_asserts(odf)
def test_gct_load_gpfile(): gpfile = gp.GPFile(gp.GPServer('http://genepattern.broadinstitute.org/gp', '', ''), 'https://software.broadinstitute.org/cancer/software/genepattern/data/all_aml/all_aml_test.gct') gct = gp.data.GCT(gpfile) gct_asserts(gct)
module_id = "urn:lsid:8080.root.ppm-sanger-dev.ppm-sanger-dev.dipr.partners.org:genepatternmodules:3:2" try: file = sys.argv[1] except: print "usage: sanger_gp_ws.py zipped_file_of_.ab1" exit(0) print "file: " + os.path.basename(file) #arguments to use arg_name = "arg0", "arg1" arg_val = file, "yoyoyo" #connect server = gp.GPServer(url, user, None) #get available tasks tasks = server.get_task_list() for task in tasks: print "gp task: " + str(task.get_name()) module = tasks[1] print "module: " + str(module.get_name()) #module args module.param_load() params = module.get_parameters() for param in params: