aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorPjotr Prins2016-05-29 17:20:20 +0000
committerPjotr Prins2016-05-29 17:20:20 +0000
commit4b083f2cdfa493f7b2ccc3c30cc5bb6cad694d3a (patch)
treec2c2503d88868f13b06dd66328720486e72f647a /wqflask
parent33d817c81b4b22bc051dbde2b26c5d4de028369e (diff)
parent0d22d3bc72cfc35cb23efce3d1687477880a5b3e (diff)
downloadgenenetwork2-4b083f2cdfa493f7b2ccc3c30cc5bb6cad694d3a.tar.gz
Merge branch 'master' of github.com:genenetwork/genenetwork2
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/base/data_set.py6
-rw-r--r--wqflask/base/trait.py14
-rwxr-xr-xwqflask/base/webqtlCaseData.py3
-rw-r--r--[-rwxr-xr-x]wqflask/base/webqtlConfig.py2
-rwxr-xr-xwqflask/utility/webqtlUtil.py2
-rw-r--r--[-rwxr-xr-x]wqflask/wqflask/correlation/show_corr_results.py551
-rw-r--r--wqflask/wqflask/gsearch.py166
-rw-r--r--wqflask/wqflask/heatmap/heatmap.py2
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression.py30
-rw-r--r--[-rwxr-xr-x]wqflask/wqflask/show_trait/show_trait.py11
-rwxr-xr-xwqflask/wqflask/static/new/javascript/dataset_menu_structure.json187
-rw-r--r--wqflask/wqflask/static/new/javascript/show_trait.js8
-rwxr-xr-xwqflask/wqflask/templates/gsearch_gene.html121
-rwxr-xr-xwqflask/wqflask/templates/show_trait.html2
-rwxr-xr-xwqflask/wqflask/templates/show_trait_calculate_correlations.html11
-rwxr-xr-xwqflask/wqflask/templates/show_trait_details.html23
-rwxr-xr-xwqflask/wqflask/templates/show_trait_mapping_tools.html172
-rw-r--r--wqflask/wqflask/update_search_results.py129
-rw-r--r--wqflask/wqflask/views.py12
19 files changed, 939 insertions, 513 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 053b45fc..4953e728 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -711,7 +711,7 @@ class PhenotypeDataSet(DataSet):
def retrieve_sample_data(self, trait):
query = """
SELECT
- Strain.Name, PublishData.value, PublishSE.error, NStrain.count
+ Strain.Name, PublishData.value, PublishSE.error, NStrain.count, Strain.Name2
FROM
(PublishData, Strain, PublishXRef, PublishFreeze)
left join PublishSE on
@@ -803,7 +803,7 @@ class GenotypeDataSet(DataSet):
def retrieve_sample_data(self, trait):
query = """
SELECT
- Strain.Name, GenoData.value, GenoSE.error, GenoData.Id
+ Strain.Name, GenoData.value, GenoSE.error, GenoData.Id, Sample.Name2
FROM
(GenoData, GenoFreeze, Strain, Geno, GenoXRef)
left join GenoSE on
@@ -1031,7 +1031,7 @@ class MrnaAssayDataSet(DataSet):
def retrieve_sample_data(self, trait):
query = """
SELECT
- Strain.Name, ProbeSetData.value, ProbeSetSE.error, ProbeSetData.Id
+ Strain.Name, ProbeSetData.value, ProbeSetSE.error, ProbeSetData.Id, Strain.Name2
FROM
(ProbeSetData, ProbeSetFreeze, Strain, ProbeSet, ProbeSetXRef)
left join ProbeSetSE on
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 6c5ca8b2..d1c0be83 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -180,13 +180,15 @@ class GeneralTrait(object):
samples = []
vals = []
the_vars = []
+ sample_aliases = []
for sample_name, sample_data in self.data.items():
if sample_data.value != None:
if not include_variance or sample_data.variance != None:
samples.append(sample_name)
vals.append(sample_data.value)
the_vars.append(sample_data.variance)
- return samples, vals, the_vars
+ sample_aliases.append(sample_data.name2)
+ return samples, vals, the_vars, sample_aliases
#
@@ -230,7 +232,7 @@ class GeneralTrait(object):
if results:
for item in results:
- name, value, variance, num_cases = item
+ name, value, variance, num_cases, name2 = item
if not samplelist or (samplelist and name in samplelist):
self.data[name] = webqtlCaseData(*item) #name, value, variance, num_cases)
@@ -313,9 +315,9 @@ class GeneralTrait(object):
self.confidential = 0
if self.pre_publication_description and not self.pubmed_id:
self.confidential = 1
-
- description = self.post_publication_description
+ description = self.post_publication_description
+
#If the dataset is confidential and the user has access to confidential
#phenotype traits, then display the pre-publication description instead
#of the post-publication description
@@ -329,7 +331,7 @@ class GeneralTrait(object):
#
# description = self.pre_publication_description
- if len(description) > 0:
+ if description:
self.description_display = description.strip()
else:
self.description_display = ""
@@ -479,7 +481,7 @@ class GeneralTrait(object):
else:
self.locus = self.lrs = self.additive = ""
- if self.locus_chr != "" and self.locus_mb != "":
+ if (self.dataset.type == 'Publish' or self.dataset.type == "ProbeSet") and self.locus_chr != "" and self.locus_mb != "":
#XZ: LRS_location_value is used for sorting
try:
LRS_location_value = int(self.locus_chr)*1000 + float(self.locus_mb)
diff --git a/wqflask/base/webqtlCaseData.py b/wqflask/base/webqtlCaseData.py
index 42763aed..99a34866 100755
--- a/wqflask/base/webqtlCaseData.py
+++ b/wqflask/base/webqtlCaseData.py
@@ -29,8 +29,9 @@ print("Mr. Mojo Risin 2")
class webqtlCaseData(object):
"""one case data in one trait"""
- def __init__(self, name, value=None, variance=None, num_cases=None):
+ def __init__(self, name, value=None, variance=None, num_cases=None, name2=None):
self.name = name
+ self.name2 = name2 # Other name (for traits like BXD65a)
self.value = value # Trait Value
self.variance = variance # Trait Variance
self.num_cases = num_cases # Number of individuals/cases
diff --git a/wqflask/base/webqtlConfig.py b/wqflask/base/webqtlConfig.py
index 0358bcbf..d0016b33 100755..100644
--- a/wqflask/base/webqtlConfig.py
+++ b/wqflask/base/webqtlConfig.py
@@ -69,7 +69,7 @@ GENERATED_TEXT_DIR = mk_dir(TMPDIR+'/generated_text/')
# Flat file directories
GENODIR = flat_files('genotype')+'/'
-JSON_GENODIR = assert_dir(GENODIR+'json/')
+JSON_GENODIR = flat_files('json')+'/'
PORTADDR = "http://50.16.251.170"
diff --git a/wqflask/utility/webqtlUtil.py b/wqflask/utility/webqtlUtil.py
index f842dde0..1108614b 100755
--- a/wqflask/utility/webqtlUtil.py
+++ b/wqflask/utility/webqtlUtil.py
@@ -509,7 +509,7 @@ def calCorrelationRank(xVals,yVals,N):
j = 0
for i in range(len(xVals)):
- if xVals[i]!= None and yVals[i]!= None:
+ if (xVals[i]!= None and yVals[i]!= None) and (xVals[i] != "None" and yVals[i] != "None"):
XX.append((j,xVals[i]))
YY.append((j,yVals[i]))
j = j+1
diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py
index dd661092..6d8dd76a 100755..100644
--- a/wqflask/wqflask/correlation/show_corr_results.py
+++ b/wqflask/wqflask/correlation/show_corr_results.py
@@ -50,6 +50,7 @@ from dbFunction import webqtlDatabaseFunction
import utility.webqtlUtil #this is for parallel computing only.
from wqflask.correlation import correlation_functions
from utility.benchmark import Bench
+import utility.webqtlUtil
from MySQLdb import escape_string as escape
@@ -159,6 +160,9 @@ class CorrelationResults(object):
self.correlation_data = {}
+ db_filename = self.getFileName(target_db_name = self.target_dataset.name)
+ cache_available = db_filename in os.listdir(webqtlConfig.TEXTDIR)
+
if self.corr_type == "tissue":
self.trait_symbol_dict = self.dataset.retrieve_genes("Symbol")
@@ -174,9 +178,25 @@ class CorrelationResults(object):
self.get_sample_r_and_p_values(trait, self.target_dataset.trait_data[trait])
elif self.corr_type == "sample":
- # print("self.target_dataset.trait_data: %d" % len(self.target_dataset.trait_data))
- for trait, values in self.target_dataset.trait_data.iteritems():
- self.get_sample_r_and_p_values(trait, values)
+ if self.dataset.type == "ProbeSet" and cache_available:
+ dataset_file = open(webqtlConfig.TEXTDIR+db_filename,'r')
+
+ #XZ, 01/08/2009: read the first line
+ line = dataset_file.readline()
+ dataset_strains = webqtlUtil.readLineCSV(line)[1:]
+
+ self.this_trait_vals = []
+ for item in dataset_strains:
+ if item in self.sample_data:
+ self.this_trait_vals.append(self.sample_data[item])
+ else:
+ self.this_trait_vals.append("None")
+ num_overlap = len(self.this_trait_vals)
+
+ self.do_parallel_correlation(db_filename, num_overlap)
+ else:
+ for trait, values in self.target_dataset.trait_data.iteritems():
+ self.get_sample_r_and_p_values(trait, values)
self.correlation_data = collections.OrderedDict(sorted(self.correlation_data.items(),
key=lambda t: -abs(t[1][0])))
@@ -190,7 +210,7 @@ class CorrelationResults(object):
range_chr_as_int = order_id
for _trait_counter, trait in enumerate(self.correlation_data.keys()[:self.return_number]):
- trait_object = GeneralTrait(dataset=self.target_dataset, name=trait, get_qtl_info=True)
+ trait_object = GeneralTrait(dataset=self.target_dataset, name=trait, get_qtl_info=True, get_sample_info=False)
if self.dataset.type == "ProbeSet" or self.dataset.type == "Geno":
#ZS: Convert trait chromosome to an int for the location range option
@@ -308,7 +328,7 @@ class CorrelationResults(object):
#traitList = self.correlate()
- #_log.info("Done doing correlation calculation")
+ #print("Done doing correlation calculation")
############################################################################################################################################
@@ -521,27 +541,126 @@ class CorrelationResults(object):
"""
- # print("len(self.sample_data):", len(self.sample_data))
-
- this_trait_vals = []
+ self.this_trait_vals = []
target_vals = []
for index, sample in enumerate(self.target_dataset.samplelist):
if sample in self.sample_data:
sample_value = self.sample_data[sample]
target_sample_value = target_samples[index]
- this_trait_vals.append(sample_value)
+ self.this_trait_vals.append(sample_value)
target_vals.append(target_sample_value)
- this_trait_vals, target_vals, num_overlap = corr_result_helpers.normalize_values(
- this_trait_vals, target_vals)
+ self.this_trait_vals, target_vals, num_overlap = corr_result_helpers.normalize_values(self.this_trait_vals, target_vals)
#ZS: 2015 could add biweight correlation, see http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3465711/
if self.corr_method == 'pearson':
- sample_r, sample_p = scipy.stats.pearsonr(this_trait_vals, target_vals)
+ sample_r, sample_p = scipy.stats.pearsonr(self.this_trait_vals, target_vals)
else:
- sample_r, sample_p = scipy.stats.spearmanr(this_trait_vals, target_vals)
+ sample_r, sample_p = scipy.stats.spearmanr(self.this_trait_vals, target_vals)
- self.correlation_data[trait] = [sample_r, sample_p, num_overlap]
+ if num_overlap > 5:
+ self.correlation_data[trait] = [sample_r, sample_p, num_overlap]
+
+
+ """
+ correlations = []
+
+ #XZ: Use the fast method only for probeset dataset, and this dataset must have been created.
+ #XZ: Otherwise, use original method
+ #print("Entering correlation")
+
+ #db_filename = self.getFileName(target_db_name=self.target_db_name)
+ #
+ #cache_available = db_filename in os.listdir(webqtlConfig.TEXTDIR)
+
+ # If the cache file exists, do a cached correlation for probeset data
+ if self.dataset.type == "ProbeSet":
+# if self.method in [METHOD_SAMPLE_PEARSON, METHOD_SAMPLE_RANK] and cache_available:
+# traits = do_parallel_correlation()
+#
+# else:
+
+ traits = self.get_traits(self.vals)
+
+ for trait in traits:
+ trait.calculate_correlation(vals, self.method)
+
+ self.record_count = len(traits) #ZS: This isn't a good way to get this value, so I need to change it later
+
+ #XZ, 3/31/2010: Theoretically, we should create one function 'comTissueCorr'
+ #to compare each trait by their tissue corr p values.
+ #But because the tissue corr p values are generated by permutation test,
+ #the top ones always have p value 0. So comparing p values actually does nothing.
+ #In addition, for the tissue data in our database, the N is always the same.
+ #So it's safe to compare with tissue corr statistic value.
+ #That's the same as literature corr.
+ #if self.method in [METHOD_LIT, METHOD_TISSUE_PEARSON, METHOD_TISSUE_RANK] and self.gene_id:
+ # traits.sort(webqtlUtil.cmpLitCorr)
+ #else:
+ #if self.method in TISSUE_METHODS:
+ # sort(traits, key=lambda A: math.fabs(A.tissue_corr))
+ #elif self.method == METHOD_LIT:
+ # traits.sort(traits, key=lambda A: math.fabs(A.lit_corr))
+ #else:
+ traits = sortTraitCorrelations(traits, self.method)
+
+ # Strip to the top N correlations
+ traits = traits[:min(self.returnNumber, len(traits))]
+
+ addLiteratureCorr = False
+ addTissueCorr = False
+
+ trait_list = []
+ for trait in traits:
+ db_trait = webqtlTrait(db=self.db, name=trait.name, cursor=self.cursor)
+ db_trait.retrieveInfo( QTL='Yes' )
+
+ db_trait.Name = trait.name
+ db_trait.corr = trait.correlation
+ db_trait.nOverlap = trait.overlap
+ db_trait.corrPValue = trait.p_value
+
+ # NL, 07/19/2010
+ # js function changed, add a new parameter rankOrder for js function 'showTissueCorrPlot'
+ db_trait.RANK_ORDER = self.RANK_ORDERS[self.method]
+
+ #XZ, 26/09/2008: Method is 4 or 5. Have fetched tissue corr, but no literature correlation yet.
+ if self.method in TISSUE_METHODS:
+ db_trait.tissueCorr = trait.tissue_corr
+ db_trait.tissuePValue = trait.p_tissue
+ addTissueCorr = True
+
+
+ #XZ, 26/09/2008: Method is 3, Have fetched literature corr, but no tissue corr yet.
+ elif self.method == METHOD_LIT:
+ db_trait.LCorr = trait.lit_corr
+ db_trait.mouse_geneid = self.translateToMouseGeneID(self.species, db_trait.geneid)
+ addLiteratureCorr = True
+
+ #XZ, 26/09/2008: Method is 1 or 2. Have NOT fetched literature corr and tissue corr yet.
+ # Phenotype data will not have geneid, and neither will some probes
+ # we need to handle this because we will get an attribute error
+ else:
+ if self.input_trait_mouse_gene_id and self.db.type=="ProbeSet":
+ addLiteratureCorr = True
+ if self.trait_symbol and self.db.type=="ProbeSet":
+ addTissueCorr = True
+
+ trait_list.append(db_trait)
+
+ if addLiteratureCorr:
+ trait_list = self.getLiteratureCorrelationByList(self.input_trait_mouse_gene_id,
+ self.species, trait_list)
+ if addTissueCorr:
+ trait_list = self.getTissueCorrelationByList(
+ primaryTraitSymbol = self.trait_symbol,
+ traitList = trait_list,
+ TissueProbeSetFreezeId = TISSUE_MOUSE_DB,
+ method=self.method)
+
+ return trait_list
+ """
+
def do_tissue_corr_for_all_traits_2(self):
"""Comments Possibly Out of Date!!!!!
@@ -670,38 +789,6 @@ class CorrelationResults(object):
# except: return False
- def get_all_dataset_data(self):
-
- """
- SELECT ProbeSet.Name, T128.value, T129.value, T130.value, T131.value, T132.value, T134.value, T135.value, T138.value, T139.value, T140.value, T141.value, T142.value, T144
- .value, T145.value, T147.value, T148.value, T149.value, T487.value, T919.value, T920.value, T922.value
- FROM (ProbeSet, ProbeSetXRef, ProbeSetFreeze)
- left join ProbeSetData as T128 on T128.Id = ProbeSetXRef.DataId and T128.StrainId=128
- left join ProbeSetData as T129 on T129.Id = ProbeSetXRef.DataId and T129.StrainId=129
- left join ProbeSetData as T130 on T130.Id = ProbeSetXRef.DataId and T130.StrainId=130
- left join ProbeSetData as T131 on T131.Id = ProbeSetXRef.DataId and T131.StrainId=131
- left join ProbeSetData as T132 on T132.Id = ProbeSetXRef.DataId and T132.StrainId=132
- left join ProbeSetData as T134 on T134.Id = ProbeSetXRef.DataId and T134.StrainId=134
- left join ProbeSetData as T135 on T135.Id = ProbeSetXRef.DataId and T135.StrainId=135
- left join ProbeSetData as T138 on T138.Id = ProbeSetXRef.DataId and T138.StrainId=138
- left join ProbeSetData as T139 on T139.Id = ProbeSetXRef.DataId and T139.StrainId=139
- left join ProbeSetData as T140 on T140.Id = ProbeSetXRef.DataId and T140.StrainId=140
- left join ProbeSetData as T141 on T141.Id = ProbeSetXRef.DataId and T141.StrainId=141
- left join ProbeSetData as T142 on T142.Id = ProbeSetXRef.DataId and T142.StrainId=142
- left join ProbeSetData as T144 on T144.Id = ProbeSetXRef.DataId and T144.StrainId=144
- left join ProbeSetData as T145 on T145.Id = ProbeSetXRef.DataId and T145.StrainId=145
- left join ProbeSetData as T147 on T147.Id = ProbeSetXRef.DataId and T147.StrainId=147
- left join ProbeSetData as T148 on T148.Id = ProbeSetXRef.DataId and T148.StrainId=148
- left join ProbeSetData as T149 on T149.Id = ProbeSetXRef.DataId and T149.StrainId=149
- left join ProbeSetData as T487 on T487.Id = ProbeSetXRef.DataId and T487.StrainId=487
- left join ProbeSetData as T919 on T919.Id = ProbeSetXRef.DataId and T919.StrainId=919
- left join ProbeSetData as T920 on T920.Id = ProbeSetXRef.DataId and T920.StrainId=920
- left join ProbeSetData as T922 on T922.Id = ProbeSetXRef.DataId and T922.StrainId=922
- WHERE ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id and
- ProbeSetFreeze.Name = 'HC_M2_0606_P' and
- ProbeSet.Id = ProbeSetXRef.ProbeSetId order by ProbeSet.Id
- """
-
def process_samples(self, start_vars, sample_names, excluded_samples=None):
if not excluded_samples:
excluded_samples = ()
@@ -988,59 +1075,7 @@ class CorrelationResults(object):
totalTraits = len(traits) #XZ, 09/18/2008: total trait number
return traits
-
-
- def do_parallel_correlation(self):
- _log.info("Invoking parallel computing")
- input_line_list = datasetFile.readlines()
- _log.info("Read lines from the file")
- all_line_number = len(input_line_list)
-
- step = 1000
- job_number = math.ceil( float(all_line_number)/step )
-
- job_input_lists = []
-
- _log.info("Configuring jobs")
-
- for job_index in range( int(job_number) ):
- starti = job_index*step
- endi = min((job_index+1)*step, all_line_number)
-
- one_job_input_list = []
-
- for i in range( starti, endi ):
- one_job_input_list.append( input_line_list[i] )
-
- job_input_lists.append( one_job_input_list )
-
- _log.info("Creating pp servers")
-
- ppservers = ()
- # Creates jobserver with automatically detected number of workers
- job_server = pp.Server(ppservers=ppservers)
-
- _log.info("Done creating servers")
-
- jobs = []
- results = []
-
- _log.info("Starting parallel computation, submitting jobs")
- for one_job_input_list in job_input_lists: #pay attention to modules from outside
- jobs.append( job_server.submit(func=compute_corr, args=(nnCorr, _newvals, one_job_input_list, self.method), depfuncs=(), modules=("utility.webqtlUtil",)) )
- _log.info("Done submitting jobs")
-
- for one_job in jobs:
- one_result = one_job()
- results.append( one_result )
-
- _log.info("Acquiring results")
-
- for one_result in results:
- for one_traitinfo in one_result:
- allcorrelations.append( one_traitinfo )
-
- _log.info("Appending the results")
+
def calculate_corr_for_all_tissues(self, tissue_dataset_id=None):
symbol_corr_dict = {}
@@ -1065,10 +1100,7 @@ class CorrelationResults(object):
# SymbolValueDict)
return (symbolCorrDict, symbolPvalueDict)
- datasetFile.close()
- totalTraits = len(allcorrelations)
- _log.info("Done correlating using the fast method")
-
+
def correlate(self):
self.correlation_data = collections.defaultdict(list)
@@ -1083,107 +1115,254 @@ class CorrelationResults(object):
values_2.append(target_value)
correlation = calCorrelation(values_1, values_2)
self.correlation_data[trait] = correlation
+
+ def getFileName(self, target_db_name): ### dcrowell August 2008
+ """Returns the name of the reference database file with which correlations are calculated.
+ Takes argument cursor which is a cursor object of any instance of a subclass of templatePage
+ Used by correlationPage"""
+
+ dataset_id = str(self.target_dataset.id)
+ dataset_fullname = self.target_dataset.fullname.replace(' ','_')
+ dataset_fullname = dataset_fullname.replace('/','_')
+ FileName = 'ProbeSetFreezeId_' + dataset_id + '_FullName_' + dataset_fullname + '.txt'
- """
- correlations = []
-
- #XZ: Use the fast method only for probeset dataset, and this dataset must have been created.
- #XZ: Otherwise, use original method
- #_log.info("Entering correlation")
-
- #db_filename = self.getFileName(target_db_name=self.target_db_name)
- #
- #cache_available = db_filename in os.listdir(webqtlConfig.TEXTDIR)
-
- # If the cache file exists, do a cached correlation for probeset data
- if self.dataset.type == "ProbeSet":
-# if self.method in [METHOD_SAMPLE_PEARSON, METHOD_SAMPLE_RANK] and cache_available:
-# traits = do_parallel_correlation()
-#
-# else:
-
- traits = self.get_traits(self.vals)
+ return FileName
+
+ def do_parallel_correlation(self, db_filename, num_overlap):
+
+ #XZ, 01/14/2009: This method is for parallel computing only.
+ #XZ: It is supposed to be called when "Genetic Correlation, Pearson's r" (method 1)
+ #XZ: or "Genetic Correlation, Spearman's rho" (method 2) is selected
+ def compute_corr(input_nnCorr, input_trait, input_list, corr_method):
+
+ import math
+ import reaper
+
+ def calCorrelation(dbdata,userdata,N):
+ X = []
+ Y = []
+ for i in range(N):
+ if (dbdata[i] != None and userdata[i] != None) and (dbdata[i] != "None" and userdata[i] != "None"):
+ X.append(float(dbdata[i]))
+ Y.append(float(userdata[i]))
+ NN = len(X)
+ if NN <6:
+ return (0.0,NN)
+ sx = reduce(lambda x,y:x+y,X,0.0)
+ sy = reduce(lambda x,y:x+y,Y,0.0)
+ meanx = sx/NN
+ meany = sy/NN
+ xyd = 0.0
+ sxd = 0.0
+ syd = 0.0
+ for i in range(NN):
+ xyd += (X[i] - meanx)*(Y[i]-meany)
+ sxd += (X[i] - meanx)*(X[i] - meanx)
+ syd += (Y[i] - meany)*(Y[i] - meany)
+ try:
+ corr = xyd/(math.sqrt(sxd)*math.sqrt(syd))
+ except:
+ corr = 0
+ return (corr,NN)
+
+ def calCorrelationRank(xVals,yVals,N):
+ """
+ Calculated Spearman Ranked Correlation. The algorithm works
+ by setting all tied ranks to the average of those ranks (for
+ example, if ranks 5-10 all have the same value, each will be set
+ to rank 7.5).
+ """
+
+ XX = []
+ YY = []
+ j = 0
+
+ for i in range(len(xVals)):
+ if (xVals[i]!= None and yVals[i]!= None) and (xVals[i] != "None" and yVals[i] != "None"):
+ XX.append((j,float(xVals[i])))
+ YY.append((j,float(yVals[i])))
+ j = j+1
+
+ NN = len(XX)
+ if NN <6:
+ return (0.0,NN)
+ XX.sort(cmpOrder2)
+ YY.sort(cmpOrder2)
+ X = [0]*NN
+ Y = [0]*NN
+
+ j = 1
+ rank = 0.0
+ t = 0.0
+ sx = 0.0
+
+ while j < NN:
+
+ if XX[j][1] != XX[j-1][1]:
+ X[XX[j-1][0]] = j
+ j = j+1
- for trait in traits:
- trait.calculate_correlation(vals, self.method)
+ else:
+ jt = j+1
+ ji = j
+ for jt in range(j+1, NN):
+ if (XX[jt][1] != XX[j-1][1]):
+ break
+ rank = 0.5*(j+jt)
+ for ji in range(j-1, jt):
+ X[XX[ji][0]] = rank
+ t = jt-j
+ sx = sx + (t*t*t-t)
+ if (jt == NN-1):
+ if (XX[jt][1] == XX[j-1][1]):
+ X[XX[NN-1][0]] = rank
+ j = jt+1
+
+ if j == NN:
+ if X[XX[NN-1][0]] == 0:
+ X[XX[NN-1][0]] = NN
+
+ j = 1
+ rank = 0.0
+ t = 0.0
+ sy = 0.0
+
+ while j < NN:
+
+ if YY[j][1] != YY[j-1][1]:
+ Y[YY[j-1][0]] = j
+ j = j+1
+ else:
+ jt = j+1
+ ji = j
+ for jt in range(j+1, NN):
+ if (YY[jt][1] != YY[j-1][1]):
+ break
+ rank = 0.5*(j+jt)
+ for ji in range(j-1, jt):
+ Y[YY[ji][0]] = rank
+ t = jt - j
+ sy = sy + (t*t*t-t)
+ if (jt == NN-1):
+ if (YY[jt][1] == YY[j-1][1]):
+ Y[YY[NN-1][0]] = rank
+ j = jt+1
+
+ if j == NN:
+ if Y[YY[NN-1][0]] == 0:
+ Y[YY[NN-1][0]] = NN
+
+ D = 0.0
+
+ for i in range(NN):
+ D += (X[i]-Y[i])*(X[i]-Y[i])
+
+ fac = (1.0 -sx/(NN*NN*NN-NN))*(1.0-sy/(NN*NN*NN-NN))
+
+ return ((1-(6.0/(NN*NN*NN-NN))*(D+(sx+sy)/12.0))/math.sqrt(fac),NN)
+
+ # allcorrelations = []
+
+ correlation_data = {}
+ for i, line in enumerate(input_list):
+ if i == 0:
+ continue
+ tokens = line.split('","')
+ tokens[-1] = tokens[-1][:-2] #remove the last "
+ tokens[0] = tokens[0][1:] #remove the first "
+
+ traitdataName = tokens[0]
+ database_trait = tokens[1:]
+
+ #print("database_trait:", database_trait)
+
+ #ZS: 2015 could add biweight correlation, see http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3465711/
+ # if corr_method == 'pearson':
+ # sample_r, sample_p = scipy.stats.pearsonr(input_trait, database_trait)
+ # else:
+ # sample_r, sample_p = scipy.stats.spearmanr(input_trait, database_trait)
+
+ if corr_method == "pearson": #XZ: Pearson's r
+ sample_r, nOverlap = calCorrelation(input_trait, database_trait, input_nnCorr)
+ else: #XZ: Spearman's rho
+ sample_r, nOverlap = calCorrelationRank(input_trait, database_trait, input_nnCorr)
+
+ #XZ: calculate corrPValue
+ if nOverlap < 3:
+ sample_p = 1.0
+ else:
+ if abs(sample_r) >= 1.0:
+ sample_p = 0.0
+ else:
+ z_value = 0.5*math.log((1.0+sample_r)/(1.0-sample_r))
+ z_value = z_value*math.sqrt(nOverlap-3)
+ sample_p = 2.0*(1.0 - reaper.normp(abs(z_value)))
+
+ correlation_data[traitdataName] = [sample_r, sample_p, nOverlap]
+
+ # traitinfo = [traitdataName, sample_r, nOverlap]
+ # allcorrelations.append(traitinfo)
- self.record_count = len(traits) #ZS: This isn't a good way to get this value, so I need to change it later
+ return correlation_data
+ # return allcorrelations
+
+
+ datasetFile = open(webqtlConfig.TEXTDIR+db_filename,'r')
+
+ print("Invoking parallel computing")
+ input_line_list = datasetFile.readlines()
+ print("Read lines from the file")
+ all_line_number = len(input_line_list)
- #XZ, 3/31/2010: Theoretically, we should create one function 'comTissueCorr'
- #to compare each trait by their tissue corr p values.
- #But because the tissue corr p values are generated by permutation test,
- #the top ones always have p value 0. So comparing p values actually does nothing.
- #In addition, for the tissue data in our database, the N is always the same.
- #So it's safe to compare with tissue corr statistic value.
- #That's the same as literature corr.
- #if self.method in [METHOD_LIT, METHOD_TISSUE_PEARSON, METHOD_TISSUE_RANK] and self.gene_id:
- # traits.sort(webqtlUtil.cmpLitCorr)
- #else:
- #if self.method in TISSUE_METHODS:
- # sort(traits, key=lambda A: math.fabs(A.tissue_corr))
- #elif self.method == METHOD_LIT:
- # traits.sort(traits, key=lambda A: math.fabs(A.lit_corr))
- #else:
- traits = sortTraitCorrelations(traits, self.method)
+ step = 1000
+ job_number = math.ceil( float(all_line_number)/step )
- # Strip to the top N correlations
- traits = traits[:min(self.returnNumber, len(traits))]
+ print("JOB NUMBER", job_number)
+
+ job_input_lists = []
- addLiteratureCorr = False
- addTissueCorr = False
+ print("Configuring jobs")
- trait_list = []
- for trait in traits:
- db_trait = webqtlTrait(db=self.db, name=trait.name, cursor=self.cursor)
- db_trait.retrieveInfo( QTL='Yes' )
+ for job_index in range( int(job_number) ):
+ starti = job_index*step
+ endi = min((job_index+1)*step, all_line_number)
- db_trait.Name = trait.name
- db_trait.corr = trait.correlation
- db_trait.nOverlap = trait.overlap
- db_trait.corrPValue = trait.p_value
+ one_job_input_list = []
- # NL, 07/19/2010
- # js function changed, add a new parameter rankOrder for js function 'showTissueCorrPlot'
- db_trait.RANK_ORDER = self.RANK_ORDERS[self.method]
+ for i in range( starti, endi ):
+ one_job_input_list.append( input_line_list[i] )
- #XZ, 26/09/2008: Method is 4 or 5. Have fetched tissue corr, but no literature correlation yet.
- if self.method in TISSUE_METHODS:
- db_trait.tissueCorr = trait.tissue_corr
- db_trait.tissuePValue = trait.p_tissue
- addTissueCorr = True
+ job_input_lists.append( one_job_input_list )
+ print("Creating pp servers")
- #XZ, 26/09/2008: Method is 3, Have fetched literature corr, but no tissue corr yet.
- elif self.method == METHOD_LIT:
- db_trait.LCorr = trait.lit_corr
- db_trait.mouse_geneid = self.translateToMouseGeneID(self.species, db_trait.geneid)
- addLiteratureCorr = True
+ ppservers = ()
+ # Creates jobserver with automatically detected number of workers
+ job_server = pp.Server(ppservers=ppservers)
- #XZ, 26/09/2008: Method is 1 or 2. Have NOT fetched literature corr and tissue corr yet.
- # Phenotype data will not have geneid, and neither will some probes
- # we need to handle this because we will get an attribute error
- else:
- if self.input_trait_mouse_gene_id and self.db.type=="ProbeSet":
- addLiteratureCorr = True
- if self.trait_symbol and self.db.type=="ProbeSet":
- addTissueCorr = True
+ print("Done creating servers")
- trait_list.append(db_trait)
+ jobs = []
+ results = []
- if addLiteratureCorr:
- trait_list = self.getLiteratureCorrelationByList(self.input_trait_mouse_gene_id,
- self.species, trait_list)
- if addTissueCorr:
- trait_list = self.getTissueCorrelationByList(
- primaryTraitSymbol = self.trait_symbol,
- traitList = trait_list,
- TissueProbeSetFreezeId = TISSUE_MOUSE_DB,
- method=self.method)
+ print("Starting parallel computation, submitting jobs")
+ for one_job_input_list in job_input_lists: #pay attention to modules from outside
+ jobs.append( job_server.submit(func=compute_corr, args=(num_overlap, self.this_trait_vals, one_job_input_list, self.corr_method), depfuncs=(), modules=("webqtlUtil",)) )
+ print("Done submitting jobs")
- return trait_list
- """
+ for one_job in jobs:
+ one_result = one_job()
+ self.correlation_data.update(one_result)
+ # one_result = one_job()
+ # results.append( one_result )
+ #print("CORRELATION DATA:", self.correlation_data)
+
+ # print("Acquiring results")
+ # for one_result in results:
+ # for one_traitinfo in one_result:
+ # allcorrelations.append( one_traitinfo )
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py
index 4cd3874c..4f9dc316 100644
--- a/wqflask/wqflask/gsearch.py
+++ b/wqflask/wqflask/gsearch.py
@@ -1,94 +1,94 @@
from __future__ import absolute_import, print_function, division
from flask import Flask, g
-from base.data_set import create_dataset
-from base.trait import GeneralTrait
-from dbFunction import webqtlDatabaseFunction
+#from base.data_set import create_dataset
+#from base.trait import GeneralTrait
+#from dbFunction import webqtlDatabaseFunction
-from utility.benchmark import Bench
+#from utility.benchmark import Bench
class GSearch(object):
def __init__(self, kw):
self.type = kw['type']
self.terms = kw['terms']
- if self.type == "gene":
- sql = """
- SELECT
- Species.`Name` AS species_name,
- InbredSet.`Name` AS inbredset_name,
- Tissue.`Name` AS tissue_name,
- ProbeSetFreeze.Name AS probesetfreeze_name,
- ProbeSet.Name AS probeset_name,
- ProbeSet.Symbol AS probeset_symbol,
- ProbeSet.`description` AS probeset_description,
- ProbeSet.Chr AS chr,
- ProbeSet.Mb AS mb,
- ProbeSetXRef.Mean AS mean,
- ProbeSetXRef.LRS AS lrs,
- ProbeSetXRef.`Locus` AS locus,
- ProbeSetXRef.`pValue` AS pvalue,
- ProbeSetXRef.`additive` AS additive
- FROM Species, InbredSet, ProbeSetXRef, ProbeSet, ProbeFreeze, ProbeSetFreeze, Tissue
- WHERE InbredSet.`SpeciesId`=Species.`Id`
- AND ProbeFreeze.InbredSetId=InbredSet.`Id`
- AND ProbeFreeze.`TissueId`=Tissue.`Id`
- AND ProbeSetFreeze.ProbeFreezeId=ProbeFreeze.Id
- AND ( MATCH (ProbeSet.Name,ProbeSet.description,ProbeSet.symbol,alias,GenbankId, UniGeneId, Probe_Target_Description) AGAINST ('%s' IN BOOLEAN MODE) )
- AND ProbeSet.Id = ProbeSetXRef.ProbeSetId
- AND ProbeSetXRef.ProbeSetFreezeId=ProbeSetFreeze.Id
- AND ProbeSetFreeze.public > 0
- ORDER BY species_name, inbredset_name, tissue_name, probesetfreeze_name, probeset_name
- LIMIT 6000
- """ % (self.terms)
- with Bench("Running query"):
- re = g.db.execute(sql).fetchall()
- self.trait_list = []
- with Bench("Creating trait objects"):
- for line in re:
- dataset = create_dataset(line[3], "ProbeSet", get_samplelist=False)
- trait_id = line[4]
- #with Bench("Building trait object"):
- this_trait = GeneralTrait(dataset=dataset, name=trait_id, get_qtl_info=True, get_sample_info=False)
- self.trait_list.append(this_trait)
+ # if self.type == "gene":
+ # sql = """
+ # SELECT
+ # Species.`Name` AS species_name,
+ # InbredSet.`Name` AS inbredset_name,
+ # Tissue.`Name` AS tissue_name,
+ # ProbeSetFreeze.Name AS probesetfreeze_name,
+ # ProbeSet.Name AS probeset_name,
+ # ProbeSet.Symbol AS probeset_symbol,
+ # ProbeSet.`description` AS probeset_description,
+ # ProbeSet.Chr AS chr,
+ # ProbeSet.Mb AS mb,
+ # ProbeSetXRef.Mean AS mean,
+ # ProbeSetXRef.LRS AS lrs,
+ # ProbeSetXRef.`Locus` AS locus,
+ # ProbeSetXRef.`pValue` AS pvalue,
+ # ProbeSetXRef.`additive` AS additive
+ # FROM Species, InbredSet, ProbeSetXRef, ProbeSet, ProbeFreeze, ProbeSetFreeze, Tissue
+ # WHERE InbredSet.`SpeciesId`=Species.`Id`
+ # AND ProbeFreeze.InbredSetId=InbredSet.`Id`
+ # AND ProbeFreeze.`TissueId`=Tissue.`Id`
+ # AND ProbeSetFreeze.ProbeFreezeId=ProbeFreeze.Id
+ # AND ( MATCH (ProbeSet.Name,ProbeSet.description,ProbeSet.symbol,alias,GenbankId, UniGeneId, Probe_Target_Description) AGAINST ('%s' IN BOOLEAN MODE) )
+ # AND ProbeSet.Id = ProbeSetXRef.ProbeSetId
+ # AND ProbeSetXRef.ProbeSetFreezeId=ProbeSetFreeze.Id
+ # AND ProbeSetFreeze.public > 0
+ # ORDER BY species_name, inbredset_name, tissue_name, probesetfreeze_name, probeset_name
+ # LIMIT 6000
+ # """ % (self.terms)
+ # with Bench("Running query"):
+ # re = g.db.execute(sql).fetchall()
+ # self.trait_list = []
+ # with Bench("Creating trait objects"):
+ # for line in re:
+ # dataset = create_dataset(line[3], "ProbeSet", get_samplelist=False)
+ # trait_id = line[4]
+ # with Bench("Building trait object"):
+ # this_trait = GeneralTrait(dataset=dataset, name=trait_id, get_qtl_info=True, get_sample_info=False)
+ # self.trait_list.append(this_trait)
- elif self.type == "phenotype":
- sql = """
- SELECT
- Species.`Name`,
- InbredSet.`Name`,
- PublishFreeze.`Name`,
- PublishXRef.`Id`,
- Phenotype.`Post_publication_description`,
- Publication.`Authors`,
- Publication.`Year`,
- PublishXRef.`LRS`,
- PublishXRef.`Locus`,
- PublishXRef.`additive`
- FROM Species,InbredSet,PublishFreeze,PublishXRef,Phenotype,Publication
- WHERE PublishXRef.`InbredSetId`=InbredSet.`Id`
- AND PublishFreeze.`InbredSetId`=InbredSet.`Id`
- AND InbredSet.`SpeciesId`=Species.`Id`
- AND PublishXRef.`PhenotypeId`=Phenotype.`Id`
- AND PublishXRef.`PublicationId`=Publication.`Id`
- AND (Phenotype.Post_publication_description REGEXP "[[:<:]]%s[[:>:]]"
- OR Phenotype.Pre_publication_description REGEXP "[[:<:]]%s[[:>:]]"
- OR Phenotype.Pre_publication_abbreviation REGEXP "[[:<:]]%s[[:>:]]"
- OR Phenotype.Post_publication_abbreviation REGEXP "[[:<:]]%s[[:>:]]"
- OR Phenotype.Lab_code REGEXP "[[:<:]]%s[[:>:]]"
- OR Publication.PubMed_ID REGEXP "[[:<:]]%s[[:>:]]"
- OR Publication.Abstract REGEXP "[[:<:]]%s[[:>:]]"
- OR Publication.Title REGEXP "[[:<:]]%s[[:>:]]"
- OR Publication.Authors REGEXP "[[:<:]]%s[[:>:]]"
- OR PublishXRef.Id REGEXP "[[:<:]]%s[[:>:]]")
- ORDER BY Species.`Name`, InbredSet.`Name`, PublishXRef.`Id`
- LIMIT 6000
- """ % (self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms)
- re = g.db.execute(sql).fetchall()
- self.trait_list = []
- with Bench("Creating trait objects"):
- for line in re:
- dataset = create_dataset(line[2], "Publish")
- trait_id = line[3]
- this_trait = GeneralTrait(dataset=dataset, name=trait_id, get_qtl_info=True, get_sample_info=False)
- self.trait_list.append(this_trait)
+ # elif self.type == "phenotype":
+ # sql = """
+ # SELECT
+ # Species.`Name`,
+ # InbredSet.`Name`,
+ # PublishFreeze.`Name`,
+ # PublishXRef.`Id`,
+ # Phenotype.`Post_publication_description`,
+ # Publication.`Authors`,
+ # Publication.`Year`,
+ # PublishXRef.`LRS`,
+ # PublishXRef.`Locus`,
+ # PublishXRef.`additive`
+ # FROM Species,InbredSet,PublishFreeze,PublishXRef,Phenotype,Publication
+ # WHERE PublishXRef.`InbredSetId`=InbredSet.`Id`
+ # AND PublishFreeze.`InbredSetId`=InbredSet.`Id`
+ # AND InbredSet.`SpeciesId`=Species.`Id`
+ # AND PublishXRef.`PhenotypeId`=Phenotype.`Id`
+ # AND PublishXRef.`PublicationId`=Publication.`Id`
+ # AND (Phenotype.Post_publication_description REGEXP "[[:<:]]%s[[:>:]]"
+ # OR Phenotype.Pre_publication_description REGEXP "[[:<:]]%s[[:>:]]"
+ # OR Phenotype.Pre_publication_abbreviation REGEXP "[[:<:]]%s[[:>:]]"
+ # OR Phenotype.Post_publication_abbreviation REGEXP "[[:<:]]%s[[:>:]]"
+ # OR Phenotype.Lab_code REGEXP "[[:<:]]%s[[:>:]]"
+ # OR Publication.PubMed_ID REGEXP "[[:<:]]%s[[:>:]]"
+ # OR Publication.Abstract REGEXP "[[:<:]]%s[[:>:]]"
+ # OR Publication.Title REGEXP "[[:<:]]%s[[:>:]]"
+ # OR Publication.Authors REGEXP "[[:<:]]%s[[:>:]]"
+ # OR PublishXRef.Id REGEXP "[[:<:]]%s[[:>:]]")
+ # ORDER BY Species.`Name`, InbredSet.`Name`, PublishXRef.`Id`
+ # LIMIT 6000
+ # """ % (self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms)
+ # re = g.db.execute(sql).fetchall()
+ # self.trait_list = []
+ # with Bench("Creating trait objects"):
+ # for line in re:
+ # dataset = create_dataset(line[2], "Publish")
+ # trait_id = line[3]
+ # this_trait = GeneralTrait(dataset=dataset, name=trait_id, get_qtl_info=True, get_sample_info=False)
+ # self.trait_list.append(this_trait)
diff --git a/wqflask/wqflask/heatmap/heatmap.py b/wqflask/wqflask/heatmap/heatmap.py
index 2445b37f..19c330eb 100644
--- a/wqflask/wqflask/heatmap/heatmap.py
+++ b/wqflask/wqflask/heatmap/heatmap.py
@@ -136,7 +136,7 @@ class Heatmap(object):
this_trait = trait_db[0]
#this_db = trait_db[1]
genotype = self.dataset.group.read_genotype_file()
- samples, values, variances = this_trait.export_informative()
+ samples, values, variances, sample_aliases = this_trait.export_informative()
trimmed_samples = []
trimmed_values = []
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py
index 08f422f0..1e0a618e 100644
--- a/wqflask/wqflask/marker_regression/marker_regression.py
+++ b/wqflask/wqflask/marker_regression/marker_regression.py
@@ -56,11 +56,21 @@ class MarkerRegression(object):
self.samples = [] # Want only ones with values
self.vals = []
-
+
+ #for sample in self.this_trait.data.keys():
for sample in self.dataset.group.samplelist:
- value = start_vars['value:' + sample]
- self.samples.append(str(sample))
- self.vals.append(value)
+ in_trait_data = False
+ for item in self.this_trait.data:
+ if self.this_trait.data[item].name2 == sample:
+ value = start_vars['value:' + self.this_trait.data[item].name]
+ self.samples.append(self.this_trait.data[item].name)
+ self.vals.append(value)
+ in_trait_data = True
+ break
+ if not in_trait_data:
+ value = start_vars['value:' + sample]
+ self.samples.append(sample)
+ self.vals.append(value)
self.mapping_method = start_vars['method']
if start_vars['manhattan_plot'] == "True":
@@ -203,6 +213,8 @@ class MarkerRegression(object):
if 'lod_score' in marker.keys():
self.qtl_results.append(marker)
+ self.trimmed_markers = trim_markers_for_table(results)
+
for qtl in enumerate(self.qtl_results):
self.json_data['chr1'].append(str(qtl['chr1']))
self.json_data['chr2'].append(str(qtl['chr2']))
@@ -641,15 +653,17 @@ class MarkerRegression(object):
if self.manhattan_plot != True:
genotype = genotype.addinterval()
- samples, values, variances = self.this_trait.export_informative()
-
+ samples, values, variances, sample_aliases = self.this_trait.export_informative()
+
trimmed_samples = []
trimmed_values = []
for i in range(0, len(samples)):
- if samples[i] in self.dataset.group.samplelist:
- trimmed_samples.append(samples[i])
+ if self.this_trait.data[samples[i]].name2 in self.dataset.group.samplelist:
+ trimmed_samples.append(sample_aliases[i])
trimmed_values.append(values[i])
+ #print("THE SAMPLES:", trimmed_samples)
+
if self.num_perm < 100:
self.suggestive = 0
self.significant = 0
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index 074c78bf..f7a33d4f 100755..100644
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -1184,17 +1184,16 @@ class ShowTrait(object):
all_samples_ordered = self.dataset.group.all_samples_ordered()
primary_sample_names = list(all_samples_ordered)
-
- print("self.dataset.group", pf(self.dataset.group.__dict__))
- print("-*- primary_samplelist is:", pf(primary_sample_names))
-
+
other_sample_names = []
for sample in this_trait.data.keys():
- if sample not in all_samples_ordered:
+ if (this_trait.data[sample].name2 in primary_sample_names) and (this_trait.data[sample].name not in primary_sample_names):
+ primary_sample_names.append(this_trait.data[sample].name)
+ primary_sample_names.remove(this_trait.data[sample].name2)
+ elif sample not in all_samples_ordered:
all_samples_ordered.append(sample)
other_sample_names.append(sample)
- print("species:", self.dataset.group.species)
if self.dataset.group.species == "human":
primary_sample_names += other_sample_names
diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json
index 2b16383f..12a30e84 100755
--- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json
+++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json
@@ -1596,6 +1596,11 @@
"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"
@@ -1606,11 +1611,6 @@
"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"
@@ -1846,6 +1846,18 @@
]
},
"BXD": {
+ "Adipose Proteome": [
+ [
+ "797",
+ "EPFL_AdiPro0416",
+ "EPFL/ETHZ BXD Brown Adipose, Total Tissue Proteome, Chow Diet (Apr16) Light SWATH **"
+ ],
+ [
+ "798",
+ "EPFL_AdiMitPro0416",
+ "EPFL/ETHZ BXD Brown Adipose, Isolated Mitochondria Proteome, Chow Diet (Apr16) Light SWATH **"
+ ]
+ ],
"Adipose mRNA": [
[
"469",
@@ -1916,21 +1928,21 @@
[
"414",
"UCLA_BXD-on_Femur_0113_RSN",
- "UCLA GSE27483 BXD Only Bone Femur ILM Mouse WG-6 v2.0 (Jan13) RSN"
+ "UCLA GSE27483 BXD Only Bone Femur ILM Mouse WG-6 v1.1 (Jan13) RSN"
]
],
"Brain mRNA": [
[
- "164",
- "UTHSC_BXD_WB_RNASeq1112",
- "UTHSC Mouse BXD Whole Brain RNA Sequence (Nov12) RPKM Untrimmed"
- ],
- [
"590",
"UTHSC_BXD_WB_RNASeqtrim1_1112",
"UTHSC Mouse BXD Whole Brain RNA Sequence (Nov12) RPKM Trimmed 1.0"
],
[
+ "164",
+ "UTHSC_BXD_WB_RNASeq1112",
+ "UTHSC Mouse BXD Whole Brain RNA Sequence (Nov12) RPKM Untrimmed"
+ ],
+ [
"394",
"UTHSC_BXD_WB_RNASeqEx1112",
"UTHSC Mouse BXD Whole Brain RNA Sequence Exon Level (Nov12) RPKM"
@@ -1946,6 +1958,11 @@
"UTHSC Brain mRNA U74Av2 (Nov05) PDNN"
],
[
+ "82",
+ "BR_U_0805_R",
+ "UTHSC Brain mRNA U74Av2 (Aug05) RMA"
+ ],
+ [
"81",
"BR_U_0805_P",
"UTHSC Brain mRNA U74Av2 (Aug05) PDNN"
@@ -1956,11 +1973,6 @@
"UTHSC Brain mRNA U74Av2 (Aug05) MAS5"
],
[
- "82",
- "BR_U_0805_R",
- "UTHSC Brain mRNA U74Av2 (Aug05) RMA"
- ],
- [
"42",
"CB_M_0204_P",
"INIA Brain mRNA M430 (Feb04) PDNN"
@@ -2027,6 +2039,11 @@
"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"
@@ -2037,11 +2054,6 @@
"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"
@@ -2557,29 +2569,29 @@
],
"Retina mRNA": [
[
+ "267",
+ "Illum_Retina_BXD_RankInv0410",
+ "Full HEI Retina Illumina V6.2 (Apr10) RankInv"
+ ],
+ [
+ "302",
+ "G2NEI_ILM_Retina_BXD_RI0410",
+ "HEI Retina Normal Illumina V6.2 (Apr10) RankInv"
+ ],
+ [
"709",
"DoDCMMRPRetMoGene2_0515",
- "DoD CDMRP Retina Affy MoGene 2.0 ST (May15) RMA Gene Level"
+ "DoD Retina Normal Affy MoGene 2.0 ST (May15) RMA Gene Level"
],
[
"710",
"DoDCMMRPRetMoGene2Ex_0515",
- "DoD CDMRP Retina Affy MoGene 2.0 ST (May15) RMA Exon Level"
+ "DoD Retina Normal Affy MoGene 2.0 ST (May15) RMA Exon Level"
],
[
"385",
"ONCRetILM6_0412",
"ONC HEI Retina (April 2012) RankInv"
- ],
- [
- "302",
- "G2NEI_ILM_Retina_BXD_RI0410",
- "Normal HEI Retina (April 2010) RankInv"
- ],
- [
- "267",
- "Illum_Retina_BXD_RankInv0410",
- "Full HEI Retina (April 2010) RankInv"
]
],
"Spleen mRNA": [
@@ -2704,6 +2716,23 @@
"RTC_1106_R",
"HZI Treg M430v2 (Feb11) RMA"
]
+ ],
+ "Ventral Tegmental Area mRNA": [
+ [
+ "228",
+ "VCUSal_0609_R",
+ "VCU BXD VTA Sal M430 2.0 (Jun09) RMA"
+ ],
+ [
+ "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"
+ ]
]
},
"BXH": {
@@ -2810,6 +2839,16 @@
"170",
"UCLA_CTB6B6CTF2_ADIPOSE_2005",
"UCLA CTB6/B6CTF2 Adipose (2005) mlratio"
+ ],
+ [
+ "189",
+ "UCLA_CTB6B6CTF2_ADIPOSE_FEMALE",
+ "UCLA CTB6B6CTF2 Adipose Female mlratio"
+ ],
+ [
+ "188",
+ "UCLA_CTB6B6CTF2_ADIPOSE_MALE",
+ "UCLA CTB6B6CTF2 Adipose Male mlratio"
]
],
"Brain mRNA": [
@@ -2841,6 +2880,16 @@
"172",
"UCLA_CTB6B6CTF2_LIVER_2005",
"UCLA CTB6/B6CTF2 Liver (2005) mlratio"
+ ],
+ [
+ "193",
+ "UCLA_CTB6B6CTF2_LIVER_FEMALE",
+ "UCLA CTB6B6CTF2 Liver Female mlratio"
+ ],
+ [
+ "192",
+ "UCLA_CTB6B6CTF2_LIVER_MALE",
+ "UCLA CTB6B6CTF2 Liver Male mlratio"
]
],
"Muscle mRNA": [
@@ -2848,6 +2897,16 @@
"173",
"UCLA_CTB6B6CTF2_MUSCLE_2005",
"UCLA CTB6/B6CTF2 Muscle (2005) mlratio"
+ ],
+ [
+ "195",
+ "UCLA_CTB6B6CTF2_MUSCLE_FEMALE",
+ "UCLA CTB6B6CTF2 Muscle Female mlratio"
+ ],
+ [
+ "194",
+ "UCLA_CTB6B6CTF2_MUSCLE_MALE",
+ "UCLA CTB6B6CTF2 Muscle Male mlratio"
]
],
"Phenotypes": [
@@ -2942,6 +3001,11 @@
],
"Hippocampus mRNA": [
[
+ "212",
+ "Illum_LXS_Hipp_RSE_1008",
+ "Hippocampus Illumina RSE (Oct08) RankInv beta"
+ ],
+ [
"214",
"Illum_LXS_Hipp_NOE_1008",
"Hippocampus Illumina NOE (Oct08) RankInv beta"
@@ -2962,11 +3026,6 @@
"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"
@@ -3130,16 +3189,32 @@
"Scripps-2013": {}
},
"rat": {
- "HSNIH": {
+ "HSNIH-Palmer": {
"Phenotypes": [
[
- "619",
- "HSNIHPublish",
- "HSNIH Published Phenotypes"
+ "None",
+ "HSNIH-PalmerPublish",
+ "HSNIH-Palmer Published Phenotypes"
+ ]
+ ]
+ },
+ "HSNIH-RGSMC": {
+ "Phenotypes": [
+ [
+ "None",
+ "HSNIH-RGSMCPublish",
+ "HSNIH-RGSMC Published Phenotypes"
]
]
},
"HXBBXH": {
+ "Adipose mRNA": [
+ [
+ "799",
+ "FGUCAS_BAdip0516",
+ "FGUCAS BXH/HXB Brown Adipose Affy Rat Gene 2.0 ST (May16) log2 **"
+ ]
+ ],
"Adrenal Gland mRNA": [
[
"220",
@@ -3460,8 +3535,12 @@
],
"rat": [
[
- "HSNIH",
- "NIH Heterogeneous Stock"
+ "HSNIH-Palmer",
+ "NIH Heterogeneous Stock (Palmer)"
+ ],
+ [
+ "HSNIH-RGSMC",
+ "NIH Heterogeneous Stock (RGSMC 2013)"
],
[
"HXBBXH",
@@ -4351,6 +4430,10 @@
"Adipose mRNA"
],
[
+ "Adipose Proteome",
+ "Adipose Proteome"
+ ],
+ [
"Adrenal Gland mRNA",
"Adrenal Gland mRNA"
],
@@ -4465,6 +4548,10 @@
[
"T Cell (regulatory) mRNA",
"T Cell (regulatory) mRNA"
+ ],
+ [
+ "Ventral Tegmental Area mRNA",
+ "Ventral Tegmental Area mRNA"
]
],
"BXH": [
@@ -4656,7 +4743,13 @@
"Scripps-2013": []
},
"rat": {
- "HSNIH": [
+ "HSNIH-Palmer": [
+ [
+ "Phenotypes",
+ "Phenotypes"
+ ]
+ ],
+ "HSNIH-RGSMC": [
[
"Phenotypes",
"Phenotypes"
@@ -4672,6 +4765,10 @@
"Genotypes"
],
[
+ "Adipose mRNA",
+ "Adipose mRNA"
+ ],
+ [
"Adrenal Gland mRNA",
"Adrenal Gland mRNA"
],
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index 2fa77ae0..34d1a139 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -50,7 +50,7 @@
}, {
vn: "interquartile",
pretty: "Interquartile Range",
- url: "/glossary.html#Interquartile",
+ url: "http://www.genenetwork.org/glossary.html#Interquartile",
digits: 2
}
];
@@ -313,6 +313,12 @@
return $("#trait_data_form").submit();
};
+ submit_corr = function(){
+ var url;
+ url = "/corr_compute";
+ return submit_special(url);
+ };
+
$(".corr_compute").on("click", (function(_this) {
return function() {
var url;
diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html
index 7cc9a1bd..92b0b411 100755
--- a/wqflask/wqflask/templates/gsearch_gene.html
+++ b/wqflask/wqflask/templates/gsearch_gene.html
@@ -2,10 +2,6 @@
{% block title %}Search Results{% endblock %}
{% block css %}
<link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/css/jquery.dataTables.css" />
- <link rel="stylesheet" type="text/css" href="/static/packages/DT_bootstrap/DT_bootstrap.css" />
- <link rel="stylesheet" type="text/css" href="/static/packages/TableTools/media/css/TableTools.css" />
- <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/dataTables.fixedHeader.css" >
- <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/fixedcolumns/3.0.4/css/dataTables.fixedColumns.css">
<link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/buttons.bootstrap.css" />
{% endblock %}
{% block content %}
@@ -13,6 +9,7 @@
<div class="container">
+ <p>You searched for {{ terms }}.</p>
<p>To study a record, click on its ID below.<br />Check records below and click Add button to add to selection.</p>
<div>
@@ -26,46 +23,28 @@
<br />
<br />
- <table width="2000px" class="table table-hover table-striped" id="trait_table">
+ <div style="width: 2000px;">
+ <table width="2000px" id="trait_table" class="table table-hover table-striped" >
<thead>
- <tr>
- <th style="width: 30px;"></th>
- <th>Index</th>
- <th>Species</th>
- <th>Group</th>
- <th>Tissue</th>
- <th>Dataset</th>
- <th>Record</th>
- <th>Symbol</th>
- <th>Description</th>
- <th>Location</th>
- <th>Mean</th>
- <th style="text-align: right;">Max&nbsp;&nbsp;<br>LRS<a href="http://genenetwork.org//glossary.html#L" target="_blank"><sup style="color:#f00"> ?</sup></a></th>
- <th>Max LRS Location</th>
- <th style="text-align: right;">Additive<br>Effect<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><INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox" style="transform: scale(1.5);" VALUE="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}"></TD>
- <TD>{{ loop.index }}</TD>
- <TD>{{ this_trait.dataset.group.species }}</TD>
- <TD>{{ this_trait.dataset.group.name }}</TD>
- <TD>{{ this_trait.dataset.tissue }}</TD>
- <TD>{{ this_trait.dataset.fullname }}</TD>
- <TD><a href="{{ url_for('show_trait_page', trait_id = this_trait.name, dataset = this_trait.dataset.name)}}">{{ this_trait.name }}</a></TD>
- <TD>{{ this_trait.symbol }}</TD>
- <TD>{{ this_trait.description_display }}</TD>
- <TD>{{ this_trait.location_repr }}</TD>
- <TD align="right">{{ '%0.3f' % this_trait.mean|float }}</TD>
- <TD align="right">{{ '%0.3f' % this_trait.LRS_score_repr|float }}</TD>
- <TD>{{ this_trait.LRS_location_repr }}</TD>
- <TD align="right">{{ '%0.3f' % this_trait.additive|float }}</TD>
- </TR>
- {% endfor %}
- </tbody>
- </table>
+ <tr>
+ <th></th>
+ <th>Index</th>
+ <th>Species</th>
+ <th>Group</th>
+ <th>Tissue</th>
+ <th>Dataset</th>
+ <th>Record</th>
+ <th>Symbol</th>
+ <th>Description</th>
+ <th>Location</th>
+ <th>Mean</th>
+ <th>Max<br>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<br>Effect<a href="http://genenetwork.org/glossary.html#A" target="_blank"><sup style="color:#f00"> ?</sup></a></th>
+ </tr>
+ </thead>
+ </table>
+ </div>
</div>
</div>
@@ -156,23 +135,18 @@
console.time("Creating table");
$('#trait_table').DataTable( {
- "columns": [
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural" },
- { "type": "cust-txt" },
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural", "width": "15%" },
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural" },
- { "type": "natural" },
- { "type": "cust-txt" }
- ],
- "order": [[ 1, "asc" ]],
+ "processing": true,
+ "serverSide": true,
+ "paging": false,
+ "ajax": {
+ "url": "/gsearch_updating?terms={{ terms }}&type={{ type }}",
+ "type": "POST",
+ "dataType": "json",
+ "contentType": "application/json; charset=utf-8",
+ "data": function ( args ) {
+ return { "args": JSON.stringify( args ) };
+ }
+ },
"buttons": [
{
extend: 'csvHtml5',
@@ -184,15 +158,26 @@
}
}
],
- "sDom": "RZBtir",
+ "columns": [
+ { "data": "checkbox", "orderable" : false },
+ { "data": "index", "orderable" : true },
+ { "data": "species", "orderable" : true },
+ { "data": "group", "orderable" : true },
+ { "data": "tissue", "orderable" : true },
+ { "data": "dataset", "orderable" : true },
+ { "data": "record", "orderable" : true },
+ { "data": "symbol", "orderable" : true },
+ { "data": "description", "orderable" : true },
+ { "data": "location", "orderable" : true },
+ { "data": "mean", "orderable" : true },
+ { "data": "max_lrs", "orderable" : true },
+ { "data": "max_lrs_location", "orderable" : true },
+ { "data": "additive_effect", "orderable" : true }
+ ],
+ "sDom": "Bfrti",
"autoWidth": false,
- "bLengthChange": true,
- "bDeferRender": true,
- "scrollCollapse": false,
- "colResize": {
- "tableWidthFixed": false,
- },
- "paging": false
+ "scrollY": "800px",
+ "bDeferRender": true
} );
console.timeEnd("Creating table");
diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html
index 64638fc7..5e2dc6fa 100755
--- a/wqflask/wqflask/templates/show_trait.html
+++ b/wqflask/wqflask/templates/show_trait.html
@@ -29,7 +29,7 @@
<h3>{{ this_trait.description_fmt }}</h3>
</div>
- <form method="post" target="_blank" action="/corr_compute" name="trait_page" id="trait_data_form"
+ <form method="post" action="/corr_compute" target="_blank" name="trait_page" id="trait_data_form"
class="form-horizontal">
<div id="hidden_inputs">
<input type="hidden" name="trait_hmac" value="{{ data_hmac('{}:{}'.format(this_trait.name, dataset.name)) }}">
diff --git a/wqflask/wqflask/templates/show_trait_calculate_correlations.html b/wqflask/wqflask/templates/show_trait_calculate_correlations.html
index 80fafa5e..0e15ce9c 100755
--- a/wqflask/wqflask/templates/show_trait_calculate_correlations.html
+++ b/wqflask/wqflask/templates/show_trait_calculate_correlations.html
@@ -90,12 +90,15 @@
</div>
<div class="form-group">
<label class="col-xs-1 control-label">Range</label>
- <div class="col-xs-3 controls">
+ <div class="col-xs-4 controls">
<input name="p_range_lower" value="" type="hidden">
<input name="p_range_upper" value="" type="hidden">
- <div id="p_range_slider" ></div>
- <span style="font: 400 12px Arial; color: #888; display: block; margin: 15px 0;" id="p_range_lower"></span>
- <span style="font: 400 12px Arial; color: #888; display: block; margin: 15px 0;" id="p_range_upper"></span>
+ <span style="display: inline;">
+ <div id="p_range_slider" style="width: 200px;"></div>
+ <span style="font: 400 12px Arial; color: #888; display: inline; margin: 25px 0; width: 20px;" id="p_range_lower"></span>
+ <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
+ <span style="font: 400 12px Arial; color: #888; display: inline; margin: 15px 0; width: 20px;" id="p_range_upper"></span>
+ </span>
</div>
</div>
diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html
index 95a3b967..d5fb0cf2 100755
--- a/wqflask/wqflask/templates/show_trait_details.html
+++ b/wqflask/wqflask/templates/show_trait_details.html
@@ -35,8 +35,7 @@
<tr>
<td>Target Score</td>
<td>
- <a href="/blatInfo.html" target="_blank"
- title="Values higher than 2 for the specificity are good">
+ <a href="http://genenetwork.org/blatInfo.html" title="Values higher than 2 for the specificity are good">
BLAT Specificity
</a>:
{{ "%0.3f" | format(this_trait.probe_set_specificity|float) }}
@@ -51,25 +50,25 @@
<td>Resource Links</td>
<td>
{% if this_trait.geneid != None %}
- <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&cmd=Retrieve&dopt=Graphics&list_uids={{ this_trait.geneid }}" target="_blank" title="Info from NCBI Entrez Gene">
+ <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&cmd=Retrieve&dopt=Graphics&list_uids={{ this_trait.geneid }}" title="Info from NCBI Entrez Gene">
Gene
</a>
&nbsp;&nbsp;
{% endif %}
{% if this_trait.omim != None %}
- <a href="http://www.ncbi.nlm.nih.gov/omim/{{ this_trait.omim }}" target="_blank" title="Summary from On Mendelion Inheritance in Man">
+ <a href="http://www.ncbi.nlm.nih.gov/omim/{{ this_trait.omim }}" title="Summary from On Mendelion Inheritance in Man">
OMIM
</a>
&nbsp;&nbsp;
{% endif %}
{% if this_trait.genbankid != None %}
- <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=Nucleotide&cmd=search&doptcmdl=DocSum&term={{ this_trait.genbankid }}" target="_blank" title="Find the original GenBank sequence used to design the probes">
+ <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=Nucleotide&cmd=search&doptcmdl=DocSum&term={{ this_trait.genbankid }}" title="Find the original GenBank sequence used to design the probes">
GenBank
</a>
&nbsp;&nbsp;
{% endif %}
{% if this_trait.symbol != None %}
- <a href="http://www.genotation.org/Getd2g.pl?gene_list={{ this_trait.symbol }}" target="_blank" title="Related descriptive, genomic, clinical, functional and drug-therapy information">
+ <a href="http://www.genotation.org/Getd2g.pl?gene_list={{ this_trait.symbol }}" title="Related descriptive, genomic, clinical, functional and drug-therapy information">
Genotation
</a>
&nbsp;&nbsp;
@@ -87,40 +86,40 @@
</a>
{% if this_trait.dataset.type == 'ProbeSet' %}
{% if this_trait.symbol != None %}
- <a href="#redirect" onclick="window.open('http://www.genenetwork.org/webqtl/main.py?cmd=sch&amp;gene={{ this_trait.symbol }}&amp;alias=1&amp;species={{ species_name }}')">
+ <a href="http://www.genenetwork.org/webqtl/main.py?cmd=sch&amp;gene={{ this_trait.symbol }}&amp;alias=1&amp;species={{ species_name }}">
<button type="button" class="btn btn-default" title="Find similar expression data">
<i class="icon-search"></i> Find
</button>
</a>
{% endif %}
{% if UCSC_BLAT_URL != "" %}
- <a href="#redirect" onclick="window.open('{{ UCSC_BLAT_URL }}')">
+ <a href="{{ UCSC_BLAT_URL }}">
<button type="button" class="btn btn-default" title="Check probe locations at UCSC">
<i class="icon-ok"></i> Verify
</button>
</a>
{% endif %}
{% if this_trait.symbol != None %}
- <a href="#redirect" onclick="window.open('http://genenetwork.org/webqtl/main.py?FormID=geneWiki&symbol={{ this_trait.symbol }}')">
+ <a href="http://genenetwork.org/webqtl/main.py?FormID=geneWiki&symbol={{ this_trait.symbol }}">
<button type="button" class="btn btn-default" title="Write or review comments about this gene">
<i class="icon-edit"></i> GeneWiki
</button>
</a>
- <a href="#redirect" onclick="window.open('http://genenetwork.org/webqtl/main.py?FormID=SnpBrowserResultPage&submitStatus=1&diffAlleles=True&customStrain=True&geneName={{ this_trait.symbol }}')">
+ <a href="http://genenetwork.org/webqtl/main.py?FormID=SnpBrowserResultPage&submitStatus=1&diffAlleles=True&customStrain=True&geneName={{ this_trait.symbol }}">
<button type="button" class="btn btn-default" title="View SNPs and Indels">
<i class="icon-road"></i> SNPs
</button>
</a>
{% endif %}
{% if UTHSC_BLAT_URL != "" %}
- <a href="#redirect" onclick="window.open('{{ UTHSC_BLAT_URL }}')">
+ <a href="{{ UTHSC_BLAT_URL }}">
<button type="button" class="btn btn-default" title="View probes, SNPs, and RNA-seq at UTHSC">
<i class="icon-eye-close"></i> RNA-seq
</button>
</a>
{% endif %}
{% if show_probes == "True" %}
- <a href="#redirect" onclick="window.open('http://genenetwork.org/webqtl/main.py?FormID=showProbeInfo&database={{ this_trait.dataset.name }}&ProbeSetID={{ this_trait.name }}&CellID={{ this_trait.cellid }}&RISet={{ dataset.group.name }}&incparentsf1=ON')">
+ <a href="http://genenetwork.org/webqtl/main.py?FormID=showProbeInfo&database={{ this_trait.dataset.name }}&ProbeSetID={{ this_trait.name }}&CellID={{ this_trait.cellid }}&RISet={{ dataset.group.name }}&incparentsf1=ON">
<button type="button" class="btn btn-default" title="Check sequence of probes">
<i class="icon-list"></i> Probes
</button>
diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html
index 067dfc67..3d9c2521 100755
--- a/wqflask/wqflask/templates/show_trait_mapping_tools.html
+++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html
@@ -6,13 +6,13 @@
<ul class="nav nav-pills">
{% if use_pylmm_rqtl and not use_plink_gemma and dataset.group.species != "human" %}
<li class="active">
- <a href="#pylmm" data-toggle="tab">pyLMM</a>
+ <a href="#interval_mapping" data-toggle="tab">Interval Mapping</a>
</li>
<li>
- <a href="#rqtl_geno" data-toggle="tab">R/qtl</a>
+ <a href="#pylmm" data-toggle="tab">pyLMM</a>
</li>
<li>
- <a href="#interval_mapping" data-toggle="tab">Interval Mapping</a>
+ <a href="#rqtl_geno" data-toggle="tab">R/qtl</a>
</li>
{% endif %}
{% if use_plink_gemma %}
@@ -30,7 +30,89 @@
<div class="tab-content">
{% if use_pylmm_rqtl and not use_plink_gemma and dataset.group.species != "human" %}
- <div class="tab-pane active" id="pylmm">
+ <div class="tab-pane active" id="interval_mapping">
+ <div style="margin-top: 20px" class="form-horizontal">
+ <div class="mapping_method_fields form-group">
+ <label for="mapping_permutations" class="col-xs-3 control-label">Permutations</label>
+ <div style="margin-left: 20px;" class="col-xs-4 controls">
+ <input name="num_perm_reaper" value="2000" type="text" class="form-control">
+ </div>
+ </div>
+ <div class="mapping_method_fields form-group">
+ <label for="mapping_bootstraps" class="col-xs-3 control-label">Bootstraps</label>
+ <div style="margin-left: 20px;" class="col-xs-4 controls">
+ <input name="num_bootstrap" value="2000" type="text" class="form-control">
+ </div>
+ </div>
+ <div class="mapping_method_fields form-group">
+ <label for="control_for" class="col-xs-3 control-label">Control&nbsp;for</label>
+ <div style="margin-left: 20px;" class="col-xs-4 controls">
+ {% if dataset.type == 'ProbeSet' and this_trait.locus_chr != "" %}
+ <input name="control_reaper" value="{{ nearest_marker }}" type="text" style="width: 160px;" class="form-control" />
+ {% else %}
+ <input name="control_reaper" value="" type="text" class="form-control" />
+ {% endif %}
+ <label class="radio-inline">
+ <input type="radio" name="do_control_reaper" value="true">
+ Yes
+ </label>
+ <label class="radio-inline">
+ <input type="radio" name="do_control_reaper" value="false" checked="">
+ No
+ </label>
+ </div>
+ </div>
+
+<!--
+ <div class="mapping_method_fields form-group">
+ <label for="mapping_bootstraps" class="col-xs-3 control-label" title="Bootstrapping Resamples">Bootstrap Test (n=2000)</label>
+ <div class="col-xs-4 controls">
+ <label>
+ <input type="checkbox" name="bootCheck" id="bootCheck"> Bootstrap Test (n=2000)
+ </label>
+ </div>
+ </div>
+
+ <div class="mapping_method_fields form-group">
+ <label style="text-align:left;" class="col-xs-12 control-label">Display Additive Effect</label>
+ <div class="col-xs-12 controls" id="display_additive_effect">
+ <label class="radio-inline">
+ <input type="radio" name="display_additive" id="display_additive" value="yes" checked="">
+ Yes
+ </label>
+ <label class="radio-inline">
+ <input type="radio" name="display_additive" id="display_additive" value="no">
+ No
+ </label>
+ </div>
+ </div>
+-->
+
+
+ <div class="mapping_method_fields form-group">
+ <label style="text-align:left;" class="col-xs-12 control-label">Marker Regr.</label>
+ <div class="col-xs-12 controls">
+ <label class="radio-inline">
+ <input type="radio" name="manhattan_plot_reaper" value="True">
+ Yes
+ </label>
+ <label class="radio-inline">
+ <input type="radio" name="manhattan_plot_reaper" value="False" checked="">
+ No
+ </label>
+ </div>
+ </div>
+ <div class="form-group">
+ <div style="padding-left:15px;" class="controls">
+ <button id="interval_mapping_compute" class="btn submit_special btn-primary" data-url="/marker_regression" title="Compute Interval Mapping">
+ <i class="icon-ok-circle icon-white"></i> Compute
+ </button>
+ </div>
+ </div>
+ <!--<div id="alert_placeholder"></div>-->
+ </div>
+ </div>
+ <div class="tab-pane" id="pylmm">
<div style="margin-top: 20px" class="form-horizontal">
<div class="mapping_method_fields form-group">
<label for="mapping_permutations" class="col-xs-3 control-label">Permutations</label>
@@ -179,88 +261,6 @@
</div>
</div>
</div>
- <div class="tab-pane" id="interval_mapping">
- <div style="margin-top: 20px" class="form-horizontal">
- <div class="mapping_method_fields form-group">
- <label for="mapping_permutations" class="col-xs-3 control-label">Permutations</label>
- <div style="margin-left: 20px;" class="col-xs-4 controls">
- <input name="num_perm_reaper" value="2000" type="text" class="form-control">
- </div>
- </div>
- <div class="mapping_method_fields form-group">
- <label for="mapping_bootstraps" class="col-xs-3 control-label">Bootstraps</label>
- <div style="margin-left: 20px;" class="col-xs-4 controls">
- <input name="num_bootstrap" value="2000" type="text" class="form-control">
- </div>
- </div>
- <div class="mapping_method_fields form-group">
- <label for="control_for" class="col-xs-3 control-label">Control&nbsp;for</label>
- <div style="margin-left: 20px;" class="col-xs-4 controls">
- {% if dataset.type == 'ProbeSet' and this_trait.locus_chr != "" %}
- <input name="control_reaper" value="{{ nearest_marker }}" type="text" style="width: 160px;" class="form-control" />
- {% else %}
- <input name="control_reaper" value="" type="text" class="form-control" />
- {% endif %}
- <label class="radio-inline">
- <input type="radio" name="do_control_reaper" value="true">
- Yes
- </label>
- <label class="radio-inline">
- <input type="radio" name="do_control_reaper" value="false" checked="">
- No
- </label>
- </div>
- </div>
-
-<!--
- <div class="mapping_method_fields form-group">
- <label for="mapping_bootstraps" class="col-xs-3 control-label" title="Bootstrapping Resamples">Bootstrap Test (n=2000)</label>
- <div class="col-xs-4 controls">
- <label>
- <input type="checkbox" name="bootCheck" id="bootCheck"> Bootstrap Test (n=2000)
- </label>
- </div>
- </div>
-
- <div class="mapping_method_fields form-group">
- <label style="text-align:left;" class="col-xs-12 control-label">Display Additive Effect</label>
- <div class="col-xs-12 controls" id="display_additive_effect">
- <label class="radio-inline">
- <input type="radio" name="display_additive" id="display_additive" value="yes" checked="">
- Yes
- </label>
- <label class="radio-inline">
- <input type="radio" name="display_additive" id="display_additive" value="no">
- No
- </label>
- </div>
- </div>
--->
-
-
- <div class="mapping_method_fields form-group">
- <label style="text-align:left;" class="col-xs-12 control-label">Marker Regr.</label>
- <div class="col-xs-12 controls">
- <label class="radio-inline">
- <input type="radio" name="manhattan_plot_reaper" value="True">
- Yes
- </label>
- <label class="radio-inline">
- <input type="radio" name="manhattan_plot_reaper" value="False" checked="">
- No
- </label>
- </div>
- </div>
- <div class="form-group">
- <div style="padding-left:15px;" class="controls">
- <button id="interval_mapping_compute" class="btn submit_special btn-primary" data-url="/marker_regression" title="Compute Interval Mapping">
- <i class="icon-ok-circle icon-white"></i> Compute
- </button>
- </div>
- </div>
- <!--<div id="alert_placeholder"></div>-->
- </div>
- </div>
{% endif %}
{% if use_plink_gemma %}
<div class="tab-pane" id="plink">
diff --git a/wqflask/wqflask/update_search_results.py b/wqflask/wqflask/update_search_results.py
new file mode 100644
index 00000000..ffd7fd51
--- /dev/null
+++ b/wqflask/wqflask/update_search_results.py
@@ -0,0 +1,129 @@
+from __future__ import absolute_import, print_function, division
+
+import json
+
+from flask import Flask, g
+from base.data_set import create_dataset
+from base.trait import GeneralTrait
+from dbFunction import webqtlDatabaseFunction
+
+from utility.benchmark import Bench
+
+class GSearch(object):
+
+ def __init__(self, kw):
+ self.type = kw['type']
+ self.terms = kw['terms']
+ #self.row_range = kw['row_range']
+ if self.type == "gene":
+ sql = """
+ SELECT
+ Species.`Name` AS species_name,
+ InbredSet.`Name` AS inbredset_name,
+ Tissue.`Name` AS tissue_name,
+ ProbeSetFreeze.Name AS probesetfreeze_name,
+ ProbeSet.Name AS probeset_name,
+ ProbeSet.Symbol AS probeset_symbol,
+ ProbeSet.`description` AS probeset_description,
+ ProbeSet.Chr AS chr,
+ ProbeSet.Mb AS mb,
+ ProbeSetXRef.Mean AS mean,
+ ProbeSetXRef.LRS AS lrs,
+ ProbeSetXRef.`Locus` AS locus,
+ ProbeSetXRef.`pValue` AS pvalue,
+ ProbeSetXRef.`additive` AS additive
+ FROM Species, InbredSet, ProbeSetXRef, ProbeSet, ProbeFreeze, ProbeSetFreeze, Tissue
+ WHERE InbredSet.`SpeciesId`=Species.`Id`
+ AND ProbeFreeze.InbredSetId=InbredSet.`Id`
+ AND ProbeFreeze.`TissueId`=Tissue.`Id`
+ AND ProbeSetFreeze.ProbeFreezeId=ProbeFreeze.Id
+ AND ( MATCH (ProbeSet.Name,ProbeSet.description,ProbeSet.symbol,alias,GenbankId, UniGeneId, Probe_Target_Description) AGAINST ('%s' IN BOOLEAN MODE) )
+ AND ProbeSet.Id = ProbeSetXRef.ProbeSetId
+ AND ProbeSetXRef.ProbeSetFreezeId=ProbeSetFreeze.Id
+ AND ProbeSetFreeze.public > 0
+ ORDER BY species_name, inbredset_name, tissue_name, probesetfreeze_name, probeset_name
+ LIMIT 6000
+ """ % (self.terms)
+ with Bench("Running query"):
+ re = g.db.execute(sql).fetchall()
+ self.trait_list = []
+ with Bench("Creating trait objects"):
+ for line in re:
+ dataset = create_dataset(line[3], "ProbeSet", get_samplelist=False)
+ trait_id = line[4]
+ #with Bench("Building trait object"):
+ this_trait = GeneralTrait(dataset=dataset, name=trait_id, get_qtl_info=True, get_sample_info=False)
+ self.trait_list.append(this_trait)
+
+ elif self.type == "phenotype":
+ sql = """
+ SELECT
+ Species.`Name`,
+ InbredSet.`Name`,
+ PublishFreeze.`Name`,
+ PublishXRef.`Id`,
+ Phenotype.`Post_publication_description`,
+ Publication.`Authors`,
+ Publication.`Year`,
+ PublishXRef.`LRS`,
+ PublishXRef.`Locus`,
+ PublishXRef.`additive`
+ FROM Species,InbredSet,PublishFreeze,PublishXRef,Phenotype,Publication
+ WHERE PublishXRef.`InbredSetId`=InbredSet.`Id`
+ AND PublishFreeze.`InbredSetId`=InbredSet.`Id`
+ AND InbredSet.`SpeciesId`=Species.`Id`
+ AND PublishXRef.`PhenotypeId`=Phenotype.`Id`
+ AND PublishXRef.`PublicationId`=Publication.`Id`
+ AND (Phenotype.Post_publication_description REGEXP "[[:<:]]%s[[:>:]]"
+ OR Phenotype.Pre_publication_description REGEXP "[[:<:]]%s[[:>:]]"
+ OR Phenotype.Pre_publication_abbreviation REGEXP "[[:<:]]%s[[:>:]]"
+ OR Phenotype.Post_publication_abbreviation REGEXP "[[:<:]]%s[[:>:]]"
+ OR Phenotype.Lab_code REGEXP "[[:<:]]%s[[:>:]]"
+ OR Publication.PubMed_ID REGEXP "[[:<:]]%s[[:>:]]"
+ OR Publication.Abstract REGEXP "[[:<:]]%s[[:>:]]"
+ OR Publication.Title REGEXP "[[:<:]]%s[[:>:]]"
+ OR Publication.Authors REGEXP "[[:<:]]%s[[:>:]]"
+ OR PublishXRef.Id REGEXP "[[:<:]]%s[[:>:]]")
+ ORDER BY Species.`Name`, InbredSet.`Name`, PublishXRef.`Id`
+ LIMIT 6000
+ """ % (self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms, self.terms)
+ re = g.db.execute(sql).fetchall()
+ self.trait_list = []
+ with Bench("Creating trait objects"):
+ for line in re:
+ dataset = create_dataset(line[2], "Publish")
+ trait_id = line[3]
+ this_trait = GeneralTrait(dataset=dataset, name=trait_id, get_qtl_info=True, get_sample_info=False)
+ self.trait_list.append(this_trait)
+
+ self.results = self.convert_to_json()
+
+ def convert_to_json(self):
+ json_dict = {}
+ #json_dict['draw'] = self.draw,
+ json_dict['recordsTotal'] = len(self.trait_list),
+ json_dict['data'] = []
+
+ for i, trait in enumerate(self.trait_list):
+ trait_row = { "checkbox": "<INPUT TYPE=\"checkbox\" NAME=\"searchResult\" class=\"checkbox trait_checkbox\" style=\"transform: scale(1.5);\" VALUE=\"{}:{}\">".format(trait.name, trait.dataset.name),
+ "index": i+1,
+ "species": trait.dataset.group.species,
+ "group": trait.dataset.group.name,
+ "tissue": trait.dataset.tissue,
+ "dataset": trait.dataset.fullname,
+ "record": "<a href=\"/show_trait?trait_id=" + trait.name + "&dataset=" + trait.dataset.name + "\" target=\"_blank\">" + trait.name + "</a>",
+ "symbol": trait.symbol,
+ "description": trait.description_display,
+ "location": trait.location_repr,
+ "mean": trait.mean,
+ "max_lrs": trait.LRS_score_repr,
+ "max_lrs_location": trait.LRS_location_repr,
+ "additive_effect": trait.additive}
+ json_dict['data'].append(trait_row)
+
+ json_results = json.dumps(json_dict)
+ return json_results
+
+
+
+
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index bd2fff50..7854b0df 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -34,6 +34,7 @@ from flask import (render_template, request, make_response, Response,
from wqflask import search_results
from wqflask import gsearch
+from wqflask import update_search_results
from wqflask import docs
from wqflask import news
from base.data_set import DataSet # Used by YAML in marker_regression
@@ -169,6 +170,17 @@ def gsearchact():
return render_template("gsearch_gene.html", **result)
elif type == "phenotype":
return render_template("gsearch_pheno.html", **result)
+
+@app.route("/gsearch_updating", methods=('POST',))
+def gsearch_updating():
+ print("REQUEST ARGS:", request.values)
+ result = update_search_results.GSearch(request.args).__dict__
+ return result['results']
+ # type = request.args['type']
+ # if type == "gene":
+ # return render_template("gsearch_gene_updating.html", **result)
+ # elif type == "phenotype":
+ # return render_template("gsearch_pheno.html", **result)
@app.route("/docedit")
def docedit():