#!/usr/local/bin/python3.3 import cgi import cgitb import datetime import DAPRfunctions as dapr cgitb.enable() cookie = dapr.get_cookies() #dapr.loadConfiguration() def pass_val_to_js(id,val): input_str=""" """%(val,id) return(input_str) if cookie: fname = cookie["fname"].value lname = cookie["lname"].value name = " ".join((fname, lname)) admin = cookie["admin"].value uid = cookie["uid"].value uname = cookie["uname"].value ceid = cookie["ck_eid"].value form = cgi.FieldStorage() eid = form.getvalue('exp') nuname = form.getvalue("uname") nbid = form.getvalue("bid") proj = form.getvalue('project') study = form.getvalue('study') #if exp is set on the drop down, then filter by exp # exp in the cookie will always be set, so I need to test before the cookie value is transfered to eid # if not, but study is set, then filter by study # if not, but project is set, then filter by project # # full query: #"""select * from BEDfile b where bid in # (select bid from ExperimentBEDfile where eid in # (select eid from StudyExperiment where sid in # (select sid from ProjectStudy where prid= %s )))""" select_clause="""select b.bid, location, b.name, w.name, c.name, description1, peaknumber, uploader, upload_date, bedtoolcommand from BEDfile b """ where_clause=" " join_clause=""" join WetlabMethod w using(wmid) join ComputationalMethod c using(cmid) """ orderby_clause=""" order by upload_date desc, b.name asc""" if eid and eid!= "0" : where_clause=where_clause+"""where bid in (select bid from ExperimentBEDfile where eid = %s)"""%eid elif study and study != "0" : where_clause=where_clause+"""where bid in (select bid from ExperimentBEDfile where eid in (select eid from StudyExperiment where sid = %s))"""%study elif proj and proj != "0": where_clause=where_clause+"""where bid in (select bid from ExperimentBEDfile where eid in (select eid from StudyExperiment where sid in (select sid from ProjectStudy where prid= %s )))"""%proj #TODO: add admin filter get_bed_query=select_clause+join_clause+where_clause+orderby_clause #form eid takes precedence over cookie eid #and we want to save it to the cookie if eid and eid != "0" : cookie["ck_eid"]=eid print(cookie) else: if ceid != "0": eid=ceid else: eid_error_flag=True eid_error="there is no experiment set" # #for debugging # print("Content-type: text/html\n") # print("proj "+proj) # print("study "+study) # print("eid "+eid) # print("ceid "+ceid) db=dapr.DBConnection() qexname = "select title from Experiment where eid = '%s'" % eid exname = db.runQuery(qexname)[0][0] print("Content-type: text/html\n") print(pass_val_to_js("pass_proj",proj)) print(pass_val_to_js("pass_study",study)) print(pass_val_to_js("pass_eid",eid)) print(""" """) dapr.phead(name, admin) print("""
ID | BED file | Wetlab method | Computational method | Info1 | Peak Number | Uploader | Upload time | bedtools command | Download | """) for j in range(len(row)): if j == 0 or j == 2: print(""" | %s | """ % (str(row[0]),str(row[j]))) elif j == 1: pass else: print("%s | " % str(row[j])) print("""Download | """ % row[1]) print("") print("
---|
Note: Please select experiment using dropdowns at the top of the page BEFORE selecting tool!
Analysis tool:Delete a BED file:
Note: This CANNOT be undone.
Please select ONE BED file using checkboxes.