aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2017-05-22 15:48:34 +0000
committerzsloan2017-05-22 15:48:34 +0000
commitd3d8da25bd837068498c78d5f8541952ae950e56 (patch)
tree42b585c2e4020a621ff4c7a64797174ae5683565 /wqflask
parente6afa39ac0bf769bed181ad9e16fc4fc8e16bb22 (diff)
parent9d4cb56608ca5de3495ede9149443e772a25d706 (diff)
downloadgenenetwork2-d3d8da25bd837068498c78d5f8541952ae950e56.tar.gz
Merge branch 'master' of https://github.com/genenetwork/genenetwork2
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/base/webqtlConfig.py2
-rw-r--r--wqflask/maintenance/gen_select_dataset.py2
-rw-r--r--wqflask/utility/tools.py11
-rw-r--r--wqflask/wqflask/database.py2
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression.py2
-rw-r--r--wqflask/wqflask/marker_regression/marker_regression_gn1.py15
-rw-r--r--wqflask/wqflask/templates/base.html2
-rw-r--r--wqflask/wqflask/templates/error.html4
-rw-r--r--wqflask/wqflask/templates/marker_regression_gn1.html2
-rw-r--r--wqflask/wqflask/templates/show_trait.html1
-rw-r--r--wqflask/wqflask/templates/show_trait_statistics.html5
-rw-r--r--wqflask/wqflask/user_manager.py26
-rw-r--r--wqflask/wqflask/views.py5
13 files changed, 42 insertions, 37 deletions
diff --git a/wqflask/base/webqtlConfig.py b/wqflask/base/webqtlConfig.py
index 1e47e183..e5f10edf 100644
--- a/wqflask/base/webqtlConfig.py
+++ b/wqflask/base/webqtlConfig.py
@@ -65,7 +65,7 @@ ENSEMBLETRANSCRIPT_URL="http://useast.ensembl.org/Mus_musculus/Lucene/Details?sp
# want to reach this base dir
assert_writable_dir(TEMPDIR)
-TMPDIR = mk_dir(TEMPDIR+'gn2')
+TMPDIR = mk_dir(TEMPDIR+'/gn2/')
assert_writable_dir(TMPDIR)
CACHEDIR = mk_dir(TMPDIR+'/cache/')
diff --git a/wqflask/maintenance/gen_select_dataset.py b/wqflask/maintenance/gen_select_dataset.py
index e5726656..a5fd86e2 100644
--- a/wqflask/maintenance/gen_select_dataset.py
+++ b/wqflask/maintenance/gen_select_dataset.py
@@ -57,7 +57,7 @@ import urlparse
from pprint import pformat as pf
-#Engine = sa.create_engine(zach_settings.SQLALCHEMY_DATABASE_URI)
+#Engine = sa.create_engine(zach_settings.SQL_URI)
# build MySql database connection
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index c28c617a..d46a84ba 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -205,21 +205,24 @@ SQL_URI = get_setting('SQL_URI')
LOG_LEVEL = get_setting('LOG_LEVEL')
LOG_LEVEL_DEBUG = get_setting_int('LOG_LEVEL_DEBUG')
LOG_SQL = get_setting_bool('LOG_SQL')
-LOG_SQLALCHEMY = get_setting_bool('LOG_SQLALCHEMY')
+LOG_SQL_ALCHEMY = get_setting_bool('LOG_SQL_ALCHEMY')
LOG_BENCH = get_setting_bool('LOG_BENCH')
LOG_FORMAT = "%(message)s" # not yet in use
USE_REDIS = get_setting_bool('USE_REDIS')
USE_GN_SERVER = get_setting_bool('USE_GN_SERVER')
GENENETWORK_FILES = get_setting('GENENETWORK_FILES')
-TEMP_TRAITS = get_setting('TEMP_TRAITS')
+GUIX_JS_PATH = get_setting('GUIX_JS_PATH')
+assert_dir(GUIX_JS_PATH)
PYLMM_COMMAND = pylmm_command()
GEMMA_COMMAND = gemma_command()
-GEMMA_RESULTS_PATH = get_setting('GEMMA_RESULTS_PATH')
PLINK_COMMAND = plink_command()
TEMPDIR = tempdir() # defaults to UNIX TMPDIR
+TWITTER_POST_FETCHER_JS_PATH = GUIX_JS_PATH + "/Twitter-Post-Fetcher"
+assert_dir(TWITTER_POST_FETCHER_JS_PATH)
+
from six import string_types
if os.environ.get('WQFLASK_OVERRIDES'):
@@ -234,5 +237,3 @@ if os.environ.get('WQFLASK_OVERRIDES'):
else:
OVERRIDES[k] = cmd
logger.debug(OVERRIDES)
-
-assert_dir(get_setting("TWITTER_POST_FETCHER_JS_PATH"))
diff --git a/wqflask/wqflask/database.py b/wqflask/wqflask/database.py
index 4df872ad..96c2c301 100644
--- a/wqflask/wqflask/database.py
+++ b/wqflask/wqflask/database.py
@@ -22,8 +22,8 @@ def init_db():
# they will be registered properly on the metadata. Otherwise
# you will have to import them first before calling init_db()
#import yourapplication.models
+ logger.info("Initializing database connection")
import wqflask.model
- logger.debug("Creating all model metadata")
Base.metadata.create_all(bind=engine)
logger.info("Done creating all model metadata")
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py
index 87532445..8882c515 100644
--- a/wqflask/wqflask/marker_regression/marker_regression.py
+++ b/wqflask/wqflask/marker_regression/marker_regression.py
@@ -37,7 +37,7 @@ from utility import temp_data
from utility.benchmark import Bench
from wqflask.marker_regression import gemma_mapping, rqtl_mapping, qtlreaper_mapping, plink_mapping
-from utility.tools import locate, locate_ignore_error, PYLMM_COMMAND, GEMMA_COMMAND, GEMMA_RESULTS_PATH, PLINK_COMMAND, TEMPDIR
+from utility.tools import locate, locate_ignore_error, PYLMM_COMMAND, GEMMA_COMMAND, PLINK_COMMAND, TEMPDIR
from utility.external import shell
from base.webqtlConfig import TMPDIR, GENERATED_TEXT_DIR
diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py
index 49959a74..82a44796 100644
--- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py
+++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py
@@ -1018,7 +1018,7 @@ class MarkerRegression(object):
else:
if self.selectedChr > -1:
for i, qtlresult in enumerate(self.qtlresults):
- if qtlresult['Chr'] != self.selectedChr:
+ if qtlresult['chr'] != self.selectedChr:
continue
if i==0 and qtlresult['Mb'] >= Mb:
@@ -1027,7 +1027,7 @@ class MarkerRegression(object):
#the trait's position is between two traits
if i > 0 and self.qtlresults[i-1]['Mb'] < Mb and qtlresult['Mb'] >= Mb:
- locPixel = xLeftOffset + plotXScale*(self.qtlresults[i-1]['cM']+(qtlresult['cM']-self.qtlresults[i-1]['cM'])*(Mb - self.qtlresults[i-1]['Mb'])/(qtlresult['Mb']-self.qtlresults[i-1]['Mb']))
+ locPixel = xLeftOffset + plotXScale*(self.qtlresults[i-1]['Mb']+(qtlresult['Mb']-self.qtlresults[i-1]['Mb'])*(Mb - self.qtlresults[i-1]['Mb'])/(qtlresult['Mb']-self.qtlresults[i-1]['Mb']))
break
#the trait's position is on the right of the last genotype
@@ -1036,11 +1036,12 @@ class MarkerRegression(object):
else:
locPixel = xLeftOffset
for i, _chr in enumerate(self.ChrList):
- if _chr != Chr:
- locPixel += (self.ChrLengthDistList[i] + self.GraphInterval)*plotXScale
- else:
- locPixel += (Mb*(_chr[-1].cM-_chr[0].cM)/self.ChrLengthCMList[i])*plotXScale
- break
+ if i < (len(self.ChrList)-1):
+ if _chr != Chr:
+ locPixel += (self.ChrLengthDistList[i] + self.GraphInterval)*plotXScale
+ else:
+ locPixel += (Mb*(_chr[-1].cM-_chr[0].cM)/self.ChrLengthCMList[i])*plotXScale
+ break
if locPixel >= 0 and self.plotScale == 'physic':
traitPixel = ((locPixel, yZero), (locPixel-6, yZero+12), (locPixel+6, yZero+12))
canvas.drawPolygon(traitPixel, edgeColor=pid.black, fillColor=self.TRANSCRIPT_LOCATION_COLOR, closed=1)
diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html
index ec55ebeb..9ca3d63a 100644
--- a/wqflask/wqflask/templates/base.html
+++ b/wqflask/wqflask/templates/base.html
@@ -144,7 +144,7 @@
<p>
Development and source code on <a href="https://github.com/genenetwork/">github</a> with <a href="https://github.com/genenetwork/genenetwork2/issues">issue tracker</a> and <a href="https://github.com/genenetwork/genenetwork2/blob/master/README.md">documentation</a>. Join the <a href="http://listserv.uthsc.edu/mailman/listinfo/genenetwork-dev">mailing list</a> and find us on <a href="https://webchat.freenode.net/">IRC</a> (#genenetwork channel).
{% if version: %}
- <p><small>GeneNetwork v{{ version }}</small></p>
+ <p><small>GeneNetwork {{ version }}</small></p>
{% endif %}
</div>
diff --git a/wqflask/wqflask/templates/error.html b/wqflask/wqflask/templates/error.html
index c707a4fc..2f1e06fa 100644
--- a/wqflask/wqflask/templates/error.html
+++ b/wqflask/wqflask/templates/error.html
@@ -35,7 +35,7 @@
</p>
<pre>
- GeneNetwork v{{ version }} {{ stack[0] }}
+ GeneNetwork {{ version }} {{ stack[0] }}
{{ message }} (error)
{{ stack[-3] }}
{{ stack[-2] }}
@@ -50,7 +50,7 @@
<a href="#Stack" class="btn btn-default" data-toggle="collapse">Toggle full stack trace</a>
<div id="Stack" class="collapse">
<pre>
- GeneNetwork v{{ version }} {% for line in stack %} {{ line }}
+ GeneNetwork {{ version }} {% for line in stack %} {{ line }}
{% endfor %}
</pre>
</div>
diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html
index 4cea51b2..65debd10 100644
--- a/wqflask/wqflask/templates/marker_regression_gn1.html
+++ b/wqflask/wqflask/templates/marker_regression_gn1.html
@@ -14,7 +14,7 @@
<input type="hidden" name="temp_uuid" value="{{ temp_uuid }}">
<input type="hidden" name="trait_id" value="{{ this_trait.name }}">
<input type="hidden" name="dataset" value="{{ dataset.name }}">
- {% if mapping_method == "reaper" %}
+ {% if mapping_method == "reaper" or mapping_method == "rqtl_geno" %}
<input type="hidden" name="genofile" value="{{ dataset.group.genofile }}">
{% endif %}
<input type="hidden" name="method" value="{{ mapping_method }}">
diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html
index 56b6cc62..5a880647 100644
--- a/wqflask/wqflask/templates/show_trait.html
+++ b/wqflask/wqflask/templates/show_trait.html
@@ -129,6 +129,7 @@
<script type="text/javascript" src="/static/new/js_external/d3-tip.min.js"></script>
<script type="text/javascript" src="/static/new/js_external/jstat.min.js"></script>
<script type="text/javascript" src="/static/new/js_external/shapiro-wilk.js"></script>
+ <script type="text/javascript" src="/static/new/js_external/saveSvgAsPng.js"></script>
<script type="text/javascript" src="/static/new/javascript/colorbrewer.js"></script>
<script type="text/javascript" src="/static/new/javascript/stats.js"></script>
diff --git a/wqflask/wqflask/templates/show_trait_statistics.html b/wqflask/wqflask/templates/show_trait_statistics.html
index 0a0e9990..ac44b656 100644
--- a/wqflask/wqflask/templates/show_trait_statistics.html
+++ b/wqflask/wqflask/templates/show_trait_statistics.html
@@ -94,12 +94,15 @@
<div class="tab-pane" id="probability_plot">
<div style="padding: 20px" class="form-horizontal">
{% if sample_groups|length != 1 %}
+ Select Group:
<select class="prob_plot_samples_group">
{% for group, pretty_group in sample_group_types.items() %}
<option value="{{ group }}">{{ pretty_group }}</option>
{% endfor %}
</select>
- <br><br>
+ <button type="button" class="btn btn-default" id="down_prob_plot">Export as PNG</button>
+ <br>
+ <br>
{% endif %}
<div id="prob_plot_container">
diff --git a/wqflask/wqflask/user_manager.py b/wqflask/wqflask/user_manager.py
index 1e831896..f7fcd2d0 100644
--- a/wqflask/wqflask/user_manager.py
+++ b/wqflask/wqflask/user_manager.py
@@ -46,7 +46,7 @@ from wqflask.database import db_session
from wqflask import model
from utility import Bunch, Struct, after
-from utility.tools import LOG_SQL, LOG_SQLALCHEMY
+from utility.tools import LOG_SQL, LOG_SQL_ALCHEMY
import logging
from utility.logger import getLogger
@@ -69,7 +69,7 @@ class AnonUser(object):
if self.cookie:
logger.debug("already is cookie")
self.anon_id = verify_cookie(self.cookie)
-
+
else:
logger.debug("creating new cookie")
self.anon_id, self.cookie = create_signed_cookie()
@@ -78,17 +78,17 @@ class AnonUser(object):
@after.after_this_request
def set_cookie(response):
response.set_cookie(self.cookie_name, self.cookie)
-
+
def add_collection(self, new_collection):
collection_dict = dict(name = new_collection.name,
created_timestamp = datetime.datetime.utcnow().strftime('%b %d %Y %I:%M%p'),
changed_timestamp = datetime.datetime.utcnow().strftime('%b %d %Y %I:%M%p'),
num_members = new_collection.num_members,
members = new_collection.get_members())
-
+
Redis.set(self.key, json.dumps(collection_dict))
Redis.expire(self.key, 60 * 60 * 24 * 5)
-
+
def delete_collection(self, collection_name):
existing_collections = self.get_collections()
updated_collections = []
@@ -106,7 +106,7 @@ class AnonUser(object):
updated_collections.append(this_collection)
Redis.set(self.key, json.dumps(updated_collections))
-
+
def get_collections(self):
json_collections = Redis.get(self.key)
if json_collections == None or json_collections == "None":
@@ -117,7 +117,7 @@ class AnonUser(object):
collection['created_timestamp'] = datetime.datetime.strptime(collection['created_timestamp'], '%b %d %Y %I:%M%p')
collection['changed_timestamp'] = datetime.datetime.strptime(collection['changed_timestamp'], '%b %d %Y %I:%M%p')
return collections
-
+
def import_traits_to_user(self):
collections_list = json.loads(Redis.get(self.key))
for collection in collections_list:
@@ -131,7 +131,7 @@ class AnonUser(object):
uc.members = json.dumps(collection['members'])
db_session.add(uc)
db_session.commit()
-
+
def display_num_collections(self):
"""
Returns the number of collections or a blank string if there are zero.
@@ -217,7 +217,7 @@ class UserSession(object):
"""Actual sqlalchemy record"""
# Only look it up once if needed, then store it
try:
- if LOG_SQLALCHEMY:
+ if LOG_SQL_ALCHEMY:
logging.getLogger('sqlalchemy.pool').setLevel(logging.DEBUG)
# Already did this before
@@ -237,7 +237,7 @@ class UserSession(object):
def before_request():
g.user_session = UserSession()
g.cookie_session = AnonUser()
-
+
class UsersManager(object):
def __init__(self):
self.users = model.User.query.all()
@@ -541,9 +541,9 @@ class LoginUser(object):
import_col = "true"
else:
import_col = "false"
-
- #g.cookie_session.import_traits_to_user()
-
+
+ #g.cookie_session.import_traits_to_user()
+
return self.actual_login(user, import_collections=import_col)
else:
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 24a7cbca..44ca8de8 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -53,7 +53,7 @@ from wqflask.ctl import ctl_analysis
#from wqflask.trait_submission import submit_trait
from utility import temp_data
-from utility.tools import SQL_URI,TEMPDIR,USE_REDIS,USE_GN_SERVER,GN_SERVER_URL,GN_VERSION
+from utility.tools import SQL_URI,TEMPDIR,USE_REDIS,USE_GN_SERVER,GN_SERVER_URL,GN_VERSION,TWITTER_POST_FETCHER_JS_PATH
from utility.helper_functions import get_species_groups
from base import webqtlFormData
@@ -152,8 +152,7 @@ def tmp_page(img_path):
@app.route("/twitter/<path:filename>")
def bd_files(filename):
- bd_path = app.config['TWITTER_POST_FETCHER_JS_PATH']
- return send_from_directory(bd_path, filename)
+ return send_from_directory(TWITTER_POST_FETCHER_JS_PATH, filename)
#@app.route("/data_sharing")
#def data_sharing_page():