From 715d9137038887c6654a14d22dc0512bb01aaf86 Mon Sep 17 00:00:00 2001
From: uditgulati
Date: Sun, 17 Jan 2021 08:51:06 -0600
Subject: modify the main query in gene global search to add locus chr, locus
mb and optimize the speed of query
---
wqflask/wqflask/gsearch.py | 37 ++++++++++++++++++++++---------------
1 file changed, 22 insertions(+), 15 deletions(-)
(limited to 'wqflask')
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py
index 9e46c0c5..6ff57563 100644
--- a/wqflask/wqflask/gsearch.py
+++ b/wqflask/wqflask/gsearch.py
@@ -1,4 +1,6 @@
import json
+import datetime as dt
+from types import SimpleNamespace
from flask import Flask, g
from base.data_set import create_dataset
@@ -9,8 +11,9 @@ from base import webqtlConfig
from utility import hmac
-from utility.type_checking import is_float, is_int, is_str, get_float, get_int, get_string
from utility.benchmark import Bench
+from utility.authentication_tools import check_resource_availability
+from utility.type_checking import is_float, is_int, is_str, get_float, get_int, get_string
from utility.logger import getLogger
logger = getLogger(__name__)
@@ -42,15 +45,19 @@ class GSearch(object):
ProbeSetXRef.LRS AS lrs,
ProbeSetXRef.`Locus` AS locus,
ProbeSetXRef.`pValue` AS pvalue,
- ProbeSetXRef.`additive` AS additive
- FROM Species, InbredSet, ProbeSetXRef, ProbeSet, ProbeFreeze, ProbeSetFreeze, Tissue
- WHERE InbredSet.`SpeciesId`=Species.`Id`
- AND ProbeFreeze.InbredSetId=InbredSet.`Id`
- AND ProbeFreeze.`TissueId`=Tissue.`Id`
- AND ProbeSetFreeze.ProbeFreezeId=ProbeFreeze.Id
- AND ( MATCH (ProbeSet.Name,ProbeSet.description,ProbeSet.symbol,alias,GenbankId, UniGeneId, Probe_Target_Description) AGAINST ('%s' IN BOOLEAN MODE) )
- AND ProbeSet.Id = ProbeSetXRef.ProbeSetId
- AND ProbeSetXRef.ProbeSetFreezeId=ProbeSetFreeze.Id
+ ProbeSetXRef.`additive` AS additive,
+ ProbeSetFreeze.Id AS probesetfreeze_id,
+ Geno.Chr as geno_chr,
+ Geno.Mb as geno_mb
+ FROM Species
+ INNER JOIN InbredSet ON InbredSet.`SpeciesId`=Species.`Id`
+ INNER JOIN ProbeFreeze ON ProbeFreeze.InbredSetId=InbredSet.`Id`
+ INNER JOIN Tissue ON ProbeFreeze.`TissueId`=Tissue.`Id`
+ INNER JOIN ProbeSetFreeze ON ProbeSetFreeze.ProbeFreezeId=ProbeFreeze.Id
+ INNER JOIN ProbeSetXRef ON ProbeSetXRef.ProbeSetFreezeId=ProbeSetFreeze.Id
+ INNER JOIN ProbeSet ON ProbeSet.Id = ProbeSetXRef.ProbeSetId
+ LEFT JOIN Geno ON ProbeSetXRef.Locus = Geno.Name AND Geno.SpeciesId = Species.Id
+ WHERE ( MATCH (ProbeSet.Name,ProbeSet.description,ProbeSet.symbol,ProbeSet.alias,ProbeSet.GenbankId, ProbeSet.UniGeneId, ProbeSet.Probe_Target_Description) AGAINST ('%s' IN BOOLEAN MODE) )
AND ProbeSetFreeze.confidentiality < 1
AND ProbeSetFreeze.public > 0
ORDER BY species_name, inbredset_name, tissue_name, probesetfreeze_name, probeset_name
@@ -90,16 +97,16 @@ class GSearch(object):
this_trait['additive'] = "N/A"
if line[14] != "" and line[14] != None:
this_trait['additive'] = '%.3f' % line[14]
+ this_trait['dataset_id'] = line[15]
+ this_trait['locus_chr'] = line[16]
+ this_trait['locus_mb'] = line[17]
#dataset = create_dataset(line[3], "ProbeSet", get_samplelist=False)
#trait_id = line[4]
#with Bench("Building trait object"):
- trait_ob = create_trait(dataset_name=this_trait['dataset'], name=this_trait['name'], get_qtl_info=True, get_sample_info=False)
- if not trait_ob:
- continue
max_lrs_text = "N/A"
- if trait_ob.locus_chr != "" and trait_ob.locus_mb != "":
- max_lrs_text = "Chr" + str(trait_ob.locus_chr) + ": " + str(trait_ob.locus_mb)
+ if this_trait['locus_chr'] != None and this_trait['locus_mb'] != None:
+ max_lrs_text = "Chr" + str(this_trait['locus_chr']) + ": " + str(this_trait['locus_mb'])
this_trait['max_lrs_text'] = max_lrs_text
trait_list.append(this_trait)
--
cgit v1.2.3
From 6749974cccdf10fc300c4265720dfd147db88989 Mon Sep 17 00:00:00 2001
From: uditgulati
Date: Sun, 17 Jan 2021 08:57:12 -0600
Subject: add dataset object creation, permission check in global search code
itself which takes the load off creating Trait object
---
wqflask/wqflask/gsearch.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
(limited to 'wqflask')
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py
index 6ff57563..2b8d4bc1 100644
--- a/wqflask/wqflask/gsearch.py
+++ b/wqflask/wqflask/gsearch.py
@@ -68,6 +68,7 @@ class GSearch(object):
re = g.db.execute(sql).fetchall()
trait_list = []
+ dataset_to_permissions = {}
with Bench("Creating trait objects"):
for i, line in enumerate(re):
this_trait = {}
@@ -101,9 +102,15 @@ class GSearch(object):
this_trait['locus_chr'] = line[16]
this_trait['locus_mb'] = line[17]
- #dataset = create_dataset(line[3], "ProbeSet", get_samplelist=False)
- #trait_id = line[4]
- #with Bench("Building trait object"):
+ dataset_ob = SimpleNamespace(id=this_trait["dataset_id"], type="ProbeSet",species=this_trait["species"])
+ if dataset_ob.id not in dataset_to_permissions:
+ permissions = check_resource_availability(dataset_ob)
+ dataset_to_permissions[dataset_ob.id] = permissions
+ else:
+ pemissions = dataset_to_permissions[dataset_ob.id]
+ if "view" not in permissions['data']:
+ continue
+
max_lrs_text = "N/A"
if this_trait['locus_chr'] != None and this_trait['locus_mb'] != None:
max_lrs_text = "Chr" + str(this_trait['locus_chr']) + ": " + str(this_trait['locus_mb'])
--
cgit v1.2.3
From 5187e582721ddfbb1e864378823f2685748bf5f2 Mon Sep 17 00:00:00 2001
From: BonfaceKilz
Date: Mon, 18 Jan 2021 11:15:33 +0300
Subject: Pass salt as bytes when testing pbkdf2_hex
* wqflask/tests/unit/wqflask/test_pbkdf2.py (test_pbkdf2_hex): Make
password salt bytes. Breaking change introduced in 0bac313ba.
---
wqflask/tests/unit/wqflask/test_pbkdf2.py | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
(limited to 'wqflask')
diff --git a/wqflask/tests/unit/wqflask/test_pbkdf2.py b/wqflask/tests/unit/wqflask/test_pbkdf2.py
index a33fbd4f..7ad6c83e 100644
--- a/wqflask/tests/unit/wqflask/test_pbkdf2.py
+++ b/wqflask/tests/unit/wqflask/test_pbkdf2.py
@@ -11,43 +11,43 @@ class TestPbkdf2(unittest.TestCase):
"""
for password, salt, iterations, keylen, expected_value in [
- ('password', 'salt', 1, 20,
+ ('password', b'salt', 1, 20,
'0c60c80f961f0e71f3a9b524af6012062fe037a6'),
- ('password', 'salt', 2, 20,
+ ('password', b'salt', 2, 20,
'ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957'),
- ('password', 'salt', 4096, 20,
+ ('password', b'salt', 4096, 20,
'4b007901b765489abead49d926f721d065a429c1'),
('passwordPASSWORDpassword',
- 'saltSALTsaltSALTsaltSALTsaltSALTsalt',
+ b'saltSALTsaltSALTsaltSALTsaltSALTsalt',
4096, 25,
'3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038'),
- ('pass\x00word', 'sa\x00lt', 4096, 16,
+ ('pass\x00word', b'sa\x00lt', 4096, 16,
'56fa6aa75548099dcc37d7f03425e0c3'),
- ('password', 'ATHENA.MIT.EDUraeburn', 1, 16,
+ ('password', b'ATHENA.MIT.EDUraeburn', 1, 16,
'cdedb5281bb2f801565a1122b2563515'),
- ('password', 'ATHENA.MIT.EDUraeburn', 1, 32,
+ ('password', b'ATHENA.MIT.EDUraeburn', 1, 32,
('cdedb5281bb2f80'
'1565a1122b256351'
'50ad1f7a04bb9f3a33'
'3ecc0e2e1f70837')),
- ('password', 'ATHENA.MIT.EDUraeburn', 2, 16,
+ ('password', b'ATHENA.MIT.EDUraeburn', 2, 16,
'01dbee7f4a9e243e988b62c73cda935d'),
- ('password', 'ATHENA.MIT.EDUraeburn', 2, 32,
+ ('password', b'ATHENA.MIT.EDUraeburn', 2, 32,
('01dbee7f4a9e243e9'
'88b62c73cda935da05'
'378b93244ec8f48a99'
'e61ad799d86')),
- ('password', 'ATHENA.MIT.EDUraeburn', 1200, 32,
+ ('password', b'ATHENA.MIT.EDUraeburn', 1200, 32,
('5c08eb61fdf71e'
'4e4ec3cf6ba1f55'
'12ba7e52ddbc5e51'
'42f708a31e2e62b1e13')),
- ('X' * 64, 'pass phrase equals block size', 1200, 32,
+ ('X' * 64, b'pass phrase equals block size', 1200, 32,
('139c30c0966bc32ba'
'55fdbf212530ac9c5'
'ec59f1a452f5cc9ad'
'940fea0598ed1')),
- ('X' * 65, 'pass phrase exceeds block size', 1200, 32,
+ ('X' * 65, b'pass phrase exceeds block size', 1200, 32,
('9ccad6d468770cd'
'51b10e6a68721be6'
'11a8b4d282601db3'
--
cgit v1.2.3
From 42fd88d0e57462d4538ae328564fcc55da761991 Mon Sep 17 00:00:00 2001
From: BonfaceKilz
Date: Mon, 18 Jan 2021 11:30:36 +0300
Subject: Revert "resize image in facilities page"
This reverts commit db31d53421c033a9907d2c67bc8a0c3c911b5402.
---
wqflask/wqflask/templates/facilities.html | 8 --------
1 file changed, 8 deletions(-)
(limited to 'wqflask')
diff --git a/wqflask/wqflask/templates/facilities.html b/wqflask/wqflask/templates/facilities.html
index dc8d0ded..56b127f9 100644
--- a/wqflask/wqflask/templates/facilities.html
+++ b/wqflask/wqflask/templates/facilities.html
@@ -4,14 +4,6 @@
{% block css %}
-
-
-
{% endblock %}
{% block content %}
--
cgit v1.2.3