diff options
author | zsloan | 2016-12-12 22:17:08 +0000 |
---|---|---|
committer | zsloan | 2016-12-12 22:17:08 +0000 |
commit | 3d710be17bedbd6f798cc783ac2f402465c79096 (patch) | |
tree | c77d7e905b8ea9286e68f58632bbbe390433d7b2 | |
parent | 2b6033c3fba3ee2eba195122018011de9c11479f (diff) | |
download | genenetwork2-3d710be17bedbd6f798cc783ac2f402465c79096.tar.gz |
Moved a bunch of functions out of the GeneralTrait class that didn't need to be there and changed the code that calls them accordingly
Improved loadings plot on the correlation matrix page to look like GN1's figure (though it's vector and GN1's was static)
Removed some unused code from show_trait.py
changed appearance of table headers some, though needs a little more work
Updated dataset_menu_structure.json
-rw-r--r-- | wqflask/base/trait.py | 1020 | ||||
-rw-r--r-- | wqflask/base/webqtlCaseData.py | 12 | ||||
-rw-r--r-- | wqflask/maintenance/gen_select_dataset.py | 33 | ||||
-rw-r--r-- | wqflask/wqflask/collect.py | 10 | ||||
-rw-r--r-- | wqflask/wqflask/ctl/ctl_analysis.py | 2 | ||||
-rw-r--r-- | wqflask/wqflask/gsearch.py | 1 | ||||
-rw-r--r-- | wqflask/wqflask/search_results.py | 6 | ||||
-rw-r--r-- | wqflask/wqflask/show_trait/show_trait.py | 463 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/dataset_menu_structure.json | 321 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/loadings_plot.js | 19 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css | 10 | ||||
-rw-r--r-- | wqflask/wqflask/static/packages/bootstrap/css/bootstrap.css | 2 | ||||
-rw-r--r-- | wqflask/wqflask/templates/gsearch_gene.html | 4 | ||||
-rw-r--r-- | wqflask/wqflask/templates/search_result_page.html | 14 |
14 files changed, 685 insertions, 1232 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 295502b3..ab0e6b82 100644 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -57,6 +57,7 @@ class GeneralTrait(object): self.lrs = None self.pvalue = None self.mean = None + self.additive = None self.num_overlap = None self.strand_probe = None self.symbol = None @@ -71,114 +72,11 @@ class GeneralTrait(object): # Todo: These two lines are necessary most of the time, but perhaps not all of the time # So we could add a simple if statement to short-circuit this if necessary - self.retrieve_info(get_qtl_info=get_qtl_info) + self = retrieve_trait_info(self, self.dataset, get_qtl_info=get_qtl_info) if get_sample_info != False: - self.retrieve_sample_data() + self = retrieve_sample_data(self, self.dataset) - def jsonable(self): - """Return a dict suitable for using as json - - Actual turning into json doesn't happen here though""" - - if self.dataset.type == "ProbeSet": - return dict(name=self.name, - symbol=self.symbol, - dataset=self.dataset.name, - description=self.description_display, - mean=self.mean, - location=self.location_repr, - lrs_score=self.LRS_score_repr, - lrs_location=self.LRS_location_repr, - additive=self.additive - ) - elif self.dataset.type == "Publish": - if self.pubmed_id: - return dict(name=self.name, - dataset=self.dataset.name, - description=self.description_display, - authors=self.authors, - pubmed_text=self.pubmed_text, - pubmed_link=self.pubmed_link, - lrs_score=self.LRS_score_repr, - lrs_location=self.LRS_location_repr, - additive=self.additive - ) - else: - return dict(name=self.name, - dataset=self.dataset.name, - description=self.description_display, - authors=self.authors, - pubmed_text=self.pubmed_text, - lrs_score=self.LRS_score_repr, - lrs_location=self.LRS_location_repr, - additive=self.additive - ) - elif self.dataset.type == "Geno": - return dict(name=self.name, - dataset=self.dataset.name, - location=self.location_repr - ) - else: - return dict() - - def jsonable_table_row(self, index): - """Return a list suitable for json and intended to be displayed in a table - - Actual turning into json doesn't happen here though""" - - if self.dataset.type == "ProbeSet": - if self.mean == "": - mean = "N/A" - else: - mean = "%.3f" % round(float(self.mean), 2) - if self.additive == "": - additive = "N/A" - else: - additive = "%.3f" % round(float(self.additive), 2) - return ['<input type="checkbox" name="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" value="' + user_manager.data_hmac('{}:{}'.format(str(self.name), self.dataset.name)) + '">', - index, - '<a href="/show_trait?trait_id='+str(self.name)+'&dataset='+self.dataset.name+'">'+str(self.name)+'</a>', - self.symbol, - self.description_display, - self.location_repr, - mean, - self.LRS_score_repr, - self.LRS_location_repr, - additive] - elif self.dataset.type == "Publish": - if self.additive == "": - additive = "N/A" - else: - additive = "%.2f" % round(float(self.additive), 2) - if self.pubmed_id: - return ['<input type="checkbox" name="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" value="' + user_manager.data_hmac('{}:{}'.format(str(self.name), self.dataset.name)) + '">', - index, - '<a href="/show_trait?trait_id='+str(self.name)+'&dataset='+self.dataset.name+'">'+str(self.name)+'</a>', - self.description_display, - self.authors, - '<a href="' + self.pubmed_link + '">' + self.pubmed_text + '</href>', - self.LRS_score_repr, - self.LRS_location_repr, - additive] - else: - return ['<input type="checkbox" name="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" value="' + user_manager.data_hmac('{}:{}'.format(str(self.name), self.dataset.name)) + '">', - index, - '<a href="/show_trait?trait_id='+str(self.name)+'&dataset='+self.dataset.name+'">'+str(self.name)+'</a>', - self.description_display, - self.authors, - self.pubmed_text, - self.LRS_score_repr, - self.LRS_location_repr, - additive] - elif self.dataset.type == "Geno": - return ['<input type="checkbox" name="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" value="' + user_manager.data_hmac('{}:{}'.format(str(self.name), self.dataset.name)) + '">', - index, - '<a href="/show_trait?trait_id='+str(self.name)+'&dataset='+self.dataset.name+'">'+str(self.name)+'</a>', - self.location_repr] - else: - return dict() - def get_name(self): stringy = "" if self.dataset and self.name: @@ -282,422 +180,6 @@ class GeneralTrait(object): return samples, vals, the_vars, sample_aliases - # - # In ProbeSet, there are maybe several annotations match one sequence - # so we need use sequence(BlatSeq) as the identification, when we update - # one annotation, we update the others who match the sequence also. - # - # Hongqiang Li, 3/3/2008 - # - #def getSequence(self): - # assert self.cursor - # if self.dataset.type == 'ProbeSet': - # self.cursor.execute(''' - # SELECT - # ProbeSet.BlatSeq - # FROM - # ProbeSet, ProbeSetFreeze, ProbeSetXRef - # WHERE - # ProbeSet.Id=ProbeSetXRef.ProbeSetId and - # ProbeSetFreeze.Id = ProbeSetXRef.ProbSetFreezeId and - # ProbeSet.Name = %s - # ProbeSetFreeze.Name = %s - # ''', self.name, self.dataset.name) - # #self.cursor.execute(query) - # results = self.fetchone() - # - # return results[0] - - - - def retrieve_sample_data(self, samplelist=None): - if samplelist == None: - samplelist = [] - - results = self.dataset.retrieve_sample_data(self.name) - - # Todo: is this necessary? If not remove - self.data.clear() - - all_samples_ordered = self.dataset.group.all_samples_ordered() - - if results: - for item in results: - name, value, variance, num_cases, name2 = item - if not samplelist or (samplelist and name in samplelist): - self.data[name] = webqtlCaseData(*item) #name, value, variance, num_cases) - - def retrieve_info(self, get_qtl_info=False): - assert self.dataset, "Dataset doesn't exist" - if self.dataset.type == 'Publish': - query = """ - SELECT - PublishXRef.Id, Publication.PubMed_ID, - Phenotype.Pre_publication_description, Phenotype.Post_publication_description, Phenotype.Original_description, - Phenotype.Pre_publication_abbreviation, Phenotype.Post_publication_abbreviation, - Phenotype.Lab_code, Phenotype.Submitter, Phenotype.Owner, Phenotype.Authorized_Users, - Publication.Authors, Publication.Title, Publication.Abstract, - Publication.Journal, Publication.Volume, Publication.Pages, - Publication.Month, Publication.Year, PublishXRef.Sequence, - Phenotype.Units, PublishXRef.comments - FROM - PublishXRef, Publication, Phenotype, PublishFreeze - WHERE - PublishXRef.Id = %s AND - Phenotype.Id = PublishXRef.PhenotypeId AND - Publication.Id = PublishXRef.PublicationId AND - PublishXRef.InbredSetId = PublishFreeze.InbredSetId AND - PublishFreeze.Id = %s - """ % (self.name, self.dataset.id) - - logger.sql(query) - trait_info = g.db.execute(query).fetchone() - - - #XZ, 05/08/2009: Xiaodong add this block to use ProbeSet.Id to find the probeset instead of just using ProbeSet.Name - #XZ, 05/08/2009: to avoid the problem of same probeset name from different platforms. - elif self.dataset.type == 'ProbeSet': - display_fields_string = ', ProbeSet.'.join(self.dataset.display_fields) - display_fields_string = 'ProbeSet.' + display_fields_string - query = """ - SELECT %s - FROM ProbeSet, ProbeSetFreeze, ProbeSetXRef - WHERE - ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id AND - ProbeSetXRef.ProbeSetId = ProbeSet.Id AND - ProbeSetFreeze.Name = '%s' AND - ProbeSet.Name = '%s' - """ % (escape(display_fields_string), - escape(self.dataset.name), - escape(str(self.name))) - logger.sql(query) - trait_info = g.db.execute(query).fetchone() - #XZ, 05/08/2009: We also should use Geno.Id to find marker instead of just using Geno.Name - # to avoid the problem of same marker name from different species. - elif self.dataset.type == 'Geno': - display_fields_string = string.join(self.dataset.display_fields,',Geno.') - display_fields_string = 'Geno.' + display_fields_string - query = """ - SELECT %s - FROM Geno, GenoFreeze, GenoXRef - WHERE - GenoXRef.GenoFreezeId = GenoFreeze.Id AND - GenoXRef.GenoId = Geno.Id AND - GenoFreeze.Name = '%s' AND - Geno.Name = '%s' - """ % (escape(display_fields_string), - escape(self.dataset.name), - escape(self.name)) - logger.sql(query) - trait_info = g.db.execute(query).fetchone() - else: #Temp type - query = """SELECT %s FROM %s WHERE Name = %s""" - logger.sql(query) - trait_info = g.db.execute(query, - (string.join(self.dataset.display_fields,','), - self.dataset.type, self.name)).fetchone() - if trait_info: - self.haveinfo = True - - #XZ: assign SQL query result to trait attributes. - for i, field in enumerate(self.dataset.display_fields): - holder = trait_info[i] - if isinstance(trait_info[i], basestring): - holder = unicode(trait_info[i], "utf8", "ignore") - setattr(self, field, holder) - - if self.dataset.type == 'Publish': - self.confidential = 0 - if self.pre_publication_description and not self.pubmed_id: - self.confidential = 1 - - description = self.post_publication_description - - #If the dataset is confidential and the user has access to confidential - #phenotype traits, then display the pre-publication description instead - #of the post-publication description - if self.confidential: - self.description_display = self.pre_publication_description - - #if not webqtlUtil.hasAccessToConfidentialPhenotypeTrait( - # privilege=self.dataset.privilege, - # userName=self.dataset.userName, - # authorized_users=self.authorized_users): - # - # description = self.pre_publication_description - else: - if description: - self.description_display = description.strip() - else: - self.description_display = "" - - if not self.year.isdigit(): - self.pubmed_text = "N/A" - else: - self.pubmed_text = self.year - - if self.pubmed_id: - self.pubmed_link = webqtlConfig.PUBMEDLINK_URL % self.pubmed_id - - - self.homologeneid = None - if self.dataset.type == 'ProbeSet' and self.dataset.group: - if self.geneid: - #XZ, 05/26/2010: From time to time, this query get error message because some geneid values in database are not number. - #XZ: So I have to test if geneid is number before execute the query. - #XZ: The geneid values in database should be cleaned up. - #try: - # float(self.geneid) - # geneidIsNumber = True - #except ValueError: - # geneidIsNumber = False - #if geneidIsNumber: - query = """ - SELECT - HomologeneId - FROM - Homologene, Species, InbredSet - WHERE - Homologene.GeneId ='%s' AND - InbredSet.Name = '%s' AND - InbredSet.SpeciesId = Species.Id AND - Species.TaxonomyId = Homologene.TaxonomyId - """ % (escape(str(self.geneid)), escape(self.dataset.group.name)) - logger.sql(query) - result = g.db.execute(query).fetchone() - #else: - # result = None - - if result: - self.homologeneid = result[0] - - description_string = unicode(str(self.description).strip(codecs.BOM_UTF8), 'utf-8') - target_string = unicode(str(self.probe_target_description).strip(codecs.BOM_UTF8), 'utf-8') - - if len(description_string) > 1 and description_string != 'None': - description_display = description_string - else: - description_display = self.symbol - - if (len(description_display) > 1 and description_display != 'N/A' and - len(target_string) > 1 and target_string != 'None'): - description_display = description_display + '; ' + target_string.strip() - - # Save it for the jinja2 template - self.description_display = description_display - - #XZ: trait_location_value is used for sorting - self.location_repr = 'N/A' - self.location_value = 1000000 - - if self.chr and self.mb: - #Checks if the chromosome number can be cast to an int (i.e. isn't "X" or "Y") - #This is so we can convert the location to a number used for sorting - trait_location_value = convert_location_to_value(self.chr, self.mb) - #try: - # trait_location_value = int(self.chr)*1000 + self.mb - #except ValueError: - # if self.chr.upper() == 'X': - # trait_location_value = 20*1000 + self.mb - # else: - # trait_location_value = (ord(str(self.chr).upper()[0])*1000 + - # self.mb) - - #ZS: Put this in function currently called "convert_location_to_value" - self.location_repr = 'Chr%s: %.6f' % (self.chr, float(self.mb)) - self.location_value = trait_location_value - - elif self.dataset.type == "Geno": - self.location_repr = 'N/A' - self.location_value = 1000000 - - if self.chr and self.mb: - #Checks if the chromosome number can be cast to an int (i.e. isn't "X" or "Y") - #This is so we can convert the location to a number used for sorting - trait_location_value = convert_location_to_value(self.chr, self.mb) - - #ZS: Put this in function currently called "convert_location_to_value" - self.location_repr = 'Chr%s: %.6f' % (self.chr, float(self.mb)) - self.location_value = trait_location_value - - if get_qtl_info: - #LRS and its location - self.LRS_score_repr = "N/A" - self.LRS_score_value = 0 - self.LRS_location_repr = "N/A" - self.LRS_location_value = 1000000 - if self.dataset.type == 'ProbeSet' and not self.cellid: - query = """ - SELECT - ProbeSetXRef.Locus, ProbeSetXRef.LRS, ProbeSetXRef.pValue, ProbeSetXRef.mean, ProbeSetXRef.additive - FROM - ProbeSetXRef, ProbeSet - WHERE - ProbeSetXRef.ProbeSetId = ProbeSet.Id AND - ProbeSet.Name = "{}" AND - ProbeSetXRef.ProbeSetFreezeId ={} - """.format(self.name, self.dataset.id) - logger.sql(query) - trait_qtl = g.db.execute(query).fetchone() - if trait_qtl: - self.locus, self.lrs, self.pvalue, self.mean, self.additive = trait_qtl - if self.locus: - query = """ - select Geno.Chr, Geno.Mb from Geno, Species - where Species.Name = '{}' and - Geno.Name = '{}' and - Geno.SpeciesId = Species.Id - """.format(self.dataset.group.species, self.locus) - logger.sql(query) - result = g.db.execute(query).fetchone() - if result: - self.locus_chr = result[0] - self.locus_mb = result[1] - else: - self.locus = self.locus_chr = self.locus_mb = self.additive = "" - else: - self.locus = self.locus_chr = self.locus_mb = self.additive = "" - else: - self.locus = self.locus_chr = self.locus_mb = self.lrs = self.pvalue = self.mean = self.additive = "" - - - if self.dataset.type == 'Publish': - query = """ - SELECT - PublishXRef.Locus, PublishXRef.LRS, PublishXRef.additive - FROM - PublishXRef, PublishFreeze - WHERE - PublishXRef.Id = %s AND - PublishXRef.InbredSetId = PublishFreeze.InbredSetId AND - PublishFreeze.Id =%s - """ % (self.name, self.dataset.id) - logger.sql(query) - trait_qtl = g.db.execute(query).fetchone() - if trait_qtl: - self.locus, self.lrs, self.additive = trait_qtl - if self.locus: - query = """ - select Geno.Chr, Geno.Mb from Geno, Species - where Species.Name = '{}' and - Geno.Name = '{}' and - Geno.SpeciesId = Species.Id - """.format(self.dataset.group.species, self.locus) - logger.sql(query) - result = g.db.execute(query).fetchone() - if result: - self.locus_chr = result[0] - self.locus_mb = result[1] - else: - self.locus = self.locus_chr = self.locus_mb = self.additive = "" - else: - self.locus = self.locus_chr = self.locus_mb = self.additive = "" - else: - self.locus = self.lrs = self.additive = "" - - if (self.dataset.type == 'Publish' or self.dataset.type == "ProbeSet") and self.locus_chr != "" and self.locus_mb != "": - #XZ: LRS_location_value is used for sorting - try: - LRS_location_value = int(self.locus_chr)*1000 + float(self.locus_mb) - except: - if self.locus_chr.upper() == 'X': - LRS_location_value = 20*1000 + float(self.locus_mb) - else: - LRS_location_value = ord(str(self.locus_chr).upper()[0])*1000 + float(self.locus_mb) - - self.LRS_location_repr = LRS_location_repr = 'Chr%s: %.6f' % (self.locus_chr, float(self.locus_mb)) - if self.lrs != "": - self.LRS_score_repr = LRS_score_repr = '%3.1f' % self.lrs - self.LRS_score_value = LRS_score_value = self.lrs - else: - raise KeyError, `self.name`+' information is not found in the database.' - - def genHTML(self, formName = "", dispFromDatabase=0, privilege="guest", userName="Guest", authorized_users=""): - if not self.haveinfo: - self.retrieveInfo() - - if self.dataset.type == 'Publish': - PubMedLink = "" - if self.pubmed_id: - PubMedLink = HT.Href(text="PubMed %d : " % self.pubmed_id, - target = "_blank", url = webqtlConfig.PUBMEDLINK_URL % self.pubmed_id) - else: - PubMedLink = HT.Span("Unpublished : ", Class="fs15") - - if formName: - setDescription2 = HT.Href(url="javascript:showDatabase3('%s','%s','%s','')" % - (formName, self.dataset.name, self.name), Class = "fs14") - else: - setDescription2 = HT.Href(url="javascript:showDatabase2('%s','%s','')" % - (self.dataset.name,self.name), Class = "fs14") - - if self.confidential and not webqtlUtil.hasAccessToConfidentialPhenotypeTrait(privilege=privilege, userName=userName, authorized_users=authorized_users): - setDescription2.append('RecordID/%s - %s' % (self.name, self.pre_publication_description)) - else: - setDescription2.append('RecordID/%s - %s' % (self.name, self.post_publication_description)) - - #XZ 03/26/2011: Xiaodong comment out the following two lins as Rob asked. Need to check with Rob why in PublishXRef table, there are few row whose Sequence > 1. - #if self.sequence > 1: - # setDescription2.append(' btach %d' % self.sequence) - if self.authors: - a1 = string.split(self.authors,',')[0] - while a1[0] == '"' or a1[0] == "'" : - a1 = a1[1:] - setDescription2.append(' by ') - setDescription2.append(HT.Italic('%s, and colleagues' % a1)) - setDescription = HT.Span(PubMedLink, setDescription2) - - elif self.dataset.type == 'Temp': - setDescription = HT.Href(text="%s" % (self.description),url="javascript:showDatabase2\ - ('%s','%s','')" % (self.dataset.name,self.name), Class = "fs14") - setDescription = HT.Span(setDescription) - - elif self.dataset.type == 'Geno': # Genome DB only available for single search - if formName: - setDescription = HT.Href(text="Locus %s [Chr %s @ %s Mb]" % (self.name,self.chr,\ - '%2.3f' % self.mb),url="javascript:showDatabase3('%s','%s','%s','')" % \ - (formName, self.dataset.name, self.name), Class = "fs14") - else: - setDescription = HT.Href(text="Locus %s [Chr %s @ %s Mb]" % (self.name,self.chr,\ - '%2.3f' % self.mb),url="javascript:showDatabase2('%s','%s','')" % \ - (self.dataset.name,self.name), Class = "fs14") - - setDescription = HT.Span(setDescription) - - else: - if self.cellid: - if formName: - setDescription = HT.Href(text="ProbeSet/%s/%s" % (self.name, self.cellid),url=\ - "javascript:showDatabase3('%s','%s','%s','%s')" % (formName, self.dataset.name,self.name,self.cellid), \ - Class = "fs14") - else: - setDescription = HT.Href(text="ProbeSet/%s/%s" % (self.name,self.cellid),url=\ - "javascript:showDatabase2('%s','%s','%s')" % (self.dataset.name,self.name,self.cellid), \ - Class = "fs14") - else: - if formName: - setDescription = HT.Href(text="ProbeSet/%s" % self.name, url=\ - "javascript:showDatabase3('%s','%s','%s','')" % (formName, self.dataset.name,self.name), \ - Class = "fs14") - else: - setDescription = HT.Href(text="ProbeSet/%s" % self.name, url=\ - "javascript:showDatabase2('%s','%s','')" % (self.dataset.name,self.name), \ - Class = "fs14") - if self.symbol and self.chr and self.mb: - setDescription.append(' [') - setDescription.append(HT.Italic('%s' % self.symbol,Class="cdg fwb")) - setDescription.append(' on Chr %s @ %s Mb]' % (self.chr,self.mb)) - if self.description: - setDescription.append(': %s' % self.description) - if self.probe_target_description: - setDescription.append('; %s' % self.probe_target_description) - setDescription = HT.Span(setDescription) - - if self.dataset.type != 'Temp' and dispFromDatabase: - setDescription.append( ' --- FROM : ') - setDescription.append(self.dataset.genHTML(Class='cori')) - return setDescription - @property def name_header_fmt(self): '''Return a human-readable name for use in page header''' @@ -763,62 +245,51 @@ class GeneralTrait(object): return fmt - - def get_database(self): - """ - Returns the database, and the url referring to the database if it exists - - We're going to to return two values here, and we don't want to have to call this twice from - the template. So it's not a property called from the template, but instead is called from the view - - """ - if self.cellid: - query = """ select ProbeFreeze.Name from ProbeFreeze, ProbeSetFreeze where - ProbeFreeze.Id = - ProbeSetFreeze.ProbeFreezeId AND - ProbeSetFreeze.Id = %d""" % thisTrait.dataset.id - logger.sql(query) - probeDBName = g.db.execute(query).fetchone()[0] - return dict(name = probeDBName, - url = None) - else: - return dict(name = self.dataset.fullname, - url = webqtlConfig.INFOPAGEHREF % self.dataset.name) - - def calculate_correlation(self, values, method): - """Calculate the correlation value and p value according to the method specified""" - - #ZS: This takes the list of values of the trait our selected trait is being correlated against and removes the values of the samples our trait has no value for - #There's probably a better way of dealing with this, but I'll have to ask Christian - updated_raw_values = [] - updated_values = [] - for i in range(len(values)): - if values[i] != "None": - updated_raw_values.append(self.raw_values[i]) - updated_values.append(values[i]) - - self.raw_values = updated_raw_values - values = updated_values - - if method == METHOD_SAMPLE_PEARSON or method == METHOD_LIT or method == METHOD_TISSUE_PEARSON: - corr, nOverlap = webqtlUtil.calCorrelation(self.raw_values, values, len(values)) - else: - corr, nOverlap = webqtlUtil.calCorrelationRank(self.raw_values, values, len(values)) - - self.correlation = corr - self.overlap = nOverlap - - if self.overlap < 3: - self.p_value = 1.0 - else: - #ZS - This is probably the wrong way to deal with this. Correlation values of 1.0 definitely exist (the trait correlated against itself), so zero division needs to br prevented. - if abs(self.correlation) >= 1.0: - self.p_value = 0.0 - else: - ZValue = 0.5*log((1.0+self.correlation)/(1.0-self.correlation)) - ZValue = ZValue*sqrt(self.overlap-3) - self.p_value = 2.0*(1.0 - reaper.normp(abs(ZValue))) - +# In ProbeSet, there are maybe several annotations match one sequence +# so we need use sequence(BlatSeq) as the identification, when we update +# one annotation, we update the others who match the sequence also. +# +# Hongqiang Li, 3/3/2008 +def getSequence(trait, dataset_name): + dataset = create_dataset(dataset_name) + + if dataset.type == 'ProbeSet': + results = g.db.execute(''' + SELECT + ProbeSet.BlatSeq + FROM + ProbeSet, ProbeSetFreeze, ProbeSetXRef + WHERE + ProbeSet.Id=ProbeSetXRef.ProbeSetId and + ProbeSetFreeze.Id = ProbeSetXRef.ProbSetFreezeId and + ProbeSet.Name = %s + ProbeSetFreeze.Name = %s + ''', trait.name, dataset.name).fetchone() + + return results[0] + +def retrieve_sample_data(trait, dataset_name, samplelist=None): + + dataset = create_dataset(dataset_name) + + if samplelist == None: + samplelist = [] + + results = dataset.retrieve_sample_data(trait.name) + + # Todo: is this necessary? If not remove + trait.data.clear() + + all_samples_ordered = dataset.group.all_samples_ordered() + + if results: + for item in results: + name, value, variance, num_cases, name2 = item + if not samplelist or (samplelist and name in samplelist): + trait.data[name] = webqtlCaseData(*item) #name, value, variance, num_cases) + + return trait + def convert_location_to_value(chromosome, mb): try: location_value = int(chromosome)*1000 + float(mb) @@ -846,3 +317,398 @@ def get_sample_data(): # jsonable_sample_data[sample] = trait_ob.data[sample].value # #return jsonable_sample_data + +def jsonable(trait, dataset_name): + """Return a dict suitable for using as json + + Actual turning into json doesn't happen here though""" + + dataset = create_dataset(dataset_name) + + if dataset.type == "ProbeSet": + return dict(name=trait.name, + symbol=trait.symbol, + dataset=dataset.name, + description=trait.description_display, + mean=trait.mean, + location=trait.location_repr, + lrs_score=trait.LRS_score_repr, + lrs_location=trait.LRS_location_repr, + additive=trait.additive + ) + elif dataset.type == "Publish": + if trait.pubmed_id: + return dict(name=trait.name, + dataset=dataset.name, + description=trait.description_display, + authors=trait.authors, + pubmed_text=trait.pubmed_text, + pubmed_link=trait.pubmed_link, + lrs_score=trait.LRS_score_repr, + lrs_location=trait.LRS_location_repr, + additive=trait.additive + ) + else: + return dict(name=trait.name, + dataset=dataset.name, + description=trait.description_display, + authors=trait.authors, + pubmed_text=trait.pubmed_text, + lrs_score=trait.LRS_score_repr, + lrs_location=trait.LRS_location_repr, + additive=trait.additive + ) + elif dataset.type == "Geno": + return dict(name=trait.name, + dataset=dataset.name, + location=trait.location_repr + ) + else: + return dict() + +def jsonable_table_row(trait, dataset_name, index): + """Return a list suitable for json and intended to be displayed in a table + + Actual turning into json doesn't happen here though""" + + dataset = create_dataset(dataset_name) + + if dataset.type == "ProbeSet": + if trait.mean == "": + mean = "N/A" + else: + mean = "%.3f" % round(float(trait.mean), 2) + if trait.additive == "": + additive = "N/A" + else: + additive = "%.3f" % round(float(trait.additive), 2) + return ['<input type="checkbox" name="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" value="' + user_manager.data_hmac('{}:{}'.format(str(trait.name), dataset.name)) + '">', + index, + '<a href="/show_trait?trait_id='+str(trait.name)+'&dataset='+dataset.name+'">'+str(trait.name)+'</a>', + trait.symbol, + trait.description_display, + trait.location_repr, + mean, + trait.LRS_score_repr, + trait.LRS_location_repr, + additive] + elif dataset.type == "Publish": + if trait.additive == "": + additive = "N/A" + else: + additive = "%.2f" % round(float(trait.additive), 2) + if trait.pubmed_id: + return ['<input type="checkbox" name="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" value="' + user_manager.data_hmac('{}:{}'.format(str(trait.name), dataset.name)) + '">', + index, + '<a href="/show_trait?trait_id='+str(trait.name)+'&dataset='+dataset.name+'">'+str(trait.name)+'</a>', + trait.description_display, + trait.authors, + '<a href="' + trait.pubmed_link + '">' + trait.pubmed_text + '</href>', + trait.LRS_score_repr, + trait.LRS_location_repr, + additive] + else: + return ['<input type="checkbox" name="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" value="' + user_manager.data_hmac('{}:{}'.format(str(trait.name), dataset.name)) + '">', + index, + '<a href="/show_trait?trait_id='+str(trait.name)+'&dataset='+dataset.name+'">'+str(trait.name)+'</a>', + trait.description_display, + trait.authors, + trait.pubmed_text, + trait.LRS_score_repr, + trait.LRS_location_repr, + additive] + elif dataset.type == "Geno": + return ['<input type="checkbox" name="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" value="' + user_manager.data_hmac('{}:{}'.format(str(trait.name), dataset.name)) + '">', + index, + '<a href="/show_trait?trait_id='+str(trait.name)+'&dataset='+dataset.name+'">'+str(trait.name)+'</a>', + trait.location_repr] + else: + return dict() + +def retrieve_trait_info(trait, dataset, get_qtl_info=False): + assert dataset, "Dataset doesn't exist" + + if dataset.type == 'Publish': + query = """ + SELECT + PublishXRef.Id, Publication.PubMed_ID, + Phenotype.Pre_publication_description, Phenotype.Post_publication_description, Phenotype.Original_description, + Phenotype.Pre_publication_abbreviation, Phenotype.Post_publication_abbreviation, + Phenotype.Lab_code, Phenotype.Submitter, Phenotype.Owner, Phenotype.Authorized_Users, + Publication.Authors, Publication.Title, Publication.Abstract, + Publication.Journal, Publication.Volume, Publication.Pages, + Publication.Month, Publication.Year, PublishXRef.Sequence, + Phenotype.Units, PublishXRef.comments + FROM + PublishXRef, Publication, Phenotype, PublishFreeze + WHERE + PublishXRef.Id = %s AND + Phenotype.Id = PublishXRef.PhenotypeId AND + Publication.Id = PublishXRef.PublicationId AND + PublishXRef.InbredSetId = PublishFreeze.InbredSetId AND + PublishFreeze.Id = %s + """ % (trait.name, dataset.id) + + logger.sql(query) + trait_info = g.db.execute(query).fetchone() + + + #XZ, 05/08/2009: Xiaodong add this block to use ProbeSet.Id to find the probeset instead of just using ProbeSet.Name + #XZ, 05/08/2009: to avoid the problem of same probeset name from different platforms. + elif dataset.type == 'ProbeSet': + display_fields_string = ', ProbeSet.'.join(dataset.display_fields) + display_fields_string = 'ProbeSet.' + display_fields_string + query = """ + SELECT %s + FROM ProbeSet, ProbeSetFreeze, ProbeSetXRef + WHERE + ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id AND + ProbeSetXRef.ProbeSetId = ProbeSet.Id AND + ProbeSetFreeze.Name = '%s' AND + ProbeSet.Name = '%s' + """ % (escape(display_fields_string), + escape(dataset.name), + escape(str(trait.name))) + logger.sql(query) + trait_info = g.db.execute(query).fetchone() + #XZ, 05/08/2009: We also should use Geno.Id to find marker instead of just using Geno.Name + # to avoid the problem of same marker name from different species. + elif dataset.type == 'Geno': + display_fields_string = string.join(dataset.display_fields,',Geno.') + display_fields_string = 'Geno.' + display_fields_string + query = """ + SELECT %s + FROM Geno, GenoFreeze, GenoXRef + WHERE + GenoXRef.GenoFreezeId = GenoFreeze.Id AND + GenoXRef.GenoId = Geno.Id AND + GenoFreeze.Name = '%s' AND + Geno.Name = '%s' + """ % (escape(display_fields_string), + escape(dataset.name), + escape(trait.name)) + logger.sql(query) + trait_info = g.db.execute(query).fetchone() + else: #Temp type + query = """SELECT %s FROM %s WHERE Name = %s""" + logger.sql(query) + trait_info = g.db.execute(query, + (string.join(dataset.display_fields,','), + dataset.type, trait.name)).fetchone() + if trait_info: + trait.haveinfo = True + + #XZ: assign SQL query result to trait attributes. + for i, field in enumerate(dataset.display_fields): + holder = trait_info[i] + if isinstance(trait_info[i], basestring): + holder = unicode(trait_info[i], "utf8", "ignore") + setattr(trait, field, holder) + + if dataset.type == 'Publish': + trait.confidential = 0 + if trait.pre_publication_description and not trait.pubmed_id: + trait.confidential = 1 + + description = trait.post_publication_description + + #If the dataset is confidential and the user has access to confidential + #phenotype traits, then display the pre-publication description instead + #of the post-publication description + if trait.confidential: + trait.description_display = trait.pre_publication_description + + #if not webqtlUtil.hasAccessToConfidentialPhenotypeTrait( + # privilege=self.dataset.privilege, + # userName=self.dataset.userName, + # authorized_users=self.authorized_users): + # + # description = self.pre_publication_description + else: + if description: + trait.description_display = description.strip() + else: + trait.description_display = "" + + if not trait.year.isdigit(): + trait.pubmed_text = "N/A" + else: + trait.pubmed_text = trait.year + + if trait.pubmed_id: + trait.pubmed_link = webqtlConfig.PUBMEDLINK_URL % trait.pubmed_id + + + trait.homologeneid = None + if dataset.type == 'ProbeSet' and dataset.group: + if trait.geneid: + #XZ, 05/26/2010: From time to time, this query get error message because some geneid values in database are not number. + #XZ: So I have to test if geneid is number before execute the query. + #XZ: The geneid values in database should be cleaned up. + #try: + # float(self.geneid) + # geneidIsNumber = True + #except ValueError: + # geneidIsNumber = False + #if geneidIsNumber: + query = """ + SELECT + HomologeneId + FROM + Homologene, Species, InbredSet + WHERE + Homologene.GeneId ='%s' AND + InbredSet.Name = '%s' AND + InbredSet.SpeciesId = Species.Id AND + Species.TaxonomyId = Homologene.TaxonomyId + """ % (escape(str(trait.geneid)), escape(dataset.group.name)) + logger.sql(query) + result = g.db.execute(query).fetchone() + #else: + # result = None + + if result: + trait.homologeneid = result[0] + + description_string = unicode(str(trait.description).strip(codecs.BOM_UTF8), 'utf-8') + target_string = unicode(str(trait.probe_target_description).strip(codecs.BOM_UTF8), 'utf-8') + + if len(description_string) > 1 and description_string != 'None': + description_display = description_string + else: + description_display = trait.symbol + + if (len(description_display) > 1 and description_display != 'N/A' and + len(target_string) > 1 and target_string != 'None'): + description_display = description_display + '; ' + target_string.strip() + + # Save it for the jinja2 template + trait.description_display = description_display + + #XZ: trait_location_value is used for sorting + trait.location_repr = 'N/A' + trait.location_value = 1000000 + + if trait.chr and trait.mb: + #Checks if the chromosome number can be cast to an int (i.e. isn't "X" or "Y") + #This is so we can convert the location to a number used for sorting + trait_location_value = convert_location_to_value(trait.chr, trait.mb) + #try: + # trait_location_value = int(self.chr)*1000 + self.mb + #except ValueError: + # if self.chr.upper() == 'X': + # trait_location_value = 20*1000 + self.mb + # else: + # trait_location_value = (ord(str(self.chr).upper()[0])*1000 + + # self.mb) + + #ZS: Put this in function currently called "convert_location_to_value" + trait.location_repr = 'Chr%s: %.6f' % (trait.chr, float(trait.mb)) + trait.location_value = trait_location_value + + elif dataset.type == "Geno": + trait.location_repr = 'N/A' + trait.location_value = 1000000 + + if trait.chr and trait.mb: + #Checks if the chromosome number can be cast to an int (i.e. isn't "X" or "Y") + #This is so we can convert the location to a number used for sorting + trait_location_value = convert_location_to_value(trait.chr, trait.mb) + + #ZS: Put this in function currently called "convert_location_to_value" + trait.location_repr = 'Chr%s: %.6f' % (trait.chr, float(trait.mb)) + trait.location_value = trait_location_value + + if get_qtl_info: + #LRS and its location + trait.LRS_score_repr = "N/A" + trait.LRS_score_value = 0 + trait.LRS_location_repr = "N/A" + trait.LRS_location_value = 1000000 + if dataset.type == 'ProbeSet' and not trait.cellid: + query = """ + SELECT + ProbeSetXRef.Locus, ProbeSetXRef.LRS, ProbeSetXRef.pValue, ProbeSetXRef.mean, ProbeSetXRef.additive + FROM + ProbeSetXRef, ProbeSet + WHERE + ProbeSetXRef.ProbeSetId = ProbeSet.Id AND + ProbeSet.Name = "{}" AND + ProbeSetXRef.ProbeSetFreezeId ={} + """.format(trait.name, dataset.id) + logger.sql(query) + trait_qtl = g.db.execute(query).fetchone() + if trait_qtl: + trait.locus, trait.lrs, trait.pvalue, trait.mean, trait.additive = trait_qtl + if trait.locus: + query = """ + select Geno.Chr, Geno.Mb from Geno, Species + where Species.Name = '{}' and + Geno.Name = '{}' and + Geno.SpeciesId = Species.Id + """.format(dataset.group.species, trait.locus) + logger.sql(query) + result = g.db.execute(query).fetchone() + if result: + trait.locus_chr = result[0] + trait.locus_mb = result[1] + else: + trait.locus = trait.locus_chr = trait.locus_mb = trait.additive = "" + else: + trait.locus = trait.locus_chr = trait.locus_mb = trait.additive = "" + else: + trait.locus = trait.locus_chr = trait.locus_mb = trait.lrs = trait.pvalue = trait.mean = trait.additive = "" + + + if dataset.type == 'Publish': + query = """ + SELECT + PublishXRef.Locus, PublishXRef.LRS, PublishXRef.additive + FROM + PublishXRef, PublishFreeze + WHERE + PublishXRef.Id = %s AND + PublishXRef.InbredSetId = PublishFreeze.InbredSetId AND + PublishFreeze.Id =%s + """ % (trait.name, dataset.id) + logger.sql(query) + trait_qtl = g.db.execute(query).fetchone() + if trait_qtl: + trait.locus, trait.lrs, trait.additive = trait_qtl + if trait.locus: + query = """ + select Geno.Chr, Geno.Mb from Geno, Species + where Species.Name = '{}' and + Geno.Name = '{}' and + Geno.SpeciesId = Species.Id + """.format(dataset.group.species, trait.locus) + logger.sql(query) + result = g.db.execute(query).fetchone() + if result: + trait.locus_chr = result[0] + trait.locus_mb = result[1] + else: + trait.locus = trait.locus_chr = trait.locus_mb = trait.additive = "" + else: + trait.locus = trait.locus_chr = trait.locus_mb = trait.additive = "" + else: + trait.locus = trait.lrs = trait.additive = "" + + if (dataset.type == 'Publish' or dataset.type == "ProbeSet") and trait.locus_chr != "" and trait.locus_mb != "": + #XZ: LRS_location_value is used for sorting + try: + LRS_location_value = int(trait.locus_chr)*1000 + float(trait.locus_mb) + except: + if trait.locus_chr.upper() == 'X': + LRS_location_value = 20*1000 + float(trait.locus_mb) + else: + LRS_location_value = ord(str(trait.locus_chr).upper()[0])*1000 + float(trait.locus_mb) + + trait.LRS_location_repr = LRS_location_repr = 'Chr%s: %.6f' % (trait.locus_chr, float(trait.locus_mb)) + if trait.lrs != "": + trait.LRS_score_repr = LRS_score_repr = '%3.1f' % trait.lrs + trait.LRS_score_value = LRS_score_value = trait.lrs + else: + raise KeyError, `trait.name`+' information is not found in the database.' + + return trait
\ No newline at end of file diff --git a/wqflask/base/webqtlCaseData.py b/wqflask/base/webqtlCaseData.py index 627b2f6c..845a7224 100644 --- a/wqflask/base/webqtlCaseData.py +++ b/wqflask/base/webqtlCaseData.py @@ -44,15 +44,15 @@ class webqtlCaseData(object): def __repr__(self): str = "<webqtlCaseData> " - if self.value != None: + if self.value: str += "value=%2.3f" % self.value - if self.variance != None: + if self.variance: str += " variance=%2.3f" % self.variance - if self.num_cases != None: + if self.num_cases: str += " ndata=%d" % self.num_cases - if self.name != None: + if self.name: str += " name=%s" % self.name - if self.name2 != None: + if self.name2: str += " name2=%s" % self.name2 return str @@ -66,7 +66,7 @@ class webqtlCaseData(object): @property def display_value(self): - if self.value != None: + if self.value: return "%2.3f" % self.value else: return "x" diff --git a/wqflask/maintenance/gen_select_dataset.py b/wqflask/maintenance/gen_select_dataset.py index 542c0d83..e5726656 100644 --- a/wqflask/maintenance/gen_select_dataset.py +++ b/wqflask/maintenance/gen_select_dataset.py @@ -95,13 +95,13 @@ def get_groups(species): for species_name, _species_full_name in species: Cursor.execute("""select InbredSet.Name, InbredSet.FullName from InbredSet, Species, - ProbeFreeze, GenoFreeze, PublishFreeze where Species.Name = %s + ProbeFreeze, GenoFreeze, PublishFreeze where Species.Name = '%s' and InbredSet.SpeciesId = Species.Id and InbredSet.Name != 'BXD300' and (PublishFreeze.InbredSetId = InbredSet.Id or GenoFreeze.InbredSetId = InbredSet.Id or ProbeFreeze.InbredSetId = InbredSet.Id) group by InbredSet.Name - order by InbredSet.Name""", (species_name)) + order by InbredSet.Name""" % species_name) groups[species_name] = list(Cursor.fetchall()) return groups @@ -133,7 +133,7 @@ def get_types(groups): def phenotypes_exist(group_name): #print("group_name:", group_name) Cursor.execute("""select Name from PublishFreeze - where PublishFreeze.Name = %s""", (group_name+"Publish")) + where PublishFreeze.Name = '%s'""" % (group_name+"Publish")) results = Cursor.fetchone() #print("RESULTS:", results) @@ -146,7 +146,7 @@ def phenotypes_exist(group_name): def genotypes_exist(group_name): #print("group_name:", group_name) Cursor.execute("""select Name from GenoFreeze - where GenoFreeze.Name = %s""", (group_name+"Geno")) + where GenoFreeze.Name = '%s'""" % (group_name+"Geno")) results = Cursor.fetchone() #print("RESULTS:", results) @@ -166,13 +166,14 @@ def build_types(species, group): Cursor.execute("""select distinct Tissue.Name from ProbeFreeze, ProbeSetFreeze, InbredSet, Tissue, Species - where Species.Name = %s and Species.Id = InbredSet.SpeciesId and - InbredSet.Name = %s and + where Species.Name = '%s' and Species.Id = InbredSet.SpeciesId and + InbredSet.Name = '%s' and ProbeFreeze.TissueId = Tissue.Id and ProbeFreeze.InbredSetId = InbredSet.Id and ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and - ProbeSetFreeze.public > 0 - order by Tissue.Name""", (species, group)) + ProbeSetFreeze.public > 0 and + ProbeSetFreeze.confidentiality < 1 + order by Tissue.Name""" % (species, group)) results = [] for result in Cursor.fetchall(): @@ -205,12 +206,12 @@ def build_datasets(species, group, type_name): if type_name == "Phenotypes": print("GROUP:", group) Cursor.execute("""select InfoFiles.GN_AccesionId from InfoFiles, PublishFreeze, InbredSet where - InbredSet.Name = %s and + InbredSet.Name = '%s' and PublishFreeze.InbredSetId = InbredSet.Id and InfoFiles.InfoPageName = PublishFreeze.Name and PublishFreeze.public > 0 and PublishFreeze.confidentiality < 1 order by - PublishFreeze.CreateTime desc""", (group)) + PublishFreeze.CreateTime desc""" % group) results = Cursor.fetchone() if results != None: @@ -225,12 +226,12 @@ def build_datasets(species, group, type_name): elif type_name == "Genotypes": Cursor.execute("""select InfoFiles.GN_AccesionId from InfoFiles, GenoFreeze, InbredSet where - InbredSet.Name = %s and + InbredSet.Name = '%s' and GenoFreeze.InbredSetId = InbredSet.Id and InfoFiles.InfoPageName = GenoFreeze.ShortName and GenoFreeze.public > 0 and GenoFreeze.confidentiality < 1 order by - GenoFreeze.CreateTime desc""", (group)) + GenoFreeze.CreateTime desc""" % group) results = Cursor.fetchone() if results != None: @@ -245,12 +246,12 @@ def build_datasets(species, group, type_name): else: Cursor.execute("""select ProbeSetFreeze.Id, ProbeSetFreeze.Name, ProbeSetFreeze.FullName from ProbeSetFreeze, ProbeFreeze, InbredSet, Tissue, Species where - Species.Name = %s and Species.Id = InbredSet.SpeciesId and - InbredSet.Name = %s and - ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and Tissue.Name = %s and + Species.Name = '%s' and Species.Id = InbredSet.SpeciesId and + InbredSet.Name = '%s' and + ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and Tissue.Name = '%s' and ProbeFreeze.TissueId = Tissue.Id and ProbeFreeze.InbredSetId = InbredSet.Id and ProbeSetFreeze.confidentiality < 1 and ProbeSetFreeze.public > 0 order by - ProbeSetFreeze.CreateTime desc""", (species, group, type_name)) + ProbeSetFreeze.CreateTime desc""" % (species, group, type_name)) dataset_results = Cursor.fetchall() datasets = [] diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py index 70ae2a1c..ba555094 100644 --- a/wqflask/wqflask/collect.py +++ b/wqflask/wqflask/collect.py @@ -34,6 +34,7 @@ from utility import Bunch, Struct from utility.formatting import numify from base import trait +from base.data_set import create_dataset def get_collection(): if g.user_session.logged_in: @@ -375,12 +376,13 @@ def view_collection(): for atrait in traits: name, dataset_name = atrait.split(':') - - trait_ob = trait.GeneralTrait(name=name, dataset_name=dataset_name) - trait_ob.retrieve_info(get_qtl_info=True) + dataset = create_dataset(dataset_name) + + trait_ob = trait.GeneralTrait(name=name, dataset=dataset) + trait_ob = trait.retrieve_trait_info(trait_ob, dataset, get_qtl_info=True) trait_obs.append(trait_ob) - json_version.append(trait_ob.jsonable()) + json_version.append(trait.jsonable(trait_ob, dataset_name)) if "uc_id" in params: collection_info = dict(trait_obs=trait_obs, diff --git a/wqflask/wqflask/ctl/ctl_analysis.py b/wqflask/wqflask/ctl/ctl_analysis.py index 7a42b2f8..c6b59ed7 100644 --- a/wqflask/wqflask/ctl/ctl_analysis.py +++ b/wqflask/wqflask/ctl/ctl_analysis.py @@ -120,7 +120,7 @@ class CTL(object): if trait != "": ts = trait.split(':') gt = TRAIT.GeneralTrait(name = ts[0], dataset_name = ts[1]) - gt.retrieve_sample_data(individuals) + gt = TRAIT.retrieve_sample_data(gt, dataset.name, individuals) for ind in individuals: if ind in gt.data.keys(): traits.append(gt.data[ind].value) diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index 64d638b2..e33e04e1 100644 --- a/wqflask/wqflask/gsearch.py +++ b/wqflask/wqflask/gsearch.py @@ -40,6 +40,7 @@ class GSearch(object): AND ( MATCH (ProbeSet.Name,ProbeSet.description,ProbeSet.symbol,alias,GenbankId, UniGeneId, Probe_Target_Description) AGAINST ('%s' IN BOOLEAN MODE) ) AND ProbeSet.Id = ProbeSetXRef.ProbeSetId AND ProbeSetXRef.ProbeSetFreezeId=ProbeSetFreeze.Id + AND ProbeSetFreeze.confidentiality < 1 AND ProbeSetFreeze.public > 0 ORDER BY species_name, inbredset_name, tissue_name, probesetfreeze_name, probeset_name LIMIT 6000 diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index cae6868e..59e100d8 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -16,7 +16,7 @@ from pprint import pformat as pf import json from base.data_set import create_dataset -from base.trait import GeneralTrait +from base import trait from wqflask import parser from wqflask import do_search from utility import webqtlUtil,tools @@ -100,9 +100,9 @@ views.py). #logger.debug("foo locals are:", locals()) trait_id = result[0] - this_trait = GeneralTrait(dataset=self.dataset, name=trait_id, get_qtl_info=True, get_sample_info=False) + this_trait = trait.GeneralTrait(dataset=self.dataset, name=trait_id, get_qtl_info=True, get_sample_info=False) self.trait_list.append(this_trait) - json_trait_list.append(this_trait.jsonable_table_row(index + 1)) + json_trait_list.append(trait.jsonable_table_row(this_trait, self.dataset.name, index + 1)) self.json_trait_list = json.dumps(json_trait_list) diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 8aff5482..091db50f 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -95,7 +95,7 @@ class ShowTrait(object): # this_trait.mysqlid) # heritability = self.cursor.fetchone() - self.dispTraitInformation(kw, "", hddn, self.this_trait) #Display trait information + function buttons + #self.dispTraitInformation(kw, "", hddn, self.this_trait) #Display trait information + function buttons self.build_correlation_tools(self.this_trait) @@ -262,467 +262,6 @@ class ShowTrait(object): logger.debug("allTraitData is:", pf(self.allTraitData)) - def dispTraitInformation(self, args, title1Body, hddn, this_trait): - - self.species_name = webqtlDatabaseFunction.retrieve_species(group=self.dataset.group.name) - - #tbl = HT.TableLite(cellpadding=2, Class="collap", style="margin-left:20px;", width="840", valign="top", id="target1") - - #reset=HT.Input(type='Reset',name='',value=' Reset ',Class="button") - - #XZ, August 02, 2011: The display of icons is decided by the trait type (if trait exists), along with user log-in status. Note that the new submitted trait might not be trait object. - addSelectionButton = "" - verifyButton = "" - rnaseqButton = "" - geneWikiButton = "" - probeButton = "" - similarButton = "" - snpBrowserButton = "" - updateButton = "" - - addSelectionText = "" - verifyText = "" - rnaseqText = "" - geneWikiText = "" - probeText = "" - similarText = "" - snpBrowserText = "" - updateText = "" - - #if webqtlConfig.USERDICT[self.privilege] >= webqtlConfig.USERDICT['user']: - # - # if this_trait==None or this_trait.dataset.type=='Temp': - # updateButton = HT.Href(url="#redirect", onClick="dataEditingFunc(document.getElementsByName('dataInput')[0],'addPublish');") - # updateButton_img = HT.Image("/images/edit_icon.jpg", name="addnew", alt="Add To Publish", title="Add To Publish", style="border:none;") - # updateButton.append(updateButton_img) - # updateText = "Edit" - # elif this_trait.dataset.type != 'Temp': - # if this_trait.dataset.type == 'Publish' and this_trait.confidential: #XZ: confidential phenotype trait - # if webqtlUtil.hasAccessToConfidentialPhenotypeTrait(privilege=self.privilege, userName=self.userName, authorized_users=this_trait.authorized_users): - # updateButton = HT.Href(url="#redirect", onClick="dataEditingFunc(document.getElementsByName('dataInput')[0],'updateRecord');") - # updateButton_img = HT.Image("/images/edit_icon.jpg", name="update", alt="Edit", title="Edit", style="border:none;") - # updateButton.append(updateButton_img) - # updateText = "Edit" - # else: - # updateButton = HT.Href(url="#redirect", onClick="dataEditingFunc(document.getElementsByName('dataInput')[0],'updateRecord');") - # updateButton_img = HT.Image("/images/edit_icon.jpg", name="update", alt="Edit", title="Edit", style="border:none;") - # updateButton.append(updateButton_img) - # updateText = "Edit" - # else: - # pass - - result = g.db.execute("SELECT Name FROM InbredSet WHERE Name=%s", self.dataset.group.name) - if this_trait: - addSelectionButton = HT.Href(url="#redirect", onClick="addRmvSelection('%s', document.getElementsByName('%s')[0], 'addToSelection');" % (self.dataset.group.name, 'dataInput')) - addSelectionButton_img = HT.Image("/images/add_icon.jpg", name="addselect", alt="Add To Collection", title="Add To Collection", style="border:none;") - #addSelectionButton.append(addSelectionButton_img) - addSelectionText = "Add" - elif result.fetchall(): - addSelectionButton = HT.Href(url="#redirect", onClick="dataEditingFunc(document.getElementsByName('%s')[0], 'addRecord');" % ('dataInput')) - addSelectionButton_img = HT.Image("/images/add_icon.jpg", name="", alt="Add To Collection", title="Add To Collection", style="border:none;") - #addSelectionButton.append(addSelectionButton_img) - addSelectionText = "Add" - else: - pass - - - # Microarray database information to display - if this_trait and this_trait.dataset and this_trait.dataset.type == 'ProbeSet': #before, this line was only reached if this_trait != 0, but now we need to check - try: - hddn['GeneId'] = int(string.strip(this_trait.geneid)) - except: - pass - - #Info2Disp = HT.Paragraph() - - #XZ: Gene Symbol - if this_trait.symbol: - #XZ: Show SNP Browser only for mouse - if self.species_name == 'mouse': - geneName = g.db.execute("SELECT geneSymbol FROM GeneList WHERE geneSymbol = %s", this_trait.symbol).fetchone() - if geneName: - snpurl = os.path.join(webqtlConfig.CGIDIR, "main.py?FormID=SnpBrowserResultPage&submitStatus=1&diffAlleles=True&customStrain=True") + "&geneName=%s" % geneName[0] - else: - if this_trait.chr and this_trait.mb: - snpurl = os.path.join(webqtlConfig.CGIDIR, "main.py?FormID=SnpBrowserResultPage&submitStatus=1&diffAlleles=True&customStrain=True") + \ - "&chr=%s&start=%2.6f&end=%2.6f" % (this_trait.chr, this_trait.mb-0.002, this_trait.mb+0.002) - else: - snpurl = "" - - if snpurl: - snpBrowserButton = HT.Href(url="#redirect", onClick="openNewWin('%s')" % snpurl) - snpBrowserButton_img = HT.Image("/images/snp_icon.jpg", name="snpbrowser", alt=" View SNPs and Indels ", title=" View SNPs and Indels ", style="border:none;") - snpBrowserText = "SNPs" - - #XZ: Show GeneWiki for all species - geneWikiButton = HT.Href(url="#redirect", onClick="openNewWin('%s')" % (os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE) + "?FormID=geneWiki&symbol=%s" % this_trait.symbol)) - geneWikiButton_img = HT.Image("/images/genewiki_icon.jpg", name="genewiki", alt=" Write or review comments about this gene ", title=" Write or review comments about this gene ", style="border:none;") - geneWikiText = 'GeneWiki' - - #XZ: display similar traits in other selected datasets - if this_trait and this_trait.dataset and this_trait.dataset.type=="ProbeSet" and this_trait.symbol: - if self.species_name in ("mouse", "rat", "human"): - similarUrl = "%s?cmd=sch&gene=%s&alias=1&species=%s" % (os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), this_trait.symbol, self.species_name) - similarButton = HT.Href(url="#redirect", onClick="openNewWin('%s')" % similarUrl) - similarButton_img = HT.Image("/images/find_icon.jpg", name="similar", alt=" Find similar expression data ", title=" Find similar expression data ", style="border:none;") - similarText = "Find" - else: - pass - else: - tbl.append(HT.TR( - HT.TD('Gene Symbol: ', Class="fwb fs13", valign="top", nowrap="on"), - HT.TD(width=10, valign="top"), - HT.TD(HT.Span('Not available', Class="fs13 fsI"), valign="top") - )) - - - - ##display Verify Location button - try: - blatsequence = this_trait.blatseq - if not blatsequence: - #XZ, 06/03/2009: ProbeSet name is not unique among platforms. We should use ProbeSet Id instead. - self.cursor.execute("""SELECT Probe.Sequence, Probe.Name - FROM Probe, ProbeSet, ProbeSetFreeze, ProbeSetXRef - WHERE ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id AND - ProbeSetXRef.ProbeSetId = ProbeSet.Id AND - ProbeSetFreeze.Name = '%s' AND - ProbeSet.Name = '%s' AND - Probe.ProbeSetId = ProbeSet.Id order by Probe.SerialOrder""" % (this_trait.dataset.name, this_trait.name) ) - seqs = self.cursor.fetchall() - if not seqs: - raise ValueError - else: - blatsequence = '' - for seqt in seqs: - if int(seqt[1][-1]) % 2 == 1: - blatsequence += string.strip(seqt[0])## NEEDED FOR UCSC GENOME BROWSER LINK - - #--------Hongqiang add this part in order to not only blat ProbeSet, but also blat Probe - blatsequence = '%3E'+this_trait.name+'%0A'+blatsequence+'%0A' - #XZ, 06/03/2009: ProbeSet name is not unique among platforms. We should use ProbeSet Id instead. - query = """SELECT Probe.Sequence, Probe.Name - FROM Probe, ProbeSet, ProbeSetFreeze, ProbeSetXRef - WHERE ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id AND - ProbeSetXRef.ProbeSetId = ProbeSet.Id AND - ProbeSetFreeze.Name = '{}' AND - ProbeSet.Name = '{}' AND - Probe.ProbeSetId = ProbeSet.Id order by Probe.SerialOrder""".format(this_trait.dataset.name, this_trait.name) - - logger.sql(query) - seqs = g.db.execute(query).fetchall() - - for seqt in seqs: - if int(seqt[1][-1]) %2 == 1: - blatsequence += '%3EProbe_'+string.strip(seqt[1])+'%0A'+string.strip(seqt[0])+'%0A' - - #XZ: Pay attention to the parameter of version (rn, mm, hg). They need to be changed if necessary. - if self.species_name == "rat": - self.UCSC_BLAT_URL = webqtlConfig.UCSC_BLAT % ('rat', 'rn3', blatsequence) - self.UTHSC_BLAT_URL = "" - elif self.species_name == "mouse": - self.UCSC_BLAT_URL = webqtlConfig.UCSC_BLAT % ('mouse', 'mm9', blatsequence) - self.UTHSC_BLAT_URL = webqtlConfig.UTHSC_BLAT % ('mouse', 'mm9', blatsequence) - elif self.species_name == "human": - self.UCSC_BLAT_URL = webqtlConfig.UCSC_BLAT % ('human', 'hg19', blatsequence) - self.UTHSC_BLAT_URL = "" - else: - self.UCSC_BLAT_URL = "" - self.UTHSC_BLAT_URL = "" - - if self.UCSC_BLAT_URL != "": - verifyButton = HT.Href(url="#", onClick="javascript:openNewWin('%s'); return false;" % UCSC_BLAT_URL) - verifyButtonImg = HT.Image("/images/verify_icon.jpg", name="verify", alt=" Check probe locations at UCSC ", - title=" Check probe locations at UCSC ", style="border:none;") - verifyButton.append(verifyButtonImg) - verifyText = 'Verify' - if self.UTHSC_BLAT_URL != "": - rnaseqButton = HT.Href(url="#", onClick="javascript:openNewWin('%s'); return false;" % UTHSC_BLAT_URL) - rnaseqButtonImg = HT.Image("/images/rnaseq_icon.jpg", name="rnaseq", alt=" View probes, SNPs, and RNA-seq at UTHSC ", - title=" View probes, SNPs, and RNA-seq at UTHSC ", style="border:none;") - rnaseqButton.append(rnaseqButtonImg) - rnaseqText = 'RNA-seq' - tSpan.append(HT.BR()) - except: - pass - - #Display probe information (if any) - if this_trait.dataset.name.find('Liver') >= 0 and this_trait.dataset.name.find('F2') < 0: - pass - else: - query = """SELECT count(*) - FROM Probe, ProbeSet - WHERE ProbeSet.Name = '%s' AND Probe.ProbeSetId = ProbeSet.Id""" % (this_trait.name) - #query database for number of probes associated with trait; if count > 0, set probe tool button and text - logger.sql(query) - probeResult = g.db.execute(query).fetchone() - if probeResult[0] > 0: - self.show_probes = "True" - probeurl = "%s?FormID=showProbeInfo&database=%s&ProbeSetID=%s&CellID=%s&group=%s&incparentsf1=ON" \ - % (os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), this_trait.dataset, this_trait.name, this_trait.cellid, self.dataset.group.name) - probeButton = HT.Href(url="#", onClick="javascript:openNewWin('%s'); return false;" % probeurl) - probeButton_img = HT.Image("/images/probe_icon.jpg", name="probe", alt=" Check sequence of probes ", title=" Check sequence of probes ", style="border:none;") - #probeButton.append(probeButton_img) - probeText = "Probes" - - this_trait.species = self.species_name # We need this in the template, so we tuck it into this_trait - this_trait.database = this_trait.get_database() - - #XZ: ID links - if this_trait.genbankid or this_trait.geneid or this_trait.unigeneid or this_trait.omim or this_trait.homologeneid: - idStyle = "background:#dddddd;padding:2" - tSpan = HT.Span(Class="fs13") - if this_trait.geneid: - gurl = HT.Href(text= 'Gene', target='_blank',\ - url=webqtlConfig.NCBI_LOCUSID % this_trait.geneid, Class="fs14 fwn", title="Info from NCBI Entrez Gene") - #tSpan.append(HT.Span(gurl, style=idStyle), " "*2) - if this_trait.omim: - gurl = HT.Href(text= 'OMIM', target='_blank', \ - url= webqtlConfig.OMIM_ID % this_trait.omim,Class="fs14 fwn", title="Summary from On Mendelian Inheritance in Man") - #tSpan.append(HT.Span(gurl, style=idStyle), " "*2) - if this_trait.unigeneid: - try: - gurl = HT.Href(text= 'UniGene',target='_blank',\ - url= webqtlConfig.UNIGEN_ID % tuple(string.split(this_trait.unigeneid,'.')[:2]),Class="fs14 fwn", title="UniGene ID") - #tSpan.append(HT.Span(gurl, style=idStyle), " "*2) - except: - pass - if this_trait.genbankid: - this_trait.genbankid = '|'.join(this_trait.genbankid.split('|')[0:10]) - if this_trait.genbankid[-1]=='|': - this_trait.genbankid=this_trait.genbankid[0:-1] - gurl = HT.Href(text= 'GenBank', target='_blank', \ - url= webqtlConfig.GENBANK_ID % this_trait.genbankid,Class="fs14 fwn", title="Find the original GenBank sequence used to design the probes") - #tSpan.append(HT.Span(gurl, style=idStyle), " "*2) - if this_trait.homologeneid: - hurl = HT.Href(text= 'HomoloGene', target='_blank',\ - url=webqtlConfig.HOMOLOGENE_ID % this_trait.homologeneid, Class="fs14 fwn", title="Find similar genes in other species") - #tSpan.append(HT.Span(hurl, style=idStyle), " "*2) - - #XZ: Resource Links: - if this_trait.symbol: - #XZ,12/26/2008: Gene symbol may contain single quotation mark. - #For example, Affymetrix, mouse430v2, 1440338_at, the symbol is 2'-Pde (geneid 211948) - #I debug this by using double quotation marks. - if self.species_name == "rat": - result = g.db.execute("SELECT kgID, chromosome,txStart,txEnd FROM GeneList_rn33 WHERE geneSymbol = %s", (this_trait.symbol)).fetchone() - if result != None: - kgId, chr, txst, txen = result[0], result[1], result[2], result[3] - if chr and txst and txen and kgId: - txst = int(txst*1000000) - txen = int(txen*1000000) - if self.species_name == "mouse": - logger.debug("this_trait.symbol:", this_trait.symbol) - result = g.db.execute("SELECT chromosome,txStart,txEnd FROM GeneList WHERE geneSymbol = %s", (this_trait.symbol)).fetchone() - if result != None: - this_chr, txst, txen = result[0], result[1], result[2] - if this_chr and txst and txen and this_trait.refseq_transcriptid : - txst = int(txst*1000000) - txen = int(txen*1000000) - ## NEEDED FOR UCSC GENOME BROWSER LINK - - #XZ, 7/16/2009: The url for SymAtlas (renamed as BioGPS) has changed. We don't need this any more - #tSpan.append(HT.Span(HT.Href(text= 'SymAtlas',target="mainFrame",\ - # url="http://symatlas.gnf.org/SymAtlas/bioentry?querytext=%s&query=14&species=%s&type=Expression" \ - # % (this_trait.symbol,symatlas_species),Class="fs14 fwn", \ - # title="Expression across many tissues and cell types"), style=linkStyle), " "*2) - if this_trait.geneid and (self.species_name == "mouse" or self.species_name == "rat" or self.species_name == "human"): - #tSpan.append(HT.Span(HT.Href(text= 'BioGPS',target="mainFrame",\ - # url="http://biogps.gnf.org/?org=%s#goto=genereport&id=%s" \ - # % (self.species_name, this_trait.geneid),Class="fs14 fwn", \ - # title="Expression across many tissues and cell types"), style=linkStyle), " "*2) - pass - #tSpan.append(HT.Span(HT.Href(text= 'STRING',target="mainFrame",\ - # url="http://string.embl.de/newstring_cgi/show_link_summary.pl?identifier=%s" \ - # % this_trait.symbol,Class="fs14 fwn", \ - # title="Protein interactions: known and inferred"), style=linkStyle), " "*2) - if this_trait.symbol: - #ZS: The "species scientific" converts the plain English species names we're using to their scientific names, which are needed for PANTHER's input - #We should probably use the scientific name along with the English name (if not instead of) elsewhere as well, given potential non-English speaking users - if self.species_name == "mouse": - species_scientific = "Mus%20musculus" - elif self.species_name == "rat": - species_scientific = "Rattus%20norvegicus" - elif self.species_name == "human": - species_scientific = "Homo%20sapiens" - elif self.species_name == "drosophila": - species_scientific = "Drosophila%20melanogaster" - else: - species_scientific = "all" - - species_scientific - #tSpan.append(HT.Span(HT.Href(text= 'PANTHER',target="mainFrame", \ - # url="http://www.pantherdb.org/genes/geneList.do?searchType=basic&fieldName=all&organism=%s&listType=1&fieldValue=%s" \ - # % (species_scientific, this_trait.symbol),Class="fs14 fwn", \ - # title="Gene and protein data resources from Celera-ABI"), style=linkStyle), " "*2) - else: - pass - #tSpan.append(HT.Span(HT.Href(text= 'BIND',target="mainFrame",\ - # url="http://bind.ca/?textquery=%s" \ - # % this_trait.symbol,Class="fs14 fwn", \ - # title="Protein interactions"), style=linkStyle), " "*2) - #if this_trait.geneid and (self.species_name == "mouse" or self.species_name == "rat" or self.species_name == "human"): - # tSpan.append(HT.Span(HT.Href(text= 'Gemma',target="mainFrame",\ - # url="http://www.chibi.ubc.ca/Gemma/gene/showGene.html?ncbiid=%s" \ - # % this_trait.geneid, Class="fs14 fwn", \ - # title="Meta-analysis of gene expression data"), style=linkStyle), " "*2) - #tSpan.append(HT.Span(HT.Href(text= 'SynDB',target="mainFrame",\ - # url="http://lily.uthsc.edu:8080/20091027_GNInterfaces/20091027_redirectSynDB.jsp?query=%s" \ - # % this_trait.symbol, Class="fs14 fwn", \ - # title="Brain synapse database"), style=linkStyle), " "*2) - #if self.species_name == "mouse": - # tSpan.append(HT.Span(HT.Href(text= 'ABA',target="mainFrame",\ - # url="http://mouse.brain-map.org/brain/%s.html" \ - # % this_trait.symbol, Class="fs14 fwn", \ - # title="Allen Brain Atlas"), style=linkStyle), " "*2) - - if this_trait.geneid: - #if self.species_name == "mouse": - # tSpan.append(HT.Span(HT.Href(text= 'ABA',target="mainFrame",\ - # url="http://www.brain-map.org/search.do?queryText=egeneid=%s" \ - # % this_trait.geneid, Class="fs14 fwn", \ - # title="Allen Brain Atlas"), style=linkStyle), " "*2) - if self.species_name == "human": - #tSpan.append(HT.Span(HT.Href(text= 'ABA',target="mainFrame",\ - # url="http://humancortex.alleninstitute.org/has/human/imageseries/search/1.html?searchSym=t&searchAlt=t&searchName=t&gene_term=&entrez_term=%s" \ - # % this_trait.geneid, Class="fs14 fwn", \ - # title="Allen Brain Atlas"), style=linkStyle), " "*2) - pass - - #for zhou mi's cliques, need to be removed - #if self.database[:6] == 'BXDMic' and self.ProbeSetID in cliqueID: - # Info2Disp.append(HT.Strong('Clique Search: '),HT.Href(text='Search',\ - # url ="http://compbio1.utmem.edu/clique_go/results.php?pid=%s&pval_1=0&pval_2=0.001" \ - # % self.ProbeSetID,target='_blank',Class="normalsize"),HT.BR()) - - elif this_trait and this_trait.dataset and this_trait.dataset.type =='Publish': #Check if trait is phenotype - - #if this_trait.confidential: - # pass - # #tbl.append(HT.TR( - # # HT.TD('Pre-publication Phenotype: ', Class="fs13 fwb", valign="top", nowrap="on", width=90), - # # HT.TD(width=10, valign="top"), - # # HT.TD(HT.Span(this_trait.pre_publication_description, Class="fs13"), valign="top", width=740) - # # )) - # if webqtlUtil.hasAccessToConfidentialPhenotypeTrait(privilege=self.privilege, userName=self.userName, authorized_users=this_trait.authorized_users): - # #tbl.append(HT.TR( - # # HT.TD('Post-publication Phenotype: ', Class="fs13 fwb", valign="top", nowrap="on", width=90), - # # HT.TD(width=10, valign="top"), - # # HT.TD(HT.Span(this_trait.post_publication_description, Class="fs13"), valign="top", width=740) - # # )) - # #tbl.append(HT.TR( - # # HT.TD('Pre-publication Abbreviation: ', Class="fs13 fwb", valign="top", nowrap="on", width=90), - # # HT.TD(width=10, valign="top"), - # # HT.TD(HT.Span(this_trait.pre_publication_abbreviation, Class="fs13"), valign="top", width=740) - # # )) - # #tbl.append(HT.TR( - # # HT.TD('Post-publication Abbreviation: ', Class="fs13 fwb", valign="top", nowrap="on", width=90), - # # HT.TD(width=10, valign="top"), - # # HT.TD(HT.Span(this_trait.post_publication_abbreviation, Class="fs13"), valign="top", width=740) - # # )) - # #tbl.append(HT.TR( - # # HT.TD('Lab code: ', Class="fs13 fwb", valign="top", nowrap="on", width=90), - # # HT.TD(width=10, valign="top"), - # # HT.TD(HT.Span(this_trait.lab_code, Class="fs13"), valign="top", width=740) - # # )) - # pass - # #tbl.append(HT.TR( - # # HT.TD('Owner: ', Class="fs13 fwb", valign="top", nowrap="on", width=90), - # # HT.TD(width=10, valign="top"), - # # HT.TD(HT.Span(this_trait.owner, Class="fs13"), valign="top", width=740) - # # )) - #else: - # pass - # #tbl.append(HT.TR( - # # HT.TD('Phenotype: ', Class="fs13 fwb", valign="top", nowrap="on", width=90), - # # HT.TD(width=10, valign="top"), - # # HT.TD(HT.Span(this_trait.post_publication_description, Class="fs13"), valign="top", width=740) - # # )) - ##tbl.append(HT.TR( - ## HT.TD('Authors: ', Class="fs13 fwb", - ## valign="top", nowrap="on", width=90), - ## HT.TD(width=10, valign="top"), - ## HT.TD(HT.Span(this_trait.authors, Class="fs13"), - ## valign="top", width=740) - ## )) - ##tbl.append(HT.TR( - ## HT.TD('Title: ', Class="fs13 fwb", - ## valign="top", nowrap="on", width=90), - ## HT.TD(width=10, valign="top"), - ## HT.TD(HT.Span(this_trait.title, Class="fs13"), - ## valign="top", width=740) - ## )) - if this_trait.journal: - journal = this_trait.journal - if this_trait.year: - journal = this_trait.journal + " (%s)" % this_trait.year - # - #tbl.append(HT.TR( - # HT.TD('Journal: ', Class="fs13 fwb", - # valign="top", nowrap="on", width=90), - # HT.TD(width=10, valign="top"), - # HT.TD(HT.Span(journal, Class="fs13"), - # valign="top", width=740) - # )) - PubMedLink = "" - if this_trait.pubmed_id: - PubMedLink = webqtlConfig.PUBMEDLINK_URL % this_trait.pubmed_id - if PubMedLink: - #tbl.append(HT.TR( - # HT.TD('Link: ', Class="fs13 fwb", - # valign="top", nowrap="on", width=90), - # HT.TD(width=10, valign="top"), - # HT.TD(HT.Span(HT.Href(url=PubMedLink, text="PubMed",target='_blank',Class="fs14 fwn"), - # style = "background:#cddcff;padding:2"), valign="top", width=740) - # )) - pass - - elif this_trait and this_trait.dataset and this_trait.dataset.type == 'Geno': #Check if trait is genotype - - if this_trait.chr and this_trait.mb: - location = ' Chr %s @ %s Mb' % (this_trait.chr,this_trait.mb) - else: - location = "not available" - - #if this_trait.sequence and len(this_trait.sequence) > 100: - # if self.species_name == "rat": - # UCSC_BLAT_URL = webqtlConfig.UCSC_BLAT % ('rat', 'rn3', this_trait.sequence) - # UTHSC_BLAT_URL = webqtlConfig.UTHSC_BLAT % ('rat', 'rn3', this_trait.sequence) - # elif self.species_name == "mouse": - # UCSC_BLAT_URL = webqtlConfig.UCSC_BLAT % ('mouse', 'mm9', this_trait.sequence) - # UTHSC_BLAT_URL = webqtlConfig.UTHSC_BLAT % ('mouse', 'mm9', this_trait.sequence) - # elif self.species_name == "human": - # UCSC_BLAT_URL = webqtlConfig.UCSC_BLAT % ('human', 'hg19', blatsequence) - # UTHSC_BLAT_URL = webqtlConfig.UTHSC_BLAT % ('human', 'hg19', this_trait.sequence) - # else: - # UCSC_BLAT_URL = "" - # UTHSC_BLAT_URL = "" - # if UCSC_BLAT_URL: - # #verifyButton = HT.Href(url="#", onClick="openNewWin('%s')" % UCSC_BLAT_URL) - # verifyButton = HT.Href(url="#") - # verifyButtonImg = HT.Image("/images/verify_icon.jpg", name="verify", alt=" Check probe locations at UCSC ", title=" Check probe locations at UCSC ", style="border:none;") - # verifyButton.append(verifyButtonImg) - # verifyText = "Verify" - # rnaseqButton = HT.Href(url="#", onClick="openNewWin('%s')" % UTHSC_BLAT_URL) - # rnaseqButtonImg = HT.Image("/images/rnaseq_icon.jpg", name="rnaseq", alt=" View probes, SNPs, and RNA-seq at UTHSC ", title=" View probes, SNPs, and RNA-seq at UTHSC ", style="border:none;") - # rnaseqButton.append(rnaseqButtonImg) - # rnaseqText = "RNA-seq" - - #tbl.append(HT.TR( - # HT.TD('Location: ', Class="fs13 fwb", - # valign="top", nowrap="on", width=90), - # HT.TD(width=10, valign="top"), - # HT.TD(HT.Span(location, Class="fs13"), valign="top", width=740) - # ), - # HT.TR( - # HT.TD('SNP Search: ', Class="fs13 fwb", - # valign="top", nowrap="on", width=90), - # HT.TD(width=10, valign="top"), - # HT.TD(HT.Href("http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=snp&cmd=search&term=%s" % this_trait.name, 'NCBI',Class="fs13"), - # valign="top", width=740) - # )) - - def dispBasicStatistics(self, fd, this_trait): #XZ, June 22, 2011: The definition and usage of primary_samples, other_samples, specialStrains, all_samples are not clear and hard to understand. But since they are only used in this function for draw graph purpose, they will not hurt the business logic outside. As of June 21, 2011, this function seems work fine, so no hurry to clean up. These parameters and code in this function should be cleaned along with fd.f1list, fd.parlist, fd.samplelist later. diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json index d3db1853..dc0af7d0 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json +++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json @@ -117,14 +117,14 @@ "Barley1 Leaf MAS 5.0 SCRI (Dec06)" ], [ - "125", - "B30_K_1206_R", - "Barley1 Leaf gcRMA SCRI (Dec06)" - ], - [ "126", "B30_K_1206_Rn", "Barley1 Leaf gcRMAn SCRI (Dec06)" + ], + [ + "125", + "B30_K_1206_R", + "Barley1 Leaf gcRMA SCRI (Dec06)" ] ], "Phenotypes": [ @@ -1340,14 +1340,14 @@ "GSE9588 Human Liver Normal (Mar11) Both Sexes" ], [ - "384", - "HLCF_0311", - "GSE9588 Human Liver Normal (Mar11) Females" - ], - [ "383", "HLCM_0311", "GSE9588 Human Liver Normal (Mar11) Males" + ], + [ + "384", + "HLCF_0311", + "GSE9588 Human Liver Normal (Mar11) Females" ] ], "Phenotypes": [ @@ -1526,14 +1526,14 @@ "NCI Mammary LMT miRNA v2 (Apr09) RMA" ], [ - "36", - "MA_M_0704_M", - "NCI Mammary mRNA M430 (July04) MAS5" - ], - [ "37", "MA_M_0704_R", "NCI Mammary mRNA M430 (July04) RMA" + ], + [ + "36", + "MA_M_0704_M", + "NCI Mammary mRNA M430 (July04) MAS5" ] ] }, @@ -1591,14 +1591,14 @@ ], "Liver mRNA": [ [ - "38", - "LVF2_M_0704_M", - "(B6 x BTBR)F2-ob/ob Liver mRNA M430 (Jul04) MAS5" - ], - [ "39", "LVF2_M_0704_R", "(B6 x BTBR)F2-ob/ob Liver mRNA M430 (Jul04) RMA" + ], + [ + "38", + "LVF2_M_0704_M", + "(B6 x BTBR)F2-ob/ob Liver mRNA M430 (Jul04) MAS5" ] ], "Phenotypes": [ @@ -1616,23 +1616,11 @@ "B6D2Publish", "B6D2 Published Phenotypes" ] - ], - "Retina mRNA": [ - [ - "803", - "UTHSC_mm9_B6D2_Ret_0916", - "UTHSC B6D2 Retina Affy MoGene 1.0ST (Sep16) Gene Level RMA" - ] ] }, "B6D2F2": { "Brain mRNA": [ [ - "78", - "BRF2_M_0805_P", - "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) PDNN" - ], - [ "77", "BRF2_M_0805_R", "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) RMA" @@ -1643,19 +1631,24 @@ "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) MAS5" ], [ + "78", + "BRF2_M_0805_P", + "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) PDNN" + ], + [ "33", "BRF2_M_0304_P", "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) PDNN" ], [ - "31", - "BRF2_M_0304_M", - "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) MAS5" - ], - [ "32", "BRF2_M_0304_R", "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) RMA" + ], + [ + "31", + "BRF2_M_0304_M", + "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) MAS5" ] ], "Genotypes": [ @@ -1683,6 +1676,23 @@ ] }, "B6D2RI": { + "Hippocampus mRNA": [ + [ + "712", + "UTHSC_BXDAged_0615", + "UTHSC BXD Aged Hippocampus Affy Mouse Gene 1.0 ST (Jun15) RMA" + ], + [ + "805", + "UTHSC_BXDAgedEx_1116", + "UTHSC BXD Aged Hippocampus Affy Mouse Gene 1.0 ST (Jun15) Exon Level RMA" + ], + [ + "391", + "UTHSC_B6D2RI_H_0912", + "UTHSC B6D2RI Aged Hippocampus Affy Mouse Gene 1.0 ST (Sep12) RMA" + ] + ], "Phenotypes": [ [ "None", @@ -1717,6 +1727,11 @@ ], "Striatum mRNA": [ [ + "84", + "SA_M2_0905_R", + "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) RMA" + ], + [ "83", "SA_M2_0905_M", "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) MAS5" @@ -1725,27 +1740,22 @@ "85", "SA_M2_0905_P", "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) PDNN" - ], - [ - "84", - "SA_M2_0905_R", - "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) RMA" ] ] }, "BHF2": { "Adipose mRNA": [ [ - "197", - "UCLA_BHF2_ADIPOSE_FEMALE", - "UCLA BHF2 Adipose Female mlratio" - ], - [ "196", "UCLA_BHF2_ADIPOSE_MALE", "UCLA BHF2 Adipose Male mlratio" ], [ + "197", + "UCLA_BHF2_ADIPOSE_FEMALE", + "UCLA BHF2 Adipose Female mlratio" + ], + [ "165", "UCLA_BHF2_ADIPOSE_0605", "UCLA BHF2 Adipose (June05) mlratio" @@ -1753,16 +1763,16 @@ ], "Brain mRNA": [ [ - "199", - "UCLA_BHF2_BRAIN_FEMALE", - "UCLA BHF2 Brain Female mlratio" - ], - [ "198", "UCLA_BHF2_BRAIN_MALE", "UCLA BHF2 Brain Male mlratio" ], [ + "199", + "UCLA_BHF2_BRAIN_FEMALE", + "UCLA BHF2 Brain Female mlratio" + ], + [ "166", "UCLA_BHF2_BRAIN_0605", "UCLA BHF2 Brain (June05) mlratio" @@ -1777,16 +1787,16 @@ ], "Liver mRNA": [ [ - "201", - "UCLA_BHF2_LIVER_FEMALE", - "UCLA BHF2 Liver Female mlratio" - ], - [ "200", "UCLA_BHF2_LIVER_MALE", "UCLA BHF2 Liver Male mlratio" ], [ + "201", + "UCLA_BHF2_LIVER_FEMALE", + "UCLA BHF2 Liver Female mlratio" + ], + [ "167", "UCLA_BHF2_LIVER_0605", "UCLA BHF2 Liver (June05) mlratio" @@ -1990,11 +2000,6 @@ "UTHSC Brain mRNA U74Av2 (Nov05) PDNN" ], [ - "81", - "BR_U_0805_P", - "UTHSC Brain mRNA U74Av2 (Aug05) PDNN" - ], - [ "80", "BR_U_0805_M", "UTHSC Brain mRNA U74Av2 (Aug05) MAS5" @@ -2005,6 +2010,11 @@ "UTHSC Brain mRNA U74Av2 (Aug05) RMA" ], [ + "81", + "BR_U_0805_P", + "UTHSC Brain mRNA U74Av2 (Aug05) PDNN" + ], + [ "42", "CB_M_0204_P", "INIA Brain mRNA M430 (Feb04) PDNN" @@ -2071,11 +2081,6 @@ "Eye M430v2 WT Gpnmb (Sep08) RMA" ], [ - "382", - "Eye_M2_0908_WTWT", - "Eye M430v2 WT WT (Sep08) RMA" - ], - [ "279", "Eye_M2_0908_R_WT", "Eye M430v2 WT Tyrp1 (Sep08) RMA" @@ -2086,6 +2091,11 @@ "Eye M430v2 Mutant Tyrp1 (Sep08) RMA" ], [ + "382", + "Eye_M2_0908_WTWT", + "Eye M430v2 WT WT (Sep08) RMA" + ], + [ "400", "DBA2J-ONH-1212", "Howell et al. 2011, DBA/2J Glaucoma Optic Nerve Head M430 2.0 (Dec12) RMA" @@ -2322,16 +2332,16 @@ ], "Kidney mRNA": [ [ - "240", - "MA_M2M_0706_R", - "Mouse kidney M430v2 Male (Aug06) RMA" - ], - [ "239", "MA_M2F_0706_R", "Mouse kidney M430v2 Female (Aug06) RMA" ], [ + "240", + "MA_M2M_0706_R", + "Mouse kidney M430v2 Male (Aug06) RMA" + ], + [ "118", "MA_M2_0806_R", "Mouse kidney M430v2 Sex Balanced (Aug06) RMA" @@ -2342,14 +2352,14 @@ "Mouse Kidney M430v2 Sex Balanced (Aug06) PDNN" ], [ - "115", - "MA_M2_0706_R", - "Mouse Kidney M430v2 (Jul06) RMA" - ], - [ "116", "MA_M2_0706_P", "Mouse Kidney M430v2 (Jul06) PDNN" + ], + [ + "115", + "MA_M2_0706_R", + "Mouse Kidney M430v2 (Jul06) RMA" ] ], "Liver Metabolome": [ @@ -2418,8 +2428,23 @@ ], "Liver mRNA": [ [ + "430", + "EPFLMouseLiverRMA0413", + "EPFL/LISP BXD CD+HFD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" + ], + [ + "431", + "EPFLMouseLiverHFDRMA0413", + "EPFL/LISP BXD HFD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" + ], + [ + "432", + "EPFLMouseLiverCDRMA0413", + "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" + ], + [ "700", - "UT-VGX_HGL1014", + "UTHSC-VGX_MmBXDHepatocytesRMA1014", "UT-VGX Hepatocytes Affy Mouse Gene 1.0 ST Gene Level (Oct14) RMA" ], [ @@ -2441,21 +2466,6 @@ "702", "SUH_Liv_RMAEx_0611", "SUH BXD Liver CCl4-treated Affy Mouse Gene 1.0 ST Exon Level (Jun11) RMA" - ], - [ - "430", - "EPFLMouseLiverRMA0413", - "EPFL/LISP BXD CD+HFD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" - ], - [ - "431", - "EPFLMouseLiverHFDRMA0413", - "EPFL/LISP BXD HFD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" - ], - [ - "432", - "EPFLMouseLiverCDRMA0413", - "EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA" ] ], "Lung mRNA": [ @@ -2479,21 +2489,6 @@ ], "Muscle mRNA": [ [ - "395", - "EPFLMouseMuscleRMA_Ex1112", - "EPFL/LISP BXD CD+HFD Muscle Affy Mouse Gene 1.0 ST (Nov12) RMA Exon Level" - ], - [ - "396", - "EPFLMouseMuscleHFDRMAEx1112", - "EPFL/LISP BXD HFD Muscle Affy Mouse Gene 1.0 ST (Nov12) RMA Exon Level" - ], - [ - "397", - "EPFLMouseMuscleCDRMAEx1112", - "EPFL/LISP BXD CD Muscle Affy Mouse Gene 1.0 ST (Nov12) RMA Exon Level" - ], - [ "378", "EPFLMouseMuscleRMA1211", "EPFL/LISP BXD CD+HFD Muscle Affy Mouse Gene 1.0 ST (Dec11) RMA" @@ -2507,20 +2502,35 @@ "379", "EPFLMouseMuscleCDRMA1211", "EPFL/LISP BXD CD Muscle Affy Mouse Gene 1.0 ST (Dec11) RMA" + ], + [ + "395", + "EPFLMouseMuscleRMA_Ex1112", + "EPFL/LISP BXD CD+HFD Muscle Affy Mouse Gene 1.0 ST (Nov12) RMA Exon Level" + ], + [ + "396", + "EPFLMouseMuscleHFDRMAEx1112", + "EPFL/LISP BXD HFD Muscle Affy Mouse Gene 1.0 ST (Nov12) RMA Exon Level" + ], + [ + "397", + "EPFLMouseMuscleCDRMAEx1112", + "EPFL/LISP BXD CD Muscle Affy Mouse Gene 1.0 ST (Nov12) RMA Exon Level" ] ], "Neocortex mRNA": [ [ - "374", - "DevNeocortex_ILM6.2P3RInv_1111", - "BIDMC/UTHSC Dev Neocortex P3 ILMv6.2 (Nov11) RankInv" - ], - [ "375", "DevNeocortex_ILM6.2P14RInv_1111", "BIDMC/UTHSC Dev Neocortex P14 ILMv6.2 (Nov11) RankInv" ], [ + "374", + "DevNeocortex_ILM6.2P3RInv_1111", + "BIDMC/UTHSC Dev Neocortex P3 ILMv6.2 (Nov11) RankInv" + ], + [ "284", "HQFNeoc_1210v2_RankInv", "HQF BXD Neocortex ILM6v1.1 (Dec10v2) RankInv" @@ -2536,14 +2546,14 @@ "HQF BXD Neocortex ILM6v1.1 (Feb08) RankInv" ], [ - "275", - "DevNeocortex_ILM6.2P14RInv_1110", - "BIDMC/UTHSC Dev Neocortex P14 ILMv6.2 (Nov10) RankInv" - ], - [ "274", "DevNeocortex_ILM6.2P3RInv_1110", "BIDMC/UTHSC Dev Neocortex P3 ILMv6.2 (Nov10) RankInv" + ], + [ + "275", + "DevNeocortex_ILM6.2P14RInv_1110", + "BIDMC/UTHSC Dev Neocortex P14 ILMv6.2 (Nov10) RankInv" ] ], "Nucleus Accumbens mRNA": [ @@ -2751,6 +2761,11 @@ ], "Ventral Tegmental Area mRNA": [ [ + "229", + "VCUEtOH_0609_R", + "VCU BXD VTA EtOH M430 2.0 (Jun09) RMA" + ], + [ "228", "VCUSal_0609_R", "VCU BXD VTA Sal M430 2.0 (Jun09) RMA" @@ -2759,11 +2774,15 @@ "230", "VCUEtvsSal_0609_R", "VCU BXD VTA Et vs Sal M430 2.0 (Jun09) RMA" - ], + ] + ] + }, + "BXD-Bone": { + "Phenotypes": [ [ - "229", - "VCUEtOH_0609_R", - "VCU BXD VTA EtOH M430 2.0 (Jun09) RMA" + "None", + "BXD-BonePublish", + "BXD-Bone Published Phenotypes" ] ] }, @@ -2959,14 +2978,14 @@ ], "Hippocampus mRNA": [ [ - "99", - "HC_M2CB_1205_P", - "Hippocampus Consortium M430v2 CXB (Dec05) PDNN" - ], - [ "100", "HC_M2CB_1205_R", "Hippocampus Consortium M430v2 CXB (Dec05) RMA" + ], + [ + "99", + "HC_M2CB_1205_P", + "Hippocampus Consortium M430v2 CXB (Dec05) PDNN" ] ], "Phenotypes": [ @@ -3033,6 +3052,16 @@ ], "Hippocampus mRNA": [ [ + "219", + "Illum_LXS_Hipp_NON_1008", + "Hippocampus Illumina NON (Oct08) RankInv beta" + ], + [ + "212", + "Illum_LXS_Hipp_RSE_1008", + "Hippocampus Illumina RSE (Oct08) RankInv beta" + ], + [ "214", "Illum_LXS_Hipp_NOE_1008", "Hippocampus Illumina NOE (Oct08) RankInv beta" @@ -3048,16 +3077,6 @@ "Hippocampus Illumina NOS (Oct08) RankInv beta" ], [ - "219", - "Illum_LXS_Hipp_NON_1008", - "Hippocampus Illumina NON (Oct08) RankInv beta" - ], - [ - "212", - "Illum_LXS_Hipp_RSE_1008", - "Hippocampus Illumina RSE (Oct08) RankInv beta" - ], - [ "143", "Illum_LXS_Hipp_loess0807", "Hippocampus Illumina (Aug07) LOESS" @@ -3148,14 +3167,14 @@ ], "Hippocampus mRNA": [ [ - "272", - "HC_M2_0606_MDP", - "Hippocampus Consortium M430v2 (Jun06) RMA MDP" - ], - [ "273", "UMUTAffyExon_0209_RMA_MDP", "UMUTAffy Hippocampus Exon (Feb09) RMA MDP" + ], + [ + "272", + "HC_M2_0606_MDP", + "Hippocampus Consortium M430v2 (Jun06) RMA MDP" ] ], "Liver mRNA": [ @@ -3524,6 +3543,10 @@ "BXD" ], [ + "BXD-Bone", + "BXD Bone" + ], + [ "BXH", "BXH" ], @@ -4387,10 +4410,6 @@ [ "Phenotypes", "Phenotypes" - ], - [ - "Retina mRNA", - "Retina mRNA" ] ], "B6D2F2": [ @@ -4417,6 +4436,10 @@ [ "Phenotypes", "Phenotypes" + ], + [ + "Hippocampus mRNA", + "Hippocampus mRNA" ] ], "BDF2-1999": [ @@ -4621,6 +4644,12 @@ "Ventral Tegmental Area mRNA" ] ], + "BXD-Bone": [ + [ + "Phenotypes", + "Phenotypes" + ] + ], "BXH": [ [ "Phenotypes", diff --git a/wqflask/wqflask/static/new/javascript/loadings_plot.js b/wqflask/wqflask/static/new/javascript/loadings_plot.js index 5bc901ec..c44288c0 100644 --- a/wqflask/wqflask/static/new/javascript/loadings_plot.js +++ b/wqflask/wqflask/static/new/javascript/loadings_plot.js @@ -1,4 +1,4 @@ -var margin = {top: 20, right: 60, bottom: 60, left: 60} +var margin = {top: 20, right: 70, bottom: 60, left: 60} , width = 960 - margin.left - margin.right , height = 500 - margin.top - margin.bottom; @@ -29,7 +29,7 @@ var xAxis = d3.svg.axis() main.append('g') .attr('transform', 'translate(0,' + height + ')') - .attr('class', 'main axis date') + .attr('class', 'x axis') .call(xAxis); chart.append("text") @@ -38,6 +38,7 @@ chart.append("text") .attr("x", 550) .attr("y", 480) .style("font-size", 14) + .style("fill", "blue") .text("Factor (1)"); chart.append("text") @@ -48,6 +49,7 @@ chart.append("text") .attr("dy", ".75em") .attr("transform", "rotate(-90)") .style("font-size", 14) + .style("fill", "blue") .text("Factor (2)"); // draw the y axis @@ -57,9 +59,17 @@ var yAxis = d3.svg.axis() main.append('g') .attr('transform', 'translate(0,0)') - .attr('class', 'main axis date') + .attr('class', 'y axis') .call(yAxis); +chart.select('.x.axis') + .selectAll("text") + .style("font-size","14px"); + +chart.select('.y.axis') + .selectAll("text") + .style("font-size","14px"); + var g = main.append("svg:g"); g.selectAll("scatter-dots") @@ -84,7 +94,8 @@ g.selectAll("scatter-dots") .attr("x", function(d, i) { return x(d[1][0]); }) .attr("y", function(d) { return y(d[1][1]); }) .text(function(d) { return d[0]; }) - .style("fill", "blue"); + .style("font-size", 12) + .style("fill", "blue"); g.selectAll("scatter-lines") .data(loadings) diff --git a/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css b/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css index 6540d01f..be82d5df 100644 --- a/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css +++ b/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css @@ -20,8 +20,14 @@ table.dataTable tfoot th { } table.dataTable thead th, table.dataTable thead td { - padding: 10px 18px 10px 0px; - border-bottom: 1px solid #111; + font: bold 12px/18px Arial, Sans-serif; + color: #000000; + background-color: #ffffff; + border-collapse: collapse; + border-bottom: #cccccc 2px solid; + padding: 0; + //padding: 10px 18px 10px 0px; + //border-bottom: 1px solid #111; } table.dataTable thead th:active, table.dataTable thead td:active { diff --git a/wqflask/wqflask/static/packages/bootstrap/css/bootstrap.css b/wqflask/wqflask/static/packages/bootstrap/css/bootstrap.css index 2c20f635..91aaa98f 100644 --- a/wqflask/wqflask/static/packages/bootstrap/css/bootstrap.css +++ b/wqflask/wqflask/static/packages/bootstrap/css/bootstrap.css @@ -2088,7 +2088,7 @@ th { border-top: 1px solid #ddd; } .table > thead > tr > th { - vertical-align: bottom; + vertical-align: middle; border-bottom: 2px solid #ddd; } .table > caption + thead > tr:first-child > th, diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index 8b8a9057..097d0d2c 100644 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -42,9 +42,9 @@ <th data-export="Description" style="background-color: #eeeeee;">Description</th> <th data-export="Location" style="background-color: #eeeeee;">Location</th> <th data-export="Mean" style="background-color: #eeeeee;">Mean</th> - <th data-export="Max LRS" style="background-color: #eeeeee;">Max <br>LRS<a href="http://genenetwork.org/glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th data-export="Max LRS" style="background-color: #eeeeee;">Max LRS<a href="http://genenetwork.org/glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> <th data-export="Max LRS Location" style="background-color: #eeeeee;">Max LRS Location</th> - <th data-export="Additive Effect" style="background-color: #eeeeee;">Additive<br>Effect<a href="http://genenetwork.org/glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th data-export="Additive Effect" style="background-color: #eeeeee;">Additive Effect<a href="http://genenetwork.org/glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> </tr> </thead> <tbody> diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index f8565042..5d0c38a3 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -1,10 +1,8 @@ {% extends "base.html" %} {% block title %}Search Results{% endblock %} {% block css %} - <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/jquery.dataTables.min.css" /> + <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/css/jquery.dataTables.css" /> <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/scroller.dataTables.min.css"> - <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/dataTables.fixedHeader.css" > - <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/fixedcolumns/3.0.4/css/dataTables.fixedColumns.css"> {% endblock %} {% block content %} <!-- Start of body --> @@ -85,9 +83,9 @@ <th style="background-color: #eeeeee;"></th> {% for header in header_fields %} {% if header == 'Max LRS' %} - <th data-export="Max LRS" style="background-color: #eeeeee; text-align: right;">Max<br>LRS</th> + <th data-export="Max LRS" style="background-color: #eeeeee; text-align: right;">Max LRS</th> {% elif header == 'Additive Effect' %} - <th data-export="Additive Effect" style="background-color: #eeeeee; text-align: right;">Additive<br>Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th data-export="Additive Effect" style="background-color: #eeeeee; text-align: right;">Additive Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> {% else %} <th data-export="{{header}}" style="background-color: #eeeeee;">{{header}}</th> {% endif %} @@ -222,7 +220,7 @@ "iDisplayLength": -1, "deferRender": true, "bSortClasses": false, - "scrollY": true, + "scrollY": "600px", "scrollCollapse": false, "scroller": true, "paging": false @@ -277,7 +275,7 @@ "autoWidth": false, "deferRender": true, "bSortClasses": false, - "scrollY": true, + "scrollY": "600px", "scrollCollapse": true, "scroller": true, "paging": false @@ -311,7 +309,7 @@ "autoWidth": false, "deferRender": true, "bSortClasses": false, - "scrollY": true, + "scrollY": "600px", "scrollCollapse": true, "scroller": true, "paging": false |