def traitInfo(self, fd, specialStrains = None): species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, RISet=fd.RISet) heading2 = HT.Paragraph(HT.Strong('Population: '), "%s %s" % (species.title(), fd.RISet) , HT.BR()) if self.Trait: trait_url = HT.Href(text=self.Trait.name, url = os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE) + \ "?FormID=showDatabase&incparentsf1=1&database=%s&ProbeSetID=%s" % (self.Trait.db.name, self.Trait.name), \ target='_blank', Class="fs13 fwn") heading2.append(HT.Strong("Database: "), HT.Href(text=self.Trait.db.fullname, url = webqtlConfig.INFOPAGEHREF % self.Trait.db.name , target='_blank',Class="fs13 fwn"),HT.BR()) if self.Trait.db.type == 'ProbeSet': heading2.append(HT.Strong('Trait ID: '), trait_url, HT.BR(), HT.Strong("Gene Symbol: "), HT.Italic('%s' % self.Trait.symbol,id="green"),HT.BR()) if self.Trait.chr and self.Trait.mb: heading2.append(HT.Strong("Location: "), 'Chr %s @ %s Mb' % (self.Trait.chr, self.Trait.mb)) elif self.Trait.db.type == 'Geno': heading2.append(HT.Strong('Locus : '), trait_url, HT.BR()) #heading2.append(HT.Strong("Gene Symbol: "), HT.Italic('%s' % self.Trait.Symbol,id="green"),HT.BR()) if self.Trait.chr and self.Trait.mb: heading2.append(HT.Strong("Location: "), 'Chr %s @ %s Mb' % (self.Trait.chr, self.Trait.mb)) elif self.Trait.db.type == 'Publish': heading2.append(HT.Strong('Record ID: '), trait_url, HT.BR()) heading2.append(HT.Strong('Phenotype: '), self.Trait.phenotype, HT.BR()) heading2.append(HT.Strong('Author: '), self.Trait.authors, HT.BR()) elif self.Trait.db.type == 'Temp': heading2.append(HT.Strong('Description: '), self.Trait.description, HT.BR()) #heading2.append(HT.Strong('Author: '), self.Trait.authors, HT.BR()) else: pass else: heading2.append(HT.Strong("Trait Name: "), fd.identification) if specialStrains: mdpform = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), name='MDP_Form',submit=HT.Input(type='hidden')) mdphddn = {'FormID':'dataEditing', 'submitID':'basicStatistics','RISet':fd.RISet, "allstrainlist":string.join(fd.allstrainlist, " "), "ptype":self.plotType, 'identification':fd.identification, "incparentsf1":1} if self.fullname: mdphddn['fullname'] = self.fullname webqtlUtil.exportData(mdphddn, fd.allTraitData) for key in mdphddn.keys(): mdpform.append(HT.Input(name=key, value=mdphddn[key], type='hidden')) btn0 = HT.Input(type='button' ,name='',value='All Cases',onClick="this.form.ptype.value=0;submit();", Class="button") btn1 = HT.Input(type='button' ,name='',value='%s Only' % fd.RISet,onClick="this.form.ptype.value=1;submit();", Class="button") btn2 = HT.Input(type='button' ,name='',value='MDP Only', onClick="this.form.ptype.value=2;submit();", Class="button") mdpform.append(btn0) mdpform.append(btn1) mdpform.append(btn2) heading2.append(HT.P(), mdpform) return HT.Span(heading2)
def gentextfile(self, db, text): # db.getRISet() info = self.getinfo(db.name) # group = db.riset species = webqtlDatabaseFunction.retrieveSpecies(self.cursor, group) type = info[4] database = db.fullname # metadatainfofile = "http://www.genenetwork.org/webqtl/main.py?FormID=sharinginfo&GN_AccessionId=%s" % info[1] originaldata = "http://datafiles.genenetwork.org/download/GN%s/" % info[1] contactinformation = "%s %s, %s, %s, %s, %s %s %s, Tel. %s, %s" % (info[22], info[23], info[33], info[24], info[25], info[26], info[27], info[28], info[29], info[30]) # attachment = "" attachment += ("Data source: GeneNetwork http://www.genenetwork.org/\n") attachment += ("Citations: http://www.genenetwork.org/reference.html\n") attachment += ("Species: %s\n" % species) attachment += ("Group: %s\n" % group) attachment += ("Type: %s\n" % type) attachment += ("Database: %s\n" % database) attachment += ("Metadata info file: %s\n" % metadatainfofile) attachment += ("Original data: %s\n" % originaldata) attachment += ("Contact Information: %s\n" % contactinformation) attachment += ("Date: %s\n" % time.strftime("%B %d, %Y", time.gmtime())) attachment += ("Time: %s\n" % time.strftime("%H:%M", time.gmtime())) attachment += "\n" attachment += ("Funding for The GeneNetwork: NIAAA (U01AA13499, U24AA13513), NIDA, NIMH, and NIAAA (P20-DA21131), NCI MMHCC (U01CA105417), and NCRR (U01NR 105417)\n") attachment += ("PLEASE RETAIN DATA SOURCE INFORMATION WHENEVER POSSIBLE\n") attachment += "\n" rowindex = 0 for row in text: if rowindex == 0: row.insert(0, 'Index') else: row.insert(0, rowindex) rowindex += 1 attachment += string.join(map(lambda cell : str(cell).replace("\r\n", " ").strip(), row), '\t') + "\n" self.content_type = 'text/plain' self.content_disposition = 'attachment; filename=%s' % ('export-%s.txt' % time.strftime("%y-%m-%d-%H-%M")) self.attachment = attachment
def __init__(self, fd): templatePage.__init__(self, fd) if not self.openMysql(): return searchResult = fd.formdata.getvalue("searchResult") if not searchResult: heading = "Partial Correlation" detail = ["You need to select at least three traits in order to calculate partial correlation."] self.error(heading=heading, detail=detail) return ## Adds the Trait instance for each trait name from the collection traits = [] for item in searchResult: traits.append(webqtlTrait(fullname=item, cursor=self.cursor)) RISet = fd.formdata.getvalue("RISet") species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, RISet=RISet) # XZ: HTML part TD_LR = HT.TD(colspan=2, height=200, width="100%", bgColor="#eeeeee") TD_LR.append( "Please select one primary trait, one to three control traits, and at least one target trait.", HT.P() ) mainFormName = "showDatabase" mainForm = HT.Form( cgi=os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), name=mainFormName, submit=HT.Input(type="hidden"), ) # XZ: Add hidden form values hddn = { "FormID": "calPartialCorrTrait", "database": "", "ProbeSetID": "", "CellID": "", # XZ: These four parameters are required by javascript function showDatabase2. "controlTraits": "", "primaryTrait": "", "targetTraits": "", "pcMethod": "", "RISet": RISet, } for key in hddn.keys(): mainForm.append(HT.Input(type="hidden", name=key, value=hddn[key])) radioNames = [] for thisTrait in traits: oneRadioName = thisTrait.getName() radioNames.append(oneRadioName) radioNamesString = ",".join(radioNames) # Creates the image href that runs the javascript setting all traits as target or ignored setAllTarget = HT.Href( url="#redirect", onClick="setAllAsTarget(document.getElementsByName('showDatabase')[0], '%s');" % radioNamesString, ) setAllTargetImg = HT.Image("/images/select_all.gif", alt="Select All", title="Select All", style="border:none;") setAllTarget.append(setAllTargetImg) setAllIgnore = HT.Href( url="#redirect", onClick="setAllAsIgnore(document.getElementsByName('showDatabase')[0], '%s');" % radioNamesString, ) setAllIgnoreImg = HT.Image("/images/select_all.gif", alt="Select All", title="Select All", style="border:none;") setAllIgnore.append(setAllIgnoreImg) tblobj = {} tblobj["header"] = self.getCollectionTableHeader() sortby = self.getSortByValue() tblobj["body"] = self.getCollectionTableBody(traitList=traits, formName=mainFormName, species=species) filename = webqtlUtil.genRandStr("Search_") objfile = open("%s.obj" % (webqtlConfig.TMPDIR + filename), "wb") cPickle.dump(tblobj, objfile) objfile.close() div = HT.Div( webqtlUtil.genTableObj(tblobj=tblobj, file=filename, sortby=sortby, tableID="sortable", addIndex="1"), Id="sortable", ) mainForm.append(div) # XZ: Add button radioNamesString = ",".join(radioNames) jsCommand_1 = "validateTrait(this.form, '" + radioNamesString + "', 0, 1);" jsCommand_2 = "validateTrait(this.form, '" + radioNamesString + "', 0, 2);" partialCorrTraitButton_1 = HT.Input( type="button", name="submitPartialCorrTrait_1", value="Pearson's r", onClick="%s" % jsCommand_1, Class="button", ) partialCorrTraitButton_2 = HT.Input( type="button", name="submitPartialCorrTrait_2", value="Spearman's rho", onClick="%s" % jsCommand_2, Class="button", ) mainForm.append( HT.BR(), "Compute partial correlation for target selected above:", HT.BR(), partialCorrTraitButton_1, partialCorrTraitButton_2, HT.BR(), HT.BR(), HT.HR(color="gray", size=3), ) jsCommand = "validateTrait(this.form, '" + radioNamesString + "', 1);" partialCorrDBButton = HT.Input( type="button", name="submitPartialCorrDB", value="Calculate", onClick="%s" % jsCommand, Class="button" ) methodText = HT.Span("Calculate:", Class="ffl fwb fs12") methodMenu = HT.Select(name="method") methodMenu.append(("Genetic Correlation, Pearson's r", "1")) methodMenu.append(("Genetic Correlation, Spearman's rho", "2")) methodMenu.append(("SGO Literature Correlation", "3")) methodMenu.append(("Tissue Correlation, Pearson's r", "4")) methodMenu.append(("Tissue Correlation, Spearman's rho", "5")) databaseText = HT.Span("Choose Database:", Class="ffl fwb fs12") databaseMenu = HT.Select(name="database2") nmenu = 0 self.cursor.execute( 'SELECT PublishFreeze.FullName,PublishFreeze.Name FROM \ PublishFreeze,InbredSet WHERE PublishFreeze.InbredSetId = InbredSet.Id \ and InbredSet.Name = "%s" and PublishFreeze.public > %d' % (RISet, webqtlConfig.PUBLICTHRESH) ) for item in self.cursor.fetchall(): databaseMenu.append(item) nmenu += 1 self.cursor.execute( 'SELECT GenoFreeze.FullName,GenoFreeze.Name FROM GenoFreeze,\ InbredSet WHERE GenoFreeze.InbredSetId = InbredSet.Id and InbredSet.Name = \ "%s" and GenoFreeze.public > %d' % (RISet, webqtlConfig.PUBLICTHRESH) ) for item in self.cursor.fetchall(): databaseMenu.append(item) nmenu += 1 # 03/09/2009: Xiaodong changed the SQL query to order by Name as requested by Rob. self.cursor.execute("SELECT Id, Name FROM Tissue order by Name") for item in self.cursor.fetchall(): TId, TName = item databaseMenuSub = HT.Optgroup(label="%s ------" % TName) self.cursor.execute( 'SELECT ProbeSetFreeze.FullName,ProbeSetFreeze.Name FROM ProbeSetFreeze, ProbeFreeze, \ InbredSet WHERE ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and ProbeFreeze.TissueId = %d and \ ProbeSetFreeze.public > %d and ProbeFreeze.InbredSetId = InbredSet.Id and InbredSet.Name like "%s%%" \ order by ProbeSetFreeze.CreateTime desc, ProbeSetFreeze.AvgId ' % (TId, webqtlConfig.PUBLICTHRESH, RISet) ) for item2 in self.cursor.fetchall(): databaseMenuSub.append(item2) nmenu += 1 databaseMenu.append(databaseMenuSub) if nmenu: criteriaText = HT.Span("Return:", Class="ffl fwb fs12") criteriaMenu = HT.Select(name="criteria", selected="500") criteriaMenu.append(("top 100", "100")) criteriaMenu.append(("top 200", "200")) criteriaMenu.append(("top 500", "500")) criteriaMenu.append(("top 1000", "1000")) criteriaMenu.append(("top 2000", "2000")) criteriaMenu.append(("top 5000", "5000")) criteriaMenu.append(("top 10000", "10000")) criteriaMenu.append(("top 15000", "15000")) criteriaMenu.append(("top 20000", "20000")) self.MPDCell = HT.TD() correlationMenus = HT.TableLite( HT.TR(HT.TD(databaseText, HT.BR(), databaseMenu, colspan=4)), HT.TR(HT.TD(methodText, HT.BR(), methodMenu), self.MPDCell, HT.TD(criteriaText, HT.BR(), criteriaMenu)), border=0, cellspacing=4, cellpadding=0, ) else: correlationMenus = "" mainForm.append( HT.Font("or", color="red", size=4), HT.BR(), HT.BR(), "Compute partial correlation for each trait in the database selected below:", HT.BR(), ) mainForm.append(partialCorrDBButton, HT.BR(), HT.BR(), correlationMenus) TD_LR.append(mainForm) self.dict["body"] = str(TD_LR) self.dict["js1"] = "" self.dict["title"] = "Partial Correlation Input"
def __init__(self, fd): templatePage.__init__(self, fd) if not self.openMysql(): return fd.readGenotype() TD_LR = HT.TD(height=200,width="100%",bgColor='#eeeeee') self.database = fd.formdata.getfirst('database') self.ProbeSetID = fd.formdata.getfirst('ProbeSetID') self.CellID = fd.formdata.getfirst('CellID') self.db = webqtlDataset(self.database, self.cursor) thisTrait = webqtlTrait(db= self.db, cursor=self.cursor, name=self.ProbeSetID) #, cellid=CellID) thisTrait.retrieveInfo() try: self.cursor.execute('SELECT ProbeFreeze.Name FROM ProbeFreeze,ProbeSetFreeze WHERE ProbeFreeze.Id = ProbeSetFreeze.ProbeFreezeId and ProbeSetFreeze.Name = "%s"' % self.db.name) self.probeDatabase = self.cursor.fetchall()[0][0] self.probeInfoDatabase = 'Probe' except: heading = 'Probe Information' intro = ['Trying to retrieve the probe information for ProbeSet ',HT.Span('%s' % self.ProbeSetID, Class="fwb cdg"),' in Database ',HT.Href(text='%s' % self.db.fullname,url=webqtlConfig.infopagehref % self.database)] detail = ['The information you just requested is not available at this time.'] self.error(heading=heading,intro=intro,detail=detail) return form = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='showDatabase', submit=HT.Input(type='hidden')) hddn = {'FormID':'showDatabase','ProbeSetID':'_','database':'_','CellID':'_','RISet':fd.RISet, 'incparentsf1':'on'} if fd.RISet == 'BXD': hddn['parentsf1']='ON' for key in hddn.keys(): form.append(HT.Input(name=key, value=hddn[key], type='hidden')) #Buttons on search page linkinfo ="%s/probeInfo.html" % webqtlConfig.PORTADDR mintmap = "" probeinfo = HT.Input(type='button' ,name='mintmap',value='Info', onClick="openNewWin('%s');" % linkinfo, Class="button") cormatrix = HT.Href(url="#redirect", onClick="databaseFunc(document.getElementsByName('showDatabase')[0], 'corMatrix');") cormatrix_img = HT.Image("/images/correlation_matrix1_final.jpg", alt="Correlation Matrix and PCA", title="Correlation Matrix and PCA", style="border:none;") cormatrix.append(cormatrix_img) heatmap = HT.Href(url="#redirect", onClick="databaseFunc(document.getElementsByName('showDatabase')[0], 'heatmap');") heatmap_img = HT.Image("/images/heatmap2_final.jpg", name='mintmap', alt="QTL Heat Map and Clustering", title="QTL Heatmap and Clustering", style="border:none;") heatmap.append(heatmap_img) if self.ProbeSetID[-2:] in ('_A', '_B'): thisProbeSetID = self.ProbeSetID[:-2] else: thisProbeSetID = self.ProbeSetID thisurl = 'http://www.ensembl.org/Mus_musculus/featureview?type=AffyProbe&id=%s' % thisProbeSetID verifyButton = HT.Input(type="button",value="Verify Ensembl",onClick= "openNewWin('%s')" % thisurl, Class="button") addselect = HT.Input(type='button' ,name='addselect',value='Add to Collection', onClick="addRmvSelection('%s', this.form, 'addToSelection');" % fd.RISet,Class="button") selectall = HT.Input(type='button' ,name='selectall',value='Select All', onClick="checkAll(this.form);",Class="button") selectpm = HT.Input(type='button' ,name='selectall',value='Select PM', onClick="checkPM(this.form);",Class="button") selectmm = HT.Input(type='button' ,name='selectall',value='Select MM', onClick="checkMM(this.form);",Class="button") selectinvert = HT.Input(type='button' ,name='selectinvert',value='Select Invert', onClick="checkInvert(this.form);",Class="button") reset = HT.Input(type='reset',name='',value='Select None',Class="button") chrMenu = HT.Input(type='hidden',name='chromosomes',value='all') probedata = HT.Input(type='hidden',name='probedata',value='all') url_rudi_track = self.getProbeTrackURL(self.probeDatabase, self.ProbeSetID) if url_rudi_track: rudi_track = HT.Input(type='button', name='ruditrack', value='Probe Track', onClick="openNewWin('%s')"%url_rudi_track, Class="button") else: rudi_track = None pinfopage = "/probeInfo.html" #updated by NL: 07-22-2011 get chosenStrains _f1, _f12, _mat, _pat = webqtlUtil.ParInfo[fd.RISet] chosenStrains="%s,%s"%(_mat,_pat) tblobj = {} tblobj['header']=[] tblobj['header'].append([ THCell(HT.TD("", Class="cbrb cw fwb fs13 b1", rowspan=2,nowrap='ON'), sort=0), THCell(HT.TD(HT.Href(target="_PROBEINFO", url=pinfopage+"#probe", text=HT.Span('Probe', Class="cw fwb fs13")), HT.Sup(HT.Italic('1')), Class="cbrb cw fwb fs13 b1",align='center',rowspan=2,nowrap='ON'), text="probe", idx=1), THCell(HT.TD(HT.Href(text=HT.Span('Sequence', Class="cw fwb fs13"), target="_PROBEINFO", url=pinfopage+"#Sequence"),HT.Sup(HT.Italic('2')), Class="cbrb cw fwb fs13 b1", align='center',rowspan=2,nowrap='ON'), text="seq", idx=2), THCell(HT.TD(HT.Href(text=HT.Span('bl2seq', Class="cw fwb fs13"), target="_PROBEINFO", url=pinfopage+"#bl2seq"),HT.Sup(HT.Italic('3')), Class="cbrb cw fwb fs13 b1", align='center',rowspan=2,nowrap='ON'), sort=0), THCell(HT.TD(HT.Href(text=HT.Span('Exons', Class="cw fwb fs13"), target="_PROBEINFO", url=pinfopage+"#Exon"),HT.Sup(HT.Italic('4')), Class="cbrb cw fwb fs13 b1",align='center',rowspan=2,nowrap='ON'), sort=0), THCell(HT.TD(HT.Href(text=HT.Span('Tm °C', Class="cw fwb fs13"), target="_PROBEINFO", url=pinfopage+"#Tm"),HT.Sup(HT.Italic('5')), Class="cbrb cw fwb fs13 b1",align='center',rowspan=2,nowrap='ON'), text="tm", idx=5), THCell(HT.TD(HT.Href(text=HT.Span('Stacking Energy K', HT.Sub('B'),'T', Class="cw fwb fs13"), target="_PROBEINFO", url=pinfopage+"#KBT"),HT.Sup(HT.Italic('6')), Class="cbrb cw fwb fs13 b1",align='center',colspan=2,NOWRAP="yes",nowrap='ON'), sort=0), THCell(HT.TD(HT.Href(text=HT.Span('Mean', Class="cw fwb fs13"), target="_PROBEINFO", url=pinfopage+"#Mean"),HT.Sup(HT.Italic('7')), Class="cbrb cw fwb fs13 b1",align='center',rowspan=2,nowrap='ON'), text="mean", idx=8), THCell(HT.TD(HT.Href(text=HT.Span('Stdev', Class="cw fwb fs13"), target="_PROBEINFO", url=pinfopage+"#Stdev"),HT.Sup(HT.Italic('8')), Class="cbrb cw fwb fs13 b1",align='center',rowspan=2,nowrap='ON'), text="std", idx=9), THCell(HT.TD(HT.Href(text=HT.Span('Probe h2', Class="cw fwb fs13"), target="_PROBEINFO", url=pinfopage+"#h2"),HT.Sup(HT.Italic('9')), Class="cbrb cw fwb fs13 b1",align='center',rowspan=2,NOWRAP="yes"), text="h2", idx=10), THCell(HT.TD(HT.Href(text=HT.Span('Probe Location', Class="cw fwb fs13"), target="_PROBEINFO", url=pinfopage+"#location"), HT.Sup(HT.Italic('10')),Class="cbrb cw fwb fs13 b1",align='center',colspan=3)), THCell(HT.TD(HT.Href(text=HT.Span('SNPs', HT.BR(), '(Across all strains)', Class="cw fwb fs13"), target="_PROBEINFO", url=pinfopage+"#snps"), HT.Sup(HT.Italic('11')),Class="cbrb cw fwb fs13 b1",align='center',rowspan=2,NOWRAP="yes")), THCell(HT.TD(HT.Href(text=HT.Span('SNPs', HT.BR(),'(Different alleles only between %s and %s)'%(_mat,_pat), Class="cw fwb fs13"), target="_PROBEINFO", url=pinfopage+"#snps"), HT.Sup(HT.Italic('11')),Class="cbrb cw fwb fs13 b1",align='center',rowspan=2,NOWRAP="yes")) ]) tblobj['header'].append([ THCell(HT.TD(HT.Span('GSB', Class="cw fwb fs13"),align='center', Class="cbrb ffl fwb fs13 b1",), text="gsb", idx=6), THCell(HT.TD(HT.Span('NSB', Class="cw fwb fs13"),align='center', Class="cbrb ffl fwb fs13 b1",), text="nsb", idx=7), THCell(HT.TD(HT.Span('Chr', Class="cw fwb fs13"), align='center', Class="cbrb ffl2 fwb fs13 b1",)), THCell(HT.TD(HT.Span('Start', Class="cw fwb fs13"),align='center', Class="cbrb ffl fwb fs13 b1",)), THCell(HT.TD(HT.Span('End', Class="cw fwb fs13"),align='center', Class="cbrb ffl fwb fs13 b1",)), ]) tblobj['body'] = [] blatbutton = '' fetchField = ['Probe.Name','Probe.Sequence','Probe.ExonNo','Probe.Tm', 'Probe.E_GSB','Probe.E_NSB', 'ProbeH2.h2', 'ProbeH2.weight'] query = "SELECT %s FROM (Probe, ProbeSet, ProbeFreeze) left join ProbeH2 on ProbeH2.ProbeId = Probe.Id and ProbeH2.ProbeFreezeId = ProbeFreeze.Id WHERE ProbeSet.Name = '%s' and Probe.ProbeSetId = ProbeSet.Id and ProbeFreeze.Name = '%s' order by Probe.SerialOrder" % (string.join(fetchField,','), self.ProbeSetID, self.probeDatabase) self.cursor.execute(query) results = self.cursor.fetchall() blatsequence = "" # add by NL: get strains' name in SnpPattern database table strainsInSnpPatternDBtable=self.getStrainNameIndexPair() # after snpBrowserPage.py change to MVC, this function can be removed in this class and called from other class; allStrainNameList=[v[0] for v in strainsInSnpPatternDBtable] speciesid = webqtlDatabaseFunction.retrieveSpeciesId(cursor=self.cursor,RISet=fd.RISet) for result in results: """ ProbeId, CellID,Sequence,ExonNo,Tm, E_GSB,E_NSB = map(self.nullRecord,result) h2 = '' query = "SELECT h2 FROM ProbeH2 WHERE ProbeFreezeId = '%s' and ProbeId=%s" % (self.probeDatabase, ProbeId) self.cursor.execute(query) results = self.cursor.fetchall() """ CellID,Sequence,ExonNo,Tm, E_GSB,E_NSB,h2, weight = map(self.nullRecord,result) Average = '' STDEV = '' mean = -10000.0 stdev = -10000.0 try: thisTrait.cellid = CellID thisTrait.retrieveData() mean, median, var, stdev, sem, N = reaper.anova(thisTrait.exportInformative()[1]) if mean: Average = '%2.2f' % mean if stdev: STDEV = '%2.2f' % stdev except: pass if CellID == self.CellID: bkColor = "cbrdull fs11 b1" else: bkColor = "fs11 b1" seqcolor= '' if thisTrait.blatseq: blatsequence = thisTrait.blatseq if int(CellID[-1]) % 2 == 1: seqcolor= 'cdg' else: if int(CellID[-1]) % 2 == 1: seqcolor= 'cdg' blatsequence += string.strip(Sequence) if thisTrait.genbankid and (int(CellID[-1]) % 2 == 1): probeurl = 'http://www.ncbi.nlm.nih.gov/blast/bl2seq/wblast2.cgi?one=%s&sseq=%s' % (thisTrait.genbankid, Sequence) probefy1 = HT.Input(type="button",value="Blast",onClick= "openNewWin('%s')" % probeurl, Class="buttonsmaller") else: probefy1 = '' traitName = str(thisTrait) #XZ, Aug 08, 2011: Note that probesets on some affy chips are not name as "xxx_at" (i.e., Affy Mouse Gene 1.0 ST (GPL6246)). #EnsemblProbeSetID = self.ProbeSetID[0:self.ProbeSetID.index('_at')+3] EnsemblProbeSetID = self.ProbeSetID if '_at' in self.ProbeSetID: EnsemblProbeSetID = self.ProbeSetID[0:self.ProbeSetID.index('_at')+3] self.cursor.execute(''' SELECT EnsemblProbeLocation.* FROM EnsemblProbeLocation, EnsemblProbe, EnsemblChip, GeneChipEnsemblXRef, ProbeFreeze WHERE EnsemblProbeLocation.ProbeId=EnsemblProbe.Id and EnsemblProbe.ChipId=GeneChipEnsemblXRef.EnsemblChipId and GeneChipEnsemblXRef.GeneChipId=ProbeFreeze.ChipId and EnsemblProbe.Name=%s and EnsemblProbe.ProbeSet=%s and ProbeFreeze.Name=%s group by Chr, Start, End''' ,(CellID, EnsemblProbeSetID, self.probeDatabase)) LocationFields = self.cursor.fetchall() Chr='' Start='' End='' if (len(LocationFields)>=1): Chr,Start,End,Strand,MisMatch,ProbeId = map(self.nullRecord,LocationFields[0]) Start /= 1000000.0 End /= 1000000.0 if (len(LocationFields)>1): self.cursor.execute(''' SELECT ProbeSet.Chr, ProbeSet.Mb FROM ProbeSet, ProbeFreeze WHERE ProbeSet.ChipId=ProbeFreeze.ChipId and ProbeSet.Name=%s and ProbeFreeze.Name=%s''' ,(self.ProbeSetID, self.probeDatabase)) ProbeSetChr, ProbeSetMb = map(self.nullRecord,self.cursor.fetchall()[0]) self.cursor.execute(''' SELECT EnsemblProbeLocation.*, ABS(EnsemblProbeLocation.Start/1000000-%s) as Mb FROM EnsemblProbeLocation, EnsemblProbe, EnsemblChip, GeneChipEnsemblXRef, ProbeFreeze WHERE EnsemblProbeLocation.ProbeId=EnsemblProbe.Id and EnsemblProbe.ChipId=GeneChipEnsemblXRef.EnsemblChipId and GeneChipEnsemblXRef.GeneChipId=ProbeFreeze.ChipId and EnsemblProbe.Name=%s and EnsemblProbe.ProbeSet=%s and EnsemblProbeLocation.Chr=%s and ProbeFreeze.Name=%s order by Mb limit 1''' ,(ProbeSetMb, CellID, EnsemblProbeSetID, ProbeSetChr, self.probeDatabase)) NewLocationFields = self.cursor.fetchall() if (len(NewLocationFields)>0): Chr,Start,End,Strand,MisMatch,ProbeId,Mb = map(self.nullRecord,NewLocationFields[0]) Start /= 1000000.0 End /= 1000000.0 snp_collection = [] snpDiff_collection=[] startIndex=3 if Chr != '' and Start != '' and End != '' and speciesid != None: self.cursor.execute(''' SELECT a.SnpName, a.Id, b.* FROM SnpAll a, SnpPattern b WHERE a.Chromosome=%s and a.Position>=%s and a.Position<=%s and a.SpeciesId=%s and a.Id=b.SnpId''' ,(Chr, Start, End, speciesid)) #chr,Start, End, 1)) snpresults = self.cursor.fetchall() index1=allStrainNameList.index(_mat) #_mat index in results index2=allStrainNameList.index(_pat) #_pat index in results for v in snpresults: #updated by NL: 07-22-2011 check 'limit to' to get snpBrowser snpresults snp_collection.append(HT.Href(text=v[0], url=os.path.join(webqtlConfig.CGIDIR, "main.py?FormID=SnpBrowserResultPage&submitStatus=1&customStrain=1")+ "&geneName=%s" % v[0], Class="fs12 fwn", target="_blank")) snp_collection.append(HT.BR()) #updated by NL: 07-27-2011 link snp info for different allele only strain1_allele=v[startIndex+index1] strain2_allele=v[startIndex+index2] if strain1_allele!=strain2_allele: snpDiff_collection.append(HT.Href(text=v[0], url=os.path.join(webqtlConfig.CGIDIR, "main.py?FormID=SnpBrowserResultPage&submitStatus=1&customStrain=1&diffAlleles=1&chosenStrains=%s"%chosenStrains)+ "&geneName=%s" % v[0], Class="fs12 fwn", target="_blank")) snpDiff_collection.append(HT.BR()) tr = [] tr.append(TDCell(HT.TD(HT.Input(type="checkbox", Class='checkbox', name="searchResult",value=traitName, onClick="highlight(this)"), align="right", Class=bkColor, nowrap="on"), text=traitName)) tr.append(TDCell(HT.TD(HT.Href(text=CellID, url = "javascript:showDatabase2('%s','%s','%s');" % (self.database,self.ProbeSetID,CellID),Class="fs12 fwn"),Class=bkColor), traitName, traitName.upper())) tr.append(TDCell(HT.TD(Sequence, Class=bkColor + " %s ffmono fs14" % seqcolor),Sequence,Sequence.upper())) tr.append(TDCell(HT.TD(probefy1,align='center',Class=bkColor))) tr.append(TDCell(HT.TD(ExonNo,align='center',Class=bkColor))) try: TmValue = float(Tm) except: TmValue = 0.0 tr.append(TDCell(HT.TD(Tm,align='center',Class=bkColor), Tm, TmValue)) try: E_GSBValue = float(E_GSB) except: E_GSBValue = -10000.0 tr.append(TDCell(HT.TD(E_GSB,align='center',Class=bkColor), E_GSB, E_GSBValue)) try: E_NSBValue = float(E_NSB) except: E_NSBValue = -10000.0 tr.append(TDCell(HT.TD(E_NSB,align='center',Class=bkColor), E_NSB, E_NSBValue)) tr.append(TDCell(HT.TD(Average,align='center',Class=bkColor), Average, mean)) tr.append(TDCell(HT.TD(STDEV,align='center',Class=bkColor), STDEV, stdev)) try: h2Value = float(h2) except: h2Value = -10000.0 tr.append(TDCell(HT.TD(h2,align='center',Class=bkColor), h2, h2Value)) tr.append(TDCell(HT.TD(Chr,align='left',Class=bkColor))) tr.append(TDCell(HT.TD(Start,align='left',Class=bkColor))) tr.append(TDCell(HT.TD(End,align='left',Class=bkColor))) snp_td = HT.TD(align='left',Class=bkColor) for one_snp_href in snp_collection: snp_td.append(one_snp_href) tr.append(TDCell(snp_td)) #07-27-2011:add by NL: show SNP results for different allele only snpDiff_td= HT.TD(align='left', valign='top', Class=bkColor) for one_snpDiff_href in snpDiff_collection: snpDiff_td.append(one_snpDiff_href) tr.append(TDCell(snpDiff_td)) tblobj['body'].append(tr) # import cPickle filename = webqtlUtil.genRandStr("Probe_") objfile = open('%s.obj' % (webqtlConfig.TMPDIR+filename), 'wb') cPickle.dump(tblobj, objfile) objfile.close() # NL, 07/27/2010. genTableObj function has been moved from templatePage.py to webqtlUtil.py; div = HT.Div(webqtlUtil.genTableObj(tblobj=tblobj, file=filename, sortby=("", ""), tableID = "sortable", addIndex = "1"), Id="sortable") #UCSC _Species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, RISet=fd.RISet) if _Species == "rat": thisurl = webqtlConfig.UCSC_BLAT % ('rat', 'rn3', blatsequence) elif _Species == "mouse": thisurl = webqtlConfig.UCSC_BLAT % ('mouse', 'mm9', blatsequence) else: thisurl = "" if thisurl: blatbutton = HT.Input(type='button' ,name='blatPM',value='Verify UCSC', onClick="window.open('%s','_blank')" % thisurl,Class="button") else: blatbutton = "" #GenBank genbankSeq = "" if thisTrait.genbankid: self.cursor.execute("SELECT Sequence FROM Genbank WHERE Id = '%s'" % thisTrait.genbankid ) genbankSeq = self.cursor.fetchone() if genbankSeq: genbankSeq = genbankSeq[0] if genbankSeq: if _Species == "rat": thisurl2 = webqtlConfig.UCSC_BLAT % ('rat', 'rn3', genbankSeq) if _Species == "mouse": thisurl2 = webqtlConfig.UCSC_BLAT % ('mouse', 'mm9', genbankSeq) else: thisurl2 = '' if thisurl2: blatbutton2 = HT.Input(type='button' ,name='blatPM',value='Verify GenBank', onClick="window.open('%s','_blank')" % thisurl2,Class="button") else: blatbutton2 = "" #Snp snpBrowser = "" if thisTrait.symbol and _Species == 'mouse': self.cursor.execute("select geneSymbol from GeneList where geneSymbol = %s", thisTrait.symbol) geneName = self.cursor.fetchone() if geneName: snpurl = os.path.join(webqtlConfig.CGIDIR, "main.py?FormID=snpBrowser") + "&geneName=%s" % geneName[0] else: if thisTrait.chr and thisTrait.mb: snpurl = os.path.join(webqtlConfig.CGIDIR, "main.py?FormID=snpBrowser") + \ "&chr=%s&start=%2.6f&end=%2.6f" % (thisTrait.chr, thisTrait.mb-0.002, thisTrait.mb+0.002) else: snpurl = "" if snpurl: snpBrowser = HT.Input(type="button",value="SNP Browser",onClick= \ "openNewWin('%s')" % snpurl, Class="button") else: snpBrowser = "" #end if heading = HT.Paragraph('Probe Information', Class="title") intro = HT.Paragraph('The table below lists information of all probes of probe set ',HT.Span(self.ProbeSetID, Class="fwb fs13"),' from database ', HT.Span(self.probeDatabase, Class="fwb fs13"), ".") buttons = HT.Paragraph(probedata,probeinfo,heatmap,cormatrix,blatbutton,blatbutton2,verifyButton,snpBrowser, HT.P(),selectall,selectpm,selectmm,selectinvert,reset,addselect) if rudi_track: buttons.append(rudi_track) form.append(buttons,div,HT.P()) TD_LR.append(heading,intro,form, HT.P()) self.dict['basehref'] = '' self.dict['body'] = str(TD_LR) self.dict['title'] = self.db.shortname + ' : ' + self.ProbeSetID +' / Probe Information' # updated by NL, javascript function xmlhttpPost(strURL, div, querystring) and function updatepage(Id, str) # have been moved to dhtml.js self.dict['js1'] = ''
def writeHTML(self,fd): TD_LR = HT.TD(height=100,width="100%",bgColor='#eeeeee',valign="top") pageTable = HT.TableLite(cellSpacing=0,cellPadding=0,width="100%",border=0, align="Left") tbl = HT.TableLite(cellSpacing=2,cellPadding=0,width="90%",border=0, align="Left") seq = 1 SelectionHeading = HT.Paragraph('%s Trait Collection' % fd.RISet, Class="title") mintmap = HT.Href(url="#redirect", onClick="if(validateTraitNumber()){databaseFunc(document.getElementsByName('showDatabase')[0], 'showIntMap');}") mintmap_img = HT.Image("/images/multiple_interval_mapping1_final.jpg", name='mintmap', alt="Multiple Interval Mapping", title="Multiple Interval Mapping", style="border:none;") mintmap.append(mintmap_img) mcorr = HT.Href(url="#redirect", onClick="if(validateTraitNumber()){databaseFunc(document.getElementsByName('showDatabase')[0], 'compCorr');}") mcorr_img = HT.Image("/images/compare_correlates2_final.jpg", name='comparecorr', alt="Compare Correlates", title="Compare Correlates", style="border:none;") mcorr.append(mcorr_img) cormatrix = HT.Href(url="#redirect", onClick="if(validateTraitNumber()){databaseFunc(document.getElementsByName('showDatabase')[0], 'corMatrix');}") cormatrix_img = HT.Image("/images/correlation_matrix1_final.jpg", name='corrmatrix', alt="Correlation Matrix and PCA", title="Correlation Matrix and PCA", style="border:none;") cormatrix.append(cormatrix_img) networkGraph = HT.Href(url="#redirect", onClick="if(validateTraitNumber()){databaseFunc(document.getElementsByName('showDatabase')[0], 'networkGraph');}") networkGraph_img = HT.Image("/images/network_graph1_final.jpg", name='networkgraph', alt="Network Graphs", title="Network Graphs", style="border:none;") networkGraph.append(networkGraph_img) heatmap = HT.Href(url="#redirect", onClick="if(validateTraitNumber()){databaseFunc(document.getElementsByName('showDatabase')[0], 'heatmap');}") heatmap_img = HT.Image("/images/heatmap2_final.jpg", name='heatmap', alt="QTL Heat Map and Clustering", title="QTL Heatmap and Clustering", style="border:none;") heatmap.append(heatmap_img) partialCorr = HT.Href(url="#redirect", onClick="if(validateTraitNumber()){databaseFunc(document.getElementsByName('showDatabase')[0], 'partialCorrInput');}") partialCorr_img = HT.Image("/images/partial_correlation_final.jpg", name='partialCorr', alt="Partial Correlation", title="Partial Correlation", style="border:none;") partialCorr.append(partialCorr_img) BN = HT.Href(url="#redirect", onClick="if(validateTraitNumber()){databaseFunc(document.getElementsByName('showDatabase')[0], 'BNInput');}") networkGraph_img = HT.Image("/images/network_graph1_final.jpg", name='BayesianNetwork', alt="Bayesian Network", title="Bayesian Network", style="border:none;") BN.append(networkGraph_img) removeselect = HT.Href(url="#redirect", onClick="addRmvSelection('%s', document.getElementsByName('showDatabase')[0], 'removeSelection');" % fd.RISet) removeselect_img = HT.Image("/images/remove_selection1_final.jpg", name="removeselect", alt="Remove Selection", title="Remove Selection", style="border:none;") removeselect.append(removeselect_img) selectall = HT.Href(url="#redirect", onClick="$('.checkallbox').attr('checked', true);") selectall_img = HT.Image("/images/select_all2_final.jpg", name="selectall", alt="Select All", title="Select All", style="border:none;") selectall.append(selectall_img) reset = HT.Href(url="#redirect", onClick="$('.checkallbox').attr('checked', false);") reset_img = HT.Image("/images/select_none2_final.jpg", alt="Select None", title="Select None", style="border:none;") reset.append(reset_img) exportSelect = HT.Href(url="#redirect", onClick="databaseFunc(document.getElementsByName('showDatabase')[0], 'exportSelectionDetailInfo');") exportSelect_img = HT.Image("/images/export2_final.jpg", name="exportSelection", alt="Export Selection", title="Export Selection", style="border:none;") exportSelect.append(exportSelect_img) selectinvert = HT.Href(url="#redirect", onClick = "checkInvert(document.getElementsByName('showDatabase')[0]);") selectinvert_img = HT.Image("/images/invert_selection2_final.jpg", name="selectinvert", alt="Invert Selection", title="Invert Selection", style="border:none;") selectinvert.append(selectinvert_img) chrMenu = HT.Input(type='hidden',name='chromosomes',value='all') importFile = HT.Input(type='file', name='importfile', size=15) importButton = HT.Input(type='button',name='importSelection',value='Load Collection', onClick="addRmvSelection('%s', this.form, 'importSelect');" % fd.RISet,Class="button") exportButton = HT.Input(type='button' ,name='exportSelection',value='Save Collection', onClick="databaseFunc(this.form,'exportSelect');", Class="button") importMenu = HT.Select(name='importmethod') importMenu.append(('append','append')) importMenu.append(('replace','replace')) GeneWeaver = HT.Href(url="#redirect", onClick="databaseFunc(document.getElementsByName('showDatabase')[0], 'ODE');") GeneWeaver_img = HT.Image("/images/ODE_logo_final.jpg", name="GeneWeaver", alt="GeneWeaver", title="GeneWeaver", style="border:none") GeneWeaver.append(GeneWeaver_img) GCATButton = HT.Href(url="#redirect", onClick="databaseFunc(document.getElementsByName('showDatabase')[0], 'GCAT');") GCATButton_img = HT.Image("/images/GCAT_logo_final.jpg", name="GCAT", alt="GCAT", title="GCAT", style="border:none") GCATButton.append(GCATButton_img) GeneSet = HT.Href(url="#redirect", onClick="databaseFunc(document.getElementsByName('showDatabase')[0],'GOTree');") GeneSet_img = HT.Image("/images/webgestalt_icon_final.jpg", name="webgestalt", alt="Gene Set Analysis Toolkit", title="Gene Set Analysis Toolkit", style="border:none") GeneSet.append(GeneSet_img) BNW = HT.Href(url="#redirect", onClick="databaseFunc(document.getElementsByName('showDatabase')[0], 'BNW');") BNW_img = HT.Image("/images/bnw.jpg", name="BNW", alt="Bayesian Network Webserver", title="Bayesian Network Webserver", style="border:none; width:57px; height:55px;") BNW.append(BNW_img) #need to be refined if fd.genotype.Mbmap: scale = HT.Input(name="scale", value="physic", type="hidden") else: scale = "" formMain = HT.Form(cgi=os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='showDatabase', submit=HT.Input(type='hidden')) #XZ, July 22, 2011: I add parameters for interval mapping hddn = {'FormID':'showDatabase','ProbeSetID':'_','database':'_','CellID':'_','RISet':fd.RISet,'incparentsf1':'ON','showHideOptions':'more','scale':'physic','additiveCheck':'ON', 'showSNP':'ON', 'showGenes':'ON', 'intervalAnalystCheck':'ON','bootCheck':None, 'permCheck':None, 'applyVarianceSE':None} for key in hddn.keys(): formMain.append(HT.Input(name=key, value=hddn[key], type='hidden')) if not self.searchResult: SelectionHeading = HT.Paragraph('%s Trait Collection' % fd.RISet, Class="title") formMain.append(HT.HR(width="70%", color = "blue"),importFile, ' ', importMenu, ' ', importButton) TD_LR.append(SelectionHeading,HT.Blockquote('No trait has been added to this selection.'), HT.Center(HT.BR(), HT.BR(), HT.BR(), HT.BR(), formMain)) self.dict['body'] = str(TD_LR) self.dict['title'] = "%s Trait Collection" % fd.RISet return ######################################### # Creating table object for AJAX table # ######################################### tblobj = {} mainfmName = 'showDatabase' # NL, 07/27/2010. retrieveSpecies function has been moved from webqtlTrait.py to webqtlDatabaseFunction.py; species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, RISet=fd.RISet) if species == 'human': chrMenu = scale = mintmap = heatmap = "" tblobj['header'] = self.getCollectionTableHeader() sortby = self.getSortByValue() thisRISet = fd.RISet tblobj['body'] = self.getCollectionTableBody(RISet=thisRISet, traitList=self.theseTraits, formName=mainfmName, species=species) filename= webqtlUtil.genRandStr("Search_") objfile = open('%s.obj' % (webqtlConfig.TMPDIR+filename), 'wb') cPickle.dump(tblobj, objfile) objfile.close() div = HT.Div(webqtlUtil.genTableObj(tblobj=tblobj, file=filename, sortby=sortby, tableID = "sortable", addIndex = "1"), Id="sortable") containerTable = HT.TableLite(cellSpacing=2,cellPadding=0,width="90%",border=0,align="Left") postContainerTable = HT.TableLite(cellSpacing=2,cellPadding=0,width="90%",border=0,align="Left") optionsTable = HT.TableLite(cellSpacing=2, cellPadding=0, width="640", border=0, align="Left") optionsTable.append(HT.TR( HT.TD(selectall, width="77", style="text-align:center"), HT.TD(reset, width="77", style="text-align:center"), HT.TD(selectinvert, width="77", style="text-align:center"), HT.TD(removeselect, width="77", style="text-align:center"), HT.TD(exportSelect, width="77", style="text-align:center"), HT.TD(" ", width="8"), HT.TD(GeneWeaver, width="77", style="text-align:center"), HT.TD(GCATButton, width="77", style="text-align:center"), HT.TD(GeneSet, width="77", style="text-align:center"), HT.TD(BNW, width="77", style="text-align:center"))) optionsTable.append(HT.TR( HT.TD("Select", style="text-align:center"), HT.TD("Deselect", style="text-align:center"), HT.TD("Invert", style="text-align:center"), HT.TD("Remove", style="text-align:center"), HT.TD("Export", style="text-align:center"), HT.TD(" "), HT.TD("Gene", HT.BR(), "Weaver", style="text-align:center"), HT.TD("GCAT", style="text-align:center"), HT.TD("Gene Set", style="text-align:center"), HT.TD("BNW", style="text-align:center"))) postContainerTable.append(HT.TR(HT.TD(optionsTable))) containerTable.append(HT.TR(HT.TD(optionsTable))) functionTable = HT.TableLite(cellSpacing=2,cellPadding=0,width="480",border=0, align="Left") functionRow = HT.TR(HT.TD(networkGraph, width="16.7%"), HT.TD(cormatrix, width="16.7%"), HT.TD(partialCorr, width="16.7%"), HT.TD(mcorr, width="16.7%"), HT.TD(mintmap, width="16.7%"), HT.TD(heatmap)) if species == "human": labelRow = HT.TR(HT.TD(" "*2,HT.Text("Graph")), HT.TD(" "*2,HT.Text("Matrix")), HT.TD(" "*2, HT.Text("Partial")), HT.TD(HT.Text("Compare"))) else: labelRow = HT.TR(HT.TD(" "*2,HT.Text("Graph")), HT.TD(" "*2,HT.Text("Matrix")), HT.TD(" "*2, HT.Text("Partial")), HT.TD(HT.Text("Compare")), HT.TD(HT.Text("QTL Map")), HT.TD(HT.Text(text="Heat Map"))) functionTable.append(functionRow, labelRow) postContainerTable.append(HT.TR(HT.TD(functionTable))) containerTable.append(HT.TR(HT.TD(functionTable))) containerTable.append(HT.TR(HT.TD(" "))) pageTable.append(HT.TR(HT.TD(containerTable))) chrMenu = scale = "" pageTable.append(HT.TR(HT.TD(div))) pageTable.append(HT.TR(HT.TD(" "))) if len(self.theseTraits) > 20: pageTable.append(HT.TR(HT.TD(postContainerTable))) pageTable.append(HT.TR(HT.TD(importFile, ' ', importMenu, ' ', importButton, ' '*10, exportButton))) #Took out scaleMenu since it will be replaced with a jquery popup in the future - Zach 5/10/2010 formMain.append(chrMenu,scale,pageTable) #Updated by NL, deleted showHideJS, moved jquery to jqueryFunction.js self.dict['js1'] = '' TD_LR.append(SelectionHeading,formMain) self.dict['body'] = str(TD_LR) self.dict['js2'] = 'onLoad="pageOffset()"' self.dict['layer'] = self.generateWarningLayer() self.dict['title'] = "%s Trait Collection" % thisRISet
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] #XZ, self.theseTraits holds the "ProbeSet" traits. 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 = 'WebGestalt' detail = ['You need to select at least one microarray trait to submit.'] self.error(heading=heading,detail=detail) return chipName = self.testChip(fd) #XZ, 8/24/2009: the name of arraylist is misleading. It holds the name of traits. arraylist, geneIdList = self.genGeneIdList(fd) target_url = "http://bioinfo.vanderbilt.edu/webgestalt/webgestalt.php" formWebGestalt = HT.Form(cgi=target_url, enctype='multipart/form-data', name='WebGestalt', submit = HT.Input(type='hidden')) id_type = chipName hddnWebGestalt = {'id_list':string.join(arraylist, ","), 'id_type':id_type} hddnWebGestalt['ref_type'] = hddnWebGestalt['id_type'] hddnWebGestalt['analysis_type'] = 'GO' hddnWebGestalt['significancelevel'] = '.05' hddnWebGestalt['stat'] = 'Hypergeometric' hddnWebGestalt['mtc'] = 'BH' hddnWebGestalt['min'] = '2' hddnWebGestalt['id_value'] = fd.formdata.getvalue('correlation') species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, RISet=fd.RISet) if species == 'rat': hddnWebGestalt['org'] = 'Rattus norvegicus' elif species == 'human': hddnWebGestalt['org'] = 'H**o sapiens' elif species == 'mouse': hddnWebGestalt['org'] = 'Mus musculus' else: hddnWebGestalt['org'] = '' hddnWebGestalt['org'] = hddnWebGestalt['org'].replace(' ','_') for key in hddnWebGestalt.keys(): formWebGestalt.append(HT.Input(name=key, value=hddnWebGestalt[key], type='hidden')) TD_LR.append(formWebGestalt) TD_LR.append(HT.Paragraph("Your selection of %d traits is being submitted to GO Tree" % len(self.theseTraits), Class="cr fs16 fwb", align="Center")) # updated by NL, moved mixedChipError() to webqtl.js and change it to mixedChipError(methodName) # moved unknownChipError() to webqtl.js and change it to unknownChipError(chipName) if chipName == 'mixed': methodName = "WebGestalt" self.dict['js1'] = """ <SCRIPT LANGUAGE="JavaScript"> setTimeout("mixedChipError('%s')" ,1000); </SCRIPT> """ % methodName elif chipName.find('_NA') > 0: chipName = chipName[0:-3] self.dict['js1'] = """ <SCRIPT LANGUAGE="JavaScript"> setTimeout("unknownChipError('%s')",1000); </SCRIPT> """ % chipName else: self.dict['js1'] = """ <SCRIPT LANGUAGE="JavaScript"> setTimeout('document.WebGestalt.submit()',1000); </SCRIPT> """ self.dict['body'] = TD_LR
def __init__(self,fd): templatePage.__init__(self, fd) if not self.openMysql(): return #XZ, self.theseTraits holds the "ProbeSet" traits. self.theseTraits = [] 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: heading = 'ODE' detail = ['You need to select at least one microarray trait to submit.'] self.error(heading=heading,detail=detail) return chipName = self.getChipName(fd) species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, RISet=fd.RISet) if species == 'rat': species = 'Rattus norvegicus' elif species == 'human': species = 'H**o sapiens' elif species == 'mouse': species = 'Mus musculus' else: species = '' probesetNameList = self.getProbesetNameList(fd) TD_LR = HT.TD(height=200,width="100%",bgColor='#eeeeee',valign="middle") formODE = HT.Form(cgi="http://ontologicaldiscovery.org/index.php?action=manage&cmd=importGeneSet", enctype='multipart/form-data', name='formODE', submit = HT.Input(type='hidden')) hddnODE = {} hddnODE['client'] = 'genenetwork' hddnODE['species'] = species hddnODE['idtype'] = chipName hddnODE['list'] = string.join(probesetNameList, ",") 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(self.theseTraits), Class="cr fs16 fwb", align="Center")) # updated by NL, moved mixedChipError() to webqtl.js and change it to mixedChipError(methodName) if chipName == 'mixed': methodName = "ODE" self.dict['js1'] = """ <SCRIPT LANGUAGE="JavaScript"> setTimeout("mixedChipError('%s')",1000); </SCRIPT> """ % methodName else: self.dict['js1'] = """ <SCRIPT LANGUAGE="JavaScript"> setTimeout('document.formODE.submit()',1000); </SCRIPT> """ self.dict['body'] = TD_LR