aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base
diff options
context:
space:
mode:
authoruditgulati2021-01-05 13:13:28 -0600
committeruditgulati2021-01-05 13:13:28 -0600
commit1e7a4d76fa36d1476fe37ae9b4c0a946fe99bce1 (patch)
tree0d18520e09fa0edce0080c773d0edd14750b855c /wqflask/base
parente106f5888cb4d761a6dcb71dc0273e461ef3c71a (diff)
parente36d40d64c1cf8476002c46b5c9dba308151f75c (diff)
downloadgenenetwork2-1e7a4d76fa36d1476fe37ae9b4c0a946fe99bce1.tar.gz
Merge branch 'testing' of https://github.com/genenetwork/genenetwork2 into snp_browser_changes
Diffstat (limited to 'wqflask/base')
-rw-r--r--wqflask/base/GeneralObject.py2
-rw-r--r--wqflask/base/trait.py29
2 files changed, 17 insertions, 14 deletions
diff --git a/wqflask/base/GeneralObject.py b/wqflask/base/GeneralObject.py
index 0122ee32..249195e2 100644
--- a/wqflask/base/GeneralObject.py
+++ b/wqflask/base/GeneralObject.py
@@ -28,7 +28,7 @@ class GeneralObject:
"""
Base class to define an Object.
a = [Spam(1, 4), Spam(9, 3), Spam(4,6)]
- a.sort(lambda x, y: cmp(x.eggs, y.eggs))
+ a.sort(key = lambda x: x.eggs)
"""
def __init__(self, *args, **kw):
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index cfc02f8b..50bd8874 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -25,19 +25,19 @@ def create_trait(**kw):
assert bool(kw.get('dataset')) != bool(
kw.get('dataset_name')), "Needs dataset ob. or name"
- if kw.get('name'):
- if kw.get('dataset_name'):
- if kw.get('dataset_name') != "Temp":
- dataset = create_dataset(kw.get('dataset_name'))
- else:
- dataset = kw.get('dataset')
+ assert bool(kw.get('name')), "Needs trait name"
+ if kw.get('dataset_name'):
if kw.get('dataset_name') != "Temp":
- if dataset.type == 'Publish':
- permissions = check_resource_availability(
- dataset, kw.get('name'))
- else:
- permissions = check_resource_availability(dataset)
+ dataset = create_dataset(kw.get('dataset_name'))
+ else:
+ dataset = kw.get('dataset')
+
+ if dataset.type == 'Publish':
+ permissions = check_resource_availability(
+ dataset, kw.get('name'))
+ else:
+ permissions = check_resource_availability(dataset)
if "view" in permissions['data']:
the_trait = GeneralTrait(**kw)
@@ -265,14 +265,17 @@ def get_sample_data():
trait_dict['species'] = trait_ob.dataset.group.species
trait_dict['url'] = url_for(
'show_trait_page', trait_id=trait, dataset=dataset)
- trait_dict['description'] = trait_ob.description_display
if trait_ob.dataset.type == "ProbeSet":
trait_dict['symbol'] = trait_ob.symbol
trait_dict['location'] = trait_ob.location_repr
+ trait_dict['description'] = trait_ob.description_display
elif trait_ob.dataset.type == "Publish":
+ trait_dict['description'] = trait_ob.description_display
if trait_ob.pubmed_id:
trait_dict['pubmed_link'] = trait_ob.pubmed_link
trait_dict['pubmed_text'] = trait_ob.pubmed_text
+ else:
+ trait_dict['location'] = trait_ob.location_repr
return json.dumps([trait_dict, {key: value.value for
key, value in list(
@@ -513,7 +516,7 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
# If the dataset is confidential and the user has access to confidential
# phenotype traits, then display the pre-publication description instead
# of the post-publication description
- if trait.confidential:
+ if not trait.pubmed_id:
trait.abbreviation = trait.pre_publication_abbreviation
trait.description_display = trait.pre_publication_description
else: