def __init__(self, fd): templatePage.__init__(self, fd) if not self.openMysql(): return ifVerified = fd.formdata.getvalue('ifVerified') status = fd.formdata.getvalue('status') if ifVerified != 'GN@UTHSC': heading = "Error page" detail = ["You are NoT verified as administrator."] self.error(heading=heading,detail=detail) return else: if status == 'input': self.dict['body'] = self.genInputPage() self.dict['title'] = 'Delete Phenotype Trait Input Page' if status == 'check': PublishFreeze_Name = fd.formdata.getvalue('PublishFreeze_Name') traitID = fd.formdata.getvalue('traitID') self.dict['body'] = self.checkInputPage(PublishFreeze_Name, traitID) self.dict['title'] = 'Delete Phenotype Trait Check Input Page' if status == 'delete': PublishFreeze_Name = fd.formdata.getvalue('PublishFreeze_Name') traitID = fd.formdata.getvalue('traitID') self.dict['body'] = self.deleteResultPage(PublishFreeze_Name, traitID) self.dict['title'] = 'Delete Phenotype Trait Result Page'
def __init__(self,fd): templatePage.__init__(self, fd) if not self.openMysql(): return if not fd.genotype: fd.readGenotype() self.searchResult = fd.formdata.getvalue('searchResult', []) if type("1") == type(self.searchResult): self.searchResult = [self.searchResult] if fd.formdata.getvalue('fromDataEditingPage'): searchResult2 = fd.formdata.getvalue('fullname') if searchResult2: self.searchResult.append(searchResult2) if self.searchResult: pass else: templatePage.__init__(self, fd) heading = 'Add Collections' detail = ['You need to select at least one trait to add to your selection.'] self.error(heading=heading,detail=detail) return if self.genSelection(fd=fd): self.writeHTML(fd)
def __init__(self, fd): templatePage.__init__(self) if not self.updMysql(): return try: user = fd.formdata.getvalue('user') password = fd.formdata.getvalue('password') newpassword = fd.formdata.getvalue('newpassword') retypepassword = fd.formdata.getvalue('retypepassword') except: user = '' if newpassword != retypepassword: result = HT.Blockquote(HT.Font('Error: ',color='red'),HT.Font('The new passwords you just entered are inconsistent. Please try it again',color='black')) elif user and password and newpassword: try: encrypt_password = webqtlUtil.authUser(user,password,self.cursor)[3] if encrypt_password: self.cursor.execute("""update User set password=SHA(%s) where name=%s""",(newpassword,user)) result = HT.Blockquote(HT.Font('Change Result: ',color='green'),HT.Font('You have succesfully changed your password. You may continue to use WebQTL.',color='black')) else: result = HT.Blockquote(HT.Font('Error: ',color='red'),HT.Font('You entered wrong user name or password. Please try it again.',color='black')) except: result = HT.Blockquote(HT.Font('Error: ',color='red'),HT.Font('User database is not ready yet. Try again later.',color='black')) else: result = HT.Blockquote(HT.Font('Error: ',color='red'),HT.Font('No user name or password or new password was entered, Please try it again.',color='black')) result.__setattr__("class","subtitle") self.dict['title'] = 'Change Password Result' self.dict['body'] = HT.TD(result,colspan=2,height=200,width="100%",bgColor='#eeeeee')
def __init__(self, fd=None): templatePage.__init__(self, fd) if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['admin']: pass else: heading = "Editing Info" detail = ["You don't have the permission to modify this file"] self.error(heading=heading,detail=detail,error="Error") return cursor = webqtlDatabaseFunction.getCursor() if (not cursor): return Id=self.trimValue(fd.formdata.getvalue('Id')) GN_AccesionId=self.trimValue(fd.formdata.getvalue('GN_AccesionId')) InfoPageName=self.trimValue(fd.formdata.getvalue('InfoPageName')) DatasetId=self.trimValue(fd.formdata.getvalue('DatasetId')) if Id=='-1': sharingInfoObject = SharingInfo2.SharingInfo2(GN_AccesionId, InfoPageName) GN_AccessionId,InfoPageName,info = sharingInfoObject.getInfo() if info: heading = "Editing Info" detail = ["The new dataset info record is duplicate."] self.error(heading=heading, detail=detail, error="Error") return sql = """INSERT INTO InfoFiles SET GN_AccesionId=%s, InfoPageName=%s, DatasetId=%s""" cursor.execute(sql, tuple([GN_AccesionId, InfoPageName, DatasetId])) infoupdate="This record has been succesfully added." else: sql = """UPDATE InfoFiles SET GN_AccesionId=%s, InfoPageName=%s, DatasetId=%s WHERE Id=%s""" cursor.execute(sql, tuple([GN_AccesionId, InfoPageName, DatasetId, Id])) infoupdate="This record has been succesfully updated." sharingInfoObject = SharingInfo2.SharingInfo2(GN_AccesionId, InfoPageName) sharingInfoObject.getInfo() sharingInfoObject.getDatasetsList() self.dict['body'] = sharingInfoObject.getBody(infoupdate=infoupdate)
def __init__(self, fd): templatePage.__init__(self, fd) collectionName = '%s_Select' % fd.RISet try: preSelection = fd.input_session_data[collectionName] preSelection = list(string.split(preSelection,',')) except: preSelection = [] for item in preSelection: if not item: preSelection.remove(item) if preSelection: self.content_type = 'application/txt' self.content_disposition = 'attachment; filename=%s' % (fd.RISet+'_export-%s.txt' % time.strftime("%y-%m-%d-%H-%M")) self.attachment += fd.RISet+"\n" for item in preSelection: self.attachment += item+"\n" else: heading = 'Export Collection' detail = ['This collection is empty. No trait could be exported.'] self.error(heading=heading,detail=detail)
def __init__(self, fd, snpId): templatePage.__init__(self, fd) snpCols = "snpname, chromosome, mb, domain, rs, function, type, majorAllele, majorCount, minorAllele, minorCount, class, flanking5, flanking3, blatScore, sourceId, gene, ncbi".split(", ") #get the details from the database if search the SNP variants by the "gene/snp" field if snpId: self.openMysql() mysqlField = ['snpname','rs', 'chromosome', 'mb', 'function', 'type', 'class', 'flanking5', 'flanking3', 'blatscore', 'domain', 'gene', 'ncbi'] query = """ SELECT %s, c.Name,b.* from SnpAll a, SnpPattern b, SnpSource c where a.Id =%s AND a.Id = b.SnpId AND a.SourceId =c.Id """ % (string.join(mysqlField, ", "), snpId) self.cursor.execute(query) results = self.cursor.fetchone() result =results[:14] mysqlField.append('sourceName') snpDict = {} for i, item in enumerate(result): snpDict[mysqlField[i]] = item alleleList =results[15:] objSnpBrowserPage =snpBrowserPage(fd) flag =0 majAllele,minAllele,majAlleleCount,minAlleleCount= objSnpBrowserPage.getMajMinAlleles(alleleList,flag) snpDict['majorAllele'] = majAllele snpDict['minorAllele'] = minAllele snpDict['majorCount'] = majAlleleCount snpDict['minorCount'] = minAlleleCount else: return # Creates the table for the SNP data snpTable = HT.TableLite(border=0, cellspacing=5, cellpadding=3, Class="collap") for item in snpCols: thisTR = HT.TR(HT.TD(snpBrowserUtils.columnNames[item], Class="fs14 fwb ffl b1 cw cbrb", NOWRAP = 1)) if item in ('flanking5', 'flanking3'): seq0 = snpDict[item] seq = "" i = 0 if seq0: while i < len(seq0): seq += seq0[i:i+5] + " " i += 5 thisTR.append(HT.TD(HT.Span(seq, Class="code", Id="green"), Class='fs13 b1 cbw c222')) elif item in snpDict.keys() and snpDict[item]: thisTR.append(HT.TD(snpDict[item], Class='fs13 b1 cbw c222')) else: thisTR.append(HT.TD("", Class='fs13 b1 cbw c222')) snpTable.append(thisTR) self.dict['body'] = HT.TD(HT.Paragraph("Details for %s" % snpDict['snpname'], Class="title"), HT.Blockquote(snpTable)) self.dict['title'] = "Details for %s" % snpDict['snpname']
def __init__(self, fd, formdata, cookies): templatePage.__init__(self, fd) if not self.openMysql(): return if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['user']: pass else: heading = "Upload File" detail = ["You don't have the permission to upload file to the server."] self.error(heading=heading,detail=detail) return self.cursor.close() file1 = self.save_uploaded_file (formdata, 'imgName1') file2 = self.save_uploaded_file (formdata, 'imgName2') file3 = self.save_uploaded_file (formdata, 'imgName3') file4 = self.save_uploaded_file (formdata, 'imgName4') file5 = self.save_uploaded_file (formdata, 'imgName5') i = 0 uploaded = [] for filename in (file1, file2, file3, file4, file5): if filename: i += 1 uploaded.append(filename) if i == 0: heading = "Upload File" detail = ["No file was selected, no file uploaded."] self.error(heading=heading,detail=detail) return else: TD_LR = HT.TD(height=200,width="100%",bgColor='#eeeeee') imgTbl = HT.TableLite(border=0, width = "90%",cellspacing=2, cellpadding=2, align="Center") imgTbl.append(HT.TR(HT.TD("Thumbnail", width="%30", align='center',Class="colorBlue"), HT.TD("URL", width="%60",Class="colorBlue", align='center'))) for item in uploaded: img = HT.Image("/images/upload/" + item, border = 0, width=80) #url = "%s/images/upload/" % webqtlConfig.PORTADDR + item #url = HT.Href(text=url, url = url, Class='normalsize', target="_blank") url2 = "/images/upload/" + item url2 = HT.Href(text=url2, url = url2, Class='normalsize', target="_blank") imgTbl.append(HT.TR(HT.TD(img, width="%30", align='center',Class="colorWhite"), #HT.TD(url, HT.BR(), 'OR', HT.BR(), url2, width="%60",Class="colorWhite", align='center'))) HT.TD(url2, width="%60",Class="colorWhite", align='center'))) intro = HT.Paragraph('A total of %d files are uploaded' % i) TD_LR.append( HT.Center(intro) ) TD_LR.append( imgTbl ) self.dict['body'] = str(TD_LR)
def __init__(self,fd): templatePage.__init__(self, fd) filename = self.session("Genome Association Result", "Computing Genome Association Results") webqtlUtil.dump_session(fd, os.path.join(webqtlConfig.TMPDIR, filename +'.session')) url = webqtlConfig.REFRESHDIR % (webqtlConfig.CGIDIR, self.filename) os.system("%s %swebqtlCmdLine.py markerRegression %s >/dev/null 2>&1 &" % (webqtlConfig.PythonPath, webqtlConfig.CMDLINEDIR, filename)) self.redirection = url
def __init__(self, fd=None): templatePage.__init__(self, fd) if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['admin']: pass else: heading = "Adding Info" detail = ["You don't have the permission to add new dataset"] self.error(heading=heading,detail=detail,error="Error") return self.dict['body'] = SharingBody.sharinginfoedit_body_string % ("Add new dataset", "-1", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "")
def __init__(self, fd=None): templatePage.__init__(self, fd) if not self.openMysql(): return if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['admin']: pass else: heading = "Editing Info" detail = ["You don't have the permission to list the datasets"] self.error(heading=heading,detail=detail,error="Error") return TD_LR = HT.TD(height=200,width="100%",bgColor='#eeeeee') query = """select InfoPageName,GN_AccesionId,InfoPageTitle,Progreso from InfoFiles order by Id""" self.cursor.execute(query) result = self.cursor.fetchall() heading = HT.Paragraph('Dataset Table', Class="title") newrecord = HT.Href(text="New Record", url="/webqtl/main.py?FormID=sharinginfoadd") info = "Click the accession id to view the dataset info. Click the dataset name to edit the dataset info." datasetTable = HT.TableLite(border=0, cellpadding=0, cellspacing=0, Class="collap", width="100%") tableHeaderRow = HT.TR() tableHeaderRow.append(HT.TD("InfoPageName", Class='fs14 fwb ffl b1 cw cbrb', align="center")) tableHeaderRow.append(HT.TD("Accession Id", Class='fs14 fwb ffl b1 cw cbrb', align="center")) tableHeaderRow.append(HT.TD("Dataset name", Class='fs14 fwb ffl b1 cw cbrb', align="center")) tableHeaderRow.append(HT.TD("Progress", Class='fs14 fwb ffl b1 cw cbrb', align="center")) tableHeaderRow.append(HT.TD("Operation", Class='fs14 fwb ffl b1 cw cbrb', align="center")) datasetTable.append(tableHeaderRow) for one_row in result: InfoPageName,Accession_Id,InfoPage_title,Progress = one_row datasetRow = HT.TR() datasetRow.append(HT.TD(HT.Href(text="%s" % InfoPageName, url="/webqtl/main.py?FormID=sharinginfo&InfoPageName=%s" % InfoPageName, Class='fs12 fwn'), Class="fs12 fwn b1 c222")) datasetRow.append(HT.TD(HT.Href(text="GN%s" % Accession_Id, url="/webqtl/main.py?FormID=sharinginfo&GN_AccessionId=%s" % Accession_Id, Class='fs12 fwn'), Class="fs12 fwn b1 c222")) datasetRow.append(HT.TD("%s" % InfoPage_title, Class="fs12 fwn b1 c222")) datasetRow.append(HT.TD("%s" % Progress, Class='fs12 fwn b1 c222')) operation_edit = HT.Href(text="Edit", url="/webqtl/main.py?FormID=sharinginfoedit&InfoPageName=%s" % InfoPageName) operation_delete = HT.Href(text="Delete", onClick="deleteRecord('%s'); return false;" % InfoPageName) operation = HT.TD(Class="fs12 fwn b1 c222", align="center") operation.append(operation_edit) operation.append(" ") operation.append(operation_delete) datasetRow.append(operation) datasetTable.append(datasetRow) TD_LR.append(heading, HT.P(), newrecord, HT.P(), datasetTable) js1 = """ <script language="javascript" type="text/javascript"> function deleteRecord(InfoPageName){ question = confirm("Are you sure you want to delete the dataset info record (InfoPageName="+InfoPageName+")?") if (question != "0"){ window.open("/webqtl/main.py?FormID=sharinginfodelete&InfoPageName="+InfoPageName, "_self"); } } </script>""" self.dict['js1'] = js1 self.dict['body'] = str(TD_LR)
def __init__(self, fd): templatePage.__init__(self, fd) # get mysql connection, if not, show error if not self.openMysql(): heading = "Geno Updating" detail = ["Can't connect to MySQL server"] self.error(heading=heading,detail=detail) return self.dict['title'] = 'Geno Updating' # status is the switch, direct what's the next step try: status = fd.formdata.getvalue('status') except: status = '' if fd.formdata.getvalue('submit')=='Clear': status='' if not status: # show self.dict['body']=self.showSelectionPage() elif status=='search' or status == 'addNewMarker': InbredSetName = fd.formdata.getvalue('InbredSetName') Chr = fd.formdata.getvalue('Chr') if not InbredSetName: self.dict['body']= "Please select the population." return elif not Chr: self.dict['body']= "Please input Chr." return else: self.dict['body']=self.showAllMarkers (InbredSetName, Chr, fd) elif status == 'editMarkerTable': self.dict['body'] = self.editMarkerTable(fd) elif status == 'checkMarkerHasBeenInGroup': # check if there is anything changed. InbredSetName = fd.formdata.getvalue('InbredSetName') Marker = fd.formdata.getvalue('Name') self.dict['body'] = self.checkMarkerHasBeenInGroup (InbredSetName, Marker, fd) elif status=='changeMarker': #insert new marker InbredSetName = fd.formdata.getvalue('InbredSetName') self.dict['body']=self.changeMarker(InbredSetName, fd) else: #this part is used to test, the proceduce won't come here in normal cycle HTTable = HT.TableLite(border=0, cellspacing=1, cellpadding=1,align="center") for key in fd.formdata.keys(): HTTable.append(HT.TR(HT.TD(key), HT.TD(':'), HT.TD(fd.formdata.getvalue(key)))) self.dict['body'] = HTTable
def __init__(self,fd): self.theseTraits = [] TD_LR = HT.TD(height=200,width="100%",bgColor='#eeeeee',valign="middle") templatePage.__init__(self, fd) if not self.openMysql(): return self.searchResult = fd.formdata.getvalue('searchResult', []) if type("1") == type(self.searchResult): self.searchResult = [self.searchResult] for item in self.searchResult: try: thisTrait = webqtlTrait(fullname=item, cursor=self.cursor) thisTrait.retrieveInfo(QTL=1) if thisTrait.db.type == "ProbeSet": self.theseTraits.append(thisTrait) except: pass if self.theseTraits: pass else: templatePage.__init__(self, fd) heading = 'GCAT' detail = ['You need to select at least one microarray trait to submit to GCAT.'] self.error(heading=heading,detail=detail) return geneSymbolList = self.getGeneSymbolList() geneSymbolSet = set(geneSymbolList) if ( len(geneSymbolSet) < 500 ): temp = '+'.join(geneSymbolSet) GCATurl = "http://binf1.memphis.edu/gcat/?organism=mouse&subset=all&year=2010&geneInput=%s" % temp self.dict['js1'] = """ <SCRIPT LANGUAGE="JavaScript"> setTimeout( 'window.location = "%s"', 2000 ); </SCRIPT> """ % GCATurl TD_LR.append(HT.Paragraph("Your selection of %d genes is being submitted to GCAT" % len(geneSymbolSet), Class="cr fs16 fwb", align="Center")) else: TD_LR.append(HT.Paragraph("Your selection of %d genes exceeds the limit of 500. Please reduce your gene number to below the limit." % len(geneSymbolSet), Class="cr fs16 fwb", align="Center")) self.dict['body'] = TD_LR
def __init__(self, fd): templatePage.__init__(self, fd) if not self.updMysql(): return fd.incparentsf1 = 1 if not fd.genotype: fd.readGenotype() fd.strainlist = fd.f1list + fd.strainlist fd.readData() if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['user']: pass else: heading = "Add to Published Database" detail = ["You don't have the permission to modify this database"] self.error(heading=heading,detail=detail,error="Error") return self.cursor.execute(""" SelecT PublishFreeze.Name from PublishFreeze, InbredSet where PublishFreeze.InbredSetId = InbredSet.Id AND InbredSet.Name = '%s'""" % fd.RISet) try: self.db = webqtlDataset(self.cursor.fetchone()[0], self.cursor) except: heading = "Add to Published Database" detail = ["The published database you requested has not been established"] self.error(heading=heading,detail=detail,error="Error") return status = fd.formdata.getvalue('curStatus') if status == 'insertResult': newRecord = self.readForm(fd) if not newRecord: return else: self.insertResultPage(fd, newRecord) elif status == 'insertCheck': newRecord = self.readForm(fd) if not newRecord: return else: self.insertCheckPage(fd, newRecord) else: self.dispFormPage(fd)
def __init__(self,fd): templatePage.__init__(self, fd) filename = self.session("QTL Heatmap", "Computing QTL Heatmap") webqtlUtil.dump_session(fd, os.path.join(webqtlConfig.TMPDIR, filename +'.session')) url = webqtlConfig.REFRESHDIR % (webqtlConfig.CGIDIR, self.filename) os.system("%s %swebqtlCmdLine.py heatmap %s >/dev/null 2>&1 &" % (webqtlConfig.PythonPath, webqtlConfig.CMDLINEDIR, filename)) self.redirection = url
def __init__(self,fd): templatePage.__init__(self, fd) filename = self.session("Generate Report v2", "Generating Report v2. Please be Patient") webqtlUtil.dump_session(fd, os.path.join(webqtlConfig.TMPDIR, filename +'.session')) url = webqtlConfig.REFRESHDIR % (webqtlConfig.CGIDIR, self.filename) os.system("%s %swebqtlCmdLine.py genreport2 %s >/dev/null 2>&1 &" % (webqtlConfig.PythonPath, webqtlConfig.CMDLINEDIR, filename)) self.redirection = url
def __init__(self,fd): templatePage.__init__(self, fd) filename = self.session("Partial Correlation", "Partial Correlation in Progress") webqtlUtil.dump_session(fd, os.path.join(webqtlConfig.TMPDIR, filename +'.session')) url = webqtlConfig.REFRESHDIR % (webqtlConfig.CGIDIR, self.filename) os.system("%s %swebqtlCmdLine.py partialCorrelation %s >/dev/null 2>&1 &" % (webqtlConfig.PythonPath, webqtlConfig.CMDLINEDIR, filename)) self.redirection = url
def __init__(self, fd=None): templatePage.__init__(self, fd) if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['admin']: pass else: heading = "Editing Info" detail = ["You don't have the permission to edit this dataset"] self.error(heading=heading,detail=detail,error="Error") return GN_AccessionId = fd.formdata.getvalue('GN_AccessionId') InfoPageName = fd.formdata.getvalue('InfoPageName') sharingInfoObject = SharingInfo2.SharingInfo2(GN_AccessionId, InfoPageName) GN_AccessionId,InfoPageName,info = sharingInfoObject.getInfo() self.dict['body'] = SharingBody.sharinginfoedit_body_string % (info[9], info[22], info[21], info[22], info[29], info[28], info[30], info[32], info[23], info[24], info[25], info[26], info[27], info[13], info[18], info[14], info[15], info[16], info[19], info[20], info[17], info[1], info[9], info[10], info[12], info[11], info[3], info[2], info[6], info[7], info[4], info[8], info[5], info[0], info[32], info[32], info[32])
def __init__(self, fd=None): templatePage.__init__(self, fd) GN_AccessionId = fd.formdata.getvalue('GN_AccessionId') InfoPageName = fd.formdata.getvalue('InfoPageName') cursor = webqtlDatabaseFunction.getCursor() if InfoPageName and not GN_AccessionId: sql = "select GN_AccesionId from InfoFiles where InfoPageName = %s" cursor.execute(sql, InfoPageName) GN_AccessionId = cursor.fetchone() url = webqtlConfig.CGIDIR + "main.py?FormID=sharinginfo&GN_AccessionId=%s" % GN_AccessionId self.redirection = url else: sharingInfoObject = SharingInfo.SharingInfo(GN_AccessionId, InfoPageName) self.dict['body'] = sharingInfoObject.getBody(infoupdate="")
def __init__(self,fd): templatePage.__init__(self, fd) if not self.openMysql(): return searchResult = fd.formdata.getvalue('searchResult') if not searchResult: heading = 'BNW' detail = ['You need to select at least one trait.'] self.error(heading=heading, detail=detail) return if type("1") == type(searchResult): searchResult = string.split(searchResult, '\t') fd.incparentsf1 = 1 if not fd.genotype: fd.readGenotype() strainlist = fd.f1list + fd.strainlist valuesList = [] formvalue = '' for item in searchResult: # thisTrait = webqtlTrait(fullname=item, cursor=self.cursor) thisTrait.retrieveData(strainlist=strainlist) values = thisTrait.exportData(strainlist) valuesList.append(values) # item = item.replace("Geno::", "_") item = item.replace("Publish::", "_") item = item.replace("::", "_") formvalue += item formvalue += ',' valuesList = zip(*valuesList) formvalue = formvalue[:-1] formvalue += ';' for row in valuesList: hasNone = False for cell in row: if not cell: hasNone = True break if hasNone: continue formvalue += ','.join(str(cell) for cell in row) formvalue += ';' self.dict['body'] = BNWPage.body % formvalue return
def __init__(self, fd): templatePage.__init__(self, fd) if not self.openMysql(): return if not fd.genotype: fd.readGenotype() self.searchResult = [] self.genSelection(fd=fd) self.writeHTML(fd)
def __init__(self, fd): templatePage.__init__(self, fd) self.session_data_changed['user'] = '******' self.session_data_changed['privilege'] = 'guest' #self.cookie.append(myCookie('user',' ',0)) #self.cookie.append(myCookie('password',' ',0)) result = HT.Blockquote(HT.Font('Logout Result: ',color='green'),HT.Font('You have been succesfully logged out. ',color='black')) result.__setattr__("class","subtitle") self.dict['title'] = 'User Logoff Result' self.dict['body'] = HT.TD(result,colspan=2,height=200,width="100%",bgColor='#eeeeee') LOGIN = HT.Href(text = "Login",Class="small", target="_blank",url="account.html") self.dict['login'] = LOGIN
def __init__(self, fd=None): templatePage.__init__(self, fd) if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['admin']: pass else: heading = "Deleting Info" detail = ["You don't have the permission to delete this dataset"] self.error(heading=heading,detail=detail,error="Error") return cursor = webqtlDatabaseFunction.getCursor() if (not cursor): return GN_AccessionId = fd.formdata.getvalue('GN_AccessionId') sql = "delete from InfoFiles where GN_AccesionId=%s" cursor.execute(sql, GN_AccessionId) re = cursor.fetchone() self.dict['body'] = "Delete dataset info record (GN_AccesionId=%s) successfully." % GN_AccessionId
def __init__(self, fd): templatePage.__init__(self, fd) fd.formdata['remote_ip'] = fd.remote_ip if not self.openMysql(): return self.species = fd.formdata.getvalue("species", "mouse") try: self.startMb = float(fd.formdata.getvalue("startMb")) except: self.startMb = 10 try: self.endMb = float(fd.formdata.getvalue("endMb")) except: self.endMb = self.startMb + 10 self.Chr = fd.formdata.getvalue("chromosome", "1") self.xls = fd.formdata.getvalue("xls", "1") try: s1 = int(fd.formdata.getvalue("s1")) s2 = int(fd.formdata.getvalue("s2")) self.diffColDefault = self.diffCol = [s1, s2] except: self.diffColDefault = self.diffCol = [] if self.species != 'mouse': self.diffColDefault = [2, 3]#default is B6 and D2 for other species controlFrm, dispFields = self.genControlForm(fd) geneTable, filename = self.genGeneTable(fd, dispFields) infoTD = HT.TD(width=400, valign= "top") infoTD.append(HT.Paragraph("Interval Analyst : Chr %s" % self.Chr, Class="title"), HT.Strong("Species : "), self.species.title(), HT.BR(), HT.Strong("Database : "), "UCSC %s" % self.speciesFreeze[self.species], HT.BR(), HT.Strong("Range : "), "%2.6f Mb - %2.6f Mb" % (self.startMb, self.endMb), HT.BR(), ) if filename: infoTD.append(HT.BR(), HT.BR(), HT.Href(text="Download", url = "/tmp/" + filename, Class="normalsize") , " output in MS excel format.") mainTable = HT.TableLite(HT.TR(infoTD, HT.TD(controlFrm, Class="doubleBorder", width=400), HT.TD(" ", width="")), cellpadding=10) mainTable.append(HT.TR(HT.TD(geneTable, colspan=3))) self.dict['body'] = HT.TD(mainTable) self.dict['title'] = "Interval Analyst"
def __init__(self, fd): templatePage.__init__(self, fd) if not self.updMysql(): return try: user = fd.formdata.getvalue('user').strip() password = fd.formdata.getvalue('password').strip() except: user = password = '' if user and password: try: if user == password: raise 'identError' privilege, id, account_name, encrypt_password, grpName = webqtlUtil.authUser(user, password, self.cursor) if encrypt_password: self.session_data_changed['user'] = user self.session_data_changed['privilege'] = privilege self.cursor.execute("""update User set user_ip=%s,lastlogin=Now() where name=%s""",(fd.remote_ip,user)) myPage = IndexPage.IndexPage(fd) self.dict['title'] = myPage.dict['title'] self.dict['body'] = myPage.dict['body'] self.dict['js1'] = myPage.dict['js1'] self.dict['js2'] = myPage.dict['js2'] return else: result = HT.Blockquote(HT.Font('Error: ',color='red'),HT.Font('You entered wrong user name or password. Please try it again.',color='black')) except 'identError': result = HT.Blockquote(HT.Font('Error: ',color='red'),HT.Font('User name and password are the same, modify you password before login.',color='black')) except: result = HT.Blockquote(HT.Font('Error: ',color='red'),HT.Font('User database is not ready yet. Try again later.',color='black')) else: result = HT.Blockquote(HT.Font('Error: ',color='red'),HT.Font('No user name or password was entered, Please try it again.',color='black')) result.__setattr__("class","subtitle") self.dict['title'] = 'User Login Result' self.dict['body'] = HT.TD(result,colspan=2,height=200,width="100%",bgColor='#eeeeee') LOGOUT = HT.Href(text = "Logout",Class="small", target="_blank",url=os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE) + "?FormID=userLogoff") self.dict['login'] = LOGOUT
def __init__(self, fd): templatePage.__init__(self, fd) self.redirect_url = None # Set if you want a redirect print("fd is:", pf(fd.__dict__)) # Todo: Need a [0] in line below????d GN_AccessionId = fd.get('GN_AccessionId') # Used under search datasharing InfoPageName = fd.get('database') # Might need to add a [0] cursor = webqtlDatabaseFunction.getCursor() if InfoPageName and not GN_AccessionId: sql = "select GN_AccesionId from InfoFiles where InfoPageName = %s" cursor.execute(sql, InfoPageName) GN_AccessionId = cursor.fetchone() self.redirect_url = urlparse.urljoin(webqtlConfig.ROOT_URL, "/data_sharing?GN_AccessionId=%s" % GN_AccessionId) #self.redirect_url = flask.url_for('data_sharing', GN_AccessionId=GN_AccessionId[0]) print("set self.redirect_url") #print("before redirect") #return flask.redirect(url) #print("after redirect") else: CauseError
def __init__(self,fd): templatePage.__init__(self, fd) shortName=fd.formdata.getfirst("shortTissueName", ',') fullName=fd.formdata.getfirst("fullTissueName", ',') shortNameList=[] fullNameList=[] if shortName: shortNameList=shortName.split(',') if fullName: fullNameList=fullName.split(',') tissueAbbrDict={} for i, item in enumerate(shortNameList): tissueAbbrDict[item]=fullNameList[i] if tissueAbbrDict: # Creates the table for the fullname and shortname of Tissue tissueAbbrTable = HT.TableLite(border=1, cellspacing=5, cellpadding=3, Class="collap") shortNameList = tissueAbbrDict.keys() shortNameList.sort() abbrHeaderStyle="fs14 fwb ffl" abbrStyle="fs14 fwn ffl" tissueAbbrTable.append(HT.TR(HT.TD('Abbr ', Class=abbrHeaderStyle, NOWRAP = 1),HT.TD('Full Name ', Class=abbrHeaderStyle, NOWRAP = 1))) for item in shortNameList: thisTR = HT.TR(HT.TD(item, Class=abbrStyle, NOWRAP = 1)) thisTR.append(HT.TD(tissueAbbrDict[item], Class=abbrStyle, NOWRAP = 1)) tissueAbbrTable.append(thisTR) self.dict['body'] = HT.TD(HT.Paragraph("Tissue Abbreviation", Class="title"), HT.Blockquote(tissueAbbrTable)) self.dict['title'] = "Tissue Abbreviation" else: heading = "Tissue abbreviation" detail = ["Cannot found Tissue Abbreviation. Please try again later."] self.error(heading=heading,detail=detail) return
def __init__(self, fd): templatePage.__init__(self, fd) if not self.updMysql(): return if not fd.genotype: fd.readGenotype() fd.strainlist = fd.f1list + fd.strainlist fd.readData() self.formdata = fd.formdata self.dict['title'] = 'Data Updating' try: thisTrait = webqtlTrait(fullname=self.formdata.getvalue('fullname'), cursor=self.cursor) thisTrait.retrieveInfo() except: heading = "Updating Database" detail = ["The trait doesn't exist."] self.error(heading=heading,detail=detail,error="Error") return if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['user']: pass else: heading = "Updating Database" detail = ["You don't have the permission to modify this trait"] self.error(heading=heading,detail=detail,error="Error") return status = self.formdata.getvalue('curStatus') if status == 'updateCheck': #XZhou: Check the change self.updateCheckPage(fd, thisTrait) elif status == 'updateResult': #XZhou: make the changes to database self.updateResultPage(fd, thisTrait) else: #XZhou: show info retrieved from database self.dispTraitPage(fd, thisTrait)
def __init__(self, fd=None): templatePage.__init__(self, fd) GN_AccessionId1 = fd.formdata.getvalue('GN_AccessionId') InfoPageName1 = fd.formdata.getvalue('InfoPageName') sharingInfoObject = SharingInfo2.SharingInfo2(GN_AccessionId1, InfoPageName1) GN_AccessionId2, InfoPageName2, info = sharingInfoObject.getInfo(create=True) # ZS: This javascript is used to hide empty fields in the infofile page. It is here only because # there are no other options due to the poor way in which all of this code is structured. # When we finally use templates, it will be far easier to do this and javascript won't be necessary. hideNoneJS = """ <script type="text/javascript"> $(window).load(function () { empty_rows = $("table[name=infoTable]").find("tr").filter(function () { return $.trim($(this).find('td').text()).length == 0; }); empty_rows.each(function () { $(this).hide(); $(this).prev().hide(); }); $("table[name=infoTable]").find("tr:contains('None')").each( function(){ $(this).hide(); $(this).prev().hide(); //hides the "title"/label for the field as well as its contents }); }); </script>""" self.dict['js1'] = hideNoneJS if not GN_AccessionId1 and GN_AccessionId2: url = webqtlConfig.CGIDIR + "main.py?FormID=sharinginfo&GN_AccessionId=%s" % GN_AccessionId2 self.redirection = url else: sharingInfoObject.getDatasetsList() self.dict['body'] = sharingInfoObject.getBody(infoupdate="")
def __init__(self, fd): templatePage.__init__(self, fd) if not self.openMysql(): return if not fd.genotype: fd.readGenotype() self.importFile = fd.formdata.getvalue('importfile') if not self.importFile: templatePage.__init__(self, fd) heading = 'Import Collection' detail = ['The file you choose to import from doesn\'t exist.'] self.error(heading=heading,detail=detail) return self.importFile = string.split(self.importFile, '\n') RISetLocate = 0 self.searchResult = [] for line in self.importFile: if line and line[0] != '#': if not RISetLocate: RISetLocate = line if RISetLocate != fd.RISet: templatePage.__init__(self, fd) heading = 'Import Collection' detail = ['The file you choose to import from doesn\'t contain %s selection.' % fd.RISet] self.error(heading=heading,detail=detail) return else: self.searchResult.append(line) if not self.searchResult: templatePage.__init__(self, fd) heading = 'Import Collection' detail = ['The file you choose to import from is empty.'] self.error(heading=heading,detail=detail) return self.importMethod = fd.formdata.getvalue('importmethod') if self.importMethod == 'replace': checkPreSelection = 0 else: checkPreSelection = 1 if self.genSelection(fd=fd, checkPreSelection = checkPreSelection): self.writeHTML(fd)
def __init__(self,fd): templatePage.__init__(self, fd) if not self.openMysql(): return searchResult = fd.formdata.getvalue('searchResult', []) TD_LR = HT.TD(height=200,width="100%",bgColor='#eeeeee',valign="middle") formODE = HT.Form(cgi="http://geneweaver.org/index.php?action=manage&cmd=importGeneSet", enctype='multipart/form-data', name='formODE', submit = HT.Input(type='hidden')) hddnODE = {} hddnODE['client'] = 'genenetwork' hddnODE['species'] = "Mus musculus" #hddnODE['idtype'] = chipName hddnODE['list'] = string.join(searchResult, ",") for key in hddnODE.keys(): formODE.append(HT.Input(name=key, value=hddnODE[key], type='hidden')) TD_LR.append(formODE) TD_LR.append(HT.Paragraph("Your selections of %d traits is being exported to the ODE" % len(searchResult), Class="cr fs16 fwb", align="Center")) self.dict['js1'] = """ <SCRIPT LANGUAGE="JavaScript"> setTimeout('document.formODE.submit()',1000); </SCRIPT> """ self.dict['body'] = TD_LR