diff options
author | zsloan | 2021-01-21 12:50:54 -0600 |
---|---|---|
committer | zsloan | 2021-01-21 12:50:54 -0600 |
commit | ac21f2e727af91862c79a502c175d39e389f0215 (patch) | |
tree | 84489fe8d917e2e9afb357e2fef8ce19c5d872a4 | |
parent | 3b2a835fce1cda94f0649d45297867ddb5994731 (diff) | |
parent | 42fd88d0e57462d4538ae328564fcc55da761991 (diff) | |
download | genenetwork2-ac21f2e727af91862c79a502c175d39e389f0215.tar.gz |
Merge branch 'testing' of github.com:genenetwork/genenetwork2 into testing
-rw-r--r-- | .github/ISSUE_TEMPLATE/bug_report.md | 6 | ||||
-rw-r--r-- | .github/ISSUE_TEMPLATE/feature_request.md | 11 | ||||
-rw-r--r-- | .github/ISSUE_TEMPLATE/user_story.md | 4 | ||||
-rw-r--r-- | .github/PULL_REQUEST_TEMPLATE.md | 3 | ||||
-rw-r--r-- | wqflask/tests/unit/wqflask/test_pbkdf2.py | 24 | ||||
-rw-r--r-- | wqflask/wqflask/gsearch.py | 50 | ||||
-rw-r--r-- | wqflask/wqflask/templates/facilities.html | 8 |
7 files changed, 44 insertions, 62 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 48bad39b..af60c290 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -8,27 +8,21 @@ assignees: '' --- **Describe the bug** - <!-- A clear and concise description of what the bug is. --> **To Reproduce** - <!-- Steps to reproduce the behavior --> **Expected behavior** - <!-- A clear and concise description of what you expected to happen. --> **Screenshots** - <!-- If applicable, add screenshots to help explain your problem. --> **Environment setup (please complete the following information):** - <!-- - OS: [e.g. Linux] --> <!-- - Guix Version (optional) --> <!-- - [Anything else you think is relevant] --> **Additional context** - <!-- Add any other context about the problem here. --> diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index eb6c3e4b..813974c1 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -8,34 +8,23 @@ assignees: '' --- ## Is your feature request related to a problem? Please describe. - <!-- A clear and concise description of what the problem is. --> - <!-- Example: I'm always frustrated when [...] --> ## Describe the solution you'd like - <!-- A clear and concise description of what you want to happen. --> ## Describe alternatives you've considered - <!-- A clear and concise description of any alternative solutions or features you've considered. --> ## User Stories (optional) - <!-- Example: --> - <!-- As a _[role or persona]_, I want _[goal/ need]_ so that _[why]_ --> - <!-- **Feature:** _[Brief description of feature]_ --> - <!-- _[Any additional descriptions on feature]_ --> - <!-- **Scenario:** - Please use _[Gherkin](https://cucumber.io/docs/gherkin/reference/)_ here --> ## Additional context - <!-- Add any other context or screenshots about the feature request here. --> diff --git a/.github/ISSUE_TEMPLATE/user_story.md b/.github/ISSUE_TEMPLATE/user_story.md index 52ae775d..d46976ba 100644 --- a/.github/ISSUE_TEMPLATE/user_story.md +++ b/.github/ISSUE_TEMPLATE/user_story.md @@ -6,11 +6,7 @@ labels: '' assignees: '' --- - <!-- As a _[role or persona]_, I want _[goal/ need]_ so that _[why]_ --> - <!-- **Feature:** _[Brief description of feature]_ --> - <!-- _[Any additional descriptions on feature]_ --> - <!-- **Scenario:** Please use _[Gherkin](https://cucumber.io/docs/gherkin/reference/)_ here --> diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f3371183..926b0548 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,15 +6,12 @@ assurance checks that should be done. What are the expectations --> #### Any background context you want to provide? - <!-- Anything the reviewer should be aware of ahead of testing --> #### What are the relevant pivotal tracker stories? - <!-- Does this PR track anything anywhere? --> #### Screenshots (if appropriate) #### Questions - <!-- Are there any questions for the reviewer --> 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' diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index 9e46c0c5..2b8d4bc1 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 @@ -61,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 = {} @@ -90,16 +98,22 @@ class GSearch(object): this_trait['additive'] = "N/A" if line[14] != "" and line[14] != None: this_trait['additive'] = '%.3f' % line[14] - - #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: + this_trait['dataset_id'] = line[15] + this_trait['locus_chr'] = line[16] + this_trait['locus_mb'] = line[17] + + 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 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) 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 %} <link rel="stylesheet" type="text/css" href="/static/new/css/markdown.css" /> - -<style> - img[src="https://github.com/genenetwork/gn-docs/raw/master/general/help/octopus.jpg"] { - width:100%; - margin:20px 0px; -} -</style> - {% endblock %} {% block content %} |