aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/do_search.py88
-rw-r--r--wqflask/wqflask/export_traits.py1
-rw-r--r--wqflask/wqflask/heatmap/heatmap.py173
-rw-r--r--wqflask/wqflask/interval_analyst/GeneUtil.py2
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression.py59
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression_gn1.py886
-rw-r--r--wqflask/wqflask/static/new/javascript/dataset_menu_structure.json67
-rw-r--r--wqflask/wqflask/templates/heatmap.html1
8 files changed, 81 insertions, 1196 deletions
diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py
index 07c67384..e2a0a479 100644
--- a/wqflask/wqflask/do_search.py
+++ b/wqflask/wqflask/do_search.py
@@ -79,38 +79,6 @@ class DoSearch(object):
else:
return None
-class QuickMrnaAssaySearch(DoSearch):
- """A general search for mRNA assays"""
-
- DoSearch.search_types['quick_mrna_assay'] = "QuickMrnaAssaySearch"
-
- base_query = """SELECT ProbeSet.Name as ProbeSet_Name,
- ProbeSet.Symbol as ProbeSet_Symbol,
- ProbeSet.description as ProbeSet_Description,
- ProbeSet.Chr_num as ProbeSet_Chr_Num,
- ProbeSet.Mb as ProbeSet_Mb,
- ProbeSet.name_num as ProbeSet_name_num
- FROM ProbeSet """
-
- header_fields = ['Index',
- 'Record',
- 'Symbol',
- 'Location']
-
- def run(self):
- """Generates and runs a search for assays across all mRNA expression datasets"""
-
- logger.debug("Running ProbeSetSearch")
- query = self.base_query + """WHERE (MATCH (ProbeSet.Name,
- ProbeSet.description,
- ProbeSet.symbol,
- ProbeSet.alias)
- AGAINST ('%s' IN BOOLEAN MODE))
- """ % (escape(self.search_term[0]))
-
- return self.execute(query)
-
-
class MrnaAssaySearch(DoSearch):
"""A search within an expression dataset, including mRNA, protein, SNP, but not phenotype or metabolites"""
@@ -311,54 +279,6 @@ class PhenotypeSearch(DoSearch):
return self.execute(query)
-class QuickPhenotypeSearch(PhenotypeSearch):
- """A search across all phenotype datasets"""
-
- DoSearch.search_types['quick_phenotype'] = "QuickPhenotypeSearch"
-
- base_query = """SELECT Species.Name as Species_Name,
- PublishFreeze.FullName as Dataset_Name,
- PublishFreeze.Name,
- PublishXRef.Id,
- PublishFreeze.createtime as thistable,
- Publication.PubMed_ID as Publication_PubMed_ID,
- Phenotype.Post_publication_description as Phenotype_Name
- FROM Phenotype,
- PublishFreeze,
- Publication,
- PublishXRef,
- InbredSet,
- Species """
-
- search_fields = ('Phenotype.Post_publication_description',
- 'Phenotype.Pre_publication_description',
- 'Phenotype.Pre_publication_abbreviation',
- 'Phenotype.Post_publication_abbreviation',
- 'Phenotype.Lab_code',
- 'Publication.PubMed_ID',
- 'Publication.Abstract',
- 'Publication.Title',
- 'Publication.Authors')
-
- def compile_final_query(self, where_clause = ''):
- """Generates the final query string"""
-
- query = (self.base_query +
- """WHERE %s
- PublishXRef.PhenotypeId = Phenotype.Id and
- PublishXRef.PublicationId = Publication.Id and
- PublishXRef.InbredSetId = InbredSet.Id and
- InbredSet.SpeciesId = Species.Id""" % where_clause)
-
- return query
-
- def run(self):
- """Generates and runs a search across all phenotype datasets"""
-
- query = self.compile_final_query(where_clause = self.get_where_clause())
-
- return self.execute(query)
-
class GenotypeSearch(DoSearch):
"""A search within a genotype dataset"""
@@ -767,14 +687,6 @@ class MeanSearch(MrnaAssaySearch):
return where_clause
- def get_final_query(self):
- self.where_clause = self.get_where_clause()
- logger.debug("where_clause is:", pf(self.where_clause))
-
- self.query = self.compile_final_query(where_clause = self.where_clause)
-
- return self.query
-
def run(self):
self.where_clause = self.get_where_clause()
logger.debug("where_clause is:", pf(self.where_clause))
diff --git a/wqflask/wqflask/export_traits.py b/wqflask/wqflask/export_traits.py
index f8fce929..ab4c0d7c 100644
--- a/wqflask/wqflask/export_traits.py
+++ b/wqflask/wqflask/export_traits.py
@@ -1,6 +1,5 @@
from __future__ import print_function, division
-import operator
import csv
import xlsxwriter
import StringIO
diff --git a/wqflask/wqflask/heatmap/heatmap.py b/wqflask/wqflask/heatmap/heatmap.py
index 56ff11cd..af75d441 100644
--- a/wqflask/wqflask/heatmap/heatmap.py
+++ b/wqflask/wqflask/heatmap/heatmap.py
@@ -3,7 +3,6 @@ from __future__ import absolute_import, print_function, division
import sys
# sys.path.append(".") Never in a running webserver
-import gc
import string
import cPickle
import os
@@ -16,7 +15,6 @@ import resource
import scipy
import numpy as np
-from scipy import linalg
from pprint import pformat as pf
@@ -82,21 +80,16 @@ class Heatmap(object):
this_trait = trait_db[0]
this_sample_data = this_trait.data
- #self.sample_data[this_trait.name] = []
this_trait_vals = []
for sample in self.all_sample_list:
if sample in this_sample_data:
this_trait_vals.append(this_sample_data[sample].value)
- #self.sample_data[this_trait.name].append(this_sample_data[sample].value)
else:
this_trait_vals.append('')
- #self.sample_data[this_trait.name].append('')
self.sample_data.append(this_trait_vals)
self.gen_reaper_results()
- #self.gen_pylmm_results()
- #chrnames = []
lodnames = []
chr_pos = []
pos = []
@@ -106,9 +99,6 @@ class Heatmap(object):
lodnames.append(trait)
for marker in self.dataset.group.markers.markers:
- #if marker['chr'] not in chrnames:
- # chr_ob = [marker['chr'], "filler"]
- # chrnames.append(chr_ob)
chr_pos.append(marker['chr'])
pos.append(marker['Mb'])
markernames.append(marker['name'])
@@ -126,9 +116,6 @@ class Heatmap(object):
json_data = self.json_data
)
- print("self.js_data:", self.js_data)
-
-
def gen_reaper_results(self):
self.trait_results = {}
for trait_db in self.trait_list:
@@ -145,172 +132,14 @@ class Heatmap(object):
trimmed_samples.append(samples[i])
trimmed_values.append(values[i])
- self.lrs_array = genotype.permutation(strains = trimmed_samples,
- trait = trimmed_values,
- nperm= self.num_permutations)
-
- #self.suggestive = self.lrs_array[int(self.num_permutations*0.37-1)]
- #self.significant = self.lrs_array[int(self.num_permutations*0.95-1)]
-
reaper_results = genotype.regression(strains = trimmed_samples,
trait = trimmed_values)
-
lrs_values = [float(qtl.lrs) for qtl in reaper_results]
- print("lrs_values:", lrs_values)
- #self.dataset.group.markers.add_pvalues(p_values)
self.trait_results[this_trait.name] = []
for qtl in reaper_results:
if qtl.additive > 0:
self.trait_results[this_trait.name].append(-float(qtl.lrs))
else:
- self.trait_results[this_trait.name].append(float(qtl.lrs))
- #for lrs in lrs_values:
- # if
- # self.trait_results[this_trait.name].append(lrs)
-
-
- #this_db_samples = self.dataset.group.samplelist
- #this_sample_data = this_trait.data
- ##print("this_sample_data", this_sample_data)
- #this_trait_vals = []
- #for index, sample in enumerate(this_db_samples):
- # if sample in this_sample_data:
- # sample_value = this_sample_data[sample].value
- # this_trait_vals.append(sample_value)
- # else:
- # this_trait_vals.append("x")
-
- #pheno_vector = np.array([val == "x" and np.nan or float(val) for val in this_trait_vals])
-
- #key = "pylmm:input:" + str(self.temp_uuid)
- #print("key is:", pf(key))
-
- #genotype_data = [marker['genotypes'] for marker in self.dataset.group.markers.markers]
-
- #no_val_samples = self.identify_empty_samples(this_trait_vals)
- #trimmed_genotype_data = self.trim_genotypes(genotype_data, no_val_samples)
-
- #genotype_matrix = np.array(trimmed_genotype_data).T
-
- #print("genotype_matrix:", str(genotype_matrix.tolist()))
- #print("pheno_vector:", str(pheno_vector.tolist()))
-
- #params = dict(pheno_vector = pheno_vector.tolist(),
- # genotype_matrix = genotype_matrix.tolist(),
- # restricted_max_likelihood = True,
- # refit = False,
- # temp_uuid = str(self.temp_uuid),
- #
- # # meta data
- # timestamp = datetime.datetime.now().isoformat(),
- # )
- #
- #json_params = json.dumps(params)
- ##print("json_params:", json_params)
- #Redis.set(key, json_params)
- #Redis.expire(key, 60*60)
- #print("before printing command")
- #
- #command = 'python lmm.py --key {} --species {}'.format(key,
- # "other")
- #print("command is:", command)
- #print("after printing command")
- #
- #os.system(command)
- #
- #json_results = Redis.blpop("pylmm:results:" + str(self.temp_uuid), 45*60)
-
- def gen_pylmm_results(self):
- # This function is NOT used. If it is, we should use a shared function with marker_regression.py
- self.trait_results = {}
- for trait_db in self.trait_list:
- this_trait = trait_db[0]
- #this_db = trait_db[1]
- self.dataset.group.get_markers()
-
- this_db_samples = self.dataset.group.samplelist
- this_sample_data = this_trait.data
- #print("this_sample_data", this_sample_data)
- this_trait_vals = []
- for index, sample in enumerate(this_db_samples):
- if sample in this_sample_data:
- sample_value = this_sample_data[sample].value
- this_trait_vals.append(sample_value)
- else:
- this_trait_vals.append("x")
-
- pheno_vector = np.array([val == "x" and np.nan or float(val) for val in this_trait_vals])
-
- key = "pylmm:input:" + str(self.temp_uuid)
- #print("key is:", pf(key))
-
- genotype_data = [marker['genotypes'] for marker in self.dataset.group.markers.markers]
-
- no_val_samples = self.identify_empty_samples(this_trait_vals)
- trimmed_genotype_data = self.trim_genotypes(genotype_data, no_val_samples)
-
- genotype_matrix = np.array(trimmed_genotype_data).T
-
- #print("genotype_matrix:", str(genotype_matrix.tolist()))
- #print("pheno_vector:", str(pheno_vector.tolist()))
-
- params = dict(pheno_vector = pheno_vector.tolist(),
- genotype_matrix = genotype_matrix.tolist(),
- restricted_max_likelihood = True,
- refit = False,
- temp_uuid = str(self.temp_uuid),
-
- # meta data
- timestamp = datetime.datetime.now().isoformat(),
- )
-
- json_params = json.dumps(params)
- #print("json_params:", json_params)
- Redis.set(key, json_params)
- Redis.expire(key, 60*60)
- print("before printing command")
-
- command = PYLMM_COMMAND+' --key {} --species {}'.format(key,
- "other")
- print("command is:", command)
- print("after printing command")
-
- os.system(command)
-
- json_results = Redis.blpop("pylmm:results:" + str(self.temp_uuid), 45*60)
- results = json.loads(json_results[1])
- p_values = [float(result) for result in results['p_values']]
- #print("p_values:", p_values)
- self.dataset.group.markers.add_pvalues(p_values)
-
- self.trait_results[this_trait.name] = []
- for marker in self.dataset.group.markers.markers:
- self.trait_results[this_trait.name].append(marker['lod_score'])
-
-
- def identify_empty_samples(self, values):
- no_val_samples = []
- for sample_count, val in enumerate(values):
- if val == "x":
- no_val_samples.append(sample_count)
- return no_val_samples
-
- def trim_genotypes(self, genotype_data, no_value_samples):
- trimmed_genotype_data = []
- for marker in genotype_data:
- new_genotypes = []
- for item_count, genotype in enumerate(marker):
- if item_count in no_value_samples:
- continue
- try:
- genotype = float(genotype)
- except ValueError:
- genotype = np.nan
- pass
- new_genotypes.append(genotype)
- trimmed_genotype_data.append(new_genotypes)
- return trimmed_genotype_data
-
-
+ self.trait_results[this_trait.name].append(float(qtl.lrs)) \ No newline at end of file
diff --git a/wqflask/wqflask/interval_analyst/GeneUtil.py b/wqflask/wqflask/interval_analyst/GeneUtil.py
index fda7773f..2c60dd70 100644
--- a/wqflask/wqflask/interval_analyst/GeneUtil.py
+++ b/wqflask/wqflask/interval_analyst/GeneUtil.py
@@ -6,7 +6,7 @@ from flask import Flask, g
#Just return a list of dictionaries
#each dictionary contains sub-dictionary
-def loadGenes(chrName, diffCol, startMb, endMb, webqtlDb =None, species='mouse'):
+def loadGenes(chrName, diffCol, startMb, endMb, species='mouse'):
fetchFields = ['SpeciesId', 'Id', 'GeneSymbol', 'GeneDescription', 'Chromosome', 'TxStart', 'TxEnd',
'Strand', 'GeneID', 'NM_ID', 'kgID', 'GenBankID', 'UnigenID', 'ProteinID', 'AlignID',
'exonCount', 'exonStarts', 'exonEnds', 'cdsStart', 'cdsEnd']
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py
index 3ec61e55..bfb63995 100644
--- a/wqflask/wqflask/marker_regression/marker_regression.py
+++ b/wqflask/wqflask/marker_regression/marker_regression.py
@@ -16,7 +16,6 @@ import uuid
import rpy2.robjects as ro
import numpy as np
-from scipy import linalg
import cPickle as pickle
import itertools
@@ -84,7 +83,6 @@ class MarkerRegression(object):
self.geno_db_exists = start_vars['geno_db_exists']
else:
try:
- geno_dataset = data_set.create_dataset(self.dataset.group.name + "Geno")
self.geno_db_exists = "True"
except:
self.geno_db_exists = "False"
@@ -278,7 +276,6 @@ class MarkerRegression(object):
)
else:
- self.cutoff = 2
self.qtl_results = []
highest_chr = 1 #This is needed in order to convert the highest chr to X/Y
for marker in results:
@@ -426,7 +423,6 @@ class MarkerRegression(object):
if self.dataset.group.species == "human":
p_values, t_stats = self.gen_human_results(pheno_vector, key, temp_uuid)
- #p_values = self.trim_results(p_values)
else:
logger.debug("NOW CWD IS:", os.getcwd())
@@ -478,8 +474,6 @@ class MarkerRegression(object):
json_results = Redis.blpop("pylmm:results:" + temp_uuid, 45*60)
results = json.loads(json_results[1])
p_values = [float(result) for result in results['p_values']]
- #logger.debug("p_values:", p_values[:10])
- #p_values = self.trim_results(p_values)
t_stats = results['t_stats']
#t_stats, p_values = lmm.run(
@@ -493,19 +487,8 @@ class MarkerRegression(object):
self.dataset.group.markers.add_pvalues(p_values)
- #self.get_lod_score_cutoff()
-
return self.dataset.group.markers.markers
- def trim_results(self, p_values):
- logger.debug("len_p_values:", len(p_values))
- if len(p_values) > 500:
- p_values.sort(reverse=True)
- trimmed_values = p_values[:500]
-
- return trimmed_values
-
- #def gen_human_results(self, pheno_vector, tempdata):
def gen_human_results(self, pheno_vector, key, temp_uuid):
file_base = locate(self.dataset.group.name,"mapping")
@@ -562,18 +545,6 @@ class MarkerRegression(object):
return p_values, t_stats
- def get_lod_score_cutoff(self):
- logger.debug("INSIDE GET LOD CUTOFF")
- high_qtl_count = 0
- for marker in self.dataset.group.markers.markers:
- if marker['lod_score'] > 1:
- high_qtl_count += 1
-
- if high_qtl_count > 1000:
- return 1
- else:
- return 0
-
def identify_empty_samples(self):
no_val_samples = []
for sample_count, val in enumerate(self.vals):
@@ -597,28 +568,6 @@ class MarkerRegression(object):
trimmed_genotype_data.append(new_genotypes)
return trimmed_genotype_data
-def create_snp_iterator_file(group):
- """
- This function is only called by main below
- """
- raise Exception("Paths are undefined here")
- plink_file_base = os.path.join(TMPDIR, group)
- plink_input = input.plink(plink_file_base, type='b')
-
- data = dict(plink_input = list(plink_input),
- numSNPs = plink_input.numSNPs)
-
- #input_dict = {}
- #
- #input_dict['plink_input'] = list(plink_input)
- #input_dict['numSNPs'] = plink_input.numSNPs
- #
-
- snp_file_base = os.path.join(webqtlConfig.SNP_PATH, group + ".snps.gz")
-
- with gzip.open(snp_file_base, "wb") as fh:
- pickle.dump(data, fh, pickle.HIGHEST_PROTOCOL)
-
def export_mapping_results(dataset, trait, markers, results_path, mapping_scale, score_type):
with open(results_path, "w+") as output_file:
output_file.write("Population: " + dataset.group.species.title() + " " + dataset.group.name + "\n")
@@ -652,8 +601,6 @@ def export_mapping_results(dataset, trait, markers, results_path, mapping_scale,
output_file.write("\n")
def trim_markers_for_table(markers):
- num_markers = len(markers)
-
if 'lod_score' in markers[0].keys():
sorted_markers = sorted(markers, key=lambda k: k['lod_score'], reverse=True)
else:
@@ -664,8 +611,4 @@ def trim_markers_for_table(markers):
trimmed_sorted_markers = sorted_markers[:200]
return trimmed_sorted_markers
else:
- return sorted_markers
-
-
-if __name__ == '__main__':
- import cPickle as pickle
+ return sorted_markers \ No newline at end of file
diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py
index 81da8976..da713325 100644
--- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py
+++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py
@@ -30,7 +30,7 @@ from math import *
import piddle as pid
import sys,os
import cPickle
-import httplib, urllib
+import httplib
from flask import Flask, g
@@ -52,7 +52,6 @@ logger = utility.logger.getLogger(__name__ )
#########################################
class MarkerRegression(object):
cMGraphInterval = 5
- maxBootStrap = 50
GRAPH_MIN_WIDTH = 900
GRAPH_MAX_WIDTH = 10000 # Don't set this too high
GRAPH_DEFAULT_WIDTH = 1280
@@ -81,8 +80,6 @@ class MarkerRegression(object):
DRAW_DETAIL_MB = 4
DRAW_UTR_LABELS_MB = 4
- MIN_PIXELS_BETWEEN_LABELS = 50
-
qmarkImg = HT.Image('/images/qmarkBoxBlue.gif', width=10, height=13, border=0, alt='Glossary')
# Note that "qmark.gif" is a similar, smaller, rounded-edges question mark. It doesn't look
# like the ones on the image, though, which is why we don't use it here.
@@ -93,11 +90,8 @@ class MarkerRegression(object):
NR_INDIVIDUALS = 0
## END HaplotypeAnalyst
- ALEX_DEBUG_BOOL_COLORIZE_GENES = 1 # 0=don't colorize, 1=colorize
ALEX_DEBUG_BOOL_PRINT_GENE_LIST = 1
- kWIDTH_DEFAULT=1
-
kONE_MILLION = 1000000
LODFACTOR = 4.61
@@ -105,18 +99,14 @@ class MarkerRegression(object):
SNP_COLOR = pid.orange # Color for the SNP "seismograph"
TRANSCRIPT_LOCATION_COLOR = pid.mediumpurple
- GENE_FILL_COLOR = pid.HexColor(0x6666FF)
- GENE_OUTLINE_COLOR = pid.HexColor(0x000077)
BOOTSTRAP_BOX_COLOR = pid.yellow
LRS_COLOR = pid.HexColor(0x0000FF)
- LRS_LINE_WIDTH = 2
SIGNIFICANT_COLOR = pid.HexColor(0xEBC7C7)
SUGGESTIVE_COLOR = pid.gainsboro
SIGNIFICANT_WIDTH = 5
SUGGESTIVE_WIDTH = 5
ADDITIVE_COLOR_POSITIVE = pid.green
ADDITIVE_COLOR_NEGATIVE = pid.orange
- ADDITIVE_COLOR = ADDITIVE_COLOR_POSITIVE
DOMINANCE_COLOR_POSITIVE = pid.darkviolet
DOMINANCE_COLOR_NEGATIVE = pid.red
@@ -127,15 +117,7 @@ class MarkerRegression(object):
HAPLOTYPE_RECOMBINATION = pid.darkgray
## END HaplotypeAnalyst
- QMARK_EDGE_COLOR = pid.HexColor(0x718118)
- QMARK_FILL_COLOR = pid.HexColor(0xDEE3BB)
-
TOP_RIGHT_INFO_COLOR = pid.black
- X_AXIS_LABEL_COLOR = pid.black #HexColor(0x505050)
-
- MINI_VIEW_MAGNIFIED_REGION_COLOR = pid.HexColor(0xCC0000)
- MINI_VIEW_OUTSIDE_REGION_COLOR = pid.HexColor(0xEEEEEE)
- MINI_VIEW_BORDER_COLOR = pid.black
CLICKABLE_WEBQTL_REGION_COLOR = pid.HexColor(0xF5D3D3)
CLICKABLE_WEBQTL_REGION_OUTLINE_COLOR = pid.HexColor(0xFCE9E9)
@@ -154,18 +136,9 @@ class MarkerRegression(object):
HELP_PAGE_REF = '/glossary.html'
- DRAW_UTR_LABELS=0
-
def __init__(self, start_vars):
-
- #templatePage.__init__(self, fd)
-
- #if not self.openMysql():
- # return
logger.info("Running qtlreaper")
- #helper_functions.get_species_dataset_trait(self, start_vars)
-
self.temp_uuid = start_vars['temp_uuid']
self.dataset = start_vars['dataset']
@@ -249,17 +222,7 @@ class MarkerRegression(object):
if 'use_loco' in start_vars.keys():
self.use_loco = start_vars['use_loco']
- #try:
self.selectedChr = int(start_vars['selected_chr'])
- #except:
- # self.selectedChr = -1
-
- #whether include parents and F1 for InbredSet
- #fd.parentsf14regression = fd.formdata.getvalue('parentsf14regression')
- #if ((fd.parentsf14regression == 'on') and fd.genotype_2):
- # fd.genotype = fd.genotype_2
- #else:
- # fd.genotype = fd.genotype_1
self.strainlist = self.dataset.group.samplelist
self.genotype = self.dataset.group.read_genotype_file()
@@ -279,7 +242,6 @@ class MarkerRegression(object):
self.graphWidth = self.MULT_GRAPH_DEFAULT_WIDTH
## BEGIN HaplotypeAnalyst
- #self.haplotypeAnalystChecked = fd.formdata.getvalue('haplotypeAnalystCheck')
if 'haplotypeAnalystCheck' in start_vars.keys():
self.haplotypeAnalystChecked = start_vars['haplotypeAnalystCheck']
else:
@@ -292,7 +254,6 @@ class MarkerRegression(object):
self.LRS_LOD = start_vars['LRSCheck']
else:
self.LRS_LOD = start_vars['score_type']
- self.cutoff = start_vars['cutoff']
self.intervalAnalystChecked = True
self.draw2X = False
if 'additiveCheck' in start_vars.keys():
@@ -324,34 +285,8 @@ class MarkerRegression(object):
except:
self.lrsMax = 0
- #self.additiveChecked = fd.formdata.getvalue('additiveCheck')
- #self.dominanceChecked = fd.formdata.getvalue('dominanceCheck')
- #self.LRS_LOD = fd.formdata.getvalue('LRSCheck', 'LRS')
- #self.intervalAnalystChecked = fd.formdata.getvalue('intervalAnalystCheck')
- #self.legendChecked = fd.formdata.getvalue('viewLegend')
- #self.geneChecked = fd.formdata.getvalue('showGenes')
- #self.SNPChecked = fd.formdata.getvalue('showSNP')
- #self.draw2X = fd.formdata.getvalue('draw2X')
- #self.lrsMax = float(fd.formdata.getvalue('lrsMax', 0))
- #self.startMb = fd.formdata.getvalue('startMb', "-1")
- #self.endMb = fd.formdata.getvalue('endMb', "-1")
-
- #try:
- # self.startMb = float(self.startMb)
- # self.endMb = float(self.endMb)
- # if self.startMb > self.endMb:
- # temp = self.startMb
- # self.startMb = self.endMb
- # self.endMb = temp
- # #minimal distance 10bp
- # if self.endMb - self.startMb < 0.00001:
- # self.endMb = self.startMb + 0.00001
- #except:
- # self.startMb = self.endMb = -1
-
#Trait Infos
self.identification = ""
- #self.identification = fd.formdata.getvalue('identification', "")
################################################################
# Generate Chr list and Retrieve Length Information
@@ -390,7 +325,6 @@ class MarkerRegression(object):
else:
self.GraphInterval = self.cMGraphInterval #cM
- self.dataSource = 'editingPage'
self.traitList = []
thisTrait = start_vars['this_trait']
self.traitList.append(thisTrait)
@@ -412,8 +346,6 @@ class MarkerRegression(object):
self.NR_INDIVIDUALS = self.NR_INDIVIDUALS + 1
# default:
self.graphHeight = self.graphHeight + 2 * (self.NR_INDIVIDUALS+10) * self.EACH_GENE_HEIGHT
-## for paper:
- # #self.graphHeight = self.graphHeight + 1 * self.NR_INDIVIDUALS * self.EACH_GENE_HEIGHT - 180
## END HaplotypeAnalyst
################################################################
@@ -421,12 +353,6 @@ class MarkerRegression(object):
################################################################
self.multipleInterval = len(self.traitList) > 1
self.qtlresults = start_vars['qtl_results']
- #errorMessage = self.calculateAllResult(fd)
- #if errorMessage:
- # heading = "Mapping"
- # detail = ['%s' % errorMessage]
- # self.error(heading=heading,detail=detail)
- # return
if self.multipleInterval:
self.colorCollection = Plot.colorSpectrum(len(self.qtlresults))
@@ -455,9 +381,6 @@ class MarkerRegression(object):
for i, strain in enumerate(self.diffCol):
self.diffCol[i] = g.db.execute("select Id from Strain where Symbol = %s", strain).fetchone()[0]
- #self.cursor.execute("select Id from Strain where Symbol = %s", strain)
- #self.diffCol[i] = self.cursor.fetchone()[0]
- #print self.diffCol
################################################################
# GeneCollection goes here
@@ -480,13 +403,13 @@ class MarkerRegression(object):
chrName = "X"
else:
chrName = self.selectedChr
- self.geneCol = GeneUtil.loadGenes(chrName, self.diffCol, self.startMb, self.endMb, webqtldatabase, "mouse")
+ self.geneCol = GeneUtil.loadGenes(chrName, self.diffCol, self.startMb, self.endMb, "mouse")
elif self.dataset.group.species == "rat":
if self.selectedChr == 21:
chrName = "X"
else:
chrName = self.selectedChr
- self.geneCol = GeneUtil.loadGenes(chrName, self.diffCol, self.startMb, self.endMb, webqtldatabase, "rat")
+ self.geneCol = GeneUtil.loadGenes(chrName, self.diffCol, self.startMb, self.endMb, "rat")
if self.geneCol and self.intervalAnalystChecked:
#######################################################################
@@ -495,26 +418,13 @@ class MarkerRegression(object):
#through set GENEID is None #
#######################################################################
- #GENEID = fd.formdata.getvalue('GeneId') or None
GENEID = None
- geneTableContainer = HT.Div(Id="sortable") #Div to hold table
self.geneTable(self.geneCol, GENEID)
- #geneTable = self.geneTable(self.geneCol, GENEID)
- #geneTableContainer.append(geneTable)
-
- #mainfmName = webqtlUtil.genRandStr("fm_")
- #tableForm = HT.Form(cgi=os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name=mainfmName, submit=HT.Input(type='hidden'))
- #tableForm.append(HT.Input(name='FormID', value='', type='hidden'))
- #tableForm.append(geneTableContainer)
-
################################################################
# Plots goes here
################################################################
- #if self.plotScale != 'physic' or self.multipleInterval:
- # showLocusForm = webqtlUtil.genRandStr("fm_")
- #else:
showLocusForm = ""
intCanvas = pid.PILCanvas(size=(self.graphWidth, self.graphHeight))
gifmap = self.plotIntMapping(intCanvas, startMb = self.startMb, endMb = self.endMb, showLocusForm= showLocusForm)
@@ -530,23 +440,6 @@ class MarkerRegression(object):
intCanvasX2 = pid.PILCanvas(size=(self.graphWidth*2,self.graphHeight*2))
gifmapX2 = self.plotIntMapping(intCanvasX2, startMb = self.startMb, endMb = self.endMb, showLocusForm= showLocusForm, zoom=2)
intCanvasX2.save(os.path.join(webqtlConfig.GENERATED_IMAGE_DIR, self.filename+"X2"), format='png')
- #DLintImgX2=HT.Href(text='Download',url = '/image/'+self.filename+'X2.png', Class='smallsize', target='_blank')
-
- #textUrl = self.writeQTL2Text(fd, self.filename)
-
- ################################################################
- # Info tables goes here
- ################################################################
- #traitInfoTD = self.traitInfoTD(fd)
-
- #if self.draw2X:
- # traitInfoTD.append(HT.P(), DLintImgX2, ' a higher resolution 2X image. ')
- #else:
- # traitInfoTD.append(HT.P())
- #if textUrl:
- # traitInfoTD.append(HT.BR(), textUrl, ' results in tab-delimited text format.')
- #traitRemapTD = self.traitRemapTD(self.cursor, fd)
- #topTable = HT.TableLite(HT.TR(traitInfoTD, HT.TD("&nbsp;", width=25), traitRemapTD), border=0, cellspacing=0, cellpadding=0)
################################################################
# Outputs goes here
@@ -564,158 +457,15 @@ class MarkerRegression(object):
if (self.permChecked and self.nperm > 0) and not (self.multipleInterval and 0 < self.nperm):
self.perm_filename = self.drawPermutationHistogram()
- #perm_text_file = self.permutationTextFile()
################################################################
# footnote goes here
################################################################
btminfo = HT.Paragraph(Id="smallsize") #Small('More information about this graph is available here.')
- #if (self.additiveChecked):
- # btminfo.append(HT.BR(), 'A positive additive coefficient (', HT.Font('green', color='green'), ' line) indicates that %s alleles increase trait values. In contrast, a negative additive coefficient (' % fd.ppolar, HT.Font('red', color='red'), ' line) indicates that %s alleles increase trait values.' % fd.mpolar)
-
if self.traitList and self.traitList[0].dataset and self.traitList[0].dataset.type == 'Geno':
btminfo.append(HT.BR(), 'Mapping using genotype data as a trait will result in infinity LRS at one locus. In order to display the result properly, all LRSs higher than 100 are capped at 100.')
- #if self.permChecked and not self.multipleInterval and 0 < self.nperm:
- # TD_LR = HT.TD(HT.Blockquote(gifmap, showLocusForm, HT.P(), btminfo, HT.P(), perm_histogram, HT.P(), perm_text_file), bgColor='#eeeeee', height = 200)
- # #TD_LR = HT.TD(HT.Blockquote(topTable), HT.Blockquote(gifmap, showLocusForm, HT.P(), btminfo, HT.P(), perm_histogram, HT.P(), perm_text_file), bgColor='#eeeeee', height = 200)
- #else:
- TD_LR = HT.TD(HT.Blockquote(gifmap, showLocusForm, HT.P(), btminfo), bgColor='#eeeeee', height = 200)
- #TD_LR = HT.TD(HT.Blockquote(topTable), HT.Blockquote(gifmap, showLocusForm, HT.P(), btminfo, HT.P(), perm_histogram, HT.P(), perm_text_file), bgColor='#eeeeee', height = 200)
-
-
- if geneTable:
- iaForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, "main.py?FormID=intervalAnalyst"), enctype='multipart/form-data',
- name="iaForm", submit=HT.Input(type='hidden'))
- hddn = {'chromosome':self.genotype[0].name, 'species':self.species,'startMb':self.startMb,'endMb':self.endMb}
- if self.diffCol:
- hddn['s1'] = self.diffCol[0]
- hddn['s2'] = self.diffCol[1]
- for key in hddn.keys():
- iaForm.append(HT.Input(name=key, value=hddn[key], type='hidden'))
- iaForm.append(HT.Paragraph("Interval Analyst : Chr %s from %2.6f to %2.6f Mb" % (self.genotype[0].name, self.startMb, self.endMb),
- HT.Input(name='customize', value='Customize', onClick= "formInNewWindow(this.form);", type='button', Class="button"), Class="subtitle"))
- TD_LR.append(HT.Blockquote(iaForm))
- # optionsTable
- selectall = HT.Href(url="#redirect", onClick="checkAll(document.getElementsByName('%s')[0]);" % mainfmName)
- selectall_img = HT.Image("/images/select_all2_final.jpg", name="selectall", alt="Select All", title="Select All", style="border:none;")
- selectall.append(selectall_img)
- reset = HT.Href(url="#redirect", onClick="checkNone(document.getElementsByName('%s')[0]); return false;" % mainfmName)
- reset_img = HT.Image("/images/select_none2_final.jpg", alt="Select None", title="Select None", style="border:none;")
- reset.append(reset_img)
- selectinvert = HT.Href(url="#redirect", onClick = "checkInvert(document.getElementsByName('%s')[0]);" % mainfmName)
- selectinvert_img = HT.Image("/images/invert_selection2_final.jpg", name="selectinvert", alt="Invert Selection", title="Invert Selection", style="border:none;")
- selectinvert.append(selectinvert_img)
- addselect = HT.Href(url="#redirect", onClick="addRmvSelection('%s', document.getElementsByName('%s')[0], 'addToSelection');" % (RISet, mainfmName))
- addselect_img = HT.Image("/images/add_collection1_final.jpg", name="addselect", alt="Add To Collection", title="Add To Collection", style="border:none;")
- addselect.append(addselect_img)
- geneweaver = HT.Href(url="#redirect", onClick="databaseFunc(document.getElementsByName('%s')[0], 'ODEIM');" % mainfmName)
- geneweaver_img = HT.Image("/images/ODE_logo_final.jpg", name="GeneWeaver", alt="Gene Weaver", title="Gene Weaver", style="border:none")
- geneweaver.append(geneweaver_img)
- optionsTable = HT.TableLite()
- optionsTable.append(HT.TR(
- HT.TD(selectall, width="77", style="text-align:center"),
- HT.TD(reset, width="77", style="text-align:center"),
- HT.TD(selectinvert, width="77", style="text-align:center"),
- HT.TD(geneweaver, width="77", style="text-align:center"),
- ))
- optionsTable.append(HT.TR(
- HT.TD("Select", style="text-align:center"),
- HT.TD("Deselect", style="text-align:center"),
- HT.TD("Invert", style="text-align:center"),
- HT.TD("Gene Weaver", style="text-align:center"),
- ))
- TD_LR.append(HT.Blockquote(optionsTable))
- # geneTableContainer
- TD_LR.append(HT.Blockquote(tableForm))
-
- self.body = TD_LR
-
- #self.dict['body'] = TD_LR
- #self.dict['title'] = "Mapping"
-
-
- def writeQTL2Text(self, filename):
- if self.multipleInterval:
- return ""
- #_dominance = (self.genotype.type == 'intercross')
- _Mb = self.genotype.Mbmap
-
- ###Write to text file
- fpText = open(os.path.join(webqtlConfig.TMPDIR, filename) + '.txt','wb')
-
- fpText.write("Source: WebQTL, The GeneNetwork (%s)\n" % webqtlConfig.PORTADDR)
- #
- fpText.write("Site: GN\n")
- fpText.write("Page: Map Viewer\n")
- fpText.write(time.strftime("Date and Time (US Center): %b %d, %Y at %I.%M %p\n", time.localtime()))
- fpText.write("Trait ID: %s\n" % self.this_trait.name)
- fpText.write("Suggestive LRS = %0.2f\n" % self.suggestive)
- fpText.write("Significant LRS = %0.2f\n" % self.significant)
- """
- if self.this_trait.symbol and self.this_trait.chr and self.this_trait.mb:
- writeSymbol, writeChromosome, writeMb = self.this_trait.symbol, self.this_trait.chr, self.this_trait.mb
- else:
- writeSymbol, writeChromosome, writeMb = (" ", " ", " ")
- fpText.write("Gene Symbol: %s\n" % writeSymbol)
- fpText.write("Location: Chr %s @ %s Mb\n" % (writeChromosome, writeMb))
- #selectedChr = self.indexToChrName(int(fd.formdata.getvalue('chromosomes', -1)))
- #fpText.write("Chromosome: %s\n" % selectedChr)
- fpText.write("Region: %0.6f-%0.6f Mb\n\n" % (self.startMb, self.endMb))
- """
-
- if hasattr(self, 'LRSArray'):
- if _dominance:
- fpText.write('Chr\tLocus\tcM\tMb\tLRS\tP-value\tAdditive\tDominance\n')
- else:
- fpText.write('Chr\tLocus\tcM\tMb\tLRS\tP-value\tAdditive\n')
- else:
- if _dominance:
- fpText.write('Chr\tLocus\tcM\tMb\tLRS\tAdditive\tDominance\n')
- else:
- fpText.write('Chr\tLocus\tcM\tMb\tLRS\tAdditive\n')
-
- i = 0
- for marker in self.qtlresults:
- if _Mb:
- locusMb = '%2.3f' % marker['Mb']
- else:
- locusMb = 'N/A'
-
- if hasattr(self, 'LRSArray'):
- if start_vars['score_type'] == "LRS":
- lrs_lod = marker['lrs_value']
- else:
- lrs_lod = marker['lod_score']
-
- P_value = self.calculatePValue(lrs_lod, self.perm_output)
-
- #if _dominance:
- # fpText.write("%s\t%s\t%2.3f\t%s\t%2.3f\t%2.3f\t%2.3f\t%2.3f\n" %(qtlresult.locus.chr, \
- # qtlresult.locus.name, qtlresult.locus.cM, locusMb , qtlresult.lrs, P_value, qtlresult.additive, qtlresult.dominance))
- #else:
- if P_value:
- fpText.write("%s\t%s\t%2.3f\t%s\t%2.3f\t%2.3f\n" %(marker['chr'], \
- marker['name'], marker['cM'], locusMb, lrs_lod, P_value))
- else:
- fpText.write("%s\t%s\t%2.3f\t%s\t%2.3f\t%s\n" %(marker['chr'], \
- marker['name'], marker['cM'], locusMb , lrs_lod, '-'))
- else:
- #if _dominance:
- # fpText.write("%s\t%s\t%2.3f\t%s\t%2.3f\t%2.3f\t%2.3f\n" %(qtlresult.locus.chr, \
- # qtlresult.locus.name, qtlresult.locus.cM, locusMb , qtlresult.lrs, qtlresult.additive, qtlresult.dominance))
- #else:
- fpText.write("%s\t%s\t%2.3f\t%s\t%2.3f\n" %(marker['chr'], \
- marker['name'], marker['cM'], locusMb , lrs_lod))
-
- i += 1
-
- fpText.close()
- textUrl = '/tmp/'+filename+'.txt'
- #textUrl = HT.Href(text = 'Download', url= '/tmp/'+filename+'.txt', target = "_blank", Class='smallsize')
- return textUrl
-
def plotIntMapping(self, canvas, offset= (80, 120, 20, 100), zoom = 1, startMb = None, endMb = None, showLocusForm = ""):
#calculating margins
xLeftOffset, xRightOffset, yTopOffset, yBottomOffset = offset
@@ -742,8 +492,6 @@ class MarkerRegression(object):
cHeight = canvas.size[1]
plotWidth = cWidth - xLeftOffset - xRightOffset
plotHeight = cHeight - yTopOffset - yBottomOffset
- startPixelX = xLeftOffset
- endPixelX = (xLeftOffset + plotWidth)
#Drawing Area Height
drawAreaHeight = plotHeight
@@ -767,7 +515,6 @@ class MarkerRegression(object):
#Image map
gifmap = HT.Map(name = "WebQTLImageMap")
- #gifmap = None
newoffset = (xLeftOffset, xRightOffset, yTopOffset, yBottomOffset)
# Draw the alternating-color background first and get plotXScale
@@ -946,15 +693,6 @@ class MarkerRegression(object):
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:
@@ -1012,7 +750,6 @@ class MarkerRegression(object):
canvas.drawPolygon(((leftOffset+6, startPosY-6), (leftOffset, startPosY+6), (leftOffset+12, startPosY+6)), edgeColor=pid.black, fillColor=self.TRANSCRIPT_LOCATION_COLOR, closed=1)
canvas.drawString("Sequence Site", (leftOffset+15), (startPosY+5), smallLabelFont, self.TOP_RIGHT_INFO_COLOR)
-
def drawSNPTrackNew(self, canvas, offset= (40, 120, 80, 10), zoom = 1, startMb = None, endMb = None):
if self.plotScale != 'physic' or self.selectedChr == -1 or not self.diffCol:
return
@@ -1052,7 +789,7 @@ class MarkerRegression(object):
snpDensity = float(SNPCounts[i-xLeftOffset]*SNP_HEIGHT_MODIFIER/maxCount)
canvas.drawLine(i, drawSNPLocationY+(snpDensity)*zoom, i, drawSNPLocationY-(snpDensity)*zoom, color=self.SNP_COLOR, width=1)
- def drawMultiTraitName(self, fd, canvas, gifmap, showLocusForm, offset= (40, 120, 80, 10), zoom = 1, locLocation= None):
+ def drawMultiTraitName(self, fd, canvas, gifmap, showLocusForm, offset= (40, 120, 80, 10), zoom = 1):
nameWidths = []
yPaddingTop = 10
colorFont=pid.Font(ttf="trebuc",size=12,bold=1)
@@ -1080,14 +817,12 @@ class MarkerRegression(object):
canvas.drawRect(rightShift,yPaddingTop+kstep*15, rectWidth+rightShift,yPaddingTop+10+kstep*15, fillColor=thisLRSColor)
canvas.drawString(name,rectWidth+2+rightShift,yPaddingTop+10+kstep*15,font=colorFont,color=pid.black)
if thisTrait.db:
-
COORDS = "%d,%d,%d,%d" %(rectWidth+2+rightShift,yPaddingTop+kstep*15,rectWidth+2+rightShift+nameWidth,yPaddingTop+10+kstep*15,)
HREF= "javascript:showDatabase3('%s','%s','%s','');" % (showLocusForm, thisTrait.db.name, thisTrait.name)
Areas = HT.Area(shape='rect',coords=COORDS,href=HREF)
gifmap.areas.append(Areas)
-
- def drawLegendPanel(self, canvas, offset= (40, 120, 80, 10), zoom = 1, locLocation= None):
+ def drawLegendPanel(self, canvas, offset= (40, 120, 80, 10), zoom = 1):
xLeftOffset, xRightOffset, yTopOffset, yBottomOffset = offset
plotWidth = canvas.size[0] - xLeftOffset - xRightOffset
plotHeight = canvas.size[1] - yTopOffset - yBottomOffset
@@ -1131,9 +866,6 @@ class MarkerRegression(object):
startPosX = xLeftOffset
canvas.drawLine(startPosX, startPosY, startPosX + 32, startPosY, color=self.SIGNIFICANT_COLOR, width=self.SIGNIFICANT_WIDTH)
canvas.drawLine(startPosX, startPosY + stepPosY, startPosX + 32, startPosY + stepPosY, color=self.SUGGESTIVE_COLOR, width=self.SUGGESTIVE_WIDTH)
- lod = 1
- if self.LRS_LOD == 'LOD':
- lod = self.LODFACTOR
canvas.drawString('Significant %s = %2.2f' % (self.LRS_LOD, self.significant),xLeftOffset+42,startPosY +5,font=labelFont,color=pid.black)
canvas.drawString('Suggestive %s = %2.2f' % (self.LRS_LOD, self.suggestive),xLeftOffset+42,startPosY + 5 +stepPosY,font=labelFont,color=pid.black)
@@ -1156,7 +888,6 @@ class MarkerRegression(object):
string3 = cofactor_names
else:
string2 += 'no cofactors'
- string3 = ''
elif self.mapping_method == "rqtl_plink" or self.mapping_method == "rqtl_geno":
string2 = 'Using R/qtl mapping method with '
if self.controlLocus and self.doControl != "false":
@@ -1198,9 +929,6 @@ class MarkerRegression(object):
yPaddingTop = yTopOffset
- displayStartInBases = startMb*self.kONE_MILLION
- displayEndInBases = endMb*self.kONE_MILLION
-
for gIndex, theGO in enumerate(self.geneCol):
geneNCBILink = 'http://www.ncbi.nlm.nih.gov/gene?term=%s'
if self.dataset.group.species == "mouse":
@@ -1215,7 +943,6 @@ class MarkerRegression(object):
cdsStart = theGO['cdsStart']
cdsEnd = theGO['cdsEnd']
accession = theGO['NM_ID']
- geneId = theGO['GeneID']
geneSymbol = theGO["GeneSymbol"]
strand = theGO["Strand"]
exonCount = theGO["exonCount"]
@@ -1233,10 +960,7 @@ class MarkerRegression(object):
geneStartPix = xLeftOffset; # clip the first in-range gene
#color the gene based on SNP density
-
-
#found earlier, needs to be recomputed as snps are added
-
#always apply colors now, even if SNP Track not checked - Zach 11/24/2010
densities=[1.0000000000000001e-05, 0.094094033555233408, 0.3306166377816987, 0.88246026851027781, 2.6690084029581951, 4.1, 61.0]
@@ -1269,7 +993,6 @@ class MarkerRegression(object):
txEnd = theGO["TxEnd"]
cdsStart = theGO["TxStart"]
cdsEnd = theGO["TxEnd"]
- geneId = theGO["GeneID"]
geneSymbol = theGO["GeneSymbol"]
strand = theGO["Strand"]
exonCount = 0
@@ -1298,11 +1021,7 @@ class MarkerRegression(object):
#Draw Genes
geneYLocation = yPaddingTop + (gIndex % self.NUM_GENE_ROWS) * self.EACH_GENE_HEIGHT*zoom
-
- if 1:#drawClickableRegions:
- geneYLocation += self.UCSC_BAND_HEIGHT + self.BAND_SPACING + self.ENSEMBL_BAND_HEIGHT + self.BAND_SPACING + self.WEBQTL_BAND_HEIGHT + self.BAND_SPACING
- else:
- geneYLocation += self.BAND_SPACING
+ geneYLocation += self.UCSC_BAND_HEIGHT + self.BAND_SPACING + self.ENSEMBL_BAND_HEIGHT + self.BAND_SPACING + self.WEBQTL_BAND_HEIGHT + self.BAND_SPACING
#draw the detail view
if self.endMb - self.startMb <= self.DRAW_DETAIL_MB and geneEndPix - geneStartPix > self.EACH_GENE_ARROW_SPACING * 3:
@@ -1310,7 +1029,6 @@ class MarkerRegression(object):
arrowColor = pid.Color(0.7, 0.7, 0.7)
#draw the line that runs the entire length of the gene
- #canvas.drawString(str(geneStartPix), 300, 400)
canvas.drawLine(geneStartPix, geneYLocation + self.EACH_GENE_HEIGHT/2*zoom, geneEndPix, geneYLocation + self.EACH_GENE_HEIGHT/2*zoom, color=outlineColor, width=1)
#draw the arrows
@@ -1360,7 +1078,6 @@ class MarkerRegression(object):
utrStartPix = xLeftOffset + plotWidth
#canvas.drawRect(utrStartPix, geneYLocation, utrEndPix, (geneYLocation+self.EACH_GENE_HEIGHT*zoom), edgeColor=utrColor, fillColor =utrColor)
- #if self.DRAW_UTR_LABELS and self.endMb - self.startMb <= self.DRAW_UTR_LABELS_MB:
if self.endMb - self.startMb <= self.DRAW_UTR_LABELS_MB:
if strand == "-":
labelText = "3'"
@@ -1382,7 +1099,6 @@ class MarkerRegression(object):
utrStartPix = xLeftOffset + plotWidth
#canvas.drawRect(utrStartPix, geneYLocation, utrEndPix, (geneYLocation+self.EACH_GENE_HEIGHT*zoom), edgeColor=utrColor, fillColor =utrColor)
- #if self.DRAW_UTR_LABELS and self.endMb - self.startMb <= self.DRAW_UTR_LABELS_MB:
if self.endMb - self.startMb <= self.DRAW_UTR_LABELS_MB:
if strand == "-":
labelText = "5'"
@@ -1403,8 +1119,6 @@ class MarkerRegression(object):
if self.plotScale != 'physic' or self.selectedChr == -1 or not self.geneCol:
return
- fpText = open(os.path.join(webqtlConfig.TMPDIR, "hallo") + '.txt','wb')
-
clickableRegionLabelFont=pid.Font(ttf="verdana", size=9, bold=0)
xLeftOffset, xRightOffset, yTopOffset, yBottomOffset = offset
@@ -1412,13 +1126,9 @@ class MarkerRegression(object):
plotHeight = canvas.size[1] - yTopOffset - yBottomOffset
yZero = canvas.size[1] - yBottomOffset
fontZoom = zoom
- widthMultiplier = 1
yPaddingTop = yTopOffset
- exprdrawn = 0
-
- #thisTrait = self.traitList[0]
thisTrait = self.this_trait
_strains, _vals, _vars, _aliases = thisTrait.export_informative()
@@ -1428,7 +1138,6 @@ class MarkerRegression(object):
temp = GeneralObject(name=_strains[ii], value=_val)
smd.append(temp)
-
smd.sort(lambda A, B: cmp(A.value, B.value))
smd.reverse()
@@ -1453,13 +1162,9 @@ class MarkerRegression(object):
drawit = 0;
if drawit == 1:
-
if self.genotype[0][i].name != " - " :
-
plotRight = geneEndPix + 4
-
-
#### end find out PlotRight
firstGene = 1
@@ -1514,11 +1219,7 @@ class MarkerRegression(object):
#Draw Genes
geneYLocation = yPaddingTop + self.NUM_GENE_ROWS * (self.EACH_GENE_HEIGHT)*zoom
-
- if 1:#drawClickableRegions:
- geneYLocation += self.UCSC_BAND_HEIGHT + self.BAND_SPACING + self.ENSEMBL_BAND_HEIGHT + self.BAND_SPACING + self.WEBQTL_BAND_HEIGHT + self.BAND_SPACING
- else:
- geneYLocation += self.BAND_SPACING
+ geneYLocation += self.UCSC_BAND_HEIGHT + self.BAND_SPACING + self.ENSEMBL_BAND_HEIGHT + self.BAND_SPACING + self.WEBQTL_BAND_HEIGHT + self.BAND_SPACING
if self.genotype[0][i].name != " - " :
@@ -1605,8 +1306,6 @@ class MarkerRegression(object):
canvas.drawString("%s" % (samplelist[j]), (xLeftOffset + plotWidth + 10) , geneYLocation+8+2*ind*self.EACH_GENE_HEIGHT*zoom, font=pid.Font(ttf="verdana", size=12, bold=0), color=pid.black)
canvas.drawString("%2.2f" % (expr), (xLeftOffset + plotWidth + 60) , geneYLocation+8+2*ind*self.EACH_GENE_HEIGHT*zoom, font=pid.Font(ttf="verdana", size=12, bold=0), color=pid.black)
- fpText.close()
-
## END HaplotypeAnalyst
def drawClickBand(self, canvas, gifmap, plotXScale, offset= (40, 120, 80, 10), zoom = 1, startMb = None, endMb = None):
@@ -1650,7 +1349,6 @@ class MarkerRegression(object):
xBrowse2 = min(xLeftOffset + plotWidth, (pixel + pixelStep - 1))
WEBQTL_COORDS = "%d, %d, %d, %d" % (xBrowse1, paddingTop, xBrowse2, (paddingTop+self.WEBQTL_BAND_HEIGHT))
- bandWidth = xBrowse2 - xBrowse1
WEBQTL_HREF = "javascript:rangeView('%s', %f, %f)" % (self.selectedChr - 1, max(0, (calBase-webqtlZoomWidth))/1000000.0, (calBase+webqtlZoomWidth)/1000000.0)
WEBQTL_TITLE = "Click to view this section of the genome in WebQTL"
@@ -1688,7 +1386,6 @@ class MarkerRegression(object):
traitFont = pid.Font(ttf="verdana", size=14, bold=0)
chrX = xLeftOffset + plotWidth - 2 - canvas.stringWidth("Chr %s" % self.ChrList[self.selectedChr][0], font=chrFont)
canvas.drawString("Chr %s" % self.ChrList[self.selectedChr][0], chrX, ensemblPaddingTop-5, font=chrFont, color=pid.gray)
- traitX = chrX - 28 - canvas.stringWidth("database", font=traitFont)
# end of drawBrowserClickableRegions
else:
#draw the gray text
@@ -1696,7 +1393,6 @@ class MarkerRegression(object):
traitFont = pid.Font(ttf="verdana", size=14, bold=0)
chrX = xLeftOffset + (plotWidth - canvas.stringWidth("Chr %s" % currentChromosome, font=chrFont))/2
canvas.drawString("Chr %s" % currentChromosome, chrX, 32, font=chrFont, color=pid.gray)
- traitX = chrX - 28 - canvas.stringWidth("database", font=traitFont)
# end of drawBrowserClickableRegions
pass
@@ -1723,13 +1419,11 @@ class MarkerRegression(object):
xAxisLabelColor = pid.black
fontHeight = 12*fontZoom # How tall the font that we're using is
spacingFromLabelToAxis = 5
- spacingFromLineToLabel = 3
if self.plotScale == 'physic':
strYLoc = yZero + spacingFromLabelToAxis + canvas.fontHeight(MBLabelFont)
###Physical single chromosome view
if self.selectedChr > -1:
- graphMbWidth = endMb - startMb
XScale = Plot.detScale(startMb, endMb)
XStart, XEnd, XStep = XScale
if XStep < 8:
@@ -1755,7 +1449,6 @@ class MarkerRegression(object):
canvas.drawString(labelStr, drawStringXc, strYLoc, font=MBLabelFont, color=xAxisLabelColor, angle=0)
else:
canvas.drawLine(Xc, yZero, Xc, yZero+xMinorTickHeight, color=xAxisTickMarkColor, width=X_MINOR_TICK_THICKNESS) # Draw the MINOR tick mark
- # end else
###Physical genome wide view
else:
@@ -1785,7 +1478,6 @@ class MarkerRegression(object):
preLpos = -1
distinctCount = 0.0
- #if len(self.genotype) > 1:
if self.selectedChr == -1: #ZS: If viewing full genome/all chromosomes
for i, _chr in enumerate(self.genotype):
thisChr = []
@@ -1894,12 +1586,6 @@ class MarkerRegression(object):
#LRSTop is then defined to be above the LRS_LOD_Max by enough to add one additional LRSScale increment.
#if we are using a set-scale, then we set LRSTop to be the user's value, and LRS_LOD_Max doesn't matter.
- #ZS: I'm not sure what this if statement is supposed to do. It appears to work correctly for both LOD and LRS if I just set lodm to 1.0
- # if self.LRS_LOD == 'LRS':
- # lodm = self.LODFACTOR
- # else:
- # lodm = 1.0
-
#ZS: This is a mess, but I don't know a better way to account for different mapping methods returning results in different formats + the option to change between LRS and LOD
if self.lrsMax <= 0: #sliding scale
if "lrs_value" in self.qtlresults[0]:
@@ -2016,10 +1702,6 @@ class MarkerRegression(object):
else:
if self.additiveChecked:
additiveMax = max(map(lambda X : abs(X['additive']), self.qtlresults))
- #if INTERCROSS:
- # dominanceMax = max(map(lambda X : abs(X.dominance), self.qtlresults[0]))
- #else:
- # dominanceMax = -1
lrsEdgeWidth = 2
if zoom == 2:
@@ -2038,7 +1720,6 @@ class MarkerRegression(object):
startPosX = xLeftOffset
for i, qtlresult in enumerate(self.qtlresults):
m = 0
- #startPosX = xLeftOffset
thisLRSColor = self.colorCollection[0]
if qtlresult['chr'] != previous_chr and self.selectedChr == -1:
@@ -2085,25 +1766,13 @@ class MarkerRegression(object):
startPosX += newStartPosX
oldStartPosX = newStartPosX
- #startPosX += (self.ChrLengthDistList[j]+self.GraphInterval)*plotXScale
-
- #for j, _chr in enumerate(self.genotype):
#ZS: This is beause the chromosome value stored in qtlresult['chr'] can be (for example) either X or 20 depending upon the mapping method/scale used
if self.plotScale == "physic":
this_chr = str(self.ChrList[self.selectedChr][0])
else:
this_chr = str(self.ChrList[self.selectedChr][1]+1)
if self.selectedChr == -1 or str(qtlresult['chr']) == this_chr:
- #AdditiveCoordXY = []
- #DominanceCoordXY = []
- #for k, _locus in enumerate(_chr):
Xc = startPosX + (qtlresult['Mb']-startMb)*plotXScale
- #if self.plotScale == 'physic':
- #Xc = startPosX + (_locus.Mb-startMb)*plotXScale
- #Xc = startPosX + (qtlresult['Mb']-startMb)*plotXScale
- #else:
- #Xc = startPosX + (_locus.cM-_chr[0].cM)*plotXScale
- #Xc = startPosX + (qtlresult['cM']-qtlresult[0]['cM'])*plotXScale
# updated by NL 06-18-2011:
# fix the over limit LRS graph issue since genotype trait may give infinite LRS;
@@ -2127,11 +1796,6 @@ class MarkerRegression(object):
Yc = yZero - qtlresult['lod_score']*self.LODFACTOR*LRSHeightThresh/LRS_LOD_Max
else:
Yc = yZero - qtlresult['lod_score']*LRSHeightThresh/LRS_LOD_Max
- #if qtlresult['lrs_value'] > 460 or qtlresult['lrs_value']=='inf':
- #if self.qtlresults[j]['lrs_value'] > 460 or self.qtlresults[j]['lrs_value']=='inf':
- # Yc = yZero - webqtlConfig.MAXLRS*LRSHeightThresh/LRS_LOD_Max
- #else:
- # Yc = yZero - qtlresult['lrs_value']*LRSHeightThresh/LRS_LOD_Max
if self.manhattan_plot == True:
point_color = pid.black
@@ -2144,11 +1808,8 @@ class MarkerRegression(object):
additiveMax = 0.000001
Yc = yZero - qtlresult['additive']*AdditiveHeightThresh/additiveMax
AdditiveCoordXY.append((Xc, Yc))
- # if not self.multipleInterval and INTERCROSS and self.additiveChecked:
- # Yc = yZero - qtlresult['dominance']*DominanceHeightThresh/dominanceMax
- # DominanceCoordXY.append((Xc, Yc))
+
m += 1
- #canvas.drawPolygon(LRSCoordXY,edgeColor=thisLRSColor,closed=0, edgeWidth=lrsEdgeWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
if self.manhattan_plot != True:
canvas.drawPolygon(LRSCoordXY,edgeColor=thisLRSColor,closed=0, edgeWidth=lrsEdgeWidth, clipX=(xLeftOffset, xLeftOffset + plotWidth))
@@ -2220,7 +1881,6 @@ class MarkerRegression(object):
additiveScale = Plot.detScaleOld(0,additiveMax)
additiveStep = (additiveScale[1]-additiveScale[0])/additiveScale[2]
additiveAxisList = Plot.frange(0, additiveScale[1], additiveStep)
- maxAdd = additiveScale[1]
addPlotScale = AdditiveHeightThresh/additiveMax
additiveAxisList.append(additiveScale[1])
@@ -2312,298 +1972,6 @@ class MarkerRegression(object):
return plotXScale
- def calculateAllResult(self, fd):
-
- weightedRegression = fd.formdata.getvalue('applyVarianceSE')
-
- self.genotype = self.genotype.addinterval()
- resultSlice = []
- controlGeno = []
-
- if self.multipleInterval:
- self.suggestive = 0
- self.significant = 0
- if self.selectedChr > -1:
- self.genotype.chromosome = [self.genotype[self.selectedChr]]
- else:
- #single interval mapping
- try:
- self.suggestive = float(fd.formdata.getvalue('permSuggestive'))
- self.significant = float(fd.formdata.getvalue('permSignificance'))
- except:
- self.suggestive = None
- self.significant = None
-
- _strains, _vals, _vars = self.traitList[0].exportInformative(weightedRegression)
-
- if webqtlUtil.ListNotNull(_vars):
- pass
- else:
- weightedRegression = 0
- _strains, _vals, _vars = self.traitList[0].exportInformative()
-
- ##locate genotype of control Locus
- if self.controlLocus:
- controlGeno2 = []
- _FIND = 0
- for _chr in self.genotype:
- for _locus in _chr:
- if _locus.name == self.controlLocus:
- controlGeno2 = _locus.genotype
- _FIND = 1
- break
- if _FIND:
- break
- if controlGeno2:
- _prgy = list(self.genotype.prgy)
- for _strain in _strains:
- _idx = _prgy.index(_strain)
- controlGeno.append(controlGeno2[_idx])
- else:
- return "The control marker you selected is not in the genofile."
-
- if weightedRegression:
- self.perm_output = self.genotype.permutation(strains = _strains, trait = _vals,
- variance = _vars, nperm=self.nperm)
- else:
- self.perm_output = self.genotype.permutation(strains = _strains, trait = _vals,
- nperm=self.nperm)
-
- if self.significant and self.suggestive:
- pass
- else:
- if self.nperm < 100:
- self.suggestive = 0
- self.significant = 0
- else:
- self.suggestive = self.perm_output[int(self.nperm*0.37-1)]
- self.significant = self.perm_output[int(self.nperm*0.95-1)]
-
- #calculating bootstrap
- #from now on, genotype could only contain a single chromosome
- #permutation need to be performed genome wide, this is not the case for bootstrap
-
- #due to the design of qtlreaper, composite regression need to be performed genome wide
- if not self.controlLocus and self.selectedChr > -1:
- self.genotype.chromosome = [self.genotype[self.selectedChr]]
- elif self.selectedChr > -1: #self.controlLocus and self.selectedChr > -1
- lociPerChr = map(len, self.genotype)
- resultSlice = reduce(lambda X, Y: X+Y, lociPerChr[:self.selectedChr], 0)
- resultSlice = [resultSlice,resultSlice+lociPerChr[self.selectedChr]]
- else:
- pass
-
- #calculate QTL for each trait
- self.qtlresults = []
-
- for thisTrait in self.traitList:
- _strains, _vals, _vars = thisTrait.exportInformative(weightedRegression)
- if self.controlLocus:
- if weightedRegression:
- qtlresult = self.genotype.regression(strains = _strains, trait = _vals,
- variance = _vars, control = self.controlLocus)
- else:
- qtlresult = self.genotype.regression(strains = _strains, trait = _vals,
- control = self.controlLocus)
- if resultSlice:
- qtlresult = qtlresult[resultSlice[0]:resultSlice[1]]
- else:
- if weightedRegression:
- qtlresult = self.genotype.regression(strains = _strains, trait = _vals,
- variance = _vars)
- else:
- qtlresult = self.genotype.regression(strains = _strains, trait = _vals)
-
- self.qtlresults.append(qtlresult)
-
- if not self.multipleInterval:
- if self.controlLocus and self.selectedChr > -1:
- self.genotype.chromosome = [self.genotype[self.selectedChr]]
-
- if self.bootChecked:
- if controlGeno:
- self.bootResult = self.genotype.bootstrap(strains = _strains, trait = _vals,
- control = controlGeno, nboot=fd.nboot)
- elif weightedRegression:
- self.bootResult = self.genotype.bootstrap(strains = _strains, trait = _vals,
- variance = _vars, nboot=fd.nboot)
- else:
- self.bootResult = self.genotype.bootstrap(strains = _strains, trait = _vals,
- nboot=fd.nboot)
- else:
- self.bootResult = []
-
- def calculatePValue (self, query_LRS, permutation_LRS_array):
- query_index = len(permutation_LRS_array)
- for i, one_permutation_LRS in enumerate(permutation_LRS_array):
- if one_permutation_LRS >= query_LRS:
- query_index = i
- break
- try:
- P_value = float(len(permutation_LRS_array) - query_index) / len(permutation_LRS_array)
- except:
- P_value = ''
- return P_value
-
- def helpButton(self, anchor):
- return HT.Href(self.HELP_PAGE_REF + '#%s' % anchor, self.qmarkImg, target=self.HELP_WINDOW_NAME)
-
-
- def traitRemapTD(self, cursor, fd):
- chrList = HT.Select(name="chromosomes", data=self.ChrList, selected=[self.selectedChr],
- onChange="chrLength(this.form.chromosomes.value, this.form.scale.value, this.form, self.ChrLengthMbList);")
-
- physicOnly = HT.Span(' *', Class="cr")
-
- showSNPCheck = HT.Input(type='checkbox', Class='checkbox', name='showSNP', value='ON', checked=self.SNPChecked)
- showSNPText = HT.Span('SNP Track ', self.helpButton("snpSeismograph"), Class="fs12 fwn")
-
- showGenesCheck = HT.Input(type='checkbox', Class='checkbox', name='showGenes', value='ON', checked=self.geneChecked)
- showGenesText = HT.Span('Gene Track', Class="fs12 fwn")
-
- showIntervalAnalystCheck = HT.Input(type='checkbox', Class='checkbox', name='intervalAnalystCheck', value='ON', checked=self.intervalAnalystChecked)
- showIntervalAnalystText = HT.Span('Interval Analyst', Class="fs12 fwn")
-## BEGIN HaplotypeAnalyst
-
- showHaplotypeAnalystCheck = HT.Input(type='checkbox', Class='checkbox', name='haplotypeAnalystCheck', value='ON', checked=self.haplotypeAnalystChecked)
- showHaplotypeAnalystText = HT.Span('Haplotype Analyst', Class="fs12 fwn")
-## END HaplotypeAnalyst
-
- leftBox = HT.Input(type="text", name="startMb", size=10)
- rightBox = HT.Input(type="text", name="endMb", size=10)
- if self.selectedChr > -1 and self.plotScale=='physic':
- leftBox.value = self.startMb
- rightBox.value = self.endMb
-
- scaleBox = HT.Select(name="scale", onChange="chrLength(this.form.chromosomes.value, this.form.scale.value, this.form, self.ChrLengthMbList);")
- scaleBox.append(("Genetic", "morgan"))
- if fd.genotype.Mbmap:
- scaleBox.append(("Physical", "physic"))
- scaleBox.selected.append(self.plotScale)
-
- permBox = HT.Input(type="checkbox", name="permCheck", value='ON', checked=self.permChecked, Class="checkbox")
- permText = HT.Span("Permutation Test ", self.helpButton("Permutation"), Class="fs12 fwn")
- bootBox = HT.Input(type="checkbox", name="bootCheck", value='ON', checked=self.bootChecked, Class="checkbox")
- bootText = HT.Span("Bootstrap Test ", self.helpButton("bootstrap"), Class="fs12 fwn")
- additiveBox = HT.Input(type="checkbox", name="additiveCheck", value='ON', checked=self.additiveChecked, Class="checkbox")
- additiveText = HT.Span("Allele Effects ", self.helpButton("additive"), Class="fs12 fwn")
- dominanceBox = HT.Input(type="checkbox", name="dominanceCheck", value='ON', checked=self.dominanceChecked, Class="checkbox")
- dominanceText = HT.Span("Dominance Effects ", self.helpButton("Dominance"), Class="fs12 fwn")
-
- lrsRadio = HT.Input(type="radio", name="LRSCheck", value='LRS', checked = (self.LRS_LOD == "LRS"))
- lodRadio = HT.Input(type="radio", name="LRSCheck", value='LOD', checked = (self.LRS_LOD != "LRS"))
- lrsMaxBox = HT.Input(type="text", name="lrsMax", value=self.lrsMax, size=3)
- widthBox = HT.Input(type="text", name="graphWidth", size=5, value=str(self.graphWidth))
- legendBox = HT.Input(type="checkbox", name="viewLegend", value='ON', checked=self.legendChecked, Class="checkbox")
- legendText = HT.Span("Legend", Class="fs12 fwn")
-
- draw2XBox = HT.Input(type="checkbox", name="draw2X", value='ON', Class="checkbox")
- draw2XText = HT.Span("2X Plot", Class="fs12 fwn")
-
- regraphButton = HT.Input(type="button", Class="button", onClick="javascript:databaseFunc(this.form,'showIntMap');", value="Remap")
- controlsForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype="multipart/form-data", name="changeViewForm", submit=HT.Input(type='hidden'))
- controlsTable = HT.TableLite(border=0)
- innerControlsTable = HT.TableLite(border=0)
- if self.selectedChr == -1:
- minimumGraphWidth = self.MULT_GRAPH_MIN_WIDTH
- else:
- minimumGraphWidth = self.GRAPH_MIN_WIDTH
- innerControlsTable.append(
- HT.TR(HT.TD("Chr: ", Class="fs12 fwb ffl"),HT.TD(chrList, scaleBox, regraphButton)),
- HT.TR(HT.TD("View: ", Class="fs12 fwb ffl"),HT.TD(leftBox, " to ", rightBox, "Mb", physicOnly, NOWRAP="on")),
- HT.TR(HT.TD("Units: ", Class="fs12 fwb ffl"), HT.TD(lrsRadio, "LRS ", lodRadio, "LOD ", self.helpButton("LOD"))),
- HT.TR(HT.TD(" ", Class="fs12 fwb ffl"), HT.TD(lrsMaxBox, "units on Y-axis (0 for default)", Class="fs11 fwn")),
- HT.TR(HT.TD("Width: ", Class="fs12 fwb ffl"), HT.TD(widthBox, "pixels (minimum=%d)" % minimumGraphWidth, Class="fs11 fwn "))
- )
- #whether SNP
- # comment this, because this will make caculation very slow.
- #cursor.execute("Select Species.Id from SnpAll, Species where SnpAll.SpeciesId = Species.Id and Species.Name = %s limit 1", self.species)
- #SNPorNot = cursor.fetchall()
- SNPorNot = True
- #Whether Gene
- cursor.execute("Select Species.Id from GeneList, Species where GeneList.SpeciesId = Species.Id and Species.Name = %s limit 1", self.species)
- GeneorNot = cursor.fetchall()
-
- if self.multipleInterval:
- optionPanel = HT.TD(valign="top", NOWRAP="on")
- else:
- optionPanel = HT.TD(permBox, permText, HT.BR(), bootBox, bootText, HT.BR(), additiveBox, additiveText, HT.BR(), valign="top", NOWRAP="on")
- #whether dominance
- if self.genotype.type == 'intercross':
- optionPanel.append(dominanceBox, dominanceText, HT.BR())
- if SNPorNot:
- optionPanel.append(showSNPCheck, showSNPText, physicOnly, HT.BR())
- if GeneorNot:
- optionPanel.append(showGenesCheck, showGenesText, physicOnly, HT.BR(),
- showIntervalAnalystCheck, showIntervalAnalystText, physicOnly, HT.BR())
-## BEGIN HaplotypeAnalyst
- optionPanel.append(showHaplotypeAnalystCheck, showHaplotypeAnalystText, physicOnly, HT.BR())
-## END HaplotypeAnalyst
- optionPanel.append(legendBox, legendText, HT.BR(),draw2XBox, draw2XText)
- controlsTable.append(
- HT.TR(HT.TD(innerControlsTable, valign="top"),
- HT.TD("&nbsp;", width=15), optionPanel),
- HT.TR(HT.TD(physicOnly, " only apply to single chromosome physical mapping", align="Center", colspan=3, Class="fs11 fwn"))
- )
- controlsForm.append(controlsTable)
-
- controlsForm.append(HT.Input(name="permSuggestive", value=self.suggestive, type="hidden"))
- controlsForm.append(HT.Input(name="permSignificance", value=self.significant, type="hidden"))
-
-## BEGIN HaplotypeAnalyst #### haplotypeAnalystCheck added below
-## END HaplotypeAnalyst
-
- for key in fd.formdata.keys():
- if key == "searchResult" and type([]) == type(fd.formdata.getvalue(key)):
- controlsForm.append(HT.Input(name=key, value=string.join(fd.formdata.getvalue(key), "\t"), type="hidden"))
- elif key not in ("endMb", "startMb", "chromosomes", "scale", "permCheck", "bootCheck", "additiveCheck", "dominanceCheck",
- "LRSCheck", "intervalAnalystCheck", "haplotypeAnalystCheck", "lrsMax", "graphWidth", "viewLegend", 'showGenes', 'showSNP', 'draw2X',
- 'permSuggestive', "permSignificance"):
- controlsForm.append(HT.Input(name=key, value=fd.formdata.getvalue(key), type="hidden"))
- else:
- pass
-
- # updated by NL, move function changeView(i) to webqtl.js and change it to function changeView(i, Chr_Mb_list)
- # move function chrLength(a, b, c) to webqtl.js and change it to function chrLength(a, b, c, Chr_Mb_list)
- self.dict['js1'] = '<script src="/javascript/sorttable.js"></script>'
- return HT.TD(controlsForm, Class="doubleBorder", width=400)
-
- def traitInfoTD(self, fd):
- if self.selectedChr == -1:
- intMapHeading = HT.Paragraph('Map Viewer: Whole Genome', Class="title")
- else:
- intMapHeading = HT.Paragraph('Map Viewer: Chr %s' % self.genotype[0].name, Class="title")
-
- heading2 = HT.Paragraph(HT.Strong('Population: '), "%s %s" % (self.species.title(), fd.RISet) , HT.BR())
- #Trait is from an database
- if self.traitList and self.traitList[0] and self.traitList[0].db:
- #single trait
- if len(self.traitList) == 1:
- thisTrait = self.traitList[0]
- trait_url = HT.Href(text=thisTrait.name, url = os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE) + \
- "?FormID=showDatabase&incparentsf1=1&database=%s&ProbeSetID=%s" % (thisTrait.db.name, thisTrait.name), \
- target='_blank', Class="normalsize")
- heading2.append(HT.Strong("Database: "), HT.Href(text=thisTrait.db.fullname, url = webqtlConfig.INFOPAGEHREF % thisTrait.db.name ,\
- target='_blank',Class="normalsize"),HT.BR())
- if thisTrait.db.type == 'ProbeSet':
- heading2.append(HT.Strong('Trait ID: '), trait_url, HT.BR(),
- HT.Strong("Gene Symbol: "), HT.Italic('%s' % thisTrait.symbol,id="green"),HT.BR())
- if thisTrait.chr and thisTrait.mb:
- heading2.append(HT.Strong("Location: "), 'Chr %s @ %s Mb' % (thisTrait.chr, thisTrait.mb))
- elif thisTrait.db.type == 'Geno':
- heading2.append(HT.Strong('Locus : '), trait_url, HT.BR())
- if thisTrait.chr and thisTrait.mb:
- heading2.append(HT.Strong("Location: "), 'Chr %s @ %s Mb' % (thisTrait.chr, thisTrait.mb))
- elif thisTrait.db.type == 'Publish':
- heading2.append(HT.Strong('Record ID: '), trait_url, HT.BR())
- else:
- pass
- else:
- heading2.append(HT.Strong("Traits: "), "Multiple Traits")
- else:
- heading2.append(HT.Strong("Trait Name: "), fd.identification)
- return HT.TD(intMapHeading, heading2, valign="top")
-
def drawPermutationHistogram(self):
#########################################
# Permutation Graph
@@ -2622,78 +1990,18 @@ class MarkerRegression(object):
return filename
- # img=HT.Image('/image/'+filename+'.gif',border=0,alt='Histogram of Permutation Test')
-
- # self.suggestive = self.perm_output[int(self.nperm*0.37-1)]
- # self.significant = self.perm_output[int(self.nperm*0.95-1)]
- # self.highlysignificant = self.perm_output[int(self.nperm*0.99-1)]
-
- # permutationHeading = HT.Paragraph('Histogram of Permutation Test')
- # permutationHeading.__setattr__("class","title")
-
- # permutation = HT.TableLite()
- # permutation.append(HT.TR(HT.TD(img)),
- # HT.TR(HT.TD('')),
- # HT.TR(HT.TD('Total of %d permutations'%self.nperm)))
-
- # return permutation
-
- def permutationTextFile(self):
- filename= webqtlUtil.genRandStr("Reg_")
- fpText = open('%s.txt' % (webqtlConfig.TMPDIR+filename), 'wb')
- fpText.write('Suggestive LRS (p = 0.63) = %3.2f\n'%self.suggestive)
- fpText.write('Significant LRS (p = 0.05) = %3.2f\n'%self.significant)
- fpText.write('Highly Significant LRS (p = 0.01) = %3.2f\n\n'%self.highlysignificant)
- fpText.write('%s Permutations\n\n' % str(len(self.perm_output)))
- LRSInfo =HT.Paragraph('&nbsp;&nbsp;&nbsp;&nbsp;Suggestive LRS = %3.2f\n'%self.suggestive,
- HT.BR(),
- '&nbsp;&nbsp;&nbsp;&nbsp;Significant LRS =%3.2f\n'%self.significant,
- HT.BR(),
- '&nbsp;&nbsp;&nbsp;&nbsp;Highly Significant LRS =%3.2f\n' % self.highlysignificant)
-
- for lrs_value in self.perm_output:
- fpText.write(str(lrs_value) + "\n")
-
- textUrl = HT.Href(text = 'Download Permutation Results', url= '/tmp/'+filename+'.txt', target = "_blank", Class='fs12 fwn')
-
- return textUrl
-
def geneTable(self, geneCol, refGene=None):
- #SNPLink = 0 #Not sure what this is used for
-
if self.dataset.group.species == 'mouse' or self.dataset.group.species == 'rat':
- #gene_tblobj = {}
- self.gene_table_header = self.getGeneTableHeader(refGene=None)
+ self.gene_table_header = self.getGeneTableHeaderList(refGene=None)
self.gene_table_body = self.getGeneTableBody(geneCol, refGene=None)
- #gene_tblobj["header"] = self.getGeneTableHeader(refGene=None)
- #gene_tblobj["body"] = self.getGeneTableBody(geneCol, refGene=None)
-
- #sortby = self.getSortByValue()
-
- #filename= webqtlUtil.genRandStr("Mapping_")
-
- #objfile = open('%s.obj' % (webqtlConfig.TMPDIR+filename), 'wb')
- #cPickle.dump(gene_tblobj, objfile)
- #objfile.close()
-
- #gene_table = webqtlUtil.genTableObj(tblobj=gene_tblobj, file=filename, sortby=sortby, tableID="sortable", addIndex="0")
else:
self.gene_table_header = None
self.gene_table_body = None
- #gene_table = ""
-
- #return gene_table
-
- def getGeneTableHeader(self, refGene=None):
- gene_tblobj_header = []
+ def getGeneTableHeaderList(self, refGene=None):
gene_table_header_list = []
-
- col_class = "fs14 fwb ffl b1 cw cbrb"
-
if self.dataset.group.species == "mouse":
-
if refGene:
gene_table_header_list = ["Index",
"Symbol",
@@ -2706,25 +2014,6 @@ class MarkerRegression(object):
"Mb Start (hg19)",
"Literature Correlation",
"Gene Description"]
- #"PolymiRTS Database" + HT.Href(url='http://compbio.uthsc.edu/miRSNP/', text='>>', target="_blank").__str__(),
- #"Gene Weaver Info Content" + HT.Href(url='http://geneweaver.org/', text='>>', target="_blank").__str__()]
-
- # gene_tblobj_header = [[THCell(HT.TD('Index', HT.BR(), HT.BR(), align='left', width=50, Class=col_class), text="index", idx=0),
- # THCell(HT.TD('Symbol', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="symbol", idx=1),
- # THCell(HT.TD('Mb Start',HT.BR(),'(mm9)', align='left', width=100, Class=col_class), text="mb_start_mm9", idx=2),
- # THCell(HT.TD('Length (Kb)', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="length", idx=3),
- # THCell(HT.TD('SNP',HT.BR(),'Count', align='left', width=47, Class=col_class), text="snp_count", idx=4),
- # THCell(HT.TD('SNP',HT.BR(),'Density', align='left', width=78, Class=col_class), text="snp_density", idx=5),
- # THCell(HT.TD('Avg',HT.BR(),'Expr', HT.BR(), HT.BR(), align='left', width=44, Class=col_class), sort=0, idx=6),
- # THCell(HT.TD('Human',HT.BR(),'Chr', align='left', width=60, Class=col_class), text="human_chr", idx=7),
- # THCell(HT.TD('Mb Start',HT.BR(),'(hg19)', align='left', width=100, Class=col_class), text="mb_start_hg19", idx=8),
- # THCell(HT.TD('Literature',HT.BR(),'Correlation', align='left', width=100, Class=col_class), text="lit_corr", idx=9),
- # THCell(HT.TD('Gene Description', HT.BR(), HT.BR(), align='left', width=290, Class=col_class), text="description", idx=10),
- # THCell(HT.TD('PolymiRTS',HT.BR(),'Database', HT.BR(), HT.Href(url='http://compbio.uthsc.edu/miRSNP/', text='>>', target="_blank", Class="normalsize"),
- # align='left', width=100, Class=col_class), sort=0, idx=11),
- # THCell(HT.TD('Gene Weaver', HT.BR(), 'Info Content', HT.BR(), HT.Href(url='http://geneweaver.org/', text='>>', target="_blank", Class="normalsize"),
- # align='left', width=110, Class=col_class), sort=0, idx=12),
- # ]]
else:
gene_table_header_list = ["",
"Index",
@@ -2737,27 +2026,7 @@ class MarkerRegression(object):
"Human Chr",
"Mb Start (hg19)",
"Gene Description"]
- #"PolymiRTS Database" + HT.Href(url='http://compbio.uthsc.edu/miRSNP/', text='>>', target="_blank").__str__(),
- #"Gene Weaver Info Content" + HT.Href(url='http://geneweaver.org/', text='>>', target="_blank").__str__()]
-
- # gene_tblobj_header = [[THCell(HT.TD('Index', HT.BR(), HT.BR(), align='left', width=50, Class=col_class), text="index", idx=0),
- # THCell(HT.TD('Symbol', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="symbol", idx=1),
- # THCell(HT.TD('Mb Start',HT.BR(),'(mm9)', align='left', width=100, Class=col_class), text="mb_start_mm9", idx=2),
- # THCell(HT.TD('Length (Kb)', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="length", idx=3),
- # THCell(HT.TD('SNP',HT.BR(),'Count', align='left', width=47, Class=col_class), text="snp_count", idx=4),
- # THCell(HT.TD('SNP',HT.BR(),'Density', align='left', width=78, Class=col_class), text="snp_density", idx=5),
- # THCell(HT.TD('Avg',HT.BR(),'Expr', HT.BR(), HT.BR(), align='left', width=44, Class=col_class), sort=0, idx=6),
- # THCell(HT.TD('Human',HT.BR(),'Chr', align='left', width=60, Class=col_class), text="human_chr", idx=7),
- # THCell(HT.TD('Mb Start',HT.BR(),'(hg19)', align='left', width=100, Class=col_class), text="mb_start_hg19", idx=8),
- # THCell(HT.TD('Gene Description', HT.BR(), HT.BR(), align='left', width=290, Class=col_class), text="description", idx=9),
- # THCell(HT.TD('PolymiRTS',HT.BR(),'Database', HT.BR(), HT.Href(url='http://compbio.uthsc.edu/miRSNP/', text='>>', target="_blank", Class="normalsize"),
- # align='left', width=100, Class=col_class), sort=0, idx=10),
- # THCell(HT.TD('Gene Weaver', HT.BR(), 'Info Content', HT.BR(), HT.Href(url='http://geneweaver.org/', text='>>', target="_blank", Class="normalsize"),
- # align='left', width=110, Class=col_class), sort=0, idx=11),
- # ]]
-
elif self.dataset.group.species == "rat":
-
gene_table_header_list = ["",
"Index",
"Symbol",
@@ -2770,52 +2039,13 @@ class MarkerRegression(object):
"Mb Start (hg19)",
"Gene Description"]
- # gene_tblobj_header = [[THCell(HT.TD('Index', HT.BR(), HT.BR(), align='left', width=50, Class=col_class), text="index", idx=0),
- # THCell(HT.TD('Symbol', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="symbol", idx=1),
- # THCell(HT.TD('Mb Start',HT.BR(),'(rn3)', align='left', width=100, Class=col_class), text="mb_start_rn3", idx=2),
- # THCell(HT.TD('Length (Kb)', HT.BR(), HT.BR(), align='left', width=100, Class=col_class), text="length", idx=3),
- # THCell(HT.TD('Avg',HT.BR(),'Expr', HT.BR(), HT.BR(), align='left', width=44, Class=col_class), sort=0, idx=4),
- # THCell(HT.TD('Mouse',HT.BR(),'Chr', align='left', width=60, Class=col_class), text="mouse_chr", idx=5),
- # THCell(HT.TD('Mb Start',HT.BR(),'(mm9)', align='left', width=100, Class=col_class), text="mb_start_mm9", idx=6),
- # THCell(HT.TD('Human',HT.BR(),'Chr', align='left', width=60, Class=col_class), text="human_chr", idx=7),
- # THCell(HT.TD('Mb Start',HT.BR(),'(hg19)', align='left', width=100, Class=col_class), text="mb_start_hg19", idx=8),
- # THCell(HT.TD('Gene Description', HT.BR(), HT.BR(), align='left', Class=col_class), text="description", idx=9)]]
-
- else:
- pass
-
return gene_table_header_list
- #return gene_tblobj_header
def getGeneTableBody(self, geneCol, refGene=None):
-
- tblobj_body = [] #contains table rows
- className = "fs13 b1 c222"
-
gene_table_body = []
tableIterationsCnt = 0
if self.dataset.group.species == "mouse":
-
- # polymiRTS
- # http://lily.uthsc.edu:8080/20090422_UTHSC_cuiyan/PolymiRTS_CLS?chrom=2&chrom_from=115&chrom_to=125
- #XZ: We can NOT assume their web service is always on. We must put this block of code in try except.
- try:
- conn = httplib.HTTPConnection("lily.uthsc.edu:8080")
- conn.request("GET", "/20090422_UTHSC_cuiyan/PolymiRTS_CLS?chrom=%s&chrom_from=%s&chrom_to=%s" % (self.genotype[0].name, self.startMb, self.endMb))
- response = conn.getresponse()
- data = response.read()
- data = data.split()
- conn.close()
- dic = {}
- index = 0
- for i in data:
- if index%3==0:
- dic[data[index]] = HT.Href(url=data[index+2], text=data[index+1], target="_blank", Class="normalsize")
- index = index+1
- except Exception:
- dic={}
-
for gIndex, theGO in enumerate(geneCol):
tableIterationsCnt = tableIterationsCnt + 1
@@ -2829,7 +2059,6 @@ class MarkerRegression(object):
txEnd = theGO["TxEnd"]
theGO["snpDensity"] = theGO["snpCount"]/geneLength
if self.ALEX_DEBUG_BOOL_PRINT_GENE_LIST:
- #accessionString = 'http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?CMD=Display&DB=gene&term=%s' % theGO["NM_ID"]
geneIdString = 'http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&cmd=Retrieve&dopt=Graphics&list_uids=%s' % theGO["GeneID"]
allProbeString = '%s?cmd=sch&gene=%s&alias=1' % (os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), theGO["GeneSymbol"])
@@ -2842,10 +2071,6 @@ class MarkerRegression(object):
mouseStartString = "http://genome.ucsc.edu/cgi-bin/hgTracks?clade=vertebrate&org=Mouse&db=mm9&position=chr" + theGO["Chromosome"] + "%3A" + str(int(theGO["TxStart"] * 1000000.0)) + "-" + str(int(theGO["TxEnd"]*1000000.0)) +"&pix=620&Submit=submit"
- #Used for sorting
- mouseStartValue = int(theGO["TxStart"])
-
-
#the chromosomes for human 1 are 1qXX.XX
if theGO['humanGene']:
if theGO['humanGene']["TxStart"] == '':
@@ -2854,20 +2079,11 @@ class MarkerRegression(object):
humanStartDisplay = "%0.6f" % theGO['humanGene']["TxStart"]
humanChr = theGO['humanGene']["Chromosome"]
- if humanChr.find('q'):
- humanChrSort = humanChr[:humanChr.find("q")].join(humanChr[(humanChr.find("q")+1):]) #value used when sorting table
- elif humanChr.find('p'):
- humanChrSort = humanChr[:humanChr.find("p")].join(humanChr[(humanChr.find("p")+1):]) #value used when sorting table
- else:
- humanChrSort = humanChr
humanTxStart = theGO['humanGene']["TxStart"]
- #Used for sorting
- humanStartValue = float(theGO['humanGene']["TxStart"])
-
humanStartString = "http://genome.ucsc.edu/cgi-bin/hgTracks?clade=vertebrate&org=Human&db=hg17&position=chr%s:%d-%d" % (humanChr, int(1000000*theGO['humanGene']["TxStart"]), int(1000000*theGO['humanGene']["TxEnd"]))
else:
- humanStartString = humanChr = humanChrSort = humanStartDisplay = humanStartValue = "--"
+ humanStartString = humanChr = humanStartDisplay = "--"
geneDescription = theGO["GeneDescription"]
if len(geneDescription) > 26:
@@ -2885,22 +2101,12 @@ class MarkerRegression(object):
else:
avgExpr = "%0.6f" % avgExpr
- # polymiRTS
- polymiRTS = ' '
- if dic.has_key(theGO["GeneID"]):
- polymiRTS = dic[theGO["GeneID"]]
-
# If we have a referenceGene then we will show the Literature Correlation
if theGO["Chromosome"] == "X":
chr_as_int = 19
else:
chr_as_int = int(theGO["Chromosome"]) - 1
if refGene:
- try:
- literatureCorrelation = self.getLiteratureCorrelation(self.cursor,refGene,theGO['GeneID'])
- except:
- literatureCorrelation = "N/A"
-
literatureCorrelationString = str(self.getLiteratureCorrelation(self.cursor,refGene,theGO['GeneID']) or "N/A")
this_row = [selectCheck.__str__(),
@@ -2915,25 +2121,7 @@ class MarkerRegression(object):
HT.Href(humanStartString, humanStartDisplay, target="_blank").__str__(),
literatureCorrelationString,
geneDescription]
- #polymiRTS,
-
-
- # this_row.append(TDCell(HT.TD(tableIterationsCnt, selectCheck, width=30, align='right', Class=className), tableIterationsCnt, tableIterationsCnt))
- # this_row.append(TDCell(HT.TD(HT.Href(geneIdString, theGO["GeneSymbol"], target="_blank"), "&nbsp;", probeSetSearch, align='right', Class=className), theGO["GeneSymbol"], theGO["GeneSymbol"]))
- # this_row.append(TDCell(HT.TD(HT.Href(mouseStartString, "%0.6f" % txStart, target="_blank"), align='right', Class=className), str(mouseStartValue), mouseStartValue))
- # this_row.append(TDCell(HT.TD(HT.Href("javascript:centerIntervalMapOnRange2('%s', " % theGO["Chromosome"]+str(txStart-tenPercentLength) + ", " + str(txEnd+tenPercentLength) + ", document.changeViewForm)", "%0.3f" % geneLength), align='right', Class=className), "%0.3f" % geneLength, geneLength))
- # this_row.append(TDCell(HT.TD(snpString, align='right', Class=className), str(theGO["snpCount"]), theGO["snpCount"]))
- # this_row.append(TDCell(HT.TD(snpDensityStr, align='right', Class=className), snpDensityStr, theGO["snpDensity"]))
- # this_row.append(TDCell(HT.TD(avgExpr, align='right', Class=className), "--", "--"))
- # this_row.append(TDCell(HT.TD(humanChr, align='right', Class=className), humanChr, humanChrSort))
- # this_row.append(TDCell(HT.TD(HT.Href(humanStartString, humanStartDisplay, target="_blank"), align='right', Class=className), humanStartDisplay, humanStartValue))
- # this_row.append(TDCell(HT.TD(literatureCorrelationString, align='right', Class=className), literatureCorrelationString, literatureCorrelation))
- # this_row.append(TDCell(HT.TD(geneDescription, align='right', Class=className), geneDescription, geneDescription))
- # this_row.append(TDCell(HT.TD(polymiRTS, align='right', Class=className), "", ""))
- # this_row.append(TDCell(HT.TD("", align='right', Class=className), "", ""))
-
else:
-
this_row = [selectCheck.__str__(),
str(tableIterationsCnt),
HT.Href(geneIdString, theGO["GeneSymbol"], target="_blank").__str__() + "&nbsp;" + probeSetSearch.__str__(),
@@ -2945,29 +2133,11 @@ class MarkerRegression(object):
humanChr,
HT.Href(humanStartString, humanStartDisplay, target="_blank").__str__(),
geneDescription]
- #polymiRTS,
-
-
- # this_row.append(TDCell(HT.TD(tableIterationsCnt, selectCheck, width=30, align='right', Class=className), tableIterationsCnt, tableIterationsCnt))
- # this_row.append(TDCell(HT.TD(HT.Href(geneIdString, theGO["GeneSymbol"], target="_blank"), "&nbsp;", probeSetSearch, align='right', Class=className), theGO["GeneSymbol"], theGO["GeneSymbol"]))
- # this_row.append(TDCell(HT.TD(HT.Href(mouseStartString, "%0.6f" % txStart, target="_blank"), align='right', Class=className), str(mouseStartValue), mouseStartValue))
- # this_row.append(TDCell(HT.TD(HT.Href("javascript:centerIntervalMapOnRange2('%s', " % theGO["Chromosome"]+str(txStart-tenPercentLength) + ", " + str(txEnd+tenPercentLength) + ", document.changeViewForm)", "%0.3f" % geneLength), align='right', Class=className), "%0.3f" % geneLength, geneLength))
- # this_row.append(TDCell(HT.TD(snpString, align='right', Class=className), str(theGO["snpCount"]), theGO["snpCount"]))
- # this_row.append(TDCell(HT.TD(snpDensityStr, align='right', Class=className), snpDensityStr, theGO["snpDensity"]))
- # this_row.append(TDCell(HT.TD(avgExpr, align='right', Class=className), "--", "--"))
- # this_row.append(TDCell(HT.TD(humanChr, align='right', Class=className), humanChr, humanChrSort))
- # this_row.append(TDCell(HT.TD(HT.Href(humanStartString, humanStartDisplay, target="_blank"), align='right', Class=className), humanStartDisplay, humanStartValue))
- # this_row.append(TDCell(HT.TD(geneDescription, align='right', Class=className), geneDescription, geneDescription))
- # this_row.append(TDCell(HT.TD(polymiRTS, align='right', Class=className), "", ""))
- # this_row.append(TDCell(HT.TD("", align='right', Class=className), "", ""))
gene_table_body.append(this_row)
- #tblobj_body.append(this_row)
elif self.dataset.group.species == 'rat':
-
for gIndex, theGO in enumerate(geneCol):
-
this_row = [] #container for the cells of each row
selectCheck = HT.Input(type="checkbox", name="searchResult", Class="checkbox", onClick="highlight(this)").__str__() #checkbox for each row
@@ -2984,7 +2154,6 @@ class MarkerRegression(object):
chr_as_int = int(theGO["Chromosome"]) - 1
geneLength = (float(theGO["TxEnd"]) - float(theGO["TxStart"]))
- #geneLengthURL = "javascript:centerIntervalMapOnRange2('%s', %f, %f, document.changeViewForm)" % (theGO["Chromosome"], float(theGO["TxStart"])-(geneLength*0.1), float(theGO["TxEnd"])+(geneLength*0.1))
geneLengthURL = "javascript:rangeView('%s', %f, %f)" % (theGO["Chromosome"], float(theGO["TxStart"])-(geneLength*0.1), float(theGO["TxEnd"])+(geneLength*0.1))
avgExprVal = []
@@ -3003,15 +2172,9 @@ class MarkerRegression(object):
#the chromosomes for human 1 are 1qXX.XX
if theGO['humanGene']:
humanChr = theGO['humanGene']["Chromosome"]
- if 'q' in humanChr:
- humanChrSort = humanChr[:humanChr.find("q")].join(humanChr[(humanChr.find("q")+1):]) #value used when sorting table
- elif 'p' in humanChr:
- humanChrSort = humanChr[:humanChr.find("p")].join(humanChr[(humanChr.find("p")+1):]) #value used when sorting table
- else:
- humanChrSort = humanChr
humanTxStart = theGO['humanGene']["TxStart"]
else:
- humanChr = humanTxStart = humanChrSort = ""
+ humanChr = humanTxStart = ""
geneDesc = theGO["GeneDescription"]
if geneDesc == "---":
@@ -3029,26 +2192,9 @@ class MarkerRegression(object):
humanTxStart,
geneDesc]
-
- #this_row.append(TDCell(HT.TD(gIndex + 1, selectCheck, align='left', Class=className), str(gIndex+1), gIndex+1))
- #this_row.append(TDCell(HT.TD(webqtlSearch, geneSymbolNCBI, align='left', Class=className), theGO["GeneSymbol"], theGO["GeneSymbol"]))
- #this_row.append(TDCell(HT.TD(theGO["TxStart"], align='left', Class=className), theGO["TxStart"], theGO["TxStart"]))
- #this_row.append(TDCell(HT.TD(HT.Href(geneLengthURL, "%0.3f" % (geneLength*1000.0)), align='left', Class=className), "%0.3f" % (geneLength*1000.0), (geneLength*1000.0)))
- #this_row.append(TDCell(HT.TD(avgExprVal, align='left', Class=className), "", ""))
- #this_row.append(TDCell(HT.TD(mouseChr, align='left', Class=className), mouseChr, mouseChr))
- #this_row.append(TDCell(HT.TD(mouseTxStart, align='left', Class=className), mouseTxStart, mouseTxStart))
- #this_row.append(TDCell(HT.TD(humanChr, align='left', Class=className), humanChr, humanChrSort))
- #this_row.append(TDCell(HT.TD(humanTxStart, align='left', Class=className), humanTxStart, humanTxStart))
- #this_row.append(TDCell(HT.TD(geneDesc, align='left', Class=className), geneDesc, geneDesc))
-
gene_table_body.append(this_row)
- #tblobj_body.append(this_row)
-
- else:
- pass
return gene_table_body
- #return tblobj_body
def getLiteratureCorrelation(cursor,geneId1=None,geneId2=None):
if not geneId1 or not geneId2:
@@ -3067,10 +2213,4 @@ class MarkerRegression(object):
lCorr = lCorr[0]
break
except: raise #lCorr = None
- return lCorr
-
- def getSortByValue(self):
-
- sortby = ("", "")
-
- return sortby
+ return lCorr \ No newline at end of file
diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json
index b7ebb9ed..d00b52b8 100644
--- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json
+++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json
@@ -1527,6 +1527,36 @@
}
},
"mouse": {
+ "AIL": {
+ "Hippocampus mRNA": [
+ [
+ "844",
+ "UCSD_AIL_HIP_RNA-Seq_0418",
+ "UCSD AIL Hippocampus (Apr18) RNA-Seq"
+ ]
+ ],
+ "Phenotypes": [
+ [
+ "None",
+ "AILPublish",
+ "AIL Published Phenotypes"
+ ]
+ ],
+ "Prefrontal Cortex mRNA": [
+ [
+ "846",
+ "UCSD_AIL_PFC_RNA-Seq_0418",
+ "UCSD AIL Prefrontal Cortex (Apr18) RNA-Seq"
+ ]
+ ],
+ "Striatum mRNA": [
+ [
+ "845",
+ "UCSD_AIL_STR_RNA-Seq_0418",
+ "UCSD AIL Striatum (Apr18) RNA-Seq"
+ ]
+ ]
+ },
"AKXD": {
"Genotypes": [
[
@@ -2968,7 +2998,7 @@
"BXD-Bone": {
"Phenotypes": [
[
- "None",
+ "650",
"BXD-BonePublish",
"BXD-Bone Published Phenotypes"
]
@@ -3156,6 +3186,13 @@
]
},
"CIE-RMA": {
+ "Hippocampus mRNA": [
+ [
+ "831",
+ "INIA_UTHSC_Hip_AffyMTA1_May17",
+ "INIA-UTHSC Hippocampus CIE Affy MTA 1.0 GeneLevel (Mar18) RMA"
+ ]
+ ],
"Midbrain mRNA": [
[
"830",
@@ -3826,6 +3863,10 @@
],
"mouse": [
[
+ "AIL",
+ "AIL Advanced Intercross Line"
+ ],
+ [
"AKXD",
"AKXD"
],
@@ -3875,7 +3916,7 @@
],
[
"BXD-Bone",
- "BXD Bone"
+ "BXD Bone Individual Data"
],
[
"BXD-Harvested",
@@ -4727,6 +4768,24 @@
]
},
"mouse": {
+ "AIL": [
+ [
+ "Phenotypes",
+ "Phenotypes"
+ ],
+ [
+ "Hippocampus mRNA",
+ "Hippocampus mRNA"
+ ],
+ [
+ "Prefrontal Cortex mRNA",
+ "Prefrontal Cortex mRNA"
+ ],
+ [
+ "Striatum mRNA",
+ "Striatum mRNA"
+ ]
+ ],
"AKXD": [
[
"Genotypes",
@@ -5111,6 +5170,10 @@
"Phenotypes"
],
[
+ "Hippocampus mRNA",
+ "Hippocampus mRNA"
+ ],
+ [
"Midbrain mRNA",
"Midbrain mRNA"
]
diff --git a/wqflask/wqflask/templates/heatmap.html b/wqflask/wqflask/templates/heatmap.html
index 49d7f962..68880829 100644
--- a/wqflask/wqflask/templates/heatmap.html
+++ b/wqflask/wqflask/templates/heatmap.html
@@ -39,7 +39,6 @@
<script language="javascript" type="text/javascript" src="/static/new/javascript/lodheatmap.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/javascript/lod_chart.js"></script>
<script language="javascript" type="text/javascript" src="/static/new/javascript/curvechart.js"></script>
-<!-- <script language="javascript" type="text/javascript" src="/static/new/javascript/create_heatmap.js"></script>-->
<script language="javascript" type="text/javascript" src="/static/new/javascript/iplotMScanone_noeff.js"></script>
<script language="javascript" type="text/javascript" src="/static/packages/underscore/underscore-min.js"></script>