def buildParamDict(fs, sessionfile): params = {} params["inputFile"] = fs.formdata.getvalue("inputFile", "") params["progress"] = fs.formdata.getvalue("progress", "1") params["filename"] = fs.formdata.getvalue("filename", "") params["session"] = sessionfile if type("1") != type(fs.formdata.getvalue("searchResult")): params["searchResult"] = string.join(fs.formdata.getvalue("searchResult"),'\t') else: params["searchResult"] = fs.formdata.getvalue("searchResult") params["riset"] = fs.formdata.getvalue("RISet", "") #if params["filename"] == "": # raise nGraphException("Required parameter filename missing") #parameter determining whether export button returns an xgmml graph file or plain text file params["exportFormat"] = fs.formdata.getvalue("exportFormat", "xgmml") #parameter determining whether or not traits in the graph file are listed by their symbol or name params["traitType"] = fs.formdata.getvalue("traitType", "symbol") #parameter saying whether or not graph structure should be locked when you redraw the graph params["lock"] = fs.formdata.getvalue("lock", "no") #parameter saying what algorithm should be used to draw the graph params["gType"] = fs.formdata.getvalue("gType", "none") params["kValue"] = webqtlUtil.safeFloat(fs.formdata.getvalue("kValue", "0.5"), 0.5) params["whichValue"] = webqtlUtil.safeInt(fs.formdata.getvalue("whichValue","0"),0) # 1 inch = 2.54 cm # 1 cm = 0.3937 inch params["width"] = webqtlUtil.safeFloat(fs.formdata.getvalue("width", "40.0"), 40.0) params["height"] = webqtlUtil.safeFloat(fs.formdata.getvalue("height", "40.0"), 40.0) yesno = ["yes", "no"] params["tune"] = webqtlUtil.safeString(fs.formdata.getvalue("tune", "yes"), yesno, "yes") params["printIslands"] = webqtlUtil.safeInt(fs.formdata.getvalue("printIslands", "1"),1) params["nodeshape"] = webqtlUtil.safeString(fs.formdata.getvalue("nodeshape","yes"), yesno, "yes") params["nodelabel"] = webqtlUtil.safeString(fs.formdata.getvalue("nodelabel","no"), yesno, "no") params["nfont"] = fs.formdata.getvalue("nfont","Arial") params["nfontsize"] = webqtlUtil.safeFloat(fs.formdata.getvalue("nfontsize", "10.0"), 10.0) params["splines"] = webqtlUtil.safeString(fs.formdata.getvalue("splines","yes"), yesno, "yes") params["dispcorr"] = webqtlUtil.safeString(fs.formdata.getvalue("dispcorr","no"), yesno, "no") params["cfont"] = fs.formdata.getvalue("cfont","Arial") params["cfontsize"] = webqtlUtil.safeFloat(fs.formdata.getvalue("cfontsize", "10.0"), 10.0) params["cPubName"] = fs.formdata.getvalue("cPubName","palegreen") params["cMicName"] = fs.formdata.getvalue("cMicName","lightblue") params["cGenName"] = fs.formdata.getvalue("cGenName","lightcoral") params["cPubColor"] = fs.formdata.getvalue("cPubColor","98fb98") params["cMicColor"] = fs.formdata.getvalue("cMicColor","add8e6") params["cGenColor"] = fs.formdata.getvalue("cGenColor","f08080") params["cL1Name"] = fs.formdata.getvalue("cL1Name","blue") params["cL2Name"] = fs.formdata.getvalue("cL2Name","green") params["cL3Name"] = fs.formdata.getvalue("cL3Name","black") params["cL4Name"] = fs.formdata.getvalue("cL4Name","pink") params["cL5Name"] = fs.formdata.getvalue("cL5Name","orange") params["cL6Name"] = fs.formdata.getvalue("cL6Name","red") params["cL1Color"] = fs.formdata.getvalue("cL1Color","0000ff") params["cL2Color"] = fs.formdata.getvalue("cL2Color","00ff00") params["cL3Color"] = fs.formdata.getvalue("cL3Color","000000") params["cL4Color"] = fs.formdata.getvalue("cL4Color","ffc0cb") params["cL5Color"] = fs.formdata.getvalue("cL5Color","ffa500") params["cL6Color"] = fs.formdata.getvalue("cL6Color","ff0000") params["L1style"] = fs.formdata.getvalue("L1style","bold") params["L2style"] = fs.formdata.getvalue("L2style","") params["L3style"] = fs.formdata.getvalue("L3style","dashed") params["L4style"] = fs.formdata.getvalue("L4style","dashed") params["L5style"] = fs.formdata.getvalue("L5style","") params["L6style"] = fs.formdata.getvalue("L6style","bold") if params["splines"] == "yes": params["splineName"] = "curves" else: params["splineName"] = "lines" if params["nodeshape"] == "yes": params["nodeshapeType"] = "box" else: params["nodeshapeType"] = "ellipse" if params["whichValue"] == 0: params["correlationName"] = "Pearson" elif params["whichValue"] == 1: params["correlationName"] = "Spearman" elif params["whichValue"] == 2: params["correlationName"] = "Literature" else: params["correlationName"] = "Tissue" # see graphviz::writeNeatoFile to find out what this done params["edges"] = "complex" return params
def buildParamDict(cursor, fd): params = {} fs = fd.formdata #cgi.FieldStorage() params["progress"] = fs.getfirst("progress", "0") params["filename"] = fs.getfirst("filename", "") if params["filename"] == "": raise MultitraitException("Required parameter filename missing.") params["targetDatabase"] = fs.getfirst("targetDatabase", "U74Av2RMA_Raw_ProbeSet_March04") params["firstRun"] = webqtlUtil.safeInt(fs.getfirst("firstRun", "0"),0) params["threshold"] = webqtlUtil.safeFloat(fs.getfirst("threshold", "0.5"), 0.5) params["subsetSize"] = webqtlUtil.safeInt(fs.getfirst("subsetSize", "10"), 10) if params["subsetSize"] < -1: params["subsetSize"] = -1 params["correlation"] = fs.getfirst("correlation", "pearson") params["subsetCount"] = webqtlUtil.safeInt(fs.getfirst("subsetCount", 10), 10) if params["subsetCount"] < -1: params["subsetCount"] = -1 #params["outputType"] = fs.getfirst("outputType", "html") #if params["outputType"] not in ("html", "text"): # params["outputType"] = "html" if params["correlation"] not in ("pearson", "spearman"): params["correlation"] = "pearson" params["correlationName"] = params["correlation"].capitalize() # one of two cases: # 1) We have just come from a submit, so there are a bunch of display* # but no displaySets. Thus, the code down there converts the display* # to displaySets so the GET request doesn't get too long # 2) We have just been redirected from a progress page which already has # a converted displaySets for us. displaySets = webqtlUtil.safeInt(fs.getfirst("displaySets","0"), 0) if displaySets == 0: for key in fs.keys(): if key[:7] == "display": #print "Hit display key %s<br>" % key try: whichSet = int(key[7:]) # prevent malicious attacks whichSet = min(whichSet, 512) displaySets += pow(2, whichSet) except ValueError: pass params["displaySets"] = displaySets #print "In the beginning, display sets was %s: %s<br>" % (displaySets, # str(binaryDecompose(displaySets))) # if we are just gonna display a progress page, then there's no # reason to look up detailed database information #if params["progress"] == "1": # return params a,b = trait.dbNameToTypeId(cursor, params["targetDatabase"]) # XZ, 09/10/2008: add module name params["targetDatabaseType"] = a params["targetDatabaseId"] = b params["targetDatabaseName"] = params["targetDatabase"] return params