From f2e3407585862581b82680e8521b1e4d944f558a Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 6 Feb 2017 20:01:03 +0000 Subject: 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 --- wqflask/base/data_set.py | 143 ++--- wqflask/utility/helper_functions.py | 20 + wqflask/utility/tools.py | 1 + .../marker_regression/marker_regression_gn1.py | 22 +- wqflask/wqflask/show_trait/show_trait.py | 593 +-------------------- .../new/javascript/dataset_menu_structure.json | 215 ++++---- .../new/javascript/show_trait_mapping_tools.js | 10 +- .../packages/DataTables/css/jquery.dataTables.css | 2 +- wqflask/wqflask/submit_trait.py | 24 - wqflask/wqflask/templates/base.html | 4 +- wqflask/wqflask/templates/data_sharing.html | 2 +- wqflask/wqflask/templates/gsearch_gene.html | 10 +- wqflask/wqflask/templates/links.html | 2 +- wqflask/wqflask/templates/loading.html | 32 +- .../wqflask/templates/marker_regression_gn1.html | 88 ++- wqflask/wqflask/templates/policies.html | 2 +- wqflask/wqflask/templates/reference.html | 2 +- wqflask/wqflask/templates/search_result_page.html | 26 +- wqflask/wqflask/templates/show_trait.html | 8 +- wqflask/wqflask/templates/show_trait_details.html | 2 +- .../wqflask/templates/show_trait_edit_data.html | 6 +- .../templates/show_trait_mapping_tools.html | 16 +- wqflask/wqflask/templates/submit_trait.html | 44 +- wqflask/wqflask/views.py | 24 +- 24 files changed, 404 insertions(+), 894 deletions(-) delete mode 100644 wqflask/wqflask/submit_trait.py (limited to 'wqflask') 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 @@ -116,15 +116,15 @@ "B30_K_1206_M", "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": [ @@ -1339,15 +1339,15 @@ "HLC_0311", "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": [ @@ -1525,15 +1525,15 @@ "NCI_Agil_Mam_Tum_RMA_0409", "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" ] ] }, @@ -1590,15 +1590,15 @@ ] ], "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": [ @@ -1620,11 +1620,6 @@ }, "B6D2F2": { "Brain mRNA": [ - [ - "76", - "BRF2_M_0805_M", - "OHSU/VA B6D2F2 Brain mRNA M430 (Aug05) MAS5" - ], [ "78", "BRF2_M_0805_P", @@ -1635,20 +1630,25 @@ "BRF2_M_0805_R", "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": [ @@ -1726,11 +1726,6 @@ ] ], "Striatum mRNA": [ - [ - "84", - "SA_M2_0905_R", - "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) RMA" - ], [ "83", "SA_M2_0905_M", @@ -1740,21 +1735,26 @@ "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", @@ -1762,16 +1762,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", @@ -1786,16 +1786,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", @@ -1999,6 +1999,11 @@ "BR_U_1105_P", "UTHSC Brain mRNA U74Av2 (Nov05) PDNN" ], + [ + "81", + "BR_U_0805_P", + "UTHSC Brain mRNA U74Av2 (Aug05) PDNN" + ], [ "80", "BR_U_0805_M", @@ -2009,11 +2014,6 @@ "BR_U_0805_R", "UTHSC Brain mRNA U74Av2 (Aug05) RMA" ], - [ - "81", - "BR_U_0805_P", - "UTHSC Brain mRNA U74Av2 (Aug05) PDNN" - ], [ "42", "CB_M_0204_P", @@ -2080,11 +2080,6 @@ "Eye_M2_0908_R_ND", "Eye M430v2 WT Gpnmb (Sep08) RMA" ], - [ - "278", - "Eye_M2_0908_R_MT", - "Eye M430v2 Mutant Tyrp1 (Sep08) RMA" - ], [ "382", "Eye_M2_0908_WTWT", @@ -2095,6 +2090,11 @@ "Eye_M2_0908_R_WT", "Eye M430v2 WT Tyrp1 (Sep08) RMA" ], + [ + "278", + "Eye_M2_0908_R_MT", + "Eye M430v2 Mutant Tyrp1 (Sep08) RMA" + ], [ "400", "DBA2J-ONH-1212", @@ -2351,15 +2351,15 @@ "MA_M2_0806_P", "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": [ @@ -2520,16 +2520,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", @@ -2545,15 +2545,15 @@ "HQFNeoc_0208_RankInv", "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": [ @@ -2760,11 +2760,6 @@ ] ], "Ventral Tegmental Area mRNA": [ - [ - "229", - "VCUEtOH_0609_R", - "VCU BXD VTA EtOH M430 2.0 (Jun09) RMA" - ], [ "228", "VCUSal_0609_R", @@ -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" ] ] }, @@ -2851,6 +2851,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", @@ -2865,6 +2870,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", @@ -2872,6 +2882,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", @@ -3007,15 +3022,15 @@ ] ], "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": [ @@ -3081,16 +3096,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", @@ -3106,6 +3111,16 @@ "Illum_LXS_Hipp_NOS_1008", "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", @@ -3196,15 +3211,15 @@ ] ], "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 @@ -
+
-
+
- {{ loop.index }} + + {{ loop.index }} {{ this_trait.name }} {{ this_trait.dataset.group.species }} {{ this_trait.dataset.group.name }} @@ -82,7 +82,7 @@ Mean Max LRS ? Max LRS Location - Additive Effect ? + Additive ? @@ -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 %} 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 %} - -
-
+Loading Mapping Results + + + + + + + {% for key, value in start_vars.iteritems() %} + + {% endfor %} +
+
+
+

Loading Mapping Results...

+
+
+
+
+
-{% endblock %} -{% block js %} + + -{% endblock %} \ No newline at end of file + \ 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 @@ LRS ? @@ -121,7 +121,7 @@ *
Gene Track *
- {% if plotScale != "morgan" %} + {% if plotScale != "morgan" and mapping_method != "gemma" %} Haplotype Analyst *
{% endif %} Legend @@ -173,10 +173,10 @@ {% if selectedChr == -1 %} -
+

Results

-
-
+
+
@@ -200,33 +200,33 @@ {% for marker in trimmed_markers %} - - {% if LRS_LOD == "LOD" %} + {% if LRS_LOD == "LOD" or LRS_LOD == "-log(p)" %} {% if 'lod_score' in marker %} - + {% else %} - + {% endif %} {% else %} {% if 'lod_score' in marker %} - + {% else %} - + {% endif %} {% endif %} - - + + {% if 'additive' in marker %} - + {% endif %} {% if 'dominance' in marker %} - + {% endif %} {% endfor %} @@ -237,8 +237,8 @@ {% else %}

Interval Analyst

-
-
+ {{ loop.index }} {{ marker.name }}{{ '%0.2f' | format(marker.lod_score|float) }}{{ '%0.2f' | format(marker.lod_score|float) }}{{ '%0.2f' | format(marker.lrs_value|float / 4.16) }}{{ '%0.2f' | format(marker.lrs_value|float / 4.16) }}{{ '%0.2f' | format(marker.lod_score|float * 4.16) }}{{ '%0.2f' | format(marker.lod_score|float * 4.16) }}{{ '%0.2f' | format(marker.lrs_value|float) }}{{ '%0.2f' | format(marker.lrs_value|float) }}{{marker.chr}}{{ '%0.6f' | format(marker.Mb|float) }}{{marker.chr}}{{ '%0.6f' | format(marker.Mb|float) }}{{ '%0.3f' | format(marker.additive|float) }}{{ '%0.3f' | format(marker.additive|float) }}{{ '%0.2f' | format(marker.dominance|float) }}{{ '%0.2f' | format(marker.dominance|float) }}
+
+
{% for header in gene_table_header %} @@ -274,12 +274,8 @@ - - - -