diff options
author | zsloan | 2017-02-06 20:01:03 +0000 |
---|---|---|
committer | zsloan | 2017-02-06 20:01:03 +0000 |
commit | f2e3407585862581b82680e8521b1e4d944f558a (patch) | |
tree | d18789ed1c375bb5b36d2f067534b5b92def89d6 | |
parent | e63c4014e7bc34b440707be19af3779b72102fdb (diff) | |
download | genenetwork2-f2e3407585862581b82680e8521b1e4d944f558a.tar.gz |
Fixed appearance of several tables (search, mapping results, sample data)
Temporarily removed second sample table for CFW traits
Fixed location of global search bar to work with wider screens
24 files changed, 404 insertions, 894 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 94b38e13..30c8e996 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -273,6 +273,7 @@ class DatasetGroup(object): self.get_f1_parent_strains() self.accession_id = self.get_accession_id() + self.mapping_id, self.mapping_names = self.get_mapping_methods() self.species = webqtlDatabaseFunction.retrieve_species(self.name) @@ -295,6 +296,20 @@ class DatasetGroup(object): else: return "None" + def get_mapping_methods(self): + + mapping_id = g.db.execute("select MappingMethodId from InbredSet where Name= '%s'" % self.name).fetchone()[0] + if mapping_id == "1": + mapping_names = ["QTLReaper", "PYLMM", "R/qtl"] + elif mapping_id == "2": + mapping_names = ["GEMMA"] + elif mapping_id == "4": + mapping_names = ["PLINK"] + else: + mapping_names = [] + + return mapping_id, mapping_names + def get_specified_markers(self, markers = []): self.markers = HumanMarkers(self.name, markers) @@ -317,69 +332,6 @@ class DatasetGroup(object): self.markers = marker_class(self.name) - def datasets(self): - key = "group_dataset_menu:v2:" + self.name - logger.debug("key is2:", key) - dataset_menu = [] - logger.debug("[tape4] webqtlConfig.PUBLICTHRESH:", webqtlConfig.PUBLICTHRESH) - logger.debug("[tape4] type webqtlConfig.PUBLICTHRESH:", type(webqtlConfig.PUBLICTHRESH)) - the_results = fetchall(''' - (SELECT '#PublishFreeze',PublishFreeze.FullName,PublishFreeze.Name - FROM PublishFreeze,InbredSet - WHERE PublishFreeze.InbredSetId = InbredSet.Id - and InbredSet.Name = '%s' - and PublishFreeze.public > %s) - UNION - (SELECT '#GenoFreeze',GenoFreeze.FullName,GenoFreeze.Name - FROM GenoFreeze, InbredSet - WHERE GenoFreeze.InbredSetId = InbredSet.Id - and InbredSet.Name = '%s' - and GenoFreeze.public > %s) - UNION - (SELECT Tissue.Name, ProbeSetFreeze.FullName,ProbeSetFreeze.Name - FROM ProbeSetFreeze, ProbeFreeze, InbredSet, Tissue - WHERE ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id - and ProbeFreeze.TissueId = Tissue.Id - and ProbeFreeze.InbredSetId = InbredSet.Id - and InbredSet.Name like %s - and ProbeSetFreeze.public > %s - ORDER BY Tissue.Name, ProbeSetFreeze.CreateTime desc, ProbeSetFreeze.AvgId) - ''' % (self.name, webqtlConfig.PUBLICTHRESH, - self.name, webqtlConfig.PUBLICTHRESH, - "'" + self.name + "'", webqtlConfig.PUBLICTHRESH)) - - #for tissue_name, dataset in itertools.groupby(the_results, itemgetter(0)): - for dataset_item in the_results: - tissue_name = dataset_item[0] - dataset = dataset_item[1] - dataset_short = dataset_item[2] - if tissue_name in ['#PublishFreeze', '#GenoFreeze']: - dataset_menu.append(dict(tissue=None, datasets=[(dataset, dataset_short)])) - else: - dataset_sub_menu = [item[1:] for item in dataset] - - tissue_already_exists = False - tissue_position = None - for i, tissue_dict in enumerate(dataset_menu): - if tissue_dict['tissue'] == tissue_name: - tissue_already_exists = True - tissue_position = i - break - - if tissue_already_exists: - #logger.debug("dataset_menu:", dataset_menu[i]['datasets']) - dataset_menu[i]['datasets'].append((dataset, dataset_short)) - else: - dataset_menu.append(dict(tissue=tissue_name, - datasets=[(dataset, dataset_short)])) - - if USE_REDIS: - Redis.set(key, pickle.dumps(dataset_menu, pickle.HIGHEST_PROTOCOL)) - Redis.expire(key, 60*5) - self._datasets = dataset_menu - - return self._datasets - def get_f1_parent_strains(self): try: # NL, 07/27/2010. ParInfo has been moved from webqtlForm.py to webqtlUtil.py; @@ -456,6 +408,71 @@ class DatasetGroup(object): return genotype +def datasets(group_name, this_group = None): + key = "group_dataset_menu:v2:" + group_name + logger.debug("key is2:", key) + dataset_menu = [] + logger.debug("[tape4] webqtlConfig.PUBLICTHRESH:", webqtlConfig.PUBLICTHRESH) + logger.debug("[tape4] type webqtlConfig.PUBLICTHRESH:", type(webqtlConfig.PUBLICTHRESH)) + the_results = fetchall(''' + (SELECT '#PublishFreeze',PublishFreeze.FullName,PublishFreeze.Name + FROM PublishFreeze,InbredSet + WHERE PublishFreeze.InbredSetId = InbredSet.Id + and InbredSet.Name = '%s' + and PublishFreeze.public > %s) + UNION + (SELECT '#GenoFreeze',GenoFreeze.FullName,GenoFreeze.Name + FROM GenoFreeze, InbredSet + WHERE GenoFreeze.InbredSetId = InbredSet.Id + and InbredSet.Name = '%s' + and GenoFreeze.public > %s) + UNION + (SELECT Tissue.Name, ProbeSetFreeze.FullName,ProbeSetFreeze.Name + FROM ProbeSetFreeze, ProbeFreeze, InbredSet, Tissue + WHERE ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id + and ProbeFreeze.TissueId = Tissue.Id + and ProbeFreeze.InbredSetId = InbredSet.Id + and InbredSet.Name like %s + and ProbeSetFreeze.public > %s + ORDER BY Tissue.Name, ProbeSetFreeze.CreateTime desc, ProbeSetFreeze.AvgId) + ''' % (group_name, webqtlConfig.PUBLICTHRESH, + group_name, webqtlConfig.PUBLICTHRESH, + "'" + group_name + "'", webqtlConfig.PUBLICTHRESH)) + + #for tissue_name, dataset in itertools.groupby(the_results, itemgetter(0)): + for dataset_item in the_results: + tissue_name = dataset_item[0] + dataset = dataset_item[1] + dataset_short = dataset_item[2] + if tissue_name in ['#PublishFreeze', '#GenoFreeze']: + dataset_menu.append(dict(tissue=None, datasets=[(dataset, dataset_short)])) + else: + dataset_sub_menu = [item[1:] for item in dataset] + + tissue_already_exists = False + tissue_position = None + for i, tissue_dict in enumerate(dataset_menu): + if tissue_dict['tissue'] == tissue_name: + tissue_already_exists = True + tissue_position = i + break + + if tissue_already_exists: + #logger.debug("dataset_menu:", dataset_menu[i]['datasets']) + dataset_menu[i]['datasets'].append((dataset, dataset_short)) + else: + dataset_menu.append(dict(tissue=tissue_name, + datasets=[(dataset, dataset_short)])) + + if USE_REDIS: + Redis.set(key, pickle.dumps(dataset_menu, pickle.HIGHEST_PROTOCOL)) + Redis.expire(key, 60*5) + + if this_group != None: + this_group._datasets = dataset_menu + return this_group._datasets + else: + return dataset_menu class DataSet(object): """ diff --git a/wqflask/utility/helper_functions.py b/wqflask/utility/helper_functions.py index 377f6b26..cf16879f 100644 --- a/wqflask/utility/helper_functions.py +++ b/wqflask/utility/helper_functions.py @@ -5,6 +5,9 @@ from base import data_set from base.species import TheSpecies from wqflask import user_manager + +from flask import Flask, g + import logging logger = logging.getLogger(__name__ ) @@ -41,3 +44,20 @@ def get_trait_db_obs(self, trait_db_list): name=trait_name, cellid=None) self.trait_list.append((trait_ob, dataset_ob)) + +def get_species_groups(): + + species_query = "SELECT SpeciesId, MenuName FROM Species" + species_ids_and_names = g.db.execute(species_query).fetchall() + + species_and_groups = [] + for species_id, species_name in species_ids_and_names: + this_species_groups = {} + this_species_groups['species'] = species_name + groups_query = "SELECT InbredSetName FROM InbredSet WHERE SpeciesId = %s" % (species_id) + groups = [group[0] for group in g.db.execute(groups_query).fetchall()] + + this_species_groups['groups'] = groups + species_and_groups.append(this_species_groups) + + return species_and_groups diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py index 8db9ac6e..c28c617a 100644 --- a/wqflask/utility/tools.py +++ b/wqflask/utility/tools.py @@ -212,6 +212,7 @@ USE_REDIS = get_setting_bool('USE_REDIS') USE_GN_SERVER = get_setting_bool('USE_GN_SERVER') GENENETWORK_FILES = get_setting('GENENETWORK_FILES') +TEMP_TRAITS = get_setting('TEMP_TRAITS') PYLMM_COMMAND = pylmm_command() GEMMA_COMMAND = gemma_command() diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py index 9ff431a2..814ffb30 100644 --- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py +++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py @@ -986,9 +986,25 @@ class MarkerRegression(object): except: return + previous_chr = 1 + previous_chr_as_int = 0 + if self.plotScale == "physic": + this_chr = str(self.ChrList[self.selectedChr][0]) + else: + this_chr = str(self.ChrList[self.selectedChr][1]+1) + # for i, qtlresult in enumerate(self.qtlresults): + # if Chr == this_chr: + # if Mb < self.startMb or Mb > self.endMb: + # return + # else: + # locPixel = xLeftOffset + (Mb-self.startMb)*plotXScale + # break + # elif self.selectedChr == -1: + # if str(qtlresult['chr']) != Chr: + if self.plotScale == 'physic': if self.selectedChr > -1: - if self.genotype[0].name != Chr or Mb < self.startMb or Mb > self.endMb: + if this_chr != Chr or Mb < self.startMb or Mb > self.endMb: return else: locPixel = xLeftOffset + (Mb-self.startMb)*plotXScale @@ -2019,6 +2035,8 @@ class MarkerRegression(object): AdditiveCoordXY = [] DominanceCoordXY = [] + symbolFont = pid.Font(ttf="fnt_bs", size=5,bold=0) #ZS: For Manhattan Plot + previous_chr = 1 previous_chr_as_int = 0 lineWidth = 1 @@ -2122,7 +2140,7 @@ class MarkerRegression(object): # Yc = yZero - qtlresult['lrs_value']*LRSHeightThresh/LRS_LOD_Max if self.manhattan_plot == True: - canvas.drawEllipse(Xc-1, Yc-1, Xc+1, Yc+1, fillColor=pid.black) + canvas.drawString("5", Xc-canvas.stringWidth("5",font=symbolFont)/2+1,Yc+2,color=pid.black, font=symbolFont) else: LRSCoordXY.append((Xc, Yc)) diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 13ae933f..3e145e40 100644 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -48,60 +48,23 @@ class ShowTrait(object): helper_functions.get_species_dataset_trait(self, kw) else: self.temp_trait = True - self.create_temp_trait() + self.trait_vals = kw['trait_paste'].split() + self.temp_group = kw['group'] + self.temp_species = kw['species'] + #self.create_temp_trait() #self.dataset.group.read_genotype_file() - # Todo: Add back in the ones we actually need from below, as we discover we need them - hddn = OrderedDict() - - ## Some fields, like method, are defaulted to None; otherwise in IE the field can't be changed using jquery - #hddn = OrderedDict( - # FormID = fmID, - # group = fd.group, - # submitID = '', - # scale = 'physic', - # additiveCheck = 'ON', - # showSNP = 'ON', - # showGenes = 'ON', - # method = None, - # parentsf14regression = 'OFF', - # stats_method = '1', - # chromosomes = '-1', - # topten = '', - # viewLegend = 'ON', - # intervalAnalystCheck = 'ON', - # valsHidden = 'OFF', - # database = '', - # criteria = None, - # MDPChoice = None, - # bootCheck = None, - # permCheck = None, - # applyVarianceSE = None, - # sampleNames = '_', - # sampleVals = '_', - # sampleVars = '_', - # otherStrainNames = '_', - # otherStrainVals = '_', - # otherStrainVars = '_', - # extra_attributes = '_', - # other_extra_attributes = '_', - # export_data = None - # ) - #if this_trait: # if this_trait.dataset and this_trait.dataset.type and this_trait.dataset.type == 'ProbeSet': # self.cursor.execute("SELECT h2 from ProbeSetXRef WHERE DataId = %d" % # this_trait.mysqlid) # heritability = self.cursor.fetchone() - #self.dispTraitInformation(kw, "", hddn, self.this_trait) #Display trait information + function buttons - - self.build_correlation_tools(self.this_trait) + self.build_correlation_tools() #Get nearest marker for composite mapping - logger.debug("self.dataset.type:", self.dataset.type) if hasattr(self.this_trait, 'locus_chr') and self.this_trait.locus_chr != "" and self.dataset.type != "Geno" and self.dataset.type != "Publish": self.nearest_marker = get_nearest_marker(self.this_trait, self.dataset) #self.nearest_marker1 = get_nearest_marker(self.this_trait, self.dataset)[0] @@ -113,6 +76,9 @@ class ShowTrait(object): self.make_sample_lists(self.this_trait) + # Todo: Add back in the ones we actually need from below, as we discover we need them + hddn = OrderedDict() + if self.dataset.group.allsamples: hddn['allsamples'] = string.join(self.dataset.group.allsamples, ' ') @@ -147,7 +113,6 @@ class ShowTrait(object): else: self.sample_group_types['samples_primary'] = self.dataset.group.name sample_lists = [group.sample_list for group in self.sample_groups] - # logger.debug("sample_lists is:", pf(sample_lists)) self.get_mapping_methods() @@ -183,275 +148,11 @@ class ShowTrait(object): self.use_pylmm_rqtl = check_pylmm_rqtl() - def read_data(self, include_f1=False): - '''read user input data or from trait data and analysis form''' - - #if incf1 == None: - # incf1 = [] - - #if not self.genotype: - # self.dataset.read_genotype_file() - if not samplelist: - if include_f1: - samplelist = self.f1list + self.samplelist - else: - samplelist = self.samplelist - - traitfiledata = getattr(self, "traitfile", None) - traitpastedata = getattr(self, "traitpaste", None) - variancefiledata = getattr(self, "variancefile", None) - variancepastedata = getattr(self, "variancepaste", None) - Nfiledata = getattr(self, "Nfile", None) - - #### Todo: Rewrite below when we get to someone submitting their own trait ##### - - def to_float(item): - try: - return float(item) - except ValueError: - return None - - logger.debug("bottle samplelist is:", samplelist) - if traitfiledata: - tt = traitfiledata.split() - values = map(webqtlUtil.StringAsFloat, tt) - elif traitpastedata: - tt = traitpastedata.split() - values = map(webqtlUtil.StringAsFloat, tt) - else: - logger.debug("mapping formdataasfloat") - #values = map(self.FormDataAsFloat, samplelist) - values = [to_float(getattr(self, key)) for key in samplelist] - logger.debug("rocket values is:", values) - - - if len(values) < len(samplelist): - values += [None] * (len(samplelist) - len(values)) - elif len(values) > len(samplelist): - values = values[:len(samplelist)] - logger.debug("now values is:", values) - - - if variancefiledata: - tt = variancefiledata.split() - variances = map(webqtlUtil.StringAsFloat, tt) - elif variancepastedata: - tt = variancepastedata.split() - variances = map(webqtlUtil.StringAsFloat, tt) - else: - variances = map(self.FormVarianceAsFloat, samplelist) - - if len(variances) < len(samplelist): - variances += [None]*(len(samplelist) - len(variances)) - elif len(variances) > len(samplelist): - variances = variances[:len(samplelist)] - - if Nfiledata: - tt = string.split(Nfiledata) - nsamples = map(webqtlUtil.IntAsFloat, tt) - if len(nsamples) < len(samplelist): - nsamples += [None]*(len(samplelist) - len(nsamples)) - else: - nsamples = map(self.FormNAsFloat, samplelist) - - ##values, variances, nsamples is obsolete - self.allTraitData = {} - for i, _sample in enumerate(samplelist): - if values[i] != None: - self.allTraitData[_sample] = webqtlCaseData( - _sample, values[i], variances[i], nsamples[i]) - logger.debug("allTraitData is:", pf(self.allTraitData)) - - - 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. - - # This should still be riset here - Sam - Nov. 2012 - if fd.genotype.type == "riset": - samplelist = fd.f1list + fd.samplelist - else: - samplelist = fd.f1list + fd.parlist + fd.samplelist - - other_samples = [] #XZ: sample that is not of primary group - specialStrains = [] #XZ: This might be replaced by other_samples / ZS: It is just other samples without parent/f1 samples. - all_samples = [] - primary_samples = [] #XZ: sample of primary group, e.g., BXD, LXS - - #self.MDP_menu = HT.Select(name='stats_mdp', Class='stats_mdp') - self.MDP_menu = [] # We're going to use the same named data structure as in the old version - # but repurpose it for Jinja2 as an array - - for sample in this_trait.data.keys(): - sampleName = sample.replace("_2nd_", "") - if sample not in samplelist: - if this_trait.data[sampleName].value != None: - if sample.find('F1') < 0: - specialStrains.append(sample) - if (this_trait.data[sampleName].value != None) and (sample not in (fd.f1list + fd.parlist)): - other_samples.append(sample) #XZ: at current stage, other_samples doesn't include parent samples and F1 samples of primary group - else: - if (this_trait.data[sampleName].value != None) and (sample not in (fd.f1list + fd.parlist)): - primary_samples.append(sample) #XZ: at current stage, the primary_samples is the same as fd.samplelist / ZS: I tried defining primary_samples as fd.samplelist instead, but in some cases it ended up including the parent samples (1436869_at BXD) - - if len(other_samples) > 3: - other_samples.sort(key=webqtlUtil.natsort_key) - primary_samples.sort(key=webqtlUtil.natsort_key) - primary_samples = map(lambda X:"_2nd_"+X, fd.f1list + fd.parlist) + primary_samples #XZ: note that fd.f1list and fd.parlist are added. - all_samples = primary_samples + other_samples - other_samples = map(lambda X:"_2nd_"+X, fd.f1list + fd.parlist) + other_samples #XZ: note that fd.f1list and fd.parlist are added. - logger.debug("ac1") # This is the one used for first sall3 - self.MDP_menu.append(('All Cases','0')) - self.MDP_menu.append(('%s Only' % fd.group, '1')) - self.MDP_menu.append(('Non-%s Only' % fd.group, '2')) - - else: - if (len(other_samples) > 0) and (len(primary_samples) + len(other_samples) > 3): - logger.debug("ac2") - self.MDP_menu.append(('All Cases','0')) - self.MDP_menu.append(('%s Only' % fd.group,'1')) - self.MDP_menu.append(('Non-%s Only' % fd.group,'2')) - all_samples = primary_samples - all_samples.sort(key=webqtlUtil.natsort_key) - all_samples = map(lambda X:"_2nd_"+X, fd.f1list + fd.parlist) + all_samples - primary_samples = map(lambda X:"_2nd_"+X, fd.f1list + fd.parlist) + primary_samples - else: - logger.debug("ac3") - all_samples = samplelist - - other_samples.sort(key=webqtlUtil.natsort_key) - all_samples = all_samples + other_samples - - if (len(other_samples)) > 0 and (len(primary_samples) + len(other_samples) > 4): - #One set of vals for all, selected sample only, and non-selected only - vals1 = [] - vals2 = [] - vals3 = [] - - #Using all samples/cases for values - #for sample_type in (all_samples, primary_samples, other_samples): - for sampleNameOrig in all_samples: - sampleName = sampleNameOrig.replace("_2nd_", "") - - logger.debug("* type of this_trait:", type(this_trait)) - logger.debug(" name:", this_trait.__class__.__name__) - logger.debug(" this_trait:", this_trait) - logger.debug(" type of this_trait.data[sampleName]:", type(this_trait.data[sampleName])) - logger.debug(" name:", this_trait.data[sampleName].__class__.__name__) - logger.debug(" this_trait.data[sampleName]:", this_trait.data[sampleName]) - thisval = this_trait.data[sampleName].value - logger.debug(" thisval:", thisval) - thisvar = this_trait.data[sampleName].variance - logger.debug(" thisvar:", thisvar) - thisValFull = [sampleName, thisval, thisvar] - logger.debug(" thisValFull:", thisValFull) - - vals1.append(thisValFull) - - #Using just the group sample - for sampleNameOrig in primary_samples: - sampleName = sampleNameOrig.replace("_2nd_", "") - - thisval = this_trait.data[sampleName].value - thisvar = this_trait.data[sampleName].variance - thisValFull = [sampleName,thisval,thisvar] - - vals2.append(thisValFull) - - #Using all non-group samples only - for sampleNameOrig in other_samples: - sampleName = sampleNameOrig.replace("_2nd_", "") - - thisval = this_trait.data[sampleName].value - thisvar = this_trait.data[sampleName].variance - thisValFull = [sampleName,thisval,thisvar] - - vals3.append(thisValFull) - - vals_set = [vals1,vals2,vals3] - + def build_correlation_tools(self): + if self.temp_trait == True: + this_group = self.temp_group else: - vals = [] - - #Using all samples/cases for values - for sampleNameOrig in all_samples: - sampleName = sampleNameOrig.replace("_2nd_", "") - - thisval = this_trait.data[sampleName].value - thisvar = this_trait.data[sampleName].variance - thisValFull = [sampleName,thisval,thisvar] - - vals.append(thisValFull) - - vals_set = [vals] - - self.stats_data = [] - for i, vals in enumerate(vals_set): - if i == 0 and len(vals) < 4: - stats_container = HT.Div(id="stats_tabs", style="padding:10px;", Class="ui-tabs") #Needed for tabs; notice the "stats_script_text" below referring to this element - stats_container.append(HT.Div(HT.Italic("Fewer than 4 case data were entered. No statistical analysis has been attempted."))) - break - elif (i == 1 and len(primary_samples) < 4): - stats_container = HT.Div(id="stats_tabs%s" % i, Class="ui-tabs") - #stats_container.append(HT.Div(HT.Italic("Fewer than 4 " + fd.group + " case data were entered. No statistical analysis has been attempted."))) - elif (i == 2 and len(other_samples) < 4): - stats_container = HT.Div(id="stats_tabs%s" % i, Class="ui-tabs") - stats_container.append(HT.Div(HT.Italic("Fewer than 4 non-" + fd.group + " case data were entered. No statistical analysis has been attempted."))) - else: - continue - if len(vals) > 4: - stats_tab_list = [HT.Href(text="Basic Table", url="#statstabs-1", Class="stats_tab"),HT.Href(text="Probability Plot", url="#statstabs-5", Class="stats_tab"), - HT.Href(text="Bar Graph (by name)", url="#statstabs-3", Class="stats_tab"), HT.Href(text="Bar Graph (by rank)", url="#statstabs-4", Class="stats_tab"), - HT.Href(text="Box Plot", url="#statstabs-2", Class="stats_tab")] - - if this_trait.dataset: - if this_trait.cellid: - self.stats_data.append(BasicStatisticsFunctions.basicStatsTable(vals=vals, trait_type=this_trait.dataset.type, cellid=this_trait.cellid)) - else: - self.stats_data.append(BasicStatisticsFunctions.basicStatsTable(vals=vals, trait_type=this_trait.dataset.type)) - else: - self.stats_data.append(BasicStatisticsFunctions.basicStatsTable(vals=vals)) - - #normalplot_div = HT.Div(id="statstabs-5") - #normalplot_container = HT.Paragraph() - #normalplot = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - - try: - plotTitle = this_trait.symbol - plotTitle += ": " - plotTitle += this_trait.name - except: - plotTitle = str(this_trait.name) - - #normalplot_img = BasicStatisticsFunctions.plotNormalProbability(vals=vals, group=fd.group, title=plotTitle, specialStrains=specialStrains) - #normalplot.append(HT.TR(HT.TD(normalplot_img))) - #normalplot.append(HT.TR(HT.TD(HT.BR(),HT.BR(),"This plot evaluates whether data are \ - #normally distributed. Different symbols represent different groups.",HT.BR(),HT.BR(), - #"More about ", HT.Href(url="http://en.wikipedia.org/wiki/Normal_probability_plot", - # target="_blank", text="Normal Probability Plots"), " and more about interpreting these plots from the ", HT.Href(url="/glossary.html#normal_probability", target="_blank", text="glossary")))) - - #boxplot_div = HT.Div(id="statstabs-2") - #boxplot_container = HT.Paragraph() - #boxplot = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - #boxplot_img, boxplot_link = BasicStatisticsFunctions.plotBoxPlot(vals) - #boxplot.append(HT.TR(HT.TD(boxplot_img, HT.P(), boxplot_link, align="left"))) - - #barName_div = HT.Div(id="statstabs-3") - #barName_container = HT.Paragraph() - #barName = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - #barName_img = BasicStatisticsFunctions.plotBarGraph(identification=fd.identification, group=fd.group, vals=vals, type="name") - - #barRank_div = HT.Div(id="statstabs-4") - #barRank_container = HT.Paragraph() - #barRank = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - #barRank_img = BasicStatisticsFunctions.plotBarGraph(identification=fd.identification, group=fd.group, vals=vals, type="rank") - - - def build_correlation_tools(self, this_trait): - - #species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, group=fd.group) - - this_group = self.dataset.group.name + this_group = self.dataset.group.name # We're checking a string here! assert isinstance(this_group, basestring), "We need a string type thing here" @@ -459,11 +160,15 @@ class ShowTrait(object): this_group = 'BXD' if this_group: - dataset_menu = self.dataset.group.datasets() + #dataset_menu = self.dataset.group.datasets() + if self.temp_trait == True: + dataset_menu = data_set.datasets(this_group) + else: + dataset_menu = data_set.datasets(this_group, self.dataset.group) dataset_menu_selected = None if len(dataset_menu): - if this_trait and this_trait.dataset: - dataset_menu_selected = this_trait.dataset.name + if self.this_trait and self.this_trait.dataset: + dataset_menu_selected = self.this_trait.dataset.name return_results_menu = (100, 200, 500, 1000, 2000, 5000, 10000, 15000, 20000) return_results_menu_selected = 500 @@ -474,260 +179,6 @@ class ShowTrait(object): return_results_menu_selected = return_results_menu_selected,) - def build_mapping_tools(self, this_trait): - - - #_Species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, group=fd.group) - - this_group = fd.group - if this_group[:3] == 'BXD': - this_group = 'BXD' - - #check boxes - one for regular interval mapping, the other for composite - permCheck1= HT.Input(type='checkbox', Class='checkbox', name='permCheck1',checked="on") - bootCheck1= HT.Input(type='checkbox', Class='checkbox', name='bootCheck1',checked=0) - permCheck2= HT.Input(type='checkbox', Class='checkbox', name='permCheck2',checked="on") - bootCheck2= HT.Input(type='checkbox', Class='checkbox', name='bootCheck2',checked=0) - optionbox1 = HT.Input(type='checkbox', Class='checkbox', name='parentsf14regression1',checked=0) - optionbox2 = HT.Input(type='checkbox', Class='checkbox', name='parentsf14regression2',checked=0) - optionbox3 = HT.Input(type='checkbox', Class='checkbox', name='parentsf14regression3',checked=0) - applyVariance1 = HT.Input(name='applyVarianceSE1',type='checkbox', Class='checkbox') - applyVariance2 = HT.Input(name='applyVarianceSE2',type='checkbox', Class='checkbox') - - IntervalMappingButton=HT.Input(type='button' ,name='interval',value=' Compute ', Class="button") - CompositeMappingButton=HT.Input(type='button' ,name='composite',value=' Compute ', Class="button") - MarkerRegressionButton=HT.Input(type='button',name='marker', value=' Compute ', Class="button") - - chrText = HT.Span("Chromosome:", Class="ffl fwb fs12") - - # updated by NL 5-28-2010 - # Interval Mapping - chrMenu = HT.Select(name='chromosomes1') - chrMenu.append(("All",-1)) - for i in range(len(fd.genotype)): - if len(fd.genotype[i]) > 1: - chrMenu.append((fd.genotype[i].name, i)) - - #Menu for Composite Interval Mapping - chrMenu2 = HT.Select(name='chromosomes2') - chrMenu2.append(("All",-1)) - for i in range(len(fd.genotype)): - if len(fd.genotype[i]) > 1: - chrMenu2.append((fd.genotype[i].name, i)) - - if fd.genotype.Mbmap: - scaleText = HT.Span("Mapping Scale:", Class="ffl fwb fs12") - scaleMenu1 = HT.Select(name='scale1', - onChange="checkUncheck(window.document.dataInput.scale1.value, window.document.dataInput.permCheck1, window.document.dataInput.bootCheck1)") - scaleMenu1.append(("Megabase",'physic')) - scaleMenu1.append(("Centimorgan",'morgan')) - scaleMenu2 = HT.Select(name='scale2', - onChange="checkUncheck(window.document.dataInput.scale2.value, window.document.dataInput.permCheck2, window.document.dataInput.bootCheck2)") - scaleMenu2.append(("Megabase",'physic')) - scaleMenu2.append(("Centimorgan",'morgan')) - - controlText = HT.Span("Control Locus:", Class="ffl fwb fs12") - controlMenu = HT.Input(type="text", name="controlLocus", Class="controlLocus") - - if fd.genotype.Mbmap: - intMappingMenu = HT.TableLite( - HT.TR(HT.TD(chrText), HT.TD(chrMenu, colspan="3")), - HT.TR(HT.TD(scaleText), HT.TD(scaleMenu1)), - cellspacing=0, width="263px", cellpadding=2) - compMappingMenu = HT.TableLite( - HT.TR(HT.TD(chrText), HT.TD(chrMenu2, colspan="3")), - HT.TR(HT.TD(scaleText), HT.TD(scaleMenu2)), - HT.TR(HT.TD(controlText), HT.TD(controlMenu)), - cellspacing=0, width="325px", cellpadding=2) - else: - intMappingMenu = HT.TableLite( - HT.TR(HT.TD(chrText), HT.TD(chrMenu, colspan="3")), - cellspacing=0, width="263px", cellpadding=2) - compMappingMenu = HT.TableLite( - HT.TR(HT.TD(chrText), HT.TD(chrMenu2, colspan="3")), - HT.TR(HT.TD(controlText), HT.TD(controlMenu)), - cellspacing=0, width="325px", cellpadding=2) - - directPlotButton = "" - directPlotButton = HT.Input(type='button',name='', value=' Compute ',\ - onClick="dataEditingFunc(this.form,'directPlot');",Class="button") - directPlotSortText = HT.Span(HT.Bold("Sort by: "), Class="ffl fwb fs12") - directPlotSortMenu = HT.Select(name='graphSort') - directPlotSortMenu.append(('LRS Full',0)) - directPlotSortMenu.append(('LRS Interact',1)) - directPlotPermuText = HT.Span("Permutation Test (n=500)", Class="ffl fs12") - directPlotPermu = HT.Input(type='checkbox', Class='checkbox',name='directPermuCheckbox', checked="on") - pairScanReturnText = HT.Span(HT.Bold("Return: "), Class="ffl fwb fs12") - pairScanReturnMenu = HT.Select(name='pairScanReturn') - pairScanReturnMenu.append(('top 50','50')) - pairScanReturnMenu.append(('top 100','100')) - pairScanReturnMenu.append(('top 200','200')) - pairScanReturnMenu.append(('top 500','500')) - - pairScanMenus = HT.TableLite( - HT.TR(HT.TD(directPlotSortText), HT.TD(directPlotSortMenu)), - HT.TR(HT.TD(pairScanReturnText), HT.TD(pairScanReturnMenu)), - cellspacing=0, width="232px", cellpadding=2) - - markerSuggestiveText = HT.Span(HT.Bold("Display LRS greater than:"), Class="ffl fwb fs12") - markerSuggestive = HT.Input(name='suggestive', size=5, maxlength=8) - displayAllText = HT.Span(" Display all LRS ", Class="ffl fs12") - displayAll = HT.Input(name='displayAllLRS', type="checkbox", Class='checkbox') - useParentsText = HT.Span(" Use Parents ", Class="ffl fs12") - useParents = optionbox2 - applyVarianceText = HT.Span(" Use Weighted ", Class="ffl fs12") - - markerMenu = HT.TableLite( - HT.TR(HT.TD(markerSuggestiveText), HT.TD(markerSuggestive)), - HT.TR(HT.TD(displayAll,displayAllText)), - HT.TR(HT.TD(useParents,useParentsText)), - HT.TR(HT.TD(applyVariance2,applyVarianceText)), - cellspacing=0, width="263px", cellpadding=2) - - - mapping_row = HT.TR() - mapping_container = HT.Div(id="mapping_tabs", Class="ui-tabs") - - mapping_tab_list = [HT.Href(text="Interval", url="#mappingtabs-1"), HT.Href(text="Marker Regression", url="#mappingtabs-2"), HT.Href(text="Composite", url="#mappingtabs-3"), HT.Href(text="Pair-Scan", url="#mappingtabs-4")] - mapping_tabs = HT.List(mapping_tab_list) - mapping_container.append(mapping_tabs) - - interval_div = HT.Div(id="mappingtabs-1") - interval_container = HT.Span() - - intervalTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - intTD = HT.TD(valign="top",NOWRAP='ON', Class="fs12 fwn") - intTD.append(intMappingMenu,HT.BR()) - - intTD.append(permCheck1,'Permutation Test (n=2000)',HT.BR(), - bootCheck1,'Bootstrap Test (n=2000)', HT.BR(), optionbox1, 'Use Parents', HT.BR(), - applyVariance1,'Use Weighted', HT.BR(), HT.BR(),IntervalMappingButton, HT.BR(), HT.BR()) - intervalTable.append(HT.TR(intTD), HT.TR(HT.TD(HT.Span(HT.Href(url='/glossary.html#intmap', target='_blank', text='Interval Mapping'), - ' computes linkage maps for the entire genome or single',HT.BR(),' chromosomes.', - ' The ',HT.Href(url='/glossary.html#permutation', target='_blank', text='Permutation Test'),' estimates suggestive and significant ',HT.BR(),' linkage scores. \ - The ',HT.Href(url='/glossary.html#bootstrap', target='_blank', text='Bootstrap Test'), ' estimates the precision of the QTL location.' - ,Class="fs12"), HT.BR(), valign="top"))) - - interval_container.append(intervalTable) - interval_div.append(interval_container) - mapping_container.append(interval_div) - - # Marker Regression - - marker_div = HT.Div(id="mappingtabs-2") - marker_container = HT.Span() - - markerTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - markerTD = HT.TD(valign="top",NOWRAP='ON', Class="fs12 fwn") - markerTD.append(markerMenu,HT.BR()) - - markerTD.append(MarkerRegressionButton,HT.BR(),HT.BR()) - - markerTable.append(HT.TR(markerTD),HT.TR(HT.TD(HT.Span(HT.Href(url='/glossary.html#',target='_blank',text='Marker regression'), - ' computes and displays LRS values for individual markers.',HT.BR(), - 'This function also lists additive effects (phenotype units per allele) and', HT.BR(), - 'dominance deviations for some datasets.', HT.BR(),Class="fs12"), HT.BR(), valign="top"))) - - marker_container.append(markerTable) - marker_div.append(marker_container) - mapping_container.append(marker_div) - - # Composite interval mapping - composite_div = HT.Div(id="mappingtabs-3") - composite_container = HT.Span() - - compositeTable = HT.TableLite(cellspacing=0, cellpadding=3, width="100%") - compTD = HT.TD(valign="top",NOWRAP='ON', Class="fs12 fwn") - compTD.append(compMappingMenu,HT.BR()) - - compTD.append(permCheck2, 'Permutation Test (n=2000)',HT.BR(), - bootCheck2,'Bootstrap Test (n=2000)', HT.BR(), - optionbox3, 'Use Parents', HT.BR(), HT.BR(), CompositeMappingButton, HT.BR(), HT.BR()) - compositeTable.append(HT.TR(compTD), HT.TR(HT.TD(HT.Span(HT.Href(url='/glossary.html#Composite',target='_blank',text='Composite Interval Mapping'), - " allows you to control for a single marker as",HT.BR()," a cofactor. ", - "To find a control marker, run the ",HT.Bold("Marker Regression")," function."), - HT.BR(), valign="top"))) - - composite_container.append(compositeTable) - composite_div.append(composite_container) - mapping_container.append(composite_div) - - # Pair Scan - - pairscan_div = HT.Div(id="mappingtabs-4") - pairscan_container = HT.Span() - - pairScanTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - pairScanTD = HT.TD(NOWRAP='ON', Class="fs12 fwn") - pairScanTD.append(pairScanMenus,HT.BR()) - pairScanTD.append(directPlotPermu, directPlotPermuText, HT.BR(), HT.BR(), - directPlotButton,HT.BR(),HT.BR()) - pairScanTable.append(HT.TR(pairScanTD), HT.TR(HT.TD(HT.Span(HT.Href(url='/glossary.html#Pair_Scan', target="_blank", text='Pair-Scan'), - ' searches for pairs of chromosomal regions that are',HT.BR(), - 'involved in two-locus epistatic interactions.'), HT.BR(), valign="top"))) - - pairscan_container.append(pairScanTable) - pairscan_div.append(pairscan_container) - mapping_container.append(pairscan_div) - - mapping_row.append(HT.TD(mapping_container)) - - # Treat Interval Mapping and Marker Regression and Pair Scan as a group for displaying - #disable Interval Mapping and Marker Regression and Pair Scan for human and the dataset doesn't have genotype file - mappingMethodId = webqtlDatabaseFunction.getMappingMethod(cursor=self.cursor, groupName=this_group) - - mapping_script = HT.Script(language="Javascript") - mapping_script_text = """$(function() { $("#mapping_tabs").tabs(); });""" - mapping_script.append(mapping_script_text) - - submitTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%", Class="target2") - - if not mappingMethodId: - if int(mappingMethodId) == 1: - submitTable.append(mapping_row) - submitTable.append(mapping_script) - elif int(mappingMethodId) == 4: - # NL; 09-26-2011 testing for Human Genome Association function - mapping_row=HT.TR() - mapping_container = HT.Div(id="mapping_tabs", Class="ui-tabs") - - mapping_tab_list = [HT.Href(text="Genome Association", url="#mappingtabs-1")] - mapping_tabs = HT.List(mapping_tab_list) - mapping_container.append(mapping_tabs) - - # Genome Association - markerSuggestiveText = HT.Span(HT.Bold("P Value:"), Class="ffl fwb fs12") - - markerSuggestive = HT.Input(name='pValue', value='0.001', size=10, maxlength=20,onClick="this.value='';",onBlur="if(this.value==''){this.value='0.001'};") - markerMenu = HT.TableLite(HT.TR(HT.TD(markerSuggestiveText), HT.TD(markerSuggestive),HT.TD(HT.Italic(' (e.g. 0.001 or 1e-3 or 1E-3 or 3)'))),cellspacing=0, width="400px", cellpadding=2) - MarkerRegressionButton=HT.Input(type='button',name='computePlink', value=' Compute Using PLINK ', onClick= "validatePvalue(this.form);", Class="button") - - marker_div = HT.Div(id="mappingtabs-1") - marker_container = HT.Span() - markerTable = HT.TableLite(cellspacing=0, cellpadding=0, width="100%") - markerTD = HT.TD(valign="top",NOWRAP='ON', Class="fs12 fwn") - markerTD.append(markerMenu,HT.BR()) - markerTD.append(MarkerRegressionButton,HT.BR(),HT.BR()) - markerTable.append(HT.TR(markerTD)) - - marker_container.append(markerTable) - marker_div.append(marker_container) - - mapping_container.append(marker_div) - mapping_row.append(HT.TD(mapping_container)) - submitTable.append(mapping_row) - submitTable.append(mapping_script) - else: - submitTable.append(HT.TR(HT.TD(HT.Div(HT.Italic("mappingMethodId %s has not been implemented for this dataset yet." % mappingMethodId), id="mapping_tabs", Class="ui-tabs")))) - submitTable.append(mapping_script) - - else: - submitTable.append(HT.TR(HT.TD(HT.Div(HT.Italic("Mapping options are disabled for data not matched with genotypes."), id="mapping_tabs", Class="ui-tabs")))) - submitTable.append(mapping_script) - - title4Body.append(submitTable) - - def make_sample_lists(self, this_trait): all_samples_ordered = self.dataset.group.all_samples_ordered() @@ -753,7 +204,7 @@ class ShowTrait(object): logger.debug("primary_samples is: ", pf(primary_samples)) logger.debug("other_sample_names2:", other_sample_names) - if other_sample_names and self.dataset.group.species != "human": + if other_sample_names and self.dataset.group.species != "human" and self.dataset.group.name != "CFW": parent_f1_samples = None if self.dataset.group.parlist and self.dataset.group.f1list: parent_f1_samples = self.dataset.group.parlist + self.dataset.group.f1list @@ -814,9 +265,9 @@ def get_genofiles(this_trait): return jsondata['genofile'] def get_trait_table_width(sample_groups): - table_width = 30 + table_width = 20 if sample_groups[0].se_exists(): - table_width += 10 + table_width += 15 if (table_width + len(sample_groups[0].attributes)*10) > 100: table_width = 100 else: diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json index 06586372..ad4d9419 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)" ], [ - "126", - "B30_K_1206_Rn", - "Barley1 Leaf gcRMAn SCRI (Dec06)" - ], - [ "125", "B30_K_1206_R", "Barley1 Leaf gcRMA SCRI (Dec06)" + ], + [ + "126", + "B30_K_1206_Rn", + "Barley1 Leaf gcRMAn SCRI (Dec06)" ] ], "Phenotypes": [ @@ -1340,14 +1340,14 @@ "GSE9588 Human Liver Normal (Mar11) Both Sexes" ], [ - "383", - "HLCM_0311", - "GSE9588 Human Liver Normal (Mar11) Males" - ], - [ "384", "HLCF_0311", "GSE9588 Human Liver Normal (Mar11) Females" + ], + [ + "383", + "HLCM_0311", + "GSE9588 Human Liver Normal (Mar11) Males" ] ], "Phenotypes": [ @@ -1526,14 +1526,14 @@ "NCI Mammary LMT miRNA v2 (Apr09) RMA" ], [ - "37", - "MA_M_0704_R", - "NCI Mammary mRNA M430 (July04) RMA" - ], - [ "36", "MA_M_0704_M", "NCI Mammary mRNA M430 (July04) MAS5" + ], + [ + "37", + "MA_M_0704_R", + "NCI Mammary mRNA M430 (July04) RMA" ] ] }, @@ -1591,14 +1591,14 @@ ], "Liver mRNA": [ [ - "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" + ], + [ + "39", + "LVF2_M_0704_R", + "(B6 x BTBR)F2-ob/ob Liver mRNA M430 (Jul04) RMA" ] ], "Phenotypes": [ @@ -1621,11 +1621,6 @@ "B6D2F2": { "Brain mRNA": [ [ - "76", - "BRF2_M_0805_M", - "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) MAS5" - ], - [ "78", "BRF2_M_0805_P", "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) PDNN" @@ -1636,19 +1631,24 @@ "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) RMA" ], [ + "76", + "BRF2_M_0805_M", + "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) MAS5" + ], + [ "33", "BRF2_M_0304_P", "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) PDNN" ], [ - "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" + ], + [ + "32", + "BRF2_M_0304_R", + "OHSU/VA B6D2F2 Brain mRNA M430A (Mar04) RMA" ] ], "Genotypes": [ @@ -1727,11 +1727,6 @@ ], "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" @@ -1740,22 +1735,27 @@ "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": [ [ - "196", - "UCLA_BHF2_ADIPOSE_MALE", - "UCLA BHF2 Adipose Male mlratio" - ], - [ "197", "UCLA_BHF2_ADIPOSE_FEMALE", "UCLA BHF2 Adipose Female mlratio" ], [ + "196", + "UCLA_BHF2_ADIPOSE_MALE", + "UCLA BHF2 Adipose Male mlratio" + ], + [ "165", "UCLA_BHF2_ADIPOSE_0605", "UCLA BHF2 Adipose (June05) mlratio" @@ -1763,16 +1763,16 @@ ], "Brain mRNA": [ [ - "198", - "UCLA_BHF2_BRAIN_MALE", - "UCLA BHF2 Brain Male mlratio" - ], - [ "199", "UCLA_BHF2_BRAIN_FEMALE", "UCLA BHF2 Brain Female mlratio" ], [ + "198", + "UCLA_BHF2_BRAIN_MALE", + "UCLA BHF2 Brain Male mlratio" + ], + [ "166", "UCLA_BHF2_BRAIN_0605", "UCLA BHF2 Brain (June05) mlratio" @@ -1787,16 +1787,16 @@ ], "Liver mRNA": [ [ - "200", - "UCLA_BHF2_LIVER_MALE", - "UCLA BHF2 Liver Male mlratio" - ], - [ "201", "UCLA_BHF2_LIVER_FEMALE", "UCLA BHF2 Liver Female mlratio" ], [ + "200", + "UCLA_BHF2_LIVER_MALE", + "UCLA BHF2 Liver Male mlratio" + ], + [ "167", "UCLA_BHF2_LIVER_0605", "UCLA BHF2 Liver (June05) mlratio" @@ -2000,6 +2000,11 @@ "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" @@ -2010,11 +2015,6 @@ "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" @@ -2081,11 +2081,6 @@ "Eye M430v2 WT Gpnmb (Sep08) RMA" ], [ - "278", - "Eye_M2_0908_R_MT", - "Eye M430v2 Mutant Tyrp1 (Sep08) RMA" - ], - [ "382", "Eye_M2_0908_WTWT", "Eye M430v2 WT WT (Sep08) RMA" @@ -2096,6 +2091,11 @@ "Eye M430v2 WT Tyrp1 (Sep08) RMA" ], [ + "278", + "Eye_M2_0908_R_MT", + "Eye M430v2 Mutant Tyrp1 (Sep08) RMA" + ], + [ "400", "DBA2J-ONH-1212", "Howell et al. 2011, DBA/2J Glaucoma Optic Nerve Head M430 2.0 (Dec12) RMA" @@ -2352,14 +2352,14 @@ "Mouse Kidney M430v2 Sex Balanced (Aug06) PDNN" ], [ - "116", - "MA_M2_0706_P", - "Mouse Kidney M430v2 (Jul06) PDNN" - ], - [ "115", "MA_M2_0706_R", "Mouse Kidney M430v2 (Jul06) RMA" + ], + [ + "116", + "MA_M2_0706_P", + "Mouse Kidney M430v2 (Jul06) PDNN" ] ], "Liver Metabolome": [ @@ -2521,16 +2521,16 @@ ], "Neocortex mRNA": [ [ - "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" ], [ + "375", + "DevNeocortex_ILM6.2P14RInv_1111", + "BIDMC/UTHSC Dev Neocortex P14 ILMv6.2 (Nov11) RankInv" + ], + [ "284", "HQFNeoc_1210v2_RankInv", "HQF BXD Neocortex ILM6v1.1 (Dec10v2) RankInv" @@ -2546,14 +2546,14 @@ "HQF BXD Neocortex ILM6v1.1 (Feb08) 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" + ], + [ + "274", + "DevNeocortex_ILM6.2P3RInv_1110", + "BIDMC/UTHSC Dev Neocortex P3 ILMv6.2 (Nov10) RankInv" ] ], "Nucleus Accumbens mRNA": [ @@ -2761,11 +2761,6 @@ ], "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" @@ -2774,6 +2769,11 @@ "230", "VCUEtvsSal_0609_R", "VCU BXD VTA Et vs Sal M430 2.0 (Jun09) RMA" + ], + [ + "229", + "VCUEtOH_0609_R", + "VCU BXD VTA EtOH M430 2.0 (Jun09) RMA" ] ] }, @@ -2852,6 +2852,11 @@ "CFW": { "Hippocampus mRNA": [ [ + "811", + "UCSD_CFW_HIP_RNA-Seq_log2_0117", + "UCSD CFW Hippocampus (Jan17) RNA-Seq Log2 Z-score" + ], + [ "808", "UCSD_CFW_HIP_RNA-Seq_0117", "UCSD CFW Hippocampus (Jan17) RNA-Seq" @@ -2866,6 +2871,11 @@ ], "Prefrontal Cortex mRNA": [ [ + "813", + "UCSD_CFW_PFC_RNA-Seq_log2_0117", + "UCSD CFW Prefrontal Cortex (Jan17) RNA-Seq Log2 Z-score" + ], + [ "810", "UCSD_CFW_PFC_RNA-Seq_0117", "UCSD CFW Prefrontal Cortex (Jan17) RNA-Seq" @@ -2873,6 +2883,11 @@ ], "Striatum mRNA": [ [ + "812", + "UCSD_CFW_STR_RNA-Seq_log2_0117", + "UCSD CFW Striatum (Jan17) RNA-Seq Log2 Z-score" + ], + [ "809", "UCSD_CFW_SPL_RNA-Seq_0117", "UCSD CFW Striatum (Jan17) RNA-Seq" @@ -3008,14 +3023,14 @@ ], "Hippocampus mRNA": [ [ - "100", - "HC_M2CB_1205_R", - "Hippocampus Consortium M430v2 CXB (Dec05) RMA" - ], - [ "99", "HC_M2CB_1205_P", "Hippocampus Consortium M430v2 CXB (Dec05) PDNN" + ], + [ + "100", + "HC_M2CB_1205_R", + "Hippocampus Consortium M430v2 CXB (Dec05) RMA" ] ], "Phenotypes": [ @@ -3082,16 +3097,6 @@ ], "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" @@ -3107,6 +3112,16 @@ "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" @@ -3197,14 +3212,14 @@ ], "Hippocampus mRNA": [ [ - "273", - "UMUTAffyExon_0209_RMA_MDP", - "UMUTAffy Hippocampus Exon (Feb09) RMA MDP" - ], - [ "272", "HC_M2_0606_MDP", "Hippocampus Consortium M430v2 (Jun06) RMA MDP" + ], + [ + "273", + "UMUTAffyExon_0209_RMA_MDP", + "UMUTAffy Hippocampus Exon (Feb09) RMA MDP" ] ], "Liver mRNA": [ diff --git a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js index c1c25a58..d6cd8134 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js @@ -166,7 +166,7 @@ return function() { var form_data, url; //$("#progress_bar_container").modal(); - url = "/marker_regression"; + url = "/loading"; $('input[name=method]').val("pylmm"); $('input[name=genofile]').val($('#genofile_pylmm').val()); $('input[name=num_perm]').val($('input[name=num_perm_pylmm]').val()); @@ -182,7 +182,7 @@ return function() { var form_data, url; //$("#progress_bar_container").modal(); - url = "/marker_regression"; + url = "/loading"; $('input[name=method]').val("rqtl_geno"); $('input[name=genofile]').val($('#genofile_rqtl_geno').val()); $('input[name=num_perm]').val($('input[name=num_perm_rqtl_geno]').val()); @@ -212,7 +212,7 @@ return function() { var form_data, url; //$("#static_progress_bar_container").modal(); - url = "/marker_regression"; + url = "/loading"; $('input[name=method]').val("plink"); $('input[name=maf]').val($('input[name=maf_plink]').val()); form_data = $('#trait_data_form').serialize(); @@ -227,7 +227,7 @@ var form_data, url; console.log("RUNNING GEMMA"); //$("#static_progress_bar_container").modal(); - url = "/marker_regression"; + url = "/loading"; $('input[name=method]').val("gemma"); $('input[name=maf]').val($('input[name=maf_gemma]').val()); form_data = $('#trait_data_form').serialize(); @@ -242,7 +242,7 @@ var form_data, url; console.log("In interval mapping"); //$("#progress_bar_container").modal(); - url = "/marker_regression"; + url = "/loading"; $('input[name=method]').val("reaper"); $('input[name=genofile]').val($('#genofile_reaper').val()); $('input[name=num_perm]').val($('input[name=num_perm_reaper]').val()); 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 87f602dc..40e58ac8 100644 --- a/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css +++ b/wqflask/wqflask/static/new/packages/DataTables/css/jquery.dataTables.css @@ -81,7 +81,7 @@ table.dataTable tbody tr.selected { table.dataTable tbody th, table.dataTable tbody td { font: 12px Arial, Sans-serif; - padding: 4px 5px 4px 0px; + padding: 4px 16px 4px 0px; } table.dataTable.row-border tbody th, table.dataTable.row-border tbody td, table.dataTable.display tbody th, table.dataTable.display tbody td { border-top: 1px solid #ddd; diff --git a/wqflask/wqflask/submit_trait.py b/wqflask/wqflask/submit_trait.py deleted file mode 100644 index 4ab9a4be..00000000 --- a/wqflask/wqflask/submit_trait.py +++ /dev/null @@ -1,24 +0,0 @@ -from __future__ import print_function, division - -from flask import Flask, g - -from pprint import pformat as pf - -def get_species_groups(): - - species_query = "SELECT SpeciesId, MenuName FROM Species" - - species_ids_and_names = g.db.execute(species_query).fetchall() - - - species_and_groups = [] - for species_id, species_name in species_ids_and_names: - this_species_groups = {} - this_species_groups['species'] = species_name - groups_query = "SELECT InbredSetName FROM InbredSet WHERE SpeciesId = %s" % (species_id) - groups = [group[0] for group in g.db.execute(groups_query).fetchall()] - - this_species_groups['groups'] = groups - species_and_groups.append(this_species_groups) - - return species_and_groups
\ No newline at end of file diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index 210c5708..ec55ebeb 100644 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -81,10 +81,10 @@ </div> </div> - <div class="container-fluid" style="background-color: #d5d5d5; height: 95px;"> + <div class="container-fluid" style="position: relative; background-color: #d5d5d5; height: 95px;"> <form method="get" action="/gsearch"> - <div class="row"> + <div class="row" style="position: absolute; bottom: 0; top: 30px;"> <select class="form-control col-xs-2" style="width: 170px; margin-top: 15px; margin-left: 10px;" name="type"> <option value="gene">Genes / Molecules</option> <option value="phenotype" {% if type=="phenotype" %}selected{% endif %}>Phenotypes</option> diff --git a/wqflask/wqflask/templates/data_sharing.html b/wqflask/wqflask/templates/data_sharing.html index 4e92106a..366e2075 100644 --- a/wqflask/wqflask/templates/data_sharing.html +++ b/wqflask/wqflask/templates/data_sharing.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% block title %}Search Results{% endblock %} +{% block title %}Data Sharing{% endblock %} {% block content %} <!-- Start of body --> diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index 205d5801..e8bb6337 100644 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -44,14 +44,14 @@ <th data-export="Mean">Mean</th> <th data-export="Max LRS">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">Max LRS Location</th> - <th data-export="Additive Effect">Additive Effect<a href="http://genenetwork.org/glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th data-export="Additive Effect">Additive <a href="http://genenetwork.org/glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> </tr> </thead> <tbody> {% for this_trait in trait_list %} <tr id="trait:{{ this_trait.name }}:{{ this_trait.dataset.name }}"> - <td style="padding-left: 5px;"><input type="checkbox" name="searchResult" class="checkbox trait_checkbox" value="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}"></td> - <td data-export="{{ loop.index }}">{{ loop.index }}</td> + <td align="center" style="padding-right: 0px; padding-left: 5px;"><input type="checkbox" name="searchResult" class="checkbox trait_checkbox" value="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}"></td> + <td align="right" data-export="{{ loop.index }}">{{ loop.index }}</td> <td data-export="{{ this_trait.name }}"><a href="{{ url_for('show_trait_page', trait_id = this_trait.name, dataset = this_trait.dataset.name)}}">{{ this_trait.name }}</a></td> <td data-export="{{ this_trait.dataset.group.species }}">{{ this_trait.dataset.group.species }}</td> <td data-export="{{ this_trait.dataset.group.name }}">{{ this_trait.dataset.group.name }}</td> @@ -82,7 +82,7 @@ <th>Mean</th> <th>Max LRS<a href="http://genenetwork.org/glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th> <th>Max LRS Location</th> - <th>Additive Effect<a href="http://genenetwork.org/glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th>Additive <a href="http://genenetwork.org/glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> </tr> </tfoot> </table> @@ -145,7 +145,7 @@ { "type": "natural", "width": "4%" }, { "type": "natural", "width": "5%" }, { "type": "natural", "width": "7%" }, - { "type": "natural", "width": "7%" } + { "type": "natural", "width": "5%" } ], "columnDefs": [ { diff --git a/wqflask/wqflask/templates/links.html b/wqflask/wqflask/templates/links.html index 80d752e6..6ff7fc6c 100644 --- a/wqflask/wqflask/templates/links.html +++ b/wqflask/wqflask/templates/links.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% block title %}Forgot Password{% endblock %} +{% block title %}Links{% endblock %} {% block content %} <Table width= "100%" cellSpacing=0 cellPadding=5><TR> diff --git a/wqflask/wqflask/templates/loading.html b/wqflask/wqflask/templates/loading.html index bc2627a0..cede0e86 100644 --- a/wqflask/wqflask/templates/loading.html +++ b/wqflask/wqflask/templates/loading.html @@ -1,14 +1,26 @@ -{% extends "base.html" %} -{% block title %}Loading Mapping Results{% endblock %} -{% block content %} -<form method="post" action="/marker_regression" name="loading_form" id="loading_form"> - <div class="progress" style="position: fixed; top: 50%; left: 50%;"> - <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width:100%"></div> +<title>Loading Mapping Results</title> +<link REL="stylesheet" TYPE="text/css" href="/static/packages/bootstrap/css/bootstrap.css" /> +<link REL="stylesheet" TYPE="text/css" href="/static/packages/bootstrap/css/non-responsive.css" /> +<link REL="stylesheet" TYPE="text/css" href="/static/packages/bootstrap/css/docs.css" /> +<link rel="stylesheet" type="text/css" href="/static/packages/colorbox/example4/colorbox.css" /> +<link rel="stylesheet" type="text/css" href="/static/new/css/main.css" /> +<form method="post" action="/marker_regression" name="loading_form" id="loading_form" class="form-horizontal"> + {% for key, value in start_vars.iteritems() %} + <input type="hidden" name="{{ key }}" value="{{ value }}"> + {% endfor %} + <div class="container"> + <div class="row"> + <div style="margin-left: 46%; margin-right: 50%; min-height: 100vh; display: flex; align-items: center;"> + <h1>Loading Mapping Results...</h1> + </div> + <div class="progress center-block" style="margin-left: 25%; margin-right: 25%; position: absolute; height:50px; width:50%; top:50%;"> + <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width:100%;"></div> + </div> + </div> </div> </form> -{% endblock %} -{% block js %} +<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> +<script src="/static/packages/bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript"> $("#loading_form").submit(); -</script> -{% endblock %}
\ No newline at end of file +</script>
\ No newline at end of file diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html index c6112edb..de901ff5 100644 --- a/wqflask/wqflask/templates/marker_regression_gn1.html +++ b/wqflask/wqflask/templates/marker_regression_gn1.html @@ -71,7 +71,7 @@ <input type="radio" name="LRSCheck" value="LRS" {% if LRS_LOD == "LRS" %}checked{% endif %}>LRS </label> <label class="radio-inline"> - <input type="radio" name="LRSCheck" value="LOD" {% if LRS_LOD == "LOD" %}checked{% endif %}>LOD + <input type="radio" name="LRSCheck" value="{% if LRS_LOD == "-log(p)" %}-log(p){% else %}LOD{% endif %}" {% if LRS_LOD == "LOD" or LRS_LOD == "-log(p)" %}checked{% endif %}>{% if LRS_LOD == "-log(p)" %}-log(p){% else %}LOD{% endif %} </label> <a href="http://genenetwork.org/glossary.html#LOD" target="_blank"> <sup style="color:#f00"> ?</sup> @@ -121,7 +121,7 @@ <span style="color:red;">*</span> <br> <input type="checkbox" name="showGenes" class="checkbox" style="display: inline; margin-top: 0px;" {% if geneChecked|upper == "ON" %}value="ON" checked{% endif %}> <span style="font-size: 12px;">Gene Track </span> <span style="color:red;">*</span><br> - {% if plotScale != "morgan" %} + {% if plotScale != "morgan" and mapping_method != "gemma" %} <input type="checkbox" name="haplotypeAnalystCheck" class="checkbox" style="display: inline; margin-top: 0px;" {% if haplotypeAnalystChecked|upper == "ON" %}value="ON" checked{% endif %}> <span style="font-size: 12px;">Haplotype Analyst </span> <span style="color:red;">*</span><br> {% endif %} <input type="checkbox" name="viewLegend" class="checkbox" style="display: inline; margin-top: 0px;" {% if legendChecked|upper == "ON" %}value="ON" checked{% endif %}> <span style="font-size: 12px;">Legend </span> @@ -173,10 +173,10 @@ </form> {% if selectedChr == -1 %} - <div style="width:{% if 'additive' in trimmed_markers[0] %}50%{% else %}35%{% endif %};"> + <div style="width:{% if 'additive' in trimmed_markers[0] %}40%{% else %}30%{% endif %};"> <h2>Results</h2> - <div id="table_container" style="background-color: #eeeeee; border: 1px solid black;"> - <table id="qtl_results" class="table table-hover table-striped"> + <div id="table_container"> + <table id="qtl_results" class="table table-hover table-striped nowrap"> <thead> <tr> <th></th> @@ -200,33 +200,33 @@ <tbody> {% for marker in trimmed_markers %} <tr> - <td> + <td align="center" style="padding-right: 0px;"> <input type="checkbox" name="selectCheck" class="checkbox edit_sample_checkbox" value="{{ marker.name }}" checked="checked"> </td> <td align="right">{{ loop.index }}</td> <td>{{ marker.name }}</td> - {% if LRS_LOD == "LOD" %} + {% if LRS_LOD == "LOD" or LRS_LOD == "-log(p)" %} {% if 'lod_score' in marker %} - <td>{{ '%0.2f' | format(marker.lod_score|float) }}</td> + <td align="right">{{ '%0.2f' | format(marker.lod_score|float) }}</td> {% else %} - <td>{{ '%0.2f' | format(marker.lrs_value|float / 4.16) }}</td> + <td align="right">{{ '%0.2f' | format(marker.lrs_value|float / 4.16) }}</td> {% endif %} {% else %} {% if 'lod_score' in marker %} - <td>{{ '%0.2f' | format(marker.lod_score|float * 4.16) }}</td> + <td align="right">{{ '%0.2f' | format(marker.lod_score|float * 4.16) }}</td> {% else %} - <td>{{ '%0.2f' | format(marker.lrs_value|float) }}</td> + <td align="right">{{ '%0.2f' | format(marker.lrs_value|float) }}</td> {% endif %} {% endif %} - <td>{{marker.chr}}</td> - <td>{{ '%0.6f' | format(marker.Mb|float) }}</td> + <td align="right">{{marker.chr}}</td> + <td align="right">{{ '%0.6f' | format(marker.Mb|float) }}</td> {% if 'additive' in marker %} - <td>{{ '%0.3f' | format(marker.additive|float) }}</td> + <td align="right">{{ '%0.3f' | format(marker.additive|float) }}</td> {% endif %} {% if 'dominance' in marker %} - <td>{{ '%0.2f' | format(marker.dominance|float) }}</td> + <td align="right">{{ '%0.2f' | format(marker.dominance|float) }}</td> {% endif %} </tr> {% endfor %} @@ -237,8 +237,8 @@ {% else %} <div> <h2>Interval Analyst</h2> - <div id="table_container" style="background-color: #eeeeee; border: 1px solid black;"> - <table id="interval_analyst" class="table table-hover table-striped"> + <div id="table_container"> + <table id="interval_analyst" class="table table-hover table-striped nowrap"> <thead> <tr> {% for header in gene_table_header %} @@ -274,12 +274,8 @@ <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script> <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/dataTables.buttons.min.js"></script> - <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.html5.min.js"></script> - <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.bootstrap.min.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.scientific.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script> - <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colResize.js"></script> - <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colReorder.js"></script> <script> js_data = {{ js_data | safe }} @@ -297,33 +293,26 @@ console.time("Creating table"); $('#qtl_results').DataTable( { "columns": [ - { "type": "natural", "width": "5%", "bSortable": false }, - { "type": "natural", "width": "6%" }, - { "type": "natural" }, - { "type": "natural" }, - { "type": "natural" }, - { "type": "natural" }, - { "type": "natural" }, - { "type": "natural" } + { "type": "natural", "width": "5%" }, + { "type": "natural", "width": "8%" }, + { "type": "natural", "width": "20%" }, + { "type": "natural", "width": "8%" }, + { "type": "natural", "width": "8%" }, + { "type": "natural", "width": "15%" } ], + "columnDefs": [ { + "targets": 0, + "orderable": false + } ], "order": [[1, "asc" ]], - "buttons": [ - { - extend: 'csvHtml5', - text: 'Download CSV', - title: 'search_results', - fieldBoundary: '"', - exportOptions: { - columns: [1, 2, 3, 4, 5, 6, 7, 8] - } - } - ], - "sDom": "RZBtir", + "sDom": "RZtir", "iDisplayLength": -1, - "bDeferRender": true, + "autoWidth": false, + "deferRender": true, "bSortClasses": false, - "scrollY": true, + "scrollY": "600px", "scrollCollapse": false, + "scroller": true, "paging": false } ); @@ -333,18 +322,7 @@ "sortable": false }], "order": [[3, "asc" ]], - "buttons": [ - { - extend: 'csvHtml5', - text: 'Download CSV', - title: 'search_results', - fieldBoundary: '"', - exportOptions: { - columns: [1, 2, 3, 4, 5, 6, 7, 8, 9] - } - } - ], - "sDom": "RZBtir", + "sDom": "RZtir", "iDisplayLength": -1, "bDeferRender": true, "bSortClasses": false, diff --git a/wqflask/wqflask/templates/policies.html b/wqflask/wqflask/templates/policies.html index aa5c453d..83b6b3c0 100644 --- a/wqflask/wqflask/templates/policies.html +++ b/wqflask/wqflask/templates/policies.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% block title %}GeneNetwork{% endblock %} +{% block title %}Policies{% endblock %} {% block content %} <Table width= "100%" cellSpacing=0 cellPadding=5><TR> diff --git a/wqflask/wqflask/templates/reference.html b/wqflask/wqflask/templates/reference.html index 4ad97522..cc4408e1 100644 --- a/wqflask/wqflask/templates/reference.html +++ b/wqflask/wqflask/templates/reference.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% block title %}GeneNetwork{% endblock %} +{% block title %}References{% endblock %} {% block content %} <TABLE cellSpacing=5 cellPadding=4 width="100%" border=0> diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index cafa8b93..718b31d3 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -10,7 +10,7 @@ {{ header("Search Results", 'GeneNetwork found {}.'.format(numify(results|count, "record", "records"))) }} - <div> + <div style="padding-left: 10px;"> <input type="hidden" name="uc_id" id="uc_id" value="{{ uc_id }}"> <!-- Need to customize text more for other types of searches --> @@ -86,7 +86,7 @@ {% if header == 'Max LRS' %} <th data-export="Max LRS">Max LRS</th> {% elif header == 'Additive Effect' %} - <th data-export="Additive Effect">Additive Effect<a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> + <th data-export="Additive Effect">Additive <a href="http://genenetwork.org//glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th> {% else %} <th data-export="{{header}}">{{header}}</th> {% endif %} @@ -182,6 +182,8 @@ $('.trait_checkbox:checkbox').on("change", change_buttons); }, "createdRow": function ( row, data, index ) { + $('td', row).eq(0).attr('style', 'padding-right: 0px;'); + $('td', row).eq(0).attr('align', 'center'); $('td', row).eq(1).attr('align', 'right'); $('td', row).eq(1).attr('data-export', index+1); $('td', row).eq(2).attr('data-export', $('td', row).eq(2).text()); @@ -189,8 +191,8 @@ $('td', row).eq(3).attr('data-export', $('td', row).eq(3).text()); $('td', row).eq(4).attr('title', $('td', row).eq(4).text()); $('td', row).eq(4).attr('data-export', $('td', row).eq(4).text()); - if ($('td', row).eq(4).text().length > 50) { - $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 50)); + if ($('td', row).eq(4).text().length > 60) { + $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 60)); $('td', row).eq(4).text($('td', row).eq(4).text() + '...') } $('td', row).eq(5).attr('data-export', $('td', row).eq(5).text()); @@ -208,12 +210,12 @@ { "type": "natural", "width": "4%" }, { "type": "natural", "width": "12%" }, { "type": "natural", "width": "12%" }, - { "type": "natural", "width": "30%" }, - { "type": "natural", "width": "10%" }, - { "type": "natural", "width": "6%" }, + { "type": "natural", "width": "25%" }, + { "type": "natural", "width": "11%" }, + { "type": "natural", "width": "5%" }, { "type": "natural", "width": "6%" }, - { "type": "natural", "width": "12%" }, - { "type": "natural", "width": "10%" } + { "type": "natural", "width": "11%" }, + { "type": "natural", "width": "6%" } ], "columnDefs": [ { "targets": 0, @@ -266,7 +268,7 @@ $('td', row).eq(4).text($('td', row).eq(4).text() + '...') } $('td', row).eq(4).text($('td', row).eq(4).text().substring(0, 30)); - $('td', row).eq(5).attr('align', 'right'); + //$('td', row).eq(5).attr('align', 'right'); $('td', row).eq(5).attr('data-export', $('td', row).eq(5).text()); $('td', row).eq(6).attr('align', 'right'); $('td', row).eq(6).attr('data-export', $('td', row).eq(6).text()); @@ -283,8 +285,8 @@ { "type": "natural", "width": "25%" }, { "type": "natural", "width": "5%" }, { "type": "natural", "width": "6%" }, - { "type": "natural", "width": "9%" }, - { "type": "natural", "width": "7%" } + { "type": "natural", "width": "10%" }, + { "type": "natural", "width": "9%" } ], "columnDefs": [ { "targets": 0, diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index d7e60b61..772c4314 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -237,10 +237,10 @@ $('#samples_primary, #samples_other').DataTable( { "columns": [ - { "bSortable": false }, - { "type": "natural" }, - null, - { "type": "cust-txt" }{% if sample_groups[0].attributes|length > 0 %},{% endif %} + { "bSortable": false, "width": "8%" }, + { "type": "natural", "width": "15%" }, + { "type": "natural", "width": "25%" }, + { "type": "cust-txt", "width": "25%" }{% if sample_groups[0].attributes|length > 0 %},{% endif %} {% for attribute in sample_groups[0].attributes %} { "type": "natural" }{% if loop.index < sample_groups[0].attributes|length %},{% endif %} {% endfor %} diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html index 017a88ae..d4b70a02 100644 --- a/wqflask/wqflask/templates/show_trait_details.html +++ b/wqflask/wqflask/templates/show_trait_details.html @@ -80,7 +80,7 @@ </a> {% if this_trait.dataset.type == 'ProbeSet' %} {% if this_trait.symbol != None %} - <a href="http://www.genenetwork.org/webqtl/main.py?cmd=sch&gene={{ this_trait.symbol }}&alias=1&species={{ species_name }}"> + <a href="http://www.genenetwork.org/webqtl/main.py?cmd=sch&gene={{ this_trait.symbol }}&alias=1&species={{ dataset.group.species }}"> <button type="button" class="btn btn-default" title="Find similar expression data"> <i class="icon-search"></i> Find </button> diff --git a/wqflask/wqflask/templates/show_trait_edit_data.html b/wqflask/wqflask/templates/show_trait_edit_data.html index 8821167b..a431821e 100644 --- a/wqflask/wqflask/templates/show_trait_edit_data.html +++ b/wqflask/wqflask/templates/show_trait_edit_data.html @@ -100,7 +100,7 @@ <tbody> {% for sample in sample_type.sample_list %} <tr class="{{ sample.class_outlier }} value_se" id="{{ sample.this_id }}"> - <td class="column_name-"><input type="checkbox" name="selectCheck" class="checkbox edit_sample_checkbox" style="transform: scale(1.5);" value="{{ sample.name }}" checked="checked"> + <td align="center" style="padding-right: 0px;" class="column_name-"><input type="checkbox" name="selectCheck" class="checkbox edit_sample_checkbox" value="{{ sample.name }}" checked="checked"> </td> <td class="column_name-Index" align="right">{{ loop.index }}</td> <td class="column_name-Sample"> @@ -110,12 +110,12 @@ </td> {# Todo: Add IDs #} - <td class="column_name-Value"> + <td class="column_name-Value" align="right"> <input type="text" data-value="{{ sample.display_value }}" name="{{ 'value:' + sample.name }}" style="text-align:right;" class="trait_value_input edit_sample_value" value="{{ sample.display_value }}" - size=8 maxlength=8 + size=6 maxlength=6 > </td> diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html index 283ee7e5..12ba80b9 100644 --- a/wqflask/wqflask/templates/show_trait_mapping_tools.html +++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html @@ -4,7 +4,8 @@ <div class="tabbable"> <!-- Only required for left/right tabs --> <ul class="nav nav-pills"> - {% if use_pylmm_rqtl and not use_plink_gemma and dataset.group.species != "human" %} + {# if use_pylmm_rqtl and not use_plink_gemma and dataset.group.species != "human" #} + {% if dataset.group.mapping_id == "1" %} <li class="active"> <a href="#interval_mapping" data-toggle="tab">Interval Mapping</a> </li> @@ -15,21 +16,25 @@ <a href="#rqtl_geno" data-toggle="tab">R/qtl</a> </li> {% endif %} - {% if use_plink_gemma %} + {# if use_plink_gemma #} + {% if dataset.group.mapping_id == "2" or dataset.group.mapping_id == "4" %} <li class="active"> <a href="#gemma" data-toggle="tab">GEMMA</a> </li> + {% if dataset.group.mapping_id == "4" %} <li> <a href="#plink" data-toggle="tab">PLINK</a> </li> {% endif %} + {% endif %} <!--<li> <a href="#pair_scan" data-toggle="tab">Pair Scan</a> </li>--> </ul> <div class="tab-content"> - {% if use_pylmm_rqtl and not use_plink_gemma and dataset.group.species != "human" %} + {# if use_pylmm_rqtl and not use_plink_gemma and dataset.group.species != "human" #} + {% if dataset.group.mapping_id == "1" %} <div class="tab-pane active" id="interval_mapping"> <div style="margin-top: 20px" class="form-horizontal"> {% if genofiles and genofiles|length>0 %} @@ -298,7 +303,8 @@ </div> </div> {% endif %} - {% if use_plink_gemma %} + {# if use_plink_gemma #} + {% if dataset.group.mapping_id == "2" or dataset.group.mapping_id == "4" %} <div class="tab-pane active" id="gemma"> <div style="padding: 20px" class="form-horizontal"> <div class="mapping_method_fields form-group"> @@ -318,6 +324,7 @@ </div> </div> </div> + {% if dataset.group.mapping_id == "4" %} <div class="tab-pane" id="plink"> <div style="padding: 20px" class="form-horizontal"> <div class="mapping_method_fields form-group"> @@ -338,6 +345,7 @@ </div> </div> {% endif %} + {% endif %} </div> </div> </div> diff --git a/wqflask/wqflask/templates/submit_trait.html b/wqflask/wqflask/templates/submit_trait.html index df6b0bb7..2529a4f4 100644 --- a/wqflask/wqflask/templates/submit_trait.html +++ b/wqflask/wqflask/templates/submit_trait.html @@ -2,13 +2,12 @@ {% block title %}Trait Submission{% endblock %} {% block content %} <!-- Start of body --> - + <form method="post" action="/show_trait"> <div class="container-fluid"> {{ flash_me() }} <div class="row" style="width: 1400px !important;"> - <div class="col-xs-5"> <section id="description"> <div> @@ -36,7 +35,7 @@ <div style="padding-bottom: 50px;" class="form-horizontal"> <h3>1. Choose cross or RI set:</h3> <br> - <div class="col-xs-2"> + <div class="col-xs-2" style="min-height: 15vh; display: flex; align-items: center;"> <img src="/static/new/images/step1.gif"> </div> <div class="col-xs-10"> @@ -52,44 +51,47 @@ <select name="group" id="group" class="form-control span3" style="width: 280px !important;"></select> </div> </div> - <!-- - <select name="corr_dataset"> - {% for species in species_and_groups %} - <optgroup label="{{ species.species }} ------"> - {% for group in species.groups %} - <option value="{{ group }}"> - {{ group }} - </option> - {% endfor %} - </optgroup> - {% endfor %} - </select> - --> </div> + <div class="form-horizontal"><img src="/static/new/images/arrowdown.gif" style="display:block; margin-left: 50%; margin-right: 50%;"></div> </div> <div style="padding-bottom: 50px;" class="form-horizontal"> <h3>2. Enter Trait Data:</h3> <br> - <div class="col-xs-2" style="vertical-align:middle;"> + <div class="col-xs-2" style="min-height: 100vh; display: flex; align-items: center;"> <img src="/static/new/images/step2.gif"> </div> <div class="col-xs-10"> - <div class="form-group"> + <div class="form-group" style="padding-left: 15px;"> <p> <b>From a File:</b> You can enter data by entering a file name here. The file should contain a series of numbers representing trait values. The values can be on one line separated by spaces or tabs, or they can be on separate lines. Include one value for each progeny individual - or recombinant inbred line. Represent missing values with a non-numeric character such as "x". If you have chosen a recombinant inbred set, - when you submit your data will be displayed in a form where you can confirm and/or edit them. If you enter a file name here, any data that - you paste into the next section will be ignored. + or recombinant inbred line. Represent missing values with a non-numeric character such as "x". If you have chosen a recombinant inbred set, + when you submit your data will be displayed in a form where you can confirm and/or edit them. If you enter a file name here, any data that + you paste into the next section will be ignored. </p> <input type="file" name="trait_file" style="border-width: 1px; border-style: solid; border-color: #999999;"> </div> + <div class="form-group" style="padding-left: 15px;"> + <p> + <b>By Pasting or Typing Multiple Values:</b> You can enter data by pasting a series of numbers representing trait values into this area. + The values can be on one line separated by spaces or tabs, or they can be on separate lines. Include one value for each progeny individual + or recombinant inbredline. Represent missing values with a non-numeric character such as "x". If you have chosen a recombinant inbred set, + when you submit your data will be displayed in a form where you can confirm and/or edit them. If you enter a file name in the previous section, + any data that you paste here will be ignored. Check sample data for the correct format. + </p> + <textarea name="trait_paste" rows="6" cols="70"></textarea> + </div> + </div> + <div class="controls" style="display:block; margin-left: 40%; margin-right: 20%;"> + <input type="submit" style="width: 110px; margin-right: 25px;" class="btn btn-primary form-control col-xs-2" value="Submit Trait"> + <input type="reset" style="width: 110px;" class="btn btn-primary form-control col-xs-2" value="Reset"> </div> </div> </section> </div> </div> </div> + </form> {%endblock%} diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 4f46a904..9e05bf10 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -50,10 +50,11 @@ from wqflask.correlation_matrix import show_corr_matrix from wqflask.correlation import corr_scatter_plot from wqflask.wgcna import wgcna_analysis from wqflask.ctl import ctl_analysis -from wqflask.submit_trait import get_species_groups +from wqflask.trait_submission import submit_trait from utility import temp_data from utility.tools import SQL_URI,TEMPDIR,USE_REDIS,USE_GN_SERVER,GN_SERVER_URL,GN_VERSION +from utility.helper_functions import get_species_groups from base import webqtlFormData from base.webqtlConfig import GENERATED_IMAGE_DIR @@ -296,10 +297,19 @@ def environments(): return render_template("docs.html", **doc.__dict__) @app.route("/submit_trait") -def submit_trait(): +def submit_trait_form(): species_and_groups = get_species_groups() return render_template("submit_trait.html", **{'species_and_groups' : species_and_groups, 'gn_server_url' : GN_SERVER_URL, 'version' : GN_VERSION}) +@app.route("/create_temp_trait", methods=('POST',)) +def create_temp_trait(): + print("REQUEST.FORM:", request.form) + template_vars = submit_trait.SubmitTrait(request.form) + + doc = docs.Docs("links") + return render_template("links.html", **doc.__dict__) + #return render_template("show_trait.html", **template_vars.__dict__) + @app.route('/export_trait_excel', methods=('POST',)) def export_trait_excel(): """Excel file consisting of the sample data from the trait data and analysis page""" @@ -381,9 +391,6 @@ def export_perm_data(): @app.route("/show_trait") def show_trait_page(): - # Here it's currently too complicated not to use an fd that is a webqtlFormData - #fd = webqtlFormData.webqtlFormData(request.args) - #logger.info("stp y1:", pf(vars(fd))) template_vars = show_trait.ShowTrait(request.args) #logger.info("js_data before dump:", template_vars.js_data) template_vars.js_data = json.dumps(template_vars.js_data, @@ -450,8 +457,9 @@ def mapping_results_container_page(): def loading_page(): initial_start_vars = request.form logger.debug("Marker regression called with initial_start_vars:", initial_start_vars.items()) - temp_uuid = initial_start_vars['temp_uuid'] + #temp_uuid = initial_start_vars['temp_uuid'] wanted = ( + 'temp_uuid', 'trait_id', 'dataset', 'method', @@ -488,12 +496,14 @@ def loading_page(): 'mapmethod_rqtl_geno', 'mapmodel_rqtl_geno' ) + start_vars_container = {} start_vars = {} for key, value in initial_start_vars.iteritems(): if key in wanted or key.startswith(('value:')): start_vars[key] = value - rendered_template = render_template("loading.html", **start_vars) + start_vars_container['start_vars'] = start_vars + rendered_template = render_template("loading.html", **start_vars_container) return rendered_template |