aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2016-10-03 19:20:21 +0000
committerzsloan2016-10-03 19:20:21 +0000
commitdb0633155b88667e3c6ea760e0637ff1308d34e0 (patch)
tree9a2d3c677bee40b9d428092727ad0e5e9842d912 /wqflask
parent6a0a3626baad96deb1e8dc7d27fe1fa15e8c5b98 (diff)
parent2115fcfde74375252f556153d48f52f4d15fb298 (diff)
downloadgenenetwork2-db0633155b88667e3c6ea760e0637ff1308d34e0.tar.gz
Merge branch 'master' of github.com:genenetwork/genenetwork2
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/base/trait.py2
-rw-r--r--wqflask/maintenance/__init__.py0
-rw-r--r--wqflask/utility/logger.py6
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression.py4
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression_gn1.py20
-rw-r--r--wqflask/wqflask/static/gif/error/Wild-Type-Mouse.gifbin0 -> 37328 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-aliens-29.gifbin0 -> 14088 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-angels-04.gifbin0 -> 12155 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-cats-016.gifbin0 -> 10388 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-cats-031.gifbin0 -> 6937 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-cell-phones-03.gifbin0 -> 14902 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-cell-phones-16.gifbin0 -> 7307 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-computers-13.gifbin0 -> 7616 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-computers-28.gifbin0 -> 7566 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-computers-32.gifbin0 -> 2970 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-computers-42.gifbin0 -> 9391 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-computers-60.gifbin0 -> 35873 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-computers-64.gifbin0 -> 20728 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-computers-65.gifbin0 -> 26358 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-computers-72.gifbin0 -> 16361 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-computers-74.gifbin0 -> 21087 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-computers-75.gifbin0 -> 98317 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-construction-sites-038.gifbin0 -> 949 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-dogs-04.gifbin0 -> 9450 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-dogs-14.gifbin0 -> 2532 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-dogs-18.gifbin0 -> 3596 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-dogs-47.gifbin0 -> 13920 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-dogs-50.gifbin0 -> 7297 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-lava-lamps-01.gifbin0 -> 27122 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-mice-02.gifbin0 -> 73345 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-mice-09.gifbin0 -> 27822 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-mice-24.gifbin0 -> 10566 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-smileys-063.gifbin0 -> 2230 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-smileys-068.gifbin0 -> 11751 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-smileys-134.gifbin0 -> 21431 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-smileys-211.gifbin0 -> 11209 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-smileys-234.gifbin0 -> 8677 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-stickmen-001.gifbin0 -> 6897 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-stickmen-002.gifbin0 -> 14098 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-stickmen-005.gifbin0 -> 13264 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-stickmen-012.gifbin0 -> 12141 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-stickmen-056.gifbin0 -> 5946 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-stickmen-059.gifbin0 -> 16427 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-stickmen-060.gifbin0 -> 14434 bytes
-rw-r--r--wqflask/wqflask/static/gif/error/animated-gifs-stickmen-069.gifbin0 -> 7668 bytes
-rw-r--r--wqflask/wqflask/templates/error.html61
-rw-r--r--wqflask/wqflask/views.py39
47 files changed, 119 insertions, 13 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 900e050c..32032ba7 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -363,7 +363,7 @@ class GeneralTrait(object):
FROM
Homologene, Species, InbredSet
WHERE
- Homologene.GeneId =%s AND
+ Homologene.GeneId ='%s' AND
InbredSet.Name = '%s' AND
InbredSet.SpeciesId = Species.Id AND
Species.TaxonomyId = Homologene.TaxonomyId
diff --git a/wqflask/maintenance/__init__.py b/wqflask/maintenance/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/wqflask/maintenance/__init__.py
diff --git a/wqflask/utility/logger.py b/wqflask/utility/logger.py
index ddc0ea82..b873e16f 100644
--- a/wqflask/utility/logger.py
+++ b/wqflask/utility/logger.py
@@ -31,6 +31,7 @@ import string
from inspect import isfunction
from pprint import pformat as pf
from inspect import stack
+import datetime
from utility.tools import LOG_LEVEL, LOG_LEVEL_DEBUG, LOG_SQL, LOG_FORMAT
@@ -66,7 +67,10 @@ LOG_LEVEL_DEBUG (NYI).
def error(self,*args):
"""Call logging.error for multiple args"""
- self.collect(self.logger.error,*args)
+ now = datetime.datetime.utcnow()
+ time_str = now.strftime('%H:%M:%S UTC %Y%m%d')
+ l = [time_str]+list(args)
+ self.collect(self.logger.error,*l)
def infof(self,*args):
"""Call logging.info for multiple args lazily"""
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py
index f2a2eb8c..f28407b3 100644
--- a/wqflask/wqflask/marker_regression/marker_regression.py
+++ b/wqflask/wqflask/marker_regression/marker_regression.py
@@ -41,6 +41,9 @@ from utility.tools import locate, locate_ignore_error, PYLMM_COMMAND, GEMMA_COMM
from utility.external import shell
from base.webqtlConfig import TMPDIR, GENERATED_TEXT_DIR
+import utility.logger
+logger = utility.logger.getLogger(__name__ )
+
class MarkerRegression(object):
def __init__(self, start_vars, temp_uuid):
@@ -197,6 +200,7 @@ class MarkerRegression(object):
self.control_marker = start_vars['control_marker']
self.do_control = start_vars['do_control']
+ logger.info("Running qtlreaper")
results = self.gen_reaper_results()
elif self.mapping_method == "plink":
results = self.run_plink()
diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py
index 9cef3cec..bc147f75 100644
--- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py
+++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py
@@ -44,6 +44,9 @@ from utility import Plot
from wqflask.interval_analyst import GeneUtil
from base.webqtlConfig import TMPDIR, GENERATED_TEXT_DIR, GENERATED_IMAGE_DIR
+import utility.logger
+logger = utility.logger.getLogger(__name__ )
+
#########################################
# Inteval Mapping Plot Page
#########################################
@@ -159,6 +162,7 @@ class MarkerRegression(object):
#if not self.openMysql():
# return
+ logger.info("Running qtlreaper")
#helper_functions.get_species_dataset_trait(self, start_vars)
@@ -211,7 +215,7 @@ class MarkerRegression(object):
self.plotScale = start_vars['mapping_scale']
else:
self.plotScale = "physic"
-
+
self.manhattan_plot = start_vars['manhattan_plot']
if 'permCheck' in start_vars.keys():
@@ -514,13 +518,13 @@ class MarkerRegression(object):
if self.dataset.group.species == "mouse":
if self.selectedChr == 20:
- chrName = "X"
+ chrName = "X"
else:
chrName = self.selectedChr
self.geneCol = GeneUtil.loadGenes(chrName, self.diffCol, self.startMb, self.endMb, webqtldatabase, "mouse")
elif self.dataset.group.species == "rat":
if self.selectedChr == 21:
- chrName = "X"
+ chrName = "X"
else:
chrName = self.selectedChr
self.geneCol = GeneUtil.loadGenes(chrName, self.diffCol, self.startMb, self.endMb, webqtldatabase, "rat")
@@ -860,7 +864,7 @@ class MarkerRegression(object):
BootCoord = []
i = 0
startX = xLeftOffset
-
+
if self.selectedChr == -1: #ZS: If viewing full genome/all chromosomes
for j, _chr in enumerate(self.genotype):
BootCoord.append( [])
@@ -883,8 +887,8 @@ class MarkerRegression(object):
else:
Xc = startX + (_locus.cM-_chr[0].cM)*plotXScale
BootCoord[-1].append([Xc, self.bootResult[i]])
- i += 1
-
+ i += 1
+
#reduce bootResult
if self.selectedChr > -1:
maxBootBar = 80.0
@@ -1851,7 +1855,7 @@ class MarkerRegression(object):
if j == 0:
canvas.drawLine(startPosX,yZero,startPosX,yZero+40, color=lineColor)
startPosX += (self.ChrLengthDistList[j]+self.GraphInterval)*plotXScale
-
+
centimorganLabelFont = pid.Font(ttf="verdana", size=18*zoom*1.5, bold=0)
canvas.drawString("Centimorgans", xLeftOffset + (plotWidth - canvas.stringWidth("Megabases", font=centimorganLabelFont))/2,
strYLoc + canvas.fontHeight(MBLabelFont)+ 10*(zoom%2) + 10, font=centimorganLabelFont, color=pid.black)
@@ -2963,7 +2967,7 @@ class MarkerRegression(object):
chr_as_int = 20
else:
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))
diff --git a/wqflask/wqflask/static/gif/error/Wild-Type-Mouse.gif b/wqflask/wqflask/static/gif/error/Wild-Type-Mouse.gif
new file mode 100644
index 00000000..2c68b5ee
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/Wild-Type-Mouse.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-aliens-29.gif b/wqflask/wqflask/static/gif/error/animated-gifs-aliens-29.gif
new file mode 100644
index 00000000..e9d38277
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-aliens-29.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-angels-04.gif b/wqflask/wqflask/static/gif/error/animated-gifs-angels-04.gif
new file mode 100644
index 00000000..94e11847
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-angels-04.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-cats-016.gif b/wqflask/wqflask/static/gif/error/animated-gifs-cats-016.gif
new file mode 100644
index 00000000..7e6ec9a3
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-cats-016.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-cats-031.gif b/wqflask/wqflask/static/gif/error/animated-gifs-cats-031.gif
new file mode 100644
index 00000000..af7ef655
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-cats-031.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-cell-phones-03.gif b/wqflask/wqflask/static/gif/error/animated-gifs-cell-phones-03.gif
new file mode 100644
index 00000000..89c79ddf
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-cell-phones-03.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-cell-phones-16.gif b/wqflask/wqflask/static/gif/error/animated-gifs-cell-phones-16.gif
new file mode 100644
index 00000000..7530d180
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-cell-phones-16.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-computers-13.gif b/wqflask/wqflask/static/gif/error/animated-gifs-computers-13.gif
new file mode 100644
index 00000000..afb05c62
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-computers-13.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-computers-28.gif b/wqflask/wqflask/static/gif/error/animated-gifs-computers-28.gif
new file mode 100644
index 00000000..f5b4a563
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-computers-28.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-computers-32.gif b/wqflask/wqflask/static/gif/error/animated-gifs-computers-32.gif
new file mode 100644
index 00000000..7258e594
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-computers-32.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-computers-42.gif b/wqflask/wqflask/static/gif/error/animated-gifs-computers-42.gif
new file mode 100644
index 00000000..ed1f8722
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-computers-42.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-computers-60.gif b/wqflask/wqflask/static/gif/error/animated-gifs-computers-60.gif
new file mode 100644
index 00000000..f58d69f1
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-computers-60.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-computers-64.gif b/wqflask/wqflask/static/gif/error/animated-gifs-computers-64.gif
new file mode 100644
index 00000000..5d5b4fdf
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-computers-64.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-computers-65.gif b/wqflask/wqflask/static/gif/error/animated-gifs-computers-65.gif
new file mode 100644
index 00000000..b4b10845
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-computers-65.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-computers-72.gif b/wqflask/wqflask/static/gif/error/animated-gifs-computers-72.gif
new file mode 100644
index 00000000..e60cb4fe
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-computers-72.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-computers-74.gif b/wqflask/wqflask/static/gif/error/animated-gifs-computers-74.gif
new file mode 100644
index 00000000..bd7b72f3
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-computers-74.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-computers-75.gif b/wqflask/wqflask/static/gif/error/animated-gifs-computers-75.gif
new file mode 100644
index 00000000..916d6b33
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-computers-75.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-construction-sites-038.gif b/wqflask/wqflask/static/gif/error/animated-gifs-construction-sites-038.gif
new file mode 100644
index 00000000..0ec782c4
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-construction-sites-038.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-dogs-04.gif b/wqflask/wqflask/static/gif/error/animated-gifs-dogs-04.gif
new file mode 100644
index 00000000..9515c18a
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-dogs-04.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-dogs-14.gif b/wqflask/wqflask/static/gif/error/animated-gifs-dogs-14.gif
new file mode 100644
index 00000000..f1e2e1f5
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-dogs-14.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-dogs-18.gif b/wqflask/wqflask/static/gif/error/animated-gifs-dogs-18.gif
new file mode 100644
index 00000000..572849d5
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-dogs-18.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-dogs-47.gif b/wqflask/wqflask/static/gif/error/animated-gifs-dogs-47.gif
new file mode 100644
index 00000000..d808c9ee
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-dogs-47.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-dogs-50.gif b/wqflask/wqflask/static/gif/error/animated-gifs-dogs-50.gif
new file mode 100644
index 00000000..9865ee45
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-dogs-50.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-lava-lamps-01.gif b/wqflask/wqflask/static/gif/error/animated-gifs-lava-lamps-01.gif
new file mode 100644
index 00000000..ee9c113d
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-lava-lamps-01.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-mice-02.gif b/wqflask/wqflask/static/gif/error/animated-gifs-mice-02.gif
new file mode 100644
index 00000000..5ca2ee5c
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-mice-02.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-mice-09.gif b/wqflask/wqflask/static/gif/error/animated-gifs-mice-09.gif
new file mode 100644
index 00000000..7cb361e4
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-mice-09.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-mice-24.gif b/wqflask/wqflask/static/gif/error/animated-gifs-mice-24.gif
new file mode 100644
index 00000000..96a26450
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-mice-24.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-smileys-063.gif b/wqflask/wqflask/static/gif/error/animated-gifs-smileys-063.gif
new file mode 100644
index 00000000..62de166c
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-smileys-063.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-smileys-068.gif b/wqflask/wqflask/static/gif/error/animated-gifs-smileys-068.gif
new file mode 100644
index 00000000..3550e978
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-smileys-068.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-smileys-134.gif b/wqflask/wqflask/static/gif/error/animated-gifs-smileys-134.gif
new file mode 100644
index 00000000..954ab614
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-smileys-134.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-smileys-211.gif b/wqflask/wqflask/static/gif/error/animated-gifs-smileys-211.gif
new file mode 100644
index 00000000..596174d7
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-smileys-211.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-smileys-234.gif b/wqflask/wqflask/static/gif/error/animated-gifs-smileys-234.gif
new file mode 100644
index 00000000..5aba636b
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-smileys-234.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-001.gif b/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-001.gif
new file mode 100644
index 00000000..7896ff1f
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-001.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-002.gif b/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-002.gif
new file mode 100644
index 00000000..89da6441
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-002.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-005.gif b/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-005.gif
new file mode 100644
index 00000000..b7887630
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-005.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-012.gif b/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-012.gif
new file mode 100644
index 00000000..f6697d02
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-012.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-056.gif b/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-056.gif
new file mode 100644
index 00000000..2b2496a4
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-056.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-059.gif b/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-059.gif
new file mode 100644
index 00000000..f2188656
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-059.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-060.gif b/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-060.gif
new file mode 100644
index 00000000..aa8f7bd3
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-060.gif
Binary files differ
diff --git a/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-069.gif b/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-069.gif
new file mode 100644
index 00000000..473212e4
--- /dev/null
+++ b/wqflask/wqflask/static/gif/error/animated-gifs-stickmen-069.gif
Binary files differ
diff --git a/wqflask/wqflask/templates/error.html b/wqflask/wqflask/templates/error.html
new file mode 100644
index 00000000..7ab2bf2f
--- /dev/null
+++ b/wqflask/wqflask/templates/error.html
@@ -0,0 +1,61 @@
+{% extends "base.html" %}
+{% block title %}Error: {{message}}{% endblock %}
+{% block content %}
+<!-- Start of body -->
+
+<div class="col-md-8">
+<div class="form-group has-error">
+ <div class="control-label" for="inputError1">
+
+ <img src="/static/gif/error/{{ error_image }}">
+
+ <h1>ERROR</h1>
+
+ <p>
+ This error is not what we wanted to see. Unfortunately errors
+ are part of all software systems and we need to resolve this
+ together.
+ </p>
+ <p>
+ <b>It is important to report this ERROR so we can fix it for everyone</b>.
+ </p>
+
+ <p>
+ Report to the GeneNetwork team by recording the steps you take
+ to reproduce this ERROR. Next to those steps, copy-paste below
+ stack trace, either as
+ a <a href="https://github.com/genenetwork/genenetwork2/issues/new">new
+ issue</a> or E-mail this full page to one of the developers
+ directly.
+ </p>
+ </div>
+
+ <p>
+ (GeneNetwork error: {{message[:128]}})
+ </p>
+
+ <pre>
+ {{ stack[0] }}
+ {{ message }} (error)
+ {{ stack[-3] }}
+ {{ stack[-2] }}
+ </pre>
+
+ <p>
+ To check if this already a known issue, search the
+ <a href="https://github.com/genenetwork/genenetwork2/issues">issue
+ tracker</a>.
+ </p>
+
+ <a href="#Stack" class="btn btn-default" data-toggle="collapse">Toggle full stack trace</a>
+ <div id="Stack" class="collapse">
+ <pre>
+ {% for line in stack %} {{ line }}
+ {% endfor %}
+ </pre>
+ </div>
+</div>
+</div>
+
+
+{% endblock %}
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 41e2c7be..cf316bee 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -4,6 +4,11 @@
from __future__ import absolute_import, division, print_function
+import traceback # for error page
+import os # for error gifs
+import random # for random error gif
+import datetime # for errors
+import time # for errors
import sys
import csv
import xlsxwriter
@@ -26,7 +31,7 @@ import base64
import array
import sqlalchemy
from wqflask import app
-from flask import g, Response, request, render_template, send_from_directory, jsonify, redirect
+from flask import g, Response, request, make_response, render_template, send_from_directory, jsonify, redirect
from wqflask import search_results
from wqflask import gsearch
from wqflask import update_search_results
@@ -58,6 +63,8 @@ from wqflask import user_manager
from wqflask import collect
from wqflask.database import db_session
+import werkzeug
+
import utility.logger
logger = utility.logger.getLogger(__name__ )
@@ -82,6 +89,31 @@ def shutdown_session(exception=None):
# from wqflask import tracer
# tracer.turn_on()
+@app.errorhandler(Exception)
+def handle_bad_request(e):
+ err_msg = str(e)
+ logger.error(err_msg)
+ logger.error(request.url)
+ # get the stack trace and send it to the logger
+ exc_type, exc_value, exc_traceback = sys.exc_info()
+ logger.error(traceback.format_exc())
+ now = datetime.datetime.utcnow()
+ time_str = now.strftime('%l:%M%p UTC %b %d, %Y')
+ formatted_lines = [request.url + " ("+time_str+")"]+traceback.format_exc().splitlines()
+
+ # Handle random animations
+ # Use a cookie to have one animation on refresh
+ animation = request.cookies.get(err_msg[:64])
+ if not animation:
+ list = [fn for fn in os.listdir("./wqflask/static/gif/error") if fn.endswith(".gif") ]
+ animation = random.choice(list)
+
+ resp = make_response(render_template("error.html",message=err_msg,stack=formatted_lines,error_image=animation))
+
+ # logger.error("Set cookie %s with %s" % (err_msg, animation))
+ resp.set_cookie(err_msg[:64],animation)
+ return resp
+
@app.route("/")
def index_page():
logger.info("Sending index_page")
@@ -395,6 +427,7 @@ def mapping_results_container_page():
@app.route("/marker_regression", methods=('POST',))
def marker_regression_page():
initial_start_vars = request.form
+ logger.debug("Marker regression called with initial_start_vars:", initial_start_vars.items())
temp_uuid = initial_start_vars['temp_uuid']
wanted = (
'trait_id',
@@ -432,11 +465,11 @@ def marker_regression_page():
'mapmethod_rqtl_geno',
'mapmodel_rqtl_geno'
)
- logger.info("Marker regression called with initial_start_vars:", initial_start_vars)
start_vars = {}
for key, value in initial_start_vars.iteritems():
if key in wanted or key.startswith(('value:')):
start_vars[key] = value
+ logger.debug("Marker regression called with start_vars:", start_vars)
version = "v3"
key = "marker_regression:{}:".format(version) + json.dumps(start_vars, sort_keys=True)
@@ -546,7 +579,7 @@ def network_graph_page():
return render_template("network_graph.html", **template_vars.__dict__)
else:
return render_template("empty_collection.html", **{'tool':'Network Graph'})
-
+
@app.route("/corr_compute", methods=('POST',))
def corr_compute_page():
logger.info("In corr_compute, request.form is:", pf(request.form))