aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/base')
-rw-r--r--wqflask/base/data_set.py19
-rw-r--r--wqflask/base/trait.py9
2 files changed, 16 insertions, 12 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index f58367ca..6e07e383 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -26,6 +26,7 @@ import collections
import codecs
import json
+import requests
import gzip
import cPickle as pickle
import itertools
@@ -63,7 +64,7 @@ logger = getLogger(__name__ )
# Each subclass will add to this
DS_NAME_MAP = {}
-def create_dataset(dataset_name, dataset_type = None, get_samplelist = True, group_name = None):
+def create_dataset(dataset_name, rebuild=True, dataset_type = None, get_samplelist = True, group_name = None):
if not dataset_type:
dataset_type = Dataset_Getter(dataset_name)
logger.debug("dataset_type", dataset_type)
@@ -77,7 +78,7 @@ def create_dataset(dataset_name, dataset_type = None, get_samplelist = True, gro
class Dataset_Types(object):
- def __init__(self):
+ def __init__(self, rebuild=False):
"""Create a dictionary of samples where the value is set to Geno,
Publish or ProbeSet. E.g.
@@ -93,8 +94,10 @@ Publish or ProbeSet. E.g.
"""
self.datasets = {}
- if USE_GN_SERVER:
- data = gen_menu.gen_dropdown_json()
+ if rebuild: #ZS: May make this the only option
+ data = json.loads(requests.get("http://gn2.genenetwork.org/api/v_pre1/gen_dropdown").content)
+ logger.debug("THE DATA:", data)
+ #data = gen_menu.gen_dropdown_json()
else:
file_name = "wqflask/static/new/javascript/dataset_menu_structure.json"
with open(file_name, 'r') as fh:
@@ -119,12 +122,8 @@ Publish or ProbeSet. E.g.
def __call__(self, name):
return self.datasets[name]
-def rebuild_dataset_ob():
- Dataset_Getter = Dataset_Types()
- return Dataset_Getter
-
# Do the intensive work at startup one time only
-Dataset_Getter = rebuild_dataset_ob()
+Dataset_Getter = Dataset_Types()
def create_datasets_list():
if USE_REDIS:
@@ -705,7 +704,7 @@ class PhenotypeDataSet(DataSet):
'PublishXRef.Id']
# Figure out what display_fields is
- self.display_fields = ['name',
+ self.display_fields = ['name', 'group_code',
'pubmed_id',
'pre_publication_description',
'post_publication_description',
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 322fb252..5fae34cf 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -352,7 +352,7 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
if dataset.type == 'Publish':
query = """
SELECT
- PublishXRef.Id, Publication.PubMed_ID,
+ PublishXRef.Id, InbredSet.InbredSetCode, Publication.PubMed_ID,
Phenotype.Pre_publication_description, Phenotype.Post_publication_description, Phenotype.Original_description,
Phenotype.Pre_publication_abbreviation, Phenotype.Post_publication_abbreviation,
Phenotype.Lab_code, Phenotype.Submitter, Phenotype.Owner, Phenotype.Authorized_Users,
@@ -361,12 +361,13 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
Publication.Month, Publication.Year, PublishXRef.Sequence,
Phenotype.Units, PublishXRef.comments
FROM
- PublishXRef, Publication, Phenotype, PublishFreeze
+ PublishXRef, Publication, Phenotype, PublishFreeze, InbredSet
WHERE
PublishXRef.Id = %s AND
Phenotype.Id = PublishXRef.PhenotypeId AND
Publication.Id = PublishXRef.PublicationId AND
PublishXRef.InbredSetId = PublishFreeze.InbredSetId AND
+ PublishXRef.InbredSetId = InbredSet.Id AND
PublishFreeze.Id = %s
""" % (trait.name, dataset.id)
@@ -428,6 +429,7 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
# holder = unicode(trait_info[i], "utf-8", "ignore")
setattr(trait, field, holder)
+ trait.display_name = trait.name
if dataset.type == 'Publish':
trait.confidential = 0
if trait.pre_publication_description and not trait.pubmed_id:
@@ -462,6 +464,9 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
if trait.pubmed_id:
trait.pubmed_link = webqtlConfig.PUBMEDLINK_URL % trait.pubmed_id
+ else:
+ if trait.group_code:
+ trait.display_name = trait.group_code + "_" + str(trait.name)
if dataset.type == 'ProbeSet' and dataset.group:
description_string = unicode(str(trait.description).strip(codecs.BOM_UTF8), 'utf-8')