def analyze(): sessionid = request.cookies.get('sessionid') networkingpreset = request.form["networkingpreset"] email = request.form["email"] if len(email) < 1 or len(email) > 100: email = "*****@*****.**" present_folders = util.check_ftp_folders(sessionid) if not "G1" in present_folders: content = {'status': 'Group 1 files required but not selected'} return json.dumps(content), 417 gnps_username = credentials.USERNAME gnps_password = credentials.PASSWORD try: if len(request.form["username"]) > 3 and len(request.form["password"]): gnps_username = request.form["username"] gnps_password = request.form["password"] except: gnps_username = credentials.USERNAME gnps_password = credentials.PASSWORD remote_dir = os.path.join(credentials.USERNAME, sessionid) task_id = util.launch_GNPS_workflow( remote_dir, "GNPS Quickstart Molecular Networking Analysis ", gnps_username, gnps_password, present_folders, email, networkingpreset) content = {'status': 'Success', 'task_id': task_id} return json.dumps(content), 200
def datasetsubmit(): sessionid = request.cookies.get('sessionid') present_folders = util.check_ftp_folders(sessionid) massive_preset_url = "https://massive.ucsd.edu/ProteoSAFe/index.jsp" parameters = { "workflow": "MASSIVE-COMPLETE", "desc": "GNPS - Dataset Created via Quickstart" } one_category_present = False if "raw" in present_folders: one_category_present = True parameters["raw_list_files"] = "d.%s/%s/raw" % (credentials.USERNAME, sessionid) if "peak" in present_folders: one_category_present = True parameters["peak_list_files"] = "d.%s/%s/peak" % (credentials.USERNAME, sessionid) if "supplementary" in present_folders: one_category_present = True parameters["other_files"] = "d.%s/%s/supplementary" % ( credentials.USERNAME, sessionid) url = massive_preset_url + "#" + json.dumps(parameters) return url, 200
def analyzefeaturenetworking(): sessionid = request.cookies.get('sessionid') print(sessionid) email = request.form["email"] networkingpreset = request.form["networkingpreset"] featuretool = request.form["featuretool"] if len(email) < 1 or len(email) > 100: email = "*****@*****.**" present_folders = util.check_ftp_folders(sessionid) if not "featurequantification" in present_folders: content = {'status': 'featurequantification required but not selected'} return json.dumps(present_folders), 417 if not "featurems2" in present_folders: content = {'status': 'featurems2 required but not selected'} return json.dumps(present_folders), 417 gnps_username = credentials.USERNAME gnps_password = credentials.PASSWORD try: if len(request.form["username"]) > 3 and len(request.form["password"]): gnps_username = request.form["username"] gnps_password = request.form["password"] except: gnps_username = credentials.USERNAME gnps_password = credentials.PASSWORD remote_dir = os.path.join(credentials.USERNAME, sessionid) task_id = util.launch_GNPS_featurenetworking_workflow( remote_dir, "GNPS Quickstart Molecular Networking Analysis ", gnps_username, gnps_password, email, featuretool, present_folders, networkingpreset) #Error if len(task_id) != 32: content = {'status': 'Error'} return json.dumps(content), 500 content = { 'status': 'Success', 'task_id': task_id, 'url': "https://gnps.ucsd.edu/ProteoSAFe/status.jsp?task=%s" % (task_id) } return json.dumps(content), 200
def uploadanalyzefeaturenetworking(): sessionid = str(uuid.uuid4()) upload_string = util.upload_single_file(request, "featurequantification") networkingpreset = "LOWRES" if "networkingpreset" in request.form: networkingpreset = request.form["networkingpreset"] #Performing Data Upload util.upload_single_file_push(request.files["featurequantification"], sessionid, "featurequantification") util.upload_single_file_push(request.files["featurems2"], sessionid, "featurems2") if "samplemetadata" in request.files: util.upload_single_file_push(request.files["samplemetadata"], sessionid, "samplemetadata") if "additionalpairs" in request.files: util.upload_single_file_push(request.files["additionalpairs"], sessionid, "additionalpairs") email = "" try: email = request.form["email"] except: email = "" if len(email) < 1 or len(email) > 100: email = "*****@*****.**" featuretool = request.form["featuretool"] present_folders = util.check_ftp_folders(sessionid) if not "featurequantification" in present_folders: content = {'status': 'featurequantification required but not selected'} return json.dumps(present_folders), 417 if not "featurems2" in present_folders: content = {'status': 'featurems2 required but not selected'} return json.dumps(present_folders), 417 gnps_username = credentials.USERNAME gnps_password = credentials.PASSWORD try: if len(request.form["username"]) > 3 and len(request.form["password"]): gnps_username = request.form["username"] gnps_password = request.form["password"] except: gnps_username = credentials.USERNAME gnps_password = credentials.PASSWORD task_description = "GNPS Quickstart Molecular Networking Analysis from MZmine2" if "description" in request.form: if len(request.form["description"]) > 1: task_description = request.form["description"] remote_dir = os.path.join(credentials.USERNAME, sessionid) task_id = util.launch_GNPS_featurenetworking_workflow( remote_dir, task_description, gnps_username, gnps_password, email, featuretool, present_folders, networkingpreset) #Error if len(task_id) != 32: content = {'status': 'Error'} return json.dumps(content), 500 content = { 'status': 'Success', 'task_id': task_id, 'url': "https://gnps.ucsd.edu/ProteoSAFe/status.jsp?task=%s" % (task_id) } return json.dumps(content), 200