From e48ec8826ec48bd4ba53f681796a235737ab0d29 Mon Sep 17 00:00:00 2001
From: Zachary Sloan
Date: Fri, 30 Jan 2015 17:21:19 +0000
Subject: Fixed several bugs Added legend to bar chart color by trait function
Added scatterplot matrix figure Fixed database timeout problem
---
wqflask/base/data_set.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'wqflask/base')
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 15a8c7cc..8965e1d1 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -640,7 +640,7 @@ class PhenotypeDataSet(DataSet):
'Year',
'Max LRS',
'Max LRS Location',
- 'Add. Effect']
+ 'Add. Effect ? ']
self.type = 'Publish'
@@ -901,7 +901,7 @@ class MrnaAssayDataSet(DataSet):
'Mean Expr',
'Max LRS',
'Max LRS Location',
- 'Add. Effect']
+ 'Add. Effect ? ']
# Todo: Obsolete or rename this field
self.type = 'ProbeSet'
--
cgit v1.2.3
From 69e509720d9242972a49635ef0fd8e725a7d9cc6 Mon Sep 17 00:00:00 2001
From: DannyArends
Date: Tue, 17 Mar 2015 19:39:39 +0100
Subject: Converting an absolute path to a relative path
---
wqflask/base/data_set.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'wqflask/base')
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 8965e1d1..489bd374 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -79,7 +79,7 @@ class Dataset_Types(object):
def __init__(self):
self.datasets = {}
- file_name = "/home/zas1024/gene/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json"
+ file_name = "wqflask/static/new/javascript/dataset_menu_structure.json"
with open(file_name, 'r') as fh:
data = json.load(fh)
--
cgit v1.2.3
From 9a5fe211a846184aea7027aa90fde3fba93697e4 Mon Sep 17 00:00:00 2001
From: DannyArends
Date: Mon, 23 Mar 2015 14:59:18 +0000
Subject: Updates to make GN2 work on my version of penguin (ports, and paths)
---
wqflask/base/webqtlConfig.py | 2 +-
wqflask/runserver.py | 4 ++--
wqflask/secure_server.py | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
(limited to 'wqflask/base')
diff --git a/wqflask/base/webqtlConfig.py b/wqflask/base/webqtlConfig.py
index 23d32233..019d592b 100755
--- a/wqflask/base/webqtlConfig.py
+++ b/wqflask/base/webqtlConfig.py
@@ -49,7 +49,7 @@ GENOMEBROWSER_URL="http://ucscbrowser.genenetwork.org/cgi-bin/hgTracks?clade=mam
ENSEMBLETRANSCRIPT_URL="http://useast.ensembl.org/Mus_musculus/Lucene/Details?species=Mus_musculus;idx=Transcript;end=1;q=%s"
-GNROOT = "/home/zas1024/gene/" # Will remove this and dependent items later
+GNROOT = "/home/danny/GeneNetwork/" # Will remove this and dependent items later
SECUREDIR = GNROOT + 'secure/'
COMMON_LIB = GNROOT + 'support/admin'
HTMLPATH = GNROOT + 'web/'
diff --git a/wqflask/runserver.py b/wqflask/runserver.py
index 8ab88580..9d5686a9 100755
--- a/wqflask/runserver.py
+++ b/wqflask/runserver.py
@@ -20,7 +20,7 @@ from wqflask import app
import logging
#from themodule import TheHandlerYouWant
-file_handler = logging.FileHandler("/tmp/flask_gn_log")
+file_handler = logging.FileHandler("/tmp/flask_gn_log_danny_unsecure")
file_handler.setLevel(logging.DEBUG)
app.logger.addHandler(file_handler)
@@ -28,7 +28,7 @@ import logging_tree
logging_tree.printout()
app.run(host='0.0.0.0',
- port=5002,
+ port=5003,
use_debugger=False,
threaded=True,
use_reloader=True)
diff --git a/wqflask/secure_server.py b/wqflask/secure_server.py
index 975c97c0..248559f3 100755
--- a/wqflask/secure_server.py
+++ b/wqflask/secure_server.py
@@ -72,7 +72,7 @@ if __name__ == '__main__':
app.run(host='0.0.0.0',
- port=5002,
+ port=5003,
use_debugger=True,
threaded=True,
use_reloader=True)
--
cgit v1.2.3
From 5eebf10533e0f03254a89fd886c02fed3a7e188d Mon Sep 17 00:00:00 2001
From: zsloan
Date: Tue, 24 Mar 2015 16:27:58 +0000
Subject: Change back port location and home directory location; this should be
in external settings
---
wqflask/base/webqtlConfig.py | 4 ++--
wqflask/secure_server.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
(limited to 'wqflask/base')
diff --git a/wqflask/base/webqtlConfig.py b/wqflask/base/webqtlConfig.py
index 019d592b..e74b9ce5 100755
--- a/wqflask/base/webqtlConfig.py
+++ b/wqflask/base/webqtlConfig.py
@@ -49,13 +49,13 @@ GENOMEBROWSER_URL="http://ucscbrowser.genenetwork.org/cgi-bin/hgTracks?clade=mam
ENSEMBLETRANSCRIPT_URL="http://useast.ensembl.org/Mus_musculus/Lucene/Details?species=Mus_musculus;idx=Transcript;end=1;q=%s"
-GNROOT = "/home/danny/GeneNetwork/" # Will remove this and dependent items later
+GNROOT = "/home/zas1024/gene/" # Will remove this and dependent items later
SECUREDIR = GNROOT + 'secure/'
COMMON_LIB = GNROOT + 'support/admin'
HTMLPATH = GNROOT + 'web/'
PYLMM_PATH = '/home/zas1024/plink/'
SNP_PATH = '/home/zas1024/snps/'
-IMGDIR = HTMLPATH +'image/'
+IMGDIR = GNROOT + '/wqflask/wqflask/images/'
IMAGESPATH = HTMLPATH + 'images/'
UPLOADPATH = IMAGESPATH + 'upload/'
TMPDIR = '/tmp/'
diff --git a/wqflask/secure_server.py b/wqflask/secure_server.py
index 248559f3..975c97c0 100755
--- a/wqflask/secure_server.py
+++ b/wqflask/secure_server.py
@@ -72,7 +72,7 @@ if __name__ == '__main__':
app.run(host='0.0.0.0',
- port=5003,
+ port=5002,
use_debugger=True,
threaded=True,
use_reloader=True)
--
cgit v1.2.3
From 93dcba89f7e424a759e3177a74b1ce322cdd7c57 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Wed, 25 Mar 2015 16:11:56 +0000
Subject: Pair scan image now loads properly
---
wqflask/base/webqtlConfig.py | 2 +-
.../wqflask/marker_regression/marker_regression.py | 6 +--
wqflask/wqflask/templates/pair_scan_results.html | 55 ++++------------------
wqflask/wqflask/templates/show_image.html | 5 ++
wqflask/wqflask/views.py | 23 ++++++++-
5 files changed, 38 insertions(+), 53 deletions(-)
create mode 100644 wqflask/wqflask/templates/show_image.html
(limited to 'wqflask/base')
diff --git a/wqflask/base/webqtlConfig.py b/wqflask/base/webqtlConfig.py
index e74b9ce5..49a596aa 100755
--- a/wqflask/base/webqtlConfig.py
+++ b/wqflask/base/webqtlConfig.py
@@ -58,7 +58,7 @@ SNP_PATH = '/home/zas1024/snps/'
IMGDIR = GNROOT + '/wqflask/wqflask/images/'
IMAGESPATH = HTMLPATH + 'images/'
UPLOADPATH = IMAGESPATH + 'upload/'
-TMPDIR = '/tmp/'
+TMPDIR = '/home/zas1024/tmp/' # Will remove this and dependent items later
GENODIR = HTMLPATH + 'genotypes/'
NEWGENODIR = HTMLPATH + 'new_genotypes/'
GENO_ARCHIVE_DIR = GENODIR + 'archive/'
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py
index af441489..3fb9915b 100755
--- a/wqflask/wqflask/marker_regression/marker_regression.py
+++ b/wqflask/wqflask/marker_regression/marker_regression.py
@@ -321,9 +321,9 @@ class MarkerRegression(object):
print("No covariates"); result_data_frame = scantwo(cross_object, pheno = "the_pheno", model=self.model, method=self.method, n_cluster = 16)
print("Pair scan results:", result_data_frame)
-
- self.pair_scan_filename = webqtlUtil.genRandStr("scantwo_")
- png(file=webqtlConfig.IMGDIR+self.pair_scan_filename+".png")
+
+ self.pair_scan_filename = webqtlUtil.genRandStr("scantwo_") + ".png"
+ png(file=webqtlConfig.TMPDIR+self.pair_scan_filename)
plot(result_data_frame)
dev_off()
diff --git a/wqflask/wqflask/templates/pair_scan_results.html b/wqflask/wqflask/templates/pair_scan_results.html
index a0041e11..869dabed 100644
--- a/wqflask/wqflask/templates/pair_scan_results.html
+++ b/wqflask/wqflask/templates/pair_scan_results.html
@@ -1,13 +1,13 @@
{% extends "base.html" %}
-{% block title %}Interval Mapping{% endblock %}
+{% block title %}Pair Scan{% endblock %}
{% block css %}
-
{% endblock %}
+
{% block content %}
{{ header("Mapping",
@@ -21,7 +21,12 @@
@@ -31,30 +36,12 @@
-
-
{% endblock %}
{% block js %}
-
-
-
-
-
-
-
-
-
@@ -62,30 +49,4 @@
-
{% endblock %}
\ No newline at end of file
diff --git a/wqflask/wqflask/templates/show_image.html b/wqflask/wqflask/templates/show_image.html
new file mode 100644
index 00000000..521f5414
--- /dev/null
+++ b/wqflask/wqflask/templates/show_image.html
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 4b7bd639..7fec0456 100755
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import sys
@@ -20,6 +21,8 @@ import redis
Redis = redis.StrictRedis()
import flask
+import base64
+import array
import sqlalchemy
#import config
@@ -83,11 +86,18 @@ def index_page():
return render_template("index_page.html")
-@app.route("/tmp")
-def tmp_page():
+@app.route("/tmp/")
+def tmp_page(img_path):
print("In tmp_page")
+ print("img_path:", img_path)
initial_start_vars = request.form
print("initial_start_vars:", initial_start_vars)
+ imgfile = open('/home/zas1024/tmp/' + img_path, 'rb')
+ imgdata = imgfile.read()
+ imgB64 = imgdata.encode("base64")
+ bytesarray = array.array('B', imgB64)
+ return render_template("show_image.html",
+ img_base64 = bytesarray )
@app.route("/data_sharing")
@@ -344,6 +354,15 @@ def marker_regression_page():
with Bench("Rendering template"):
if result['pair_scan'] == True:
+ img_path = result['pair_scan_filename']
+ print("img_path:", img_path)
+ initial_start_vars = request.form
+ print("initial_start_vars:", initial_start_vars)
+ imgfile = open('/home/zas1024/tmp/' + img_path, 'rb')
+ imgdata = imgfile.read()
+ imgB64 = imgdata.encode("base64")
+ bytesarray = array.array('B', imgB64)
+ result['pair_scan_array'] = bytesarray
rendered_template = render_template("pair_scan_results.html", **result)
else:
rendered_template = render_template("marker_regression.html", **result)
--
cgit v1.2.3
From a840ad18e1fe3db98a359a159e9b9b72367a2839 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Thu, 26 Mar 2015 21:24:24 +0000
Subject: Removed several unused files from the base folder and their
references in other files
---
wqflask/base/GeneralObject.py | 68 -----
wqflask/base/JinjaPage.py | 28 --
wqflask/base/admin.py | 86 ------
wqflask/base/cgiData.py | 66 -----
wqflask/base/cookieData.py | 49 ----
wqflask/base/footer.py | 6 -
wqflask/base/generate_probesetfreeze_file.py | 31 ---
wqflask/base/header.py | 6 -
wqflask/base/indexBody.py | 290 ---------------------
wqflask/base/myCookie.py | 51 ----
wqflask/base/sessionData.py | 50 ----
wqflask/base/templatePage.py | 222 ----------------
wqflask/base/webqtlFormData.py | 6 -
wqflask/wqflask/search_results.py | 2 -
.../static/new/javascript/css/bar_chart.css | 15 --
.../wqflask/static/new/javascript/css/box_plot.css | 20 --
.../wqflask/static/new/javascript/css/charts.css | 28 --
.../static/new/javascript/css/corr_matrix.css | 12 -
.../new/javascript/css/corr_scatter_plot.css | 13 -
.../static/new/javascript/css/d3-tip.min.css | 1 -
.../static/new/javascript/css/interval_mapping.css | 32 ---
wqflask/wqflask/static/new/javascript/css/main.css | 4 -
.../new/javascript/css/marker_regression.css | 38 ---
.../static/new/javascript/css/panelutil.css | 91 -------
.../wqflask/static/new/javascript/css/parsley.css | 20 --
.../static/new/javascript/css/scatter-matrix.css | 40 ---
.../static/new/javascript/css/show_trait.css | 7 -
.../wqflask/static/new/javascript/css/table.css | 36 ---
28 files changed, 1318 deletions(-)
delete mode 100755 wqflask/base/GeneralObject.py
delete mode 100755 wqflask/base/JinjaPage.py
delete mode 100755 wqflask/base/admin.py
delete mode 100755 wqflask/base/cgiData.py
delete mode 100755 wqflask/base/cookieData.py
delete mode 100755 wqflask/base/footer.py
delete mode 100755 wqflask/base/generate_probesetfreeze_file.py
delete mode 100755 wqflask/base/header.py
delete mode 100755 wqflask/base/indexBody.py
delete mode 100755 wqflask/base/myCookie.py
delete mode 100755 wqflask/base/sessionData.py
delete mode 100755 wqflask/base/templatePage.py
delete mode 100755 wqflask/wqflask/static/new/javascript/css/bar_chart.css
delete mode 100755 wqflask/wqflask/static/new/javascript/css/box_plot.css
delete mode 100644 wqflask/wqflask/static/new/javascript/css/charts.css
delete mode 100755 wqflask/wqflask/static/new/javascript/css/corr_matrix.css
delete mode 100755 wqflask/wqflask/static/new/javascript/css/corr_scatter_plot.css
delete mode 100644 wqflask/wqflask/static/new/javascript/css/d3-tip.min.css
delete mode 100755 wqflask/wqflask/static/new/javascript/css/interval_mapping.css
delete mode 100755 wqflask/wqflask/static/new/javascript/css/main.css
delete mode 100755 wqflask/wqflask/static/new/javascript/css/marker_regression.css
delete mode 100644 wqflask/wqflask/static/new/javascript/css/panelutil.css
delete mode 100755 wqflask/wqflask/static/new/javascript/css/parsley.css
delete mode 100644 wqflask/wqflask/static/new/javascript/css/scatter-matrix.css
delete mode 100644 wqflask/wqflask/static/new/javascript/css/show_trait.css
delete mode 100755 wqflask/wqflask/static/new/javascript/css/table.css
(limited to 'wqflask/base')
diff --git a/wqflask/base/GeneralObject.py b/wqflask/base/GeneralObject.py
deleted file mode 100755
index 53d1357b..00000000
--- a/wqflask/base/GeneralObject.py
+++ /dev/null
@@ -1,68 +0,0 @@
-# Copyright (C) University of Tennessee Health Science Center, Memphis, TN.
-#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Affero General Public License
-# as published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU Affero General Public License for more details.
-#
-# This program is available from Source Forge: at GeneNetwork Project
-# (sourceforge.net/projects/genenetwork/).
-#
-# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010)
-# at rwilliams@uthsc.edu and xzhou15@uthsc.edu
-#
-#
-#
-# This module is used by GeneNetwork project (www.genenetwork.org)
-#
-# Created by GeneNetwork Core Team 2010/08/10
-#
-# Last updated by GeneNetwork Core Team 2010/10/20
-
-class GeneralObject:
- """
- Base class to define an Object.
- a = [Spam(1, 4), Spam(9, 3), Spam(4,6)]
- a.sort(lambda x, y: cmp(x.eggs, y.eggs))
- """
-
- def __init__(self, *args, **kw):
- self.contents = list(args)
- for name, value in kw.items():
- setattr(self, name, value)
-
- def __setitem__(self, key, value):
- setattr(self, key, value)
-
- def __getitem__(self, key):
- return getattr(self, key)
-
- def __getattr__(self, key):
- if key in self.__dict__.keys():
- return self.__dict__[key]
- else:
- return eval("self.__dict__.%s" % key)
-
- def __len__(self):
- return len(self.__dict__) - 1
-
- def __str__(self):
- s = ''
- for key in self.__dict__.keys():
- if key != 'contents':
- s += '%s = %s\n' % (key,self.__dict__[key])
- return s
-
- def __repr__(self):
- s = ''
- for key in self.__dict__.keys():
- s += '%s = %s\n' % (key,self.__dict__[key])
- return s
-
- def __cmp__(self,other):
- return len(self.__dict__.keys()).__cmp__(len(other.__dict__.keys()))
diff --git a/wqflask/base/JinjaPage.py b/wqflask/base/JinjaPage.py
deleted file mode 100755
index 07e485b1..00000000
--- a/wqflask/base/JinjaPage.py
+++ /dev/null
@@ -1,28 +0,0 @@
-import logging
-logging.basicConfig(filename="/tmp/gn_log", level=logging.INFO)
-_log = logging.getLogger("search")
-
-from pprint import pformat as pf
-
-import templatePage
-
-from utility import formatting
-
-import jinja2
-JinjaEnv = jinja2.Environment(loader=jinja2.FileSystemLoader('/gnshare/gn/web/webqtl/templates'))
-JinjaEnv.globals['numify'] = formatting.numify
-
-
-class JinjaPage(templatePage.templatePage):
- """Class derived from our regular templatePage, but uses Jinja2 instead.
-
- When converting pages from Python generated templates, change the base class from templatePage
- to JinjaPage
-
- """
-
-
- def write(self):
- """We override the base template write so we can use Jinja2."""
- _log.info(pf(self.__dict__))
- return self.jtemplate.render(**self.__dict__)
diff --git a/wqflask/base/admin.py b/wqflask/base/admin.py
deleted file mode 100755
index 1ba75117..00000000
--- a/wqflask/base/admin.py
+++ /dev/null
@@ -1,86 +0,0 @@
-# Copyright (C) University of Tennessee Health Science Center, Memphis, TN.
-#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Affero General Public License
-# as published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU Affero General Public License for more details.
-#
-# This program is available from Source Forge: at GeneNetwork Project
-# (sourceforge.net/projects/genenetwork/).
-#
-# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010)
-# at rwilliams@uthsc.edu and xzhou15@uthsc.edu
-#
-#
-#
-# This module is used by GeneNetwork project (www.genenetwork.org)
-#
-# Created by GeneNetwork Core Team 2010/08/10
-#
-# Last updated by GeneNetwork Core Team 2010/10/20
-
-
-
-
-
-#XZ, 04/02/2009: we should put this into database.
-
-
-###LIST of databases used into gene name query
-
-
-ADMIN_search_dbs = {
- 'rat': {'PERITONEAL FAT': ['FT_2A_0605_Rz'],
- 'KIDNEY': ['KI_2A_0405_Rz'],
- 'ADRENAL GLAND': ['HXB_Adrenal_1208'],
- 'HEART': ['HXB_Heart_1208']
- },
- 'mouse': {'CEREBELLUM': ['CB_M_0305_R'],
- 'STRIATUM': ['SA_M2_0905_R', 'SA_M2_0405_RC', 'UTHSC_1107_RankInv', 'Striatum_Exon_0209'],
- 'HIPPOCAMPUS': ['HC_M2_0606_R', 'UMUTAffyExon_0209_RMA'],
- 'WHOLE BRAIN': ['BR_M2_1106_R', 'IBR_M_0106_R', 'BRF2_M_0805_R', 'UCLA_BHF2_BRAIN_0605'],
- 'LIVER': ['LV_G_0106_B', 'UCLA_BHF2_LIVER_0605'],
- 'EYE': ['Eye_M2_0908_R'],
- 'HEMATOPOIETIC STEM CELLS': ['HC_U_0304_R'],
- 'KIDNEY': ['MA_M2_0806_R'],
- 'MAMMARY TUMORS': ['MA_M_0704_R', 'NCI_Agil_Mam_Tum_RMA_0409'],
- 'PREFRONTAL CORTEX': ['VCUSal_1206_R'],
- 'SPLEEN': ['IoP_SPL_RMA_0509'],
- 'NUCLEUS ACCUMBENS': ['VCUSalo_1007_R'],
- 'NEOCORTEX': ['HQFNeoc_0208_RankInv'],
- 'ADIPOSE': ['UCLA_BHF2_ADIPOSE_0605'],
- 'RETINA': ['Illum_Retina_BXD_RankInv0410']
- },
- 'human': {
- 'LYMPHOBLAST B CELL': ['Human_1008', 'UT_CEPH_RankInv0909'],
- 'WHOLE BRAIN': ['GSE5281_F_RMA0709', 'GSE15222_F_RI_0409']
- }
- }
-
-
-###LIST of tissue alias
-
-ADMIN_tissue_alias = {'CEREBELLUM': ['Cb'],
- 'STRIATUM': ['Str'],
- 'HIPPOCAMPUS': ['Hip'],
- 'WHOLE BRAIN': ['Brn'],
- 'LIVER': ['Liv'],
- 'EYE': ['Eye'],
- 'PERITONEAL FAT': ['Fat'],
- 'HEMATOPOIETIC STEM CELLS': ['Hsc'],
- 'KIDNEY': ['Kid'],
- 'ADRENAL GLAND': ['Adr'],
- 'HEART': ['Hea'],
- 'MAMMARY TUMORS': ['Mam'],
- 'PREFRONTAL CORTEX': ['Pfc'],
- 'SPLEEN': ['Spl'],
- 'NUCLEUS ACCUMBENS': ['Nac'],
- 'NEOCORTEX': ['Ctx'],
- 'ADIPOSE': ['Wfat'],
- 'RETINA': ['Ret']
- }
diff --git a/wqflask/base/cgiData.py b/wqflask/base/cgiData.py
deleted file mode 100755
index 155b3ec3..00000000
--- a/wqflask/base/cgiData.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright (C) University of Tennessee Health Science Center, Memphis, TN.
-#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Affero General Public License
-# as published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU Affero General Public License for more details.
-#
-# This program is available from Source Forge: at GeneNetwork Project
-# (sourceforge.net/projects/genenetwork/).
-#
-# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010)
-# at rwilliams@uthsc.edu and xzhou15@uthsc.edu
-#
-#
-#
-# This module is used by GeneNetwork project (www.genenetwork.org)
-#
-# Created by GeneNetwork Core Team 2010/08/10
-#
-# Last updated by GeneNetwork Core Team 2010/10/20
-
-#########################################
-#convert Field storage object to Dict object
-#in order to be able to saved into a session file
-#########################################
-
-class cgiData(dict):
- '''convert Field storage object to Dict object
- Filed storage object cannot be properly dumped
- '''
-
- def __init__(self, field_storage=None):
-
- if not field_storage:
- field_storage={}
-
- for key in field_storage.keys():
- temp = field_storage.getlist(key)
- if len(temp) > 1:
- temp = map(self.toValue, temp)
- elif len(temp) == 1:
- temp = self.toValue(temp[0])
- else:
- temp = None
- self[key]= temp
-
- def toValue(self, obj):
- '''fieldstorge returns different type of objects, \
- need to convert to string or None'''
- try:
- return obj.value
- except:
- return ""
-
- def getvalue(self, k, default= None):
- try:
- return self[k]
- except:
- return default
-
- getfirst = getvalue
diff --git a/wqflask/base/cookieData.py b/wqflask/base/cookieData.py
deleted file mode 100755
index eeb7c0cf..00000000
--- a/wqflask/base/cookieData.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright (C) University of Tennessee Health Science Center, Memphis, TN.
-#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Affero General Public License
-# as published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU Affero General Public License for more details.
-#
-# This program is available from Source Forge: at GeneNetwork Project
-# (sourceforge.net/projects/genenetwork/).
-#
-# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010)
-# at rwilliams@uthsc.edu and xzhou15@uthsc.edu
-#
-#
-#
-# This module is used by GeneNetwork project (www.genenetwork.org)
-#
-# Created by GeneNetwork Core Team 2010/08/10
-#
-# Last updated by GeneNetwork Core Team 2010/10/20
-
-#########################################
-#convert mod_python object to Dict object
-#in order to be able to be pickled
-#########################################
-
-class cookieData(dict):
- 'convert mod python Cookie object to Dict object'
-
- def __init__(self, cookies=None):
-
- if not cookies:
- cookies={}
-
- for key in cookies.keys():
- self[key.lower()]= cookies[key].value
-
- def getvalue(self, k, default= None):
- try:
- return self[k.lower()]
- except:
- return default
-
- getfirst = getvalue
diff --git a/wqflask/base/footer.py b/wqflask/base/footer.py
deleted file mode 100755
index 6f92fdf8..00000000
--- a/wqflask/base/footer.py
+++ /dev/null
@@ -1,6 +0,0 @@
-import webqtlConfig
-
-footer_html = open(webqtlConfig.HTMLPATH + 'footer.html', 'r').read()
-footer = footer_html.replace('%"','%%"')
-
-footer_string = footer.replace('', '%s')
diff --git a/wqflask/base/generate_probesetfreeze_file.py b/wqflask/base/generate_probesetfreeze_file.py
deleted file mode 100755
index a0ff804b..00000000
--- a/wqflask/base/generate_probesetfreeze_file.py
+++ /dev/null
@@ -1,31 +0,0 @@
-from __future__ import absolute_import, print_function, division
-import os
-import math
-
-import json
-import itertools
-
-from flask import Flask, g
-
-from base import webqtlConfig
-from dbFunction import webqtlDatabaseFunction
-from utility import webqtlUtil
-
-from MySQLdb import escape_string as escape
-from pprint import pformat as pf
-
-
-query = """ select ProbeSet.Name
- from ProbeSetXRef,
- ProbeSetFreeze,
- ProbeSet
- where ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id and
- ProbeSetFreeze.Name = "EPFLMouseMuscleCDRMA1211" and
- ProbeSetXRef.ProbeSetId = ProbeSet.Id;
- """
-
-markers = g.db.execute(query).fetchall()
-print("markers: ", pf(markers))
-
-if __name__ == '__main__':
- main()
\ No newline at end of file
diff --git a/wqflask/base/header.py b/wqflask/base/header.py
deleted file mode 100755
index ec15e174..00000000
--- a/wqflask/base/header.py
+++ /dev/null
@@ -1,6 +0,0 @@
-import webqtlConfig
-
-header_string = open(webqtlConfig.HTMLPATH + 'header.html', 'r').read()
-header_string = header_string.replace("\\'", "'")
-header_string = header_string.replace('%"','%%"')
-header_string = header_string.replace('', '%s')
diff --git a/wqflask/base/indexBody.py b/wqflask/base/indexBody.py
deleted file mode 100755
index a5bc4c17..00000000
--- a/wqflask/base/indexBody.py
+++ /dev/null
@@ -1,290 +0,0 @@
-index_body_string = """
-
- Select and Search
-
-
-
-
-
-
-
-
-
- ______________________________________________________
-
-
-
-Quick HELP Examples and
-
- User's Guide
-
-
- You can also use advanced commands. Copy these simple examples
- into the Get Any or Combined search fields:
-
-
-POSITION=(chr1 25 30) finds genes, markers, or transcripts on chromosome 1 between 25 and 30 Mb.
-
-MEAN=(15 16) LRS=(23 46) in the Combined field finds highly expressed genes (15 to 16 log2 units) AND with peak LRS linkage between 23 and 46.
-
-
-RIF=mitochondrial searches RNA databases for GeneRIF links.
-
-WIKI=nicotine searches GeneWiki for genes that you or other users have annotated with the word nicotine .
-
-GO:0045202 searches for synapse-associated genes listed in the Gene Ontology .
-
-
-GO:0045202 LRS=(9 99 Chr4 122 155) cisLRS=(9 999 10) in Combined finds synapse-associated genes with cis eQTL on Chr 4 from 122 and 155 Mb with LRS scores between 9 and 999.
-
-RIF=diabetes LRS=(9 999 Chr2 100 105) transLRS=(9 999 10) in Combined finds diabetes-associated transcripts with peak trans eQTLs on Chr 2 between 100 and 105 Mb with LRS scores between 9 and 999.
-
-
-
-
-
-
-
-
-
-
- Websites Affiliated with GeneNetwork
-
-
-
- ____________________________
-
-
Getting Started
-
- Select Species (or select All)
- Select Group (a specific sample)
- Select Type of data:
-
- Phenotype (traits)
- Genotype (markers)
- Expression (mRNAs)
-
- Select a Database
- Enter search terms in the Get Any or Combined field: words, genes, ID numbers, probes, advanced search commands
- Click on the Search button
- Optional: Use the Make Default button to save your preferences
-
-
- ____________________________
-
-
How to Use GeneNetwork
-
-
- Take a 20-40 minute GeneNetwork Tour that includes screen shots and typical steps in the analysis.
-
-
- For information about resources and methods, select the buttons.
-
-
-
-Try the Workstation site to explore data and features that are being implemented.
-
-
-Review the Conditions and Contacts pages for information on the status of data sets and advice on their use and citation.
-
-
-
-
-
-
- Mirror and Development Sites
-
-
-
-
- History and Archive
-
-
- GeneNetwork's Time Machine links to earlier versions that correspond to specific publication dates.
-
-
-
-
-
-
-"""
diff --git a/wqflask/base/myCookie.py b/wqflask/base/myCookie.py
deleted file mode 100755
index add7e6ea..00000000
--- a/wqflask/base/myCookie.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright (C) University of Tennessee Health Science Center, Memphis, TN.
-#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Affero General Public License
-# as published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU Affero General Public License for more details.
-#
-# This program is available from Source Forge: at GeneNetwork Project
-# (sourceforge.net/projects/genenetwork/).
-#
-# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010)
-# at rwilliams@uthsc.edu and xzhou15@uthsc.edu
-#
-#
-#
-# This module is used by GeneNetwork project (www.genenetwork.org)
-#
-# Created by GeneNetwork Core Team 2010/08/10
-#
-# Last updated by GeneNetwork Core Team 2010/10/20
-
-#########################################
-## python cookie and mod python cookie are
-## not compatible
-#########################################
-
-class myCookie(dict):
- 'define my own cookie'
-
- def __init__(self, name="", value="", expire = None, path="/"):
- self['name']= name
- self['value']= value
- self['expire']= expire
- self['path']= path
-
- def __getattr__(self, key):
- if key in self.keys():
- return self[key]
- else:
- return None
-
- def __nonzero__ (self):
- if self['name']:
- return 1
- else:
- return 0
diff --git a/wqflask/base/sessionData.py b/wqflask/base/sessionData.py
deleted file mode 100755
index 4b23060f..00000000
--- a/wqflask/base/sessionData.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# Copyright (C) University of Tennessee Health Science Center, Memphis, TN.
-#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Affero General Public License
-# as published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU Affero General Public License for more details.
-#
-# This program is available from Source Forge: at GeneNetwork Project
-# (sourceforge.net/projects/genenetwork/).
-#
-# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010)
-# at rwilliams@uthsc.edu and xzhou15@uthsc.edu
-#
-#
-#
-# This module is used by GeneNetwork project (www.genenetwork.org)
-#
-# Created by GeneNetwork Core Team 2010/08/10
-#
-# Last updated by GeneNetwork Core Team 2010/10/20
-
-#########################################
-#convert mod_python object to Dict object
-#in order to be able to be pickled
-#########################################
-
-class sessionData(dict):
- 'convert mod python Session object to Dict object'
-
- def __init__(self, mod_python_session=None):
-
- if not mod_python_session:
- mod_python_session = {}
-
- for key in mod_python_session.keys():
- self[key]= mod_python_session[key]
-
-
- def getvalue(self, k, default= None):
- try:
- return self[k]
- except:
- return default
-
- getfirst = getvalue
diff --git a/wqflask/base/templatePage.py b/wqflask/base/templatePage.py
deleted file mode 100755
index a94d5153..00000000
--- a/wqflask/base/templatePage.py
+++ /dev/null
@@ -1,222 +0,0 @@
-# Copyright (C) University of Tennessee Health Science Center, Memphis, TN.
-#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Affero General Public License
-# as published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU Affero General Public License for more details.
-#
-# This program is available from Source Forge: at GeneNetwork Project
-# (sourceforge.net/projects/genenetwork/).
-#
-# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010)
-# at rwilliams@uthsc.edu and xzhou15@uthsc.edu
-#
-#
-#
-# This module is used by GeneNetwork project (www.genenetwork.org)
-#
-# Created by GeneNetwork Core Team 2010/08/10
-#
-# Last updated by GeneNetwork Core Team 2010/10/20
-
-#templatePage.py
-#
-#--Genenetwork generates a lot of pages; this file is the generic version of them, defining routines they all use.
-#
-#Classes:
-#templatePage
-#
-#Functions (of templatePage):
-#__init__(...) -- class constructor, allows a more specific template to be used in addition to templatePage
-#__str__(self) -- returns the object's elements as a tuple
-#__del__(self) -- closes the current connection to MySQL, if there is one
-#write -- explained below
-#writefile -- explained below
-#openMysql(self) -- opens a MySQL connection and stores the resulting cursor in the object's cursor variable
-#updMysql(self) -- same as openMysql
-#error -- explained below
-#session -- explained below
-
-
-import socket
-import time
-import shutil
-import MySQLdb
-import os
-
-from htmlgen import HTMLgen2 as HT
-
-import template
-import webqtlConfig
-import header
-import footer
-from utility import webqtlUtil
-
-
-
-class templatePage:
-
- contents = ['title','basehref','js1','js2', 'layer', 'header', 'body', 'footer']
-
- # you can pass in another template here if you want
- def __init__(self, fd=None, template=template.template):
-
- # initiate dictionary
- self.starttime = time.time()
- self.dict = {}
- self.template = template
-
- for item in self.contents:
- self.dict[item] = ""
-
- self.dict['basehref'] = "" #webqtlConfig.BASEHREF
- self.cursor = None
-
- self.cookie = [] #XZ: list to hold cookies (myCookie object) being changed
- self.content_type = 'text/html'
- self.content_disposition = ''
- self.redirection = ''
- self.debug = ''
- self.attachment = ''
-
- #XZ: Holding data (new data or existing data being changed) that should be saved to session. The data must be picklable!!!
- self.session_data_changed = {}
-
- self.userName = 'Guest'
- self.privilege = 'guest'
-
- # Commenting this out for flask - we'll have to reimplement later - Sam
- #if fd.input_session_data.has_key('user'):
- # self.userName = fd.input_session_data['user']
- #if fd.input_session_data.has_key('privilege'):
- # self.privilege = fd.input_session_data['privilege']
-
- def __str__(self):
-
- #XZ: default setting
- thisUserName = self.userName
- thisPrivilege = self.privilege
- #XZ: user may just go through login or logoff page
- if self.session_data_changed.has_key('user'):
- thisUserName = self.session_data_changed['user']
- if self.session_data_changed.has_key('privilege'):
- thisPrivilege = self.session_data_changed['privilege']
-
- if thisUserName == 'Guest':
- userInfo = 'Welcome! Login '
- else:
- userInfo = 'Hi, %s! Logout ' % thisUserName
-
- reload(header)
- self.dict['header'] = header.header_string % userInfo
-
- serverInfo = "It took %2.3f second(s) for %s to generate this page" % (time.time()-self.starttime, socket.getfqdn())
- reload(footer)
- self.dict['footer'] = footer.footer_string % serverInfo
-
- slist = []
- for item in self.contents:
- slist.append(self.dict[item])
- return self.template % tuple(slist)
-
-
- def __del__(self):
- if self.cursor:
- self.cursor.close()
-
- def write(self):
- 'return string representation of this object'
-
- if self.cursor:
- self.cursor.close()
-
- return str(self)
-
- def writeFile(self, filename):
- 'save string representation of this object into a file'
- if self.cursor:
- self.cursor.close()
-
- try:
- 'it could take a long time to generate the file, save to .tmp first'
- fp = open(os.path.join(webqtlConfig.TMPDIR, filename+'.tmp'), 'wb')
- fp.write(str(self))
- fp.close()
- path_tmp = os.path.join(webqtlConfig.TMPDIR, filename+'.tmp')
- path_html = os.path.join(webqtlConfig.TMPDIR, filename)
- shutil.move(path_tmp,path_html)
- except:
- pass
-
- def openMysql(self):
- try:
- self.db_conn = MySQLdb.Connect(db=webqtlConfig.DB_NAME,host=webqtlConfig.MYSQL_SERVER, \
- user=webqtlConfig.DB_USER,passwd=webqtlConfig.DB_PASSWD)
- self.cursor = self.db_conn.cursor()
- return True
- except Exception:
- heading = "Connect MySQL Server"
- detail = ["Can't connect to MySQL server on '"+ webqtlConfig.MYSQL_SERVER+"':100061. \
- The server may be down at this time"]
- self.error(heading=heading,detail=detail,error="Error 2003")
- return False
-
- def updMysql(self):
- try:
- self.db_conn = MySQLdb.Connect(db=webqtlConfig.DB_UPDNAME,host=webqtlConfig.MYSQL_UPDSERVER, \
- user=webqtlConfig.DB_UPDUSER,passwd=webqtlConfig.DB_UPDPASSWD)
- self.cursor = self.db_conn.cursor()
- return True
- except Exception:
- heading = "Connect MySQL Server"
- detail = ["update: Can't connect to MySQL server on '"+ webqtlConfig.MYSQL_UPDSERVER+"':100061. \
- The server may be down at this time "]
- self.error(heading=heading,detail=detail,error="Error 2003")
- return False
-
- def error(self,heading="",intro=[],detail=[],title="Error",error="Error"):
- 'generating a WebQTL style error page'
- Heading = HT.Paragraph(heading)
- Heading.__setattr__("class","title")
-
- Intro = HT.Blockquote()
- if intro:
- for item in intro:
- Intro.append(item)
- else:
- Intro.append(HT.Strong('Sorry!'),' Error occurred while processing\
- your request.', HT.P(),'The nature of the error generated is as\
- follows:')
-
- Detail = HT.Blockquote()
- Detail.append(HT.Span("%s : " % error,Class="fwb cr"))
- if detail:
- Detail2 = HT.Blockquote()
- for item in detail:
- Detail2.append(item)
- Detail.append(HT.Italic(Detail2))
-
- #Detail.__setattr__("class","subtitle")
- TD_LR = HT.TD(height=200,width="100%",bgColor='#eeeeee',valign="top")
- TD_LR.append(Heading,Intro,Detail)
- self.dict['body'] = str(TD_LR)
- self.dict['title'] = title
-
- def session(self,mytitle="",myHeading=""):
- 'generate a auto-refreshing temporary html file(waiting page)'
- self.filename = webqtlUtil.generate_session()
- self.dict['title'] = mytitle
- self.dict['basehref'] = webqtlConfig.REFRESHSTR % (webqtlConfig.CGIDIR, self.filename) + "" #webqtlConfig.BASEHREF
-
- TD_LR = HT.TD(align="center", valign="middle", height=200,width="100%", bgColor='#eeeeee')
- Heading = HT.Paragraph(myHeading, Class="fwb fs16 cr")
- # NL, 07/27/2010. variable 'PROGRESSBAR' has been moved from templatePage.py to webqtlUtil.py;
- TD_LR.append(Heading, HT.BR(), webqtlUtil.PROGRESSBAR)
- self.dict['body'] = TD_LR
- self.writeFile(self.filename + '.html')
- return self.filename
diff --git a/wqflask/base/webqtlFormData.py b/wqflask/base/webqtlFormData.py
index a3537c87..44fdcc3f 100755
--- a/wqflask/base/webqtlFormData.py
+++ b/wqflask/base/webqtlFormData.py
@@ -35,15 +35,9 @@ import os
import reaper
import webqtlConfig
-import cookieData
-import sessionData
-from cgiData import cgiData
from webqtlCaseData import webqtlCaseData
from utility import webqtlUtil
-
-
-
class webqtlFormData(object):
'Represents data from a WebQTL form page, needed to generate the next page'
diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py
index a2958108..df1edb13 100755
--- a/wqflask/wqflask/search_results.py
+++ b/wqflask/wqflask/search_results.py
@@ -37,8 +37,6 @@ from dbFunction import webqtlDatabaseFunction
from utility import formatting
-#from base.JinjaPage import JinjaEnv, JinjaPage
-
#class QuickSearchResult(object):
#def __init__(self, key, result_fields):
# self.key = key
diff --git a/wqflask/wqflask/static/new/javascript/css/bar_chart.css b/wqflask/wqflask/static/new/javascript/css/bar_chart.css
deleted file mode 100755
index 78d31eee..00000000
--- a/wqflask/wqflask/static/new/javascript/css/bar_chart.css
+++ /dev/null
@@ -1,15 +0,0 @@
-.barchart .axis path,
-.barchart .axis line {
- fill: none;
- stroke: #000;
- shape-rendering: crispEdges;
-}
-
-.bar {
- fill: steelblue;
- shape-rendering: crispEdges;
-}
-/*
-.x.axis path {
- display: none;
-}*/
\ No newline at end of file
diff --git a/wqflask/wqflask/static/new/javascript/css/box_plot.css b/wqflask/wqflask/static/new/javascript/css/box_plot.css
deleted file mode 100755
index 4c743b33..00000000
--- a/wqflask/wqflask/static/new/javascript/css/box_plot.css
+++ /dev/null
@@ -1,20 +0,0 @@
-.box {
- font: 10px sans-serif;
-}
-
-.box line,
-.box rect,
-.box circle {
- fill: #fff;
- stroke: #000;
- stroke-width: 1.5px;
-}
-
-.box .center {
- stroke-dasharray: 3,3;
-}
-
-.box .outlier {
- fill: none;
- stroke: #ccc;
-}
\ No newline at end of file
diff --git a/wqflask/wqflask/static/new/javascript/css/charts.css b/wqflask/wqflask/static/new/javascript/css/charts.css
deleted file mode 100644
index 5f2d4d23..00000000
--- a/wqflask/wqflask/static/new/javascript/css/charts.css
+++ /dev/null
@@ -1,28 +0,0 @@
-body {
- font-family: sans-serif;
-}
-
-svg {
- margin-top: 10px;
- margin-left: 50px;
-}
-
-.line {
- stroke-width: 1;
- fill: none;
-}
-
-text {
- font-family: sans-serif;
- font-size: 11pt;
-}
-
-p {
- font-family: sans-serif;
- font-size: 12pt;
-}
-
-p#caption {
- margin-left: 100px;
- width: 500px;
-}
diff --git a/wqflask/wqflask/static/new/javascript/css/corr_matrix.css b/wqflask/wqflask/static/new/javascript/css/corr_matrix.css
deleted file mode 100755
index f4838f77..00000000
--- a/wqflask/wqflask/static/new/javascript/css/corr_matrix.css
+++ /dev/null
@@ -1,12 +0,0 @@
-.vertical_label {
- -webkit-transform: rotate(-90deg);
- -moz-transform: rotate(-90deg);
- -ms-transform: rotate(-90deg);
- -o-transform: rotate(-90deg);
- trasnform: rotate(-90deg);
- color: #000
- font-size: 22px;
- height: 50px;
- width: 100px;
- float: left;
-}
diff --git a/wqflask/wqflask/static/new/javascript/css/corr_scatter_plot.css b/wqflask/wqflask/static/new/javascript/css/corr_scatter_plot.css
deleted file mode 100755
index c62d4c9a..00000000
--- a/wqflask/wqflask/static/new/javascript/css/corr_scatter_plot.css
+++ /dev/null
@@ -1,13 +0,0 @@
-.chart {
-
-}
-
-.main text {
- font: 10px sans-serif;
-}
-
-.axis line, .axis path {
- shape-rendering: crispEdges;
- stroke: black;
- fill: none;
-}
diff --git a/wqflask/wqflask/static/new/javascript/css/d3-tip.min.css b/wqflask/wqflask/static/new/javascript/css/d3-tip.min.css
deleted file mode 100644
index 3d253caf..00000000
--- a/wqflask/wqflask/static/new/javascript/css/d3-tip.min.css
+++ /dev/null
@@ -1 +0,0 @@
-.d3-tip{line-height:1;font-weight:bold;padding:12px;background:rgba(0,0,0,0.8);color:#fff;border-radius:2px;pointer-events:none}.d3-tip:after{box-sizing:border-box;display:inline;font-size:10px;width:100%;line-height:1;color:rgba(0,0,0,0.8);position:absolute;pointer-events:none}.d3-tip.n:after{content:"\25BC";margin:-1px 0 0 0;top:100%;left:0;text-align:center}.d3-tip.e:after{content:"\25C0";margin:-4px 0 0 0;top:50%;left:-8px}.d3-tip.s:after{content:"\25B2";margin:0 0 1px 0;top:-8px;left:0;text-align:center}.d3-tip.w:after{content:"\25B6";margin:-4px 0 0 -1px;top:50%;left:100%}
\ No newline at end of file
diff --git a/wqflask/wqflask/static/new/javascript/css/interval_mapping.css b/wqflask/wqflask/static/new/javascript/css/interval_mapping.css
deleted file mode 100755
index 4a55d2e3..00000000
--- a/wqflask/wqflask/static/new/javascript/css/interval_mapping.css
+++ /dev/null
@@ -1,32 +0,0 @@
-.chr_interval_map .y_axis path,
-.chr_interval_map .y_axis line {
- fill: none;
- stroke: black;
- shape-rendering: crispEdges;
-}
-.chr_interval_map .y_axis text {
- font-family: sans-serif;
- font-size: 14px;
-}
-
-.chr_interval_map .x_axis path,
-.chr_interval_map .x_axis line {
- fill: none;
- stroke: black;
- shape-rendering: crispEdges;
-}
-.chr_interval_map .x_axis text {
- text-anchor: end;
- font-family: sans-serif;
- font-size: 8px;
-}
-/*
-interval_map rect {
- stroke: WhiteSmoke;
- fill: white;
-}
-
-interval_map path {
- stroke: steelblue;
- stroke-width: 1;
-}*/
\ No newline at end of file
diff --git a/wqflask/wqflask/static/new/javascript/css/main.css b/wqflask/wqflask/static/new/javascript/css/main.css
deleted file mode 100755
index 017bbdb8..00000000
--- a/wqflask/wqflask/static/new/javascript/css/main.css
+++ /dev/null
@@ -1,4 +0,0 @@
-.security_box {
- padding-left: 30px;
- padding-right: 30px;
-}
diff --git a/wqflask/wqflask/static/new/javascript/css/marker_regression.css b/wqflask/wqflask/static/new/javascript/css/marker_regression.css
deleted file mode 100755
index d81b5021..00000000
--- a/wqflask/wqflask/static/new/javascript/css/marker_regression.css
+++ /dev/null
@@ -1,38 +0,0 @@
-.chr_manhattan_plot .y_axis path,
-.chr_manhattan_plot .y_axis line {
- fill: none;
- stroke: black;
- shape-rendering: crispEdges;
-}
-.chr_manhattan_plot .y_axis text {
- font-family: sans-serif;
- font-size: 14px;
-}
-
-.chr_manhattan_plot .x_axis path,
-.chr_manhattan_plot .x_axis line {
- fill: none;
- stroke: black;
- shape-rendering: crispEdges;
-}
-
-.chr_manhattan_plot .x_axis text {
- text-anchor: end;
- font-family: sans-serif;
- font-size: 10px;
-}
-
-rect.pane {
- cursor: move;
- fill: none;
- pointer-events: all;
-}
-
-/*rect {
- stroke: WhiteSmoke;
- fill: lightgrey;
-}*/
-/*rect {
- stroke: WhiteSmoke;
- fill: Azure;
-}*/
\ No newline at end of file
diff --git a/wqflask/wqflask/static/new/javascript/css/panelutil.css b/wqflask/wqflask/static/new/javascript/css/panelutil.css
deleted file mode 100644
index ccd7eb01..00000000
--- a/wqflask/wqflask/static/new/javascript/css/panelutil.css
+++ /dev/null
@@ -1,91 +0,0 @@
-
-/* figures will always be within a div with class="qtlcharts" */
-div.qtlcharts {
- font-family: sans-serif;
- font-size: 11pt;
-}
-
-div.qtlcharts .title text {
- dominant-baseline: middle;
- fill: blue;
- text-anchor: middle;
-}
-
-div.qtlcharts .y.axis text {
- dominant-baseline: middle;
- text-anchor: end;
-}
-
-div.qtlcharts .y.axis text.title {
- text-anchor: middle;
- fill: slateblue;
-}
-
-div.qtlcharts .x.axis text {
- dominant-baseline: hanging;
- text-anchor: middle;
-}
-
-div.qtlcharts .x.axis text.title {
- fill: slateblue;
-}
-
-/*div.qtlcharts line.axis.grid {
- fill: none;
- stroke-width: 1;
- pointer-events: none;
-}
-
-div.qtlcharts line.x.axis.grid {
- stroke: rgb(200, 200, 200);
- stroke-width: 3;
-}
-
-div.qtlcharts line.y.axis.grid {
- stroke: white;
-}*/
-
-div.qtlcharts .extent {
- fill: #cac;
- opacity: 0.3;
-}
-
-div.qtlcharts circle.selected {
- fill: hotpink;
- opacity: 1;
-}
-
-div.qtlcharts a {
- color: #08c;
- text-decoration: none;
-}
-
-div.qtlcharts a:hover {
- color: #333;
- text-decoration: underline;
-}
-
-
-/* figure captions */
-.caption {
- font-family: Sans-serif;
- font-size: 11pt;
- margin-left: 60px;
- width: 600px;
-}
-
-
-/* d3 tip for tool tips */
-.d3-tip {
- background: darkslateblue;
- color: #fff;
- stroke: none;
- font-weight: bold;
- font-size: 16px;
- font-family: sans-serif;
- padding: 5px;
-}
-
-.d3-tip.e:after {
- color: darkslateblue;
-}
\ No newline at end of file
diff --git a/wqflask/wqflask/static/new/javascript/css/parsley.css b/wqflask/wqflask/static/new/javascript/css/parsley.css
deleted file mode 100755
index 7d244579..00000000
--- a/wqflask/wqflask/static/new/javascript/css/parsley.css
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Adapted from parsleyjs.org/documentation.html#parsleyclasses */
-
-input.parsley-success, textarea.parsley-success {
- color: #468847 !important;
- background-color: #DFF0D8 !important;
- border: 1px solid #D6E9C6 !important;
-}
-input.parsley-error, textarea.parsley-error {
- color: #B94A48 !important;
- background-color: #F2DEDE !important;
- border: 1px solid #EED3D7 !important;
-}
-ul.parsley-error-list {
- font-size: 11px;
- margin: 2px;
- list-style-type:none;
-}
-ul.parsley-error-list li {
- line-height: 11px;
-}
\ No newline at end of file
diff --git a/wqflask/wqflask/static/new/javascript/css/scatter-matrix.css b/wqflask/wqflask/static/new/javascript/css/scatter-matrix.css
deleted file mode 100644
index 147903be..00000000
--- a/wqflask/wqflask/static/new/javascript/css/scatter-matrix.css
+++ /dev/null
@@ -1,40 +0,0 @@
-#scatter-matrix { font-size: 14px; }
-
-.axis { shape-rendering: crispEdges; }
-.axis line { stroke: #ddd; stroke-width: 1px; }
-.axis path { display: none; }
-.axis text { font-size: 0.8em; }
-
-rect.extent { fill: #000; fill-opacity: .125; stroke: #fff; }
-rect.frame { fill: #fff; fill-opacity: .7; stroke: #aaa; }
-
-circle { fill: #ccc; fill-opacity: .5; }
-
-.legend circle { fill-opacity: 1; }
-.legend text { font-size: 18px; font-style: oblique; }
-
-.cell text { pointer-events: none; }
-
-.color-0 { fill: #800; }
-.color-1 { fill: #080; }
-.color-2 { fill: #008; }
-.color-3 { fill: #440; }
-.color-4 { fill: #044; }
-.color-5 { fill: #404; }
-.color-6 { fill: #400; }
-.color-7 { fill: #040; }
-.color-8 { fill: #004; }
-.color-9 { fill: #cc0; }
-.color-10 { fill: #0cc; }
-.color-11 { fill: #c0c; }
-.color-12 { fill: #880; }
-.color-13 { fill: #088; }
-.color-14 { fill: #808; }
-.color-15 { fill: #c00; }
-.color-16 { fill: #0c0; }
-.color-17 { fill: #00c; }
-
-.scatter-matrix-filter-control ul { list-style: none; padding-left: 10px; }
-.scatter-matrix-variable-control ul { list-style: none; padding-left: 10px; }
-.scatter-matrix-drill-control ul { list-style: none; padding-left: 10px; }
-
diff --git a/wqflask/wqflask/static/new/javascript/css/show_trait.css b/wqflask/wqflask/static/new/javascript/css/show_trait.css
deleted file mode 100644
index 9fc82a85..00000000
--- a/wqflask/wqflask/static/new/javascript/css/show_trait.css
+++ /dev/null
@@ -1,7 +0,0 @@
-tr .outlier {
- background-color: #ffff99;
-}
-
-#bar_chart_container {
- overflow-x:scroll;
-}
\ No newline at end of file
diff --git a/wqflask/wqflask/static/new/javascript/css/table.css b/wqflask/wqflask/static/new/javascript/css/table.css
deleted file mode 100755
index 1910ef88..00000000
--- a/wqflask/wqflask/static/new/javascript/css/table.css
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Adapted from http://coding.smashingmagazine.com/2008/08/13/top-10-css-table-designs/ */
-
-.one-column-emphasis
-{
- font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
- font-size: 12px;
- line-height: 1.6em;
- margin: 45px;
- width: 480px;
- text-align: left;
- border-collapse: collapse;
-}
-.one-column-emphasis th
-{
- font-size: 14px;
- font-weight: normal;
- padding: 12px 15px;
- color: #039;
-}
-.one-column-emphasis td
-{
- padding: 10px 15px;
- color: #669;
- border-top: 1px solid #e8edff;
-}
-.oce-first
-{
- background: #d0dafd;
- border-right: 10px solid transparent;
- border-left: 10px solid transparent;
-}
-.one-column-emphasis tr:hover td
-{
- color: #339;
- background: #eff2ff;
-}
--
cgit v1.2.3
From 1dd2981a25cdb33ab575206020490c7cf799e2da Mon Sep 17 00:00:00 2001
From: zsloan
Date: Fri, 27 Mar 2015 20:32:47 +0000
Subject: Changed HTMLPATH in webqtlConfig since I forgot to in the last commit
(since it used to point to the now-renamed 'web' directory). It obviously
also needs to be renamed later, but I'll have to find every place that calls
webqtlConfig.HTMLPATH first to do so.
---
wqflask/base/webqtlConfig.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'wqflask/base')
diff --git a/wqflask/base/webqtlConfig.py b/wqflask/base/webqtlConfig.py
index 49a596aa..48d8cd0a 100755
--- a/wqflask/base/webqtlConfig.py
+++ b/wqflask/base/webqtlConfig.py
@@ -52,7 +52,7 @@ ENSEMBLETRANSCRIPT_URL="http://useast.ensembl.org/Mus_musculus/Lucene/Details?sp
GNROOT = "/home/zas1024/gene/" # Will remove this and dependent items later
SECUREDIR = GNROOT + 'secure/'
COMMON_LIB = GNROOT + 'support/admin'
-HTMLPATH = GNROOT + 'web/'
+HTMLPATH = GNROOT + 'genotype_files/'
PYLMM_PATH = '/home/zas1024/plink/'
SNP_PATH = '/home/zas1024/snps/'
IMGDIR = GNROOT + '/wqflask/wqflask/images/'
--
cgit v1.2.3
From 64526b27922053d608147b2ce896b42ee9e5c2dc Mon Sep 17 00:00:00 2001
From: zsloan
Date: Fri, 10 Apr 2015 19:08:18 +0000
Subject: Added git large file system (the .gitattributes files) and fixed an
issue where rat trait pages wouldn't work
---
genotype_files/genotypes/.gitattributes | 1 +
genotype_files/new_genotypes/.gitattributes | 1 +
web/images/edit.png | Bin 4322 -> 0 bytes
wqflask/base/trait.py | 3 ++
wqflask/wqflask/show_trait/show_trait.py | 41 +++++-----------------------
5 files changed, 12 insertions(+), 34 deletions(-)
create mode 100644 genotype_files/genotypes/.gitattributes
create mode 100644 genotype_files/new_genotypes/.gitattributes
delete mode 100644 web/images/edit.png
(limited to 'wqflask/base')
diff --git a/genotype_files/genotypes/.gitattributes b/genotype_files/genotypes/.gitattributes
new file mode 100644
index 00000000..c311ac85
--- /dev/null
+++ b/genotype_files/genotypes/.gitattributes
@@ -0,0 +1 @@
+*.geno filter=lfs -crlf
diff --git a/genotype_files/new_genotypes/.gitattributes b/genotype_files/new_genotypes/.gitattributes
new file mode 100644
index 00000000..912ed80c
--- /dev/null
+++ b/genotype_files/new_genotypes/.gitattributes
@@ -0,0 +1 @@
+*.json filter=lfs -crlf
diff --git a/web/images/edit.png b/web/images/edit.png
deleted file mode 100644
index dda50521..00000000
Binary files a/web/images/edit.png and /dev/null differ
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 58bed865..f3648b80 100755
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -549,6 +549,9 @@ class GeneralTrait(object):
if self.alias:
alias = string.replace(self.alias, ";", " ")
alias = string.join(string.split(alias), ", ")
+ else:
+ alias = 'Not available'
+
return alias
diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py
index 929f5abb..836a0be5 100755
--- a/wqflask/wqflask/show_trait/show_trait.py
+++ b/wqflask/wqflask/show_trait/show_trait.py
@@ -283,13 +283,13 @@ class ShowTrait(object):
# else:
# pass
- g.db.execute("SELECT Name FROM InbredSet WHERE Name=%s", self.dataset.group.name)
+ result = g.db.execute("SELECT Name FROM InbredSet WHERE Name=%s", self.dataset.group.name)
if this_trait:
addSelectionButton = HT.Href(url="#redirect", onClick="addRmvSelection('%s', document.getElementsByName('%s')[0], 'addToSelection');" % (self.dataset.group.name, 'dataInput'))
addSelectionButton_img = HT.Image("/images/add_icon.jpg", name="addselect", alt="Add To Collection", title="Add To Collection", style="border:none;")
#addSelectionButton.append(addSelectionButton_img)
addSelectionText = "Add"
- elif self.cursor.fetchall():
+ elif result.fetchall():
addSelectionButton = HT.Href(url="#redirect", onClick="dataEditingFunc(document.getElementsByName('%s')[0], 'addRecord');" % ('dataInput'))
addSelectionButton_img = HT.Image("/images/add_icon.jpg", name="", alt="Add To Collection", title="Add To Collection", style="border:none;")
#addSelectionButton.append(addSelectionButton_img)
@@ -368,7 +368,7 @@ class ShowTrait(object):
blatsequence = ''
for seqt in seqs:
if int(seqt[1][-1]) % 2 == 1:
- blatsequence += string.strip(seqt[0])
+ blatsequence += string.strip(seqt[0])## NEEDED FOR UCSC GENOME BROWSER LINK
#--------Hongqiang add this part in order to not only blat ProbeSet, but also blat Probe
blatsequence = '%3E'+this_trait.name+'%0A'+blatsequence+'%0A'
@@ -469,52 +469,25 @@ class ShowTrait(object):
#XZ: Resource Links:
if this_trait.symbol:
- linkStyle = "background:#dddddd;padding:2"
- tSpan = HT.Span(style="font-family:verdana,serif;font-size:13px")
-
#XZ,12/26/2008: Gene symbol may contain single quotation mark.
#For example, Affymetrix, mouse430v2, 1440338_at, the symbol is 2'-Pde (geneid 211948)
#I debug this by using double quotation marks.
if _Species == "rat":
-
- #XZ, 7/16/2009: The url for SymAtlas (renamed as BioGPS) has changed. We don't need this any more
- #symatlas_species = "Rattus norvegicus"
-
- #self.cursor.execute("SELECT kgID, chromosome,txStart,txEnd FROM GeneList_rn33 WHERE geneSymbol = '%s'" % this_trait.symbol)
- self.cursor.execute('SELECT kgID, chromosome,txStart,txEnd FROM GeneList_rn33 WHERE geneSymbol = "%s"' % this_trait.symbol)
- try:
- kgId, chr, txst, txen = self.cursor.fetchall()[0]
+ result = g.db.execute("SELECT kgID, chromosome,txStart,txEnd FROM GeneList_rn33 WHERE geneSymbol = %s", (this_trait.symbol)).fetchone()
+ if result != None:
+ kgId, chr, txst, txen = result[0], result[1], result[2], result[3]
if chr and txst and txen and kgId:
txst = int(txst*1000000)
txen = int(txen*1000000)
- #tSpan.append(HT.Span(HT.Href(text= 'UCSC',target="mainFrame",\
- # title= 'Info from UCSC Genome Browser', url = webqtlConfig.UCSC_REFSEQ % ('rn3',kgId,chr,txst,txen),Class="fs14 fwn"), style=linkStyle)
- # , " "*2)
- except:
- pass
if _Species == "mouse":
-
- #XZ, 7/16/2009: The url for SymAtlas (renamed as BioGPS) has changed. We don't need this any more
- #symatlas_species = "Mus musculus"
-
- #self.cursor.execute("SELECT chromosome,txStart,txEnd FROM GeneList WHERE geneSymbol = '%s'" % this_trait.symbol)
- #try:
print("this_trait.symbol:", this_trait.symbol)
result = g.db.execute("SELECT chromosome,txStart,txEnd FROM GeneList WHERE geneSymbol = %s", (this_trait.symbol)).fetchone()
if result != None:
this_chr, txst, txen = result[0], result[1], result[2]
- #this_chr, txst, txen = g.db.execute("SELECT chromosome,txStart,txEnd FROM GeneList WHERE geneSymbol = %s", (this_trait.symbol)).fetchone()
if this_chr and txst and txen and this_trait.refseq_transcriptid :
txst = int(txst*1000000)
txen = int(txen*1000000)
- #tSpan.append(HT.Span(HT.Href(text= 'UCSC',target="mainFrame",\
- # title= 'Info from UCSC Genome Browser', url = webqtlConfig.UCSC_REFSEQ % ('mm9',
- # this_trait.refseq_transcriptid,
- # this_chr,
- # txst,
- # txen),
- # Class="fs14 fwn"), style=linkStyle)
- # , " "*2)
+ ## NEEDED FOR UCSC GENOME BROWSER LINK
#XZ, 7/16/2009: The url for SymAtlas (renamed as BioGPS) has changed. We don't need this any more
#tSpan.append(HT.Span(HT.Href(text= 'SymAtlas',target="mainFrame",\
--
cgit v1.2.3
From eef63adae30c1547f4c4189eb59a18d190c3aa08 Mon Sep 17 00:00:00 2001
From: pjotrp
Date: Mon, 11 May 2015 17:03:42 -0500
Subject: Moving pylmm out of the tree
---
wqflask/base/data_set.py | 2 +-
wqflask/utility/chunks.py | 96 ++++
wqflask/wqflask/heatmap/heatmap.py | 635 +++++++++++----------
.../wqflask/marker_regression/marker_regression.py | 4 +-
4 files changed, 417 insertions(+), 320 deletions(-)
create mode 100644 wqflask/utility/chunks.py
(limited to 'wqflask/base')
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 489bd374..9f805fc3 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -42,7 +42,7 @@ from base import species
from dbFunction import webqtlDatabaseFunction
from utility import webqtlUtil
from utility.benchmark import Bench
-from wqflask.my_pylmm.pyLMM import chunks
+from wqflask.utility import chunks
from maintenance import get_group_samplelists
diff --git a/wqflask/utility/chunks.py b/wqflask/utility/chunks.py
new file mode 100644
index 00000000..9565fb96
--- /dev/null
+++ b/wqflask/utility/chunks.py
@@ -0,0 +1,96 @@
+from __future__ import absolute_import, print_function, division
+
+import math
+import time
+
+
+def divide_into_chunks(the_list, number_chunks):
+ """Divides a list into approximately number_chunks smaller lists
+
+ >>> divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 3)
+ [[1, 2, 7], [3, 22, 8], [5, 22, 333]]
+ >>> divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 4)
+ [[1, 2, 7], [3, 22, 8], [5, 22, 333]]
+ >>> divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 5)
+ [[1, 2], [7, 3], [22, 8], [5, 22], [333]]
+ >>>
+
+ """
+ length = len(the_list)
+
+ if length == 0:
+ return [[]]
+
+ if length <= number_chunks:
+ number_chunks = length
+
+ chunksize = int(math.ceil(length / number_chunks))
+
+ chunks = []
+ for counter in range(0, length, chunksize):
+ chunks.append(the_list[counter:counter+chunksize])
+
+ return chunks
+
+def _confirm_chunk(original, result):
+ all_chunked = []
+ for chunk in result:
+ all_chunked.extend(chunk)
+ print("length of all chunked:", len(all_chunked))
+ assert original == all_chunked, "You didn't chunk right"
+
+
+def _chunk_test(divide_func):
+ import random
+ random.seed(7)
+
+ number_exact = 0
+ total_amount_off = 0
+
+ for test in range(1, 1001):
+ print("\n\ntest:", test)
+ number_chunks = random.randint(1, 20)
+ number_elements = random.randint(0, 100)
+ the_list = list(range(1, number_elements))
+ result = divide_func(the_list, number_chunks)
+
+ print("Dividing list of length {} into approximately {} chunks - got {} chunks".format(
+ len(the_list), number_chunks, len(result)))
+ print("result:", result)
+
+ _confirm_chunk(the_list, result)
+
+ amount_off = abs(number_chunks - len(result))
+ if amount_off == 0:
+ number_exact += 1
+ else:
+ total_amount_off += amount_off
+
+
+ print("\n{} exact out of {} [Total amount off: {}]".format(number_exact,
+ test,
+ total_amount_off))
+ assert number_exact == 558
+ assert total_amount_off == 1580
+ return number_exact, total_amount_off
+
+
+def _main():
+ info = dict()
+ #funcs = (("sam", sam_divide_into_chunks), ("zach", zach_divide_into_chunks))
+ funcs = (("only one", divide_into_chunks),)
+ for name, func in funcs:
+ start = time.time()
+ number_exact, total_amount_off = _chunk_test(func)
+ took = time.time() - start
+ info[name] = dict(number_exact=number_exact,
+ total_amount_off=total_amount_off,
+ took=took)
+
+ print("info is:", info)
+
+if __name__ == '__main__':
+ _main()
+ print("\nConfirming doctests...")
+ import doctest
+ doctest.testmod()
diff --git a/wqflask/wqflask/heatmap/heatmap.py b/wqflask/wqflask/heatmap/heatmap.py
index 9b6b1b69..035736fd 100644
--- a/wqflask/wqflask/heatmap/heatmap.py
+++ b/wqflask/wqflask/heatmap/heatmap.py
@@ -1,317 +1,318 @@
-from __future__ import absolute_import, print_function, division
-
-import sys
-sys.path.append(".")
-
-import gc
-import string
-import cPickle
-import os
-import datetime
-import time
-import pp
-import math
-import collections
-import resource
-
-import scipy
-import numpy as np
-from scipy import linalg
-
-from pprint import pformat as pf
-
-from htmlgen import HTMLgen2 as HT
-import reaper
-
-from base.trait import GeneralTrait
-from base import data_set
-from base import species
-from base import webqtlConfig
-from utility import webqtlUtil
-from wqflask.my_pylmm.data import prep_data
-from wqflask.my_pylmm.pyLMM import lmm
-from wqflask.my_pylmm.pyLMM import input
-from utility import helper_functions
-from utility import Plot, Bunch
-from utility import temp_data
-
-from MySQLdb import escape_string as escape
-
-import cPickle as pickle
-import simplejson as json
-
-from pprint import pformat as pf
-
-from redis import Redis
-Redis = Redis()
-
-from flask import Flask, g
-
-class Heatmap(object):
-
- def __init__(self, start_vars, temp_uuid):
-
- trait_db_list = [trait.strip() for trait in start_vars['trait_list'].split(',')]
-
- helper_functions.get_trait_db_obs(self, trait_db_list)
-
- self.temp_uuid = temp_uuid
- self.num_permutations = 5000
- self.dataset = self.trait_list[0][1]
-
- self.json_data = {} #The dictionary that will be used to create the json object that contains all the data needed to create the figure
-
- self.all_sample_list = []
- self.traits = []
-
- chrnames = []
- self.species = species.TheSpecies(dataset=self.trait_list[0][1])
- for key in self.species.chromosomes.chromosomes.keys():
- chrnames.append([self.species.chromosomes.chromosomes[key].name, self.species.chromosomes.chromosomes[key].mb_length])
-
- for trait_db in self.trait_list:
-
- this_trait = trait_db[0]
- self.traits.append(this_trait.name)
- this_sample_data = this_trait.data
-
- for sample in this_sample_data:
- if sample not in self.all_sample_list:
- self.all_sample_list.append(sample)
-
- self.sample_data = []
- for trait_db in self.trait_list:
- 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 = []
- markernames = []
-
- for trait in self.trait_results.keys():
- 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'])
-
- self.json_data['chrnames'] = chrnames
- self.json_data['lodnames'] = lodnames
- self.json_data['chr'] = chr_pos
- self.json_data['pos'] = pos
- self.json_data['markernames'] = markernames
-
- for trait in self.trait_results:
- self.json_data[trait] = self.trait_results[trait]
-
- self.js_data = dict(
- 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:
- self.dataset.group.get_markers()
- this_trait = trait_db[0]
- #this_db = trait_db[1]
- genotype = self.dataset.group.read_genotype_file()
- samples, values, variances = 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])
- 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 /home/zas1024/gene/wqflask/wqflask/my_pylmm/pyLMM/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):
- 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 = 'python /home/zas1024/gene/wqflask/wqflask/my_pylmm/pyLMM/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)
- 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
-
-
\ No newline at end of file
+from __future__ import absolute_import, print_function, division
+
+import sys
+sys.path.append(".")
+
+import gc
+import string
+import cPickle
+import os
+import datetime
+import time
+import pp
+import math
+import collections
+import resource
+
+import scipy
+import numpy as np
+from scipy import linalg
+
+from pprint import pformat as pf
+
+from htmlgen import HTMLgen2 as HT
+import reaper
+
+from base.trait import GeneralTrait
+from base import data_set
+from base import species
+from base import webqtlConfig
+from utility import webqtlUtil
+from wqflask.my_pylmm.data import prep_data
+# from wqflask.my_pylmm.pyLMM import lmm
+# from wqflask.my_pylmm.pyLMM import input
+from utility import helper_functions
+from utility import Plot, Bunch
+from utility import temp_data
+
+from MySQLdb import escape_string as escape
+
+import cPickle as pickle
+import simplejson as json
+
+from pprint import pformat as pf
+
+from redis import Redis
+Redis = Redis()
+
+from flask import Flask, g
+
+class Heatmap(object):
+
+ def __init__(self, start_vars, temp_uuid):
+
+ trait_db_list = [trait.strip() for trait in start_vars['trait_list'].split(',')]
+
+ helper_functions.get_trait_db_obs(self, trait_db_list)
+
+ self.temp_uuid = temp_uuid
+ self.num_permutations = 5000
+ self.dataset = self.trait_list[0][1]
+
+ self.json_data = {} #The dictionary that will be used to create the json object that contains all the data needed to create the figure
+
+ self.all_sample_list = []
+ self.traits = []
+
+ chrnames = []
+ self.species = species.TheSpecies(dataset=self.trait_list[0][1])
+ for key in self.species.chromosomes.chromosomes.keys():
+ chrnames.append([self.species.chromosomes.chromosomes[key].name, self.species.chromosomes.chromosomes[key].mb_length])
+
+ for trait_db in self.trait_list:
+
+ this_trait = trait_db[0]
+ self.traits.append(this_trait.name)
+ this_sample_data = this_trait.data
+
+ for sample in this_sample_data:
+ if sample not in self.all_sample_list:
+ self.all_sample_list.append(sample)
+
+ self.sample_data = []
+ for trait_db in self.trait_list:
+ 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 = []
+ markernames = []
+
+ for trait in self.trait_results.keys():
+ 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'])
+
+ self.json_data['chrnames'] = chrnames
+ self.json_data['lodnames'] = lodnames
+ self.json_data['chr'] = chr_pos
+ self.json_data['pos'] = pos
+ self.json_data['markernames'] = markernames
+
+ for trait in self.trait_results:
+ self.json_data[trait] = self.trait_results[trait]
+
+ self.js_data = dict(
+ 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:
+ self.dataset.group.get_markers()
+ this_trait = trait_db[0]
+ #this_db = trait_db[1]
+ genotype = self.dataset.group.read_genotype_file()
+ samples, values, variances = 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])
+ 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 /home/zas1024/gene/wqflask/wqflask/my_pylmm/pyLMM/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 = 'python /home/zas1024/gene/wqflask/wqflask/my_pylmm/pyLMM/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)
+ 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
+
+
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py
index 49521bd6..c5fab4ee 100755
--- a/wqflask/wqflask/marker_regression/marker_regression.py
+++ b/wqflask/wqflask/marker_regression/marker_regression.py
@@ -37,8 +37,8 @@ from utility import webqtlUtil
from wqflask.marker_regression import gemma_mapping
#from wqflask.marker_regression import rqtl_mapping
from wqflask.my_pylmm.data import prep_data
-from wqflask.my_pylmm.pyLMM import lmm
-from wqflask.my_pylmm.pyLMM import input
+# from wqflask.my_pylmm.pyLMM import lmm
+# from wqflask.my_pylmm.pyLMM import input
from utility import helper_functions
from utility import Plot, Bunch
from utility import temp_data
--
cgit v1.2.3
From bc98e46fc910357ea3aeca5950e94e38d9584f9e Mon Sep 17 00:00:00 2001
From: Pjotr Prins
Date: Mon, 11 May 2015 22:44:18 +0000
Subject: Moved chunks
---
wqflask/base/data_set.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'wqflask/base')
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 9f805fc3..1cd57b4b 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -42,7 +42,7 @@ from base import species
from dbFunction import webqtlDatabaseFunction
from utility import webqtlUtil
from utility.benchmark import Bench
-from wqflask.utility import chunks
+from utility import chunks
from maintenance import get_group_samplelists
--
cgit v1.2.3
From 2eeaf2f6df9deb3f89db0b5821d784b93eb4bc36 Mon Sep 17 00:00:00 2001
From: Artem Tarasov
Date: Tue, 12 May 2015 14:10:04 +0300
Subject: Fix #35
* 'aliases' and 'location' are shown only where relevant
* descriptions for phenotype datasets are provided at the top
---
wqflask/base/trait.py | 28 ++++++++++++++++++-----
wqflask/wqflask/templates/show_trait.html | 10 +++++---
wqflask/wqflask/templates/show_trait_details.html | 6 ++++-
3 files changed, 34 insertions(+), 10 deletions(-)
(limited to 'wqflask/base')
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index f3648b80..8930c917 100755
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -53,7 +53,8 @@ class GeneralTrait(object):
self.pvalue = None
self.mean = None
self.num_overlap = None
-
+ self.strand_probe = None
+ self.symbol = None
if kw.get('fullname'):
name2 = value.split("::")
@@ -532,13 +533,28 @@ class GeneralTrait(object):
setDescription.append(self.dataset.genHTML(Class='cori'))
return setDescription
+ @property
+ def name_header_fmt(self):
+ '''Return a human-readable name for use in page header'''
+ if self.dataset.type == 'ProbeSet':
+ return self.symbol
+ elif self.dataset.type == 'Geno':
+ return self.name
+ elif self.dataset.type == 'Publish':
+ return self.post_publication_abbreviation
+ else:
+ return "unnamed"
+
@property
def description_fmt(self):
'''Return a text formated description'''
- if self.description:
- formatted = self.description
- if self.probe_target_description:
- formatted += "; " + self.probe_target_description
+ if self.dataset.type == 'ProbeSet':
+ if self.description:
+ formatted = self.description
+ if self.probe_target_description:
+ formatted += "; " + self.probe_target_description
+ elif self.dataset.type == 'Publish':
+ formatted = self.post_publication_description
else:
formatted = "Not available"
return formatted.capitalize()
@@ -652,4 +668,4 @@ def get_sample_data():
# jsonable_sample_data[sample] = trait_ob.data[sample].value
#
#return jsonable_sample_data
-
\ No newline at end of file
+
diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html
index a1723ef8..d6f22f41 100755
--- a/wqflask/wqflask/templates/show_trait.html
+++ b/wqflask/wqflask/templates/show_trait.html
@@ -13,8 +13,12 @@
{% endblock %}
{% block content %}
- {{ header("{}".format(this_trait.symbol),
- '{}: {}'.format(this_trait.name, this_trait.description_fmt)) }}
+ {% if this_trait.dataset.type != 'Geno' %}
+ {{ header("{}".format(this_trait.name_header_fmt),
+ '{}: {}'.format(this_trait.name, this_trait.description_fmt)) }}
+ {% else %}
+ {{ header("{}".format(this_trait.name_header_fmt)) }}
+ {% endif %}