aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/gsearch.py5
-rw-r--r--wqflask/wqflask/show_trait/export_trait_data.py30
-rw-r--r--wqflask/wqflask/user_manager.py22
3 files changed, 44 insertions, 13 deletions
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py
index 3d9b508a..04e3d578 100644
--- a/wqflask/wqflask/gsearch.py
+++ b/wqflask/wqflask/gsearch.py
@@ -75,7 +75,10 @@ class GSearch(object):
this_trait['group'] = line[1]
this_trait['tissue'] = line[2]
this_trait['symbol'] = line[6]
- this_trait['description'] = line[7].decode('utf-8', 'replace')
+ if line[7]:
+ this_trait['description'] = line[7].decode('utf-8', 'replace')
+ else:
+ this_trait['description'] = "N/A"
this_trait['location_repr'] = 'N/A'
if (line[8] != "NULL" and line[8] != "") and (line[9] != 0):
this_trait['location_repr'] = 'Chr%s: %.6f' % (line[8], float(line[9]))
diff --git a/wqflask/wqflask/show_trait/export_trait_data.py b/wqflask/wqflask/show_trait/export_trait_data.py
index 7ca4a4c0..107f87c6 100644
--- a/wqflask/wqflask/show_trait/export_trait_data.py
+++ b/wqflask/wqflask/show_trait/export_trait_data.py
@@ -4,11 +4,17 @@ import simplejson as json
from pprint import pformat as pf
+from base.trait import GeneralTrait
+from base import data_set
+
def export_sample_table(targs):
sample_data = json.loads(targs['export_data'])
trait_name = targs['trait_display_name']
- final_sample_data = []
+
+ meta_data = get_export_metadata(targs['trait_id'], targs['dataset'])
+
+ final_sample_data = meta_data
for sample_group in ['primary_samples', 'other_samples']:
for row in sample_data[sample_group]:
@@ -18,6 +24,28 @@ def export_sample_table(targs):
return trait_name, final_sample_data
+def get_export_metadata(trait_id, dataset_name):
+ dataset = data_set.create_dataset(dataset_name)
+ this_trait = GeneralTrait(dataset=dataset,
+ name=trait_id,
+ cellid=None,
+ get_qtl_info=False)
+
+ metadata = []
+ if dataset.type == "Publish":
+ metadata.append(["Phenotype ID: " + trait_id])
+ metadata.append(["Phenotype URL: " + "http://genenetwork.org/show_trait?trait_id=" + trait_id + "&dataset=" + dataset_name])
+ metadata.append(["Group: " + dataset.group.name])
+ metadata.append(["Phenotype: " + this_trait.description_display.replace(",", "\",\"")])
+ metadata.append(["Authors: " + this_trait.authors])
+ metadata.append(["Title: " + this_trait.title])
+ metadata.append(["Journal: " + this_trait.journal])
+ metadata.append(["Dataset Link: http://gn1.genenetwork.org/webqtl/main.py?FormID=sharinginfo&InfoPageName=" + dataset.name])
+ metadata.append([])
+
+ return metadata
+
+
def dict_to_sorted_list(dictionary):
sorted_list = [item for item in dictionary.iteritems()]
sorted_list = sorted(sorted_list, cmp=cmp_samples)
diff --git a/wqflask/wqflask/user_manager.py b/wqflask/wqflask/user_manager.py
index ce76e0e8..a871e91a 100644
--- a/wqflask/wqflask/user_manager.py
+++ b/wqflask/wqflask/user_manager.py
@@ -356,7 +356,7 @@ def get_cookie():
g.user_session = UserSession()
g.cookie_session = AnonUser()
-@app.after_request
+#@app.after_request
def set_cookie(response):
if not request.cookies.get(g.cookie_session.cookie_name):
response.set_cookie(g.cookie_session.cookie_name, g.cookie_session.cookie)
@@ -538,7 +538,7 @@ def basic_info():
ip_address = request.remote_addr,
user_agent = request.headers.get('User-Agent'))
-@app.route("/manage/verify_email")
+#@app.route("/manage/verify_email")
def verify_email():
user = DecodeUser(VerificationEmail.key_prefix).user
user.confirmed = json.dumps(basic_info(), sort_keys=True)
@@ -552,7 +552,7 @@ def verify_email():
response.set_cookie(UserSession.cookie_name, session_id_signed)
return response
-@app.route("/n/password_reset", methods=['GET'])
+#@app.route("/n/password_reset", methods=['GET'])
def password_reset():
"""Entry point after user clicks link in E-mail"""
logger.debug("in password_reset request.url is:", request.url)
@@ -576,7 +576,7 @@ def password_reset():
else:
return redirect(url_for("login"))
-@app.route("/n/password_reset_step2", methods=('POST',))
+#@app.route("/n/password_reset_step2", methods=('POST',))
def password_reset_step2():
"""Handle confirmation E-mail for password reset"""
logger.debug("in password_reset request.url is:", request.url)
@@ -620,7 +620,7 @@ class DecodeUser(object):
logger.debug("data is:", data)
return model.User.query.get(data['id'])
-@app.route("/n/login", methods=('GET', 'POST'))
+#@app.route("/n/login", methods=('GET', 'POST'))
def login():
lu = LoginUser()
login_type = request.args.get("type")
@@ -630,7 +630,7 @@ def login():
else:
return lu.standard_login()
-@app.route("/n/login/github_oauth2", methods=('GET', 'POST'))
+#@app.route("/n/login/github_oauth2", methods=('GET', 'POST'))
def github_oauth2():
from utility.tools import GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET
code = request.args.get("code")
@@ -661,7 +661,7 @@ def github_oauth2():
url = "/n/login?type=github&uid="+user_details["user_id"]
return redirect(url)
-@app.route("/n/login/orcid_oauth2", methods=('GET', 'POST'))
+#@app.route("/n/login/orcid_oauth2", methods=('GET', 'POST'))
def orcid_oauth2():
from uuid import uuid4
from utility.tools import ORCID_CLIENT_ID, ORCID_CLIENT_SECRET, ORCID_TOKEN_URL, ORCID_AUTH_URL
@@ -841,7 +841,7 @@ class LoginUser(object):
db_session.add(login_rec)
db_session.commit()
-@app.route("/n/logout")
+#@app.route("/n/logout")
def logout():
logger.debug("Logging out...")
UserSession().delete_session()
@@ -852,7 +852,7 @@ def logout():
return response
-@app.route("/n/forgot_password", methods=['GET'])
+#@app.route("/n/forgot_password", methods=['GET'])
def forgot_password():
"""Entry point for forgotten password"""
print("ARGS: ", request.args)
@@ -860,7 +860,7 @@ def forgot_password():
print("ERRORS: ", errors)
return render_template("new_security/forgot_password.html", errors=errors)
-@app.route("/n/forgot_password_submit", methods=('POST',))
+#@app.route("/n/forgot_password_submit", methods=('POST',))
def forgot_password_submit():
"""When a forgotten password form is submitted we get here"""
params = request.form
@@ -945,7 +945,7 @@ def is_redis_available():
# return LoginUser().actual_login(user, assumed_by=assumed_by)
-@app.route("/n/register", methods=('GET', 'POST'))
+#@app.route("/n/register", methods=('GET', 'POST'))
def register():
params = None
errors = None