about summary refs log tree commit diff
path: root/wqflask/base
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/base')
-rw-r--r--wqflask/base/data_set.py3
-rw-r--r--wqflask/base/mrna_assay_tissue_data.py6
-rw-r--r--wqflask/base/trait.py18
-rw-r--r--wqflask/base/webqtlCaseData.py6
-rw-r--r--wqflask/base/webqtlConfig.py24
5 files changed, 36 insertions, 21 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 1b4e1195..fddfce58 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -107,7 +107,8 @@ Publish or ProbeSet. E.g.
                         else:
                             new_type = "ProbeSet"
                         self.datasets[short_dataset_name] = new_type
-        logger.info("datasets",self.datasets)
+        # Set LOG_LEVEL_DEBUG=5 to see the following:
+        logger.debugf(5,"datasets",self.datasets)
 
     def __call__(self, name):
         return self.datasets[name]
diff --git a/wqflask/base/mrna_assay_tissue_data.py b/wqflask/base/mrna_assay_tissue_data.py
index e99ef7b5..eb836e6c 100644
--- a/wqflask/base/mrna_assay_tissue_data.py
+++ b/wqflask/base/mrna_assay_tissue_data.py
@@ -57,7 +57,7 @@ class MrnaAssayTissueData(object):
                 as x inner join TissueProbeSetXRef as t on t.Symbol = x.Symbol
                 and t.Mean = x.maxmean;
                     '''.format(in_clause)
-        logger.sql(query)
+
         results = g.db.execute(query).fetchall()
 
         lower_symbols = []
@@ -91,7 +91,7 @@ class MrnaAssayTissueData(object):
 
     def get_symbol_values_pairs(self):
         id_list = [self.data[symbol].data_id for symbol in self.data]
-
+        
         symbol_values_dict = {}
 
         if len(id_list) > 0:
@@ -100,8 +100,6 @@ class MrnaAssayTissueData(object):
                        WHERE TissueProbeSetData.Id IN {} and
                              TissueProbeSetXRef.DataId = TissueProbeSetData.Id""".format(db_tools.create_in_clause(id_list))
 
-            logger.sql('tissue query',query)
-
             results = g.db.execute(query).fetchall()
             for result in results:
                 if result.Symbol.lower() not in symbol_values_dict:
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 9566c192..32032ba7 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -116,7 +116,6 @@ class GeneralTrait(object):
         return stringy
 
 
-
     def display_name(self):
         stringy = ""
         if self.dataset and self.name:
@@ -323,7 +322,7 @@ class GeneralTrait(object):
                 #phenotype traits, then display the pre-publication description instead
                 #of the post-publication description
                 if self.confidential:
-                    self.description_display = ""
+                    self.description_display = self.pre_publication_description
 
                     #if not webqtlUtil.hasAccessToConfidentialPhenotypeTrait(
                     #        privilege=self.dataset.privilege,
@@ -331,11 +330,11 @@ class GeneralTrait(object):
                     #        authorized_users=self.authorized_users):
                     #
                     #    description = self.pre_publication_description
-
-                if description:
-                    self.description_display = description.strip()
                 else:
-                    self.description_display = ""
+                    if description:
+                        self.description_display = description.strip()
+                    else:
+                        self.description_display = ""
 
                 if not self.year.isdigit():
                     self.pubmed_text = "N/A"
@@ -364,7 +363,7 @@ class GeneralTrait(object):
                             FROM
                                     Homologene, Species, InbredSet
                             WHERE
-                                    Homologene.GeneId =%s AND
+                                    Homologene.GeneId ='%s' AND
                                     InbredSet.Name = '%s' AND
                                     InbredSet.SpeciesId = Species.Id AND
                                     Species.TaxonomyId = Homologene.TaxonomyId
@@ -613,7 +612,10 @@ class GeneralTrait(object):
                 if self.probe_target_description:
                     formatted += "; " + self.probe_target_description
         elif self.dataset.type == 'Publish':
-            formatted = self.post_publication_description
+            if self.confidential:
+                formatted = self.pre_publication_description
+            else:
+                formatted = self.post_publication_description
         else:
             formatted = "Not available"
         return formatted.capitalize()
diff --git a/wqflask/base/webqtlCaseData.py b/wqflask/base/webqtlCaseData.py
index c80fcb65..2f88f778 100644
--- a/wqflask/base/webqtlCaseData.py
+++ b/wqflask/base/webqtlCaseData.py
@@ -16,8 +16,6 @@
 # Contact Drs. Robert W. Williams and Xiaodong Zhou (2010)
 # at rwilliams@uthsc.edu and xzhou15@uthsc.edu
 #
-#
-#
 # This module is used by GeneNetwork project (www.genenetwork.org)
 #
 # Created by GeneNetwork Core Team 2010/08/10
@@ -52,6 +50,10 @@ class webqtlCaseData(object):
             str += " variance=%2.3f" % self.variance
         if self.num_cases != None:
             str += " ndata=%d" % self.num_cases
+        if self.name != None:
+            str += " name=%s" % self.name
+        if self.name2 != None:
+            str += " name2=%s" % self.name2
         return str
 
     @property
diff --git a/wqflask/base/webqtlConfig.py b/wqflask/base/webqtlConfig.py
index f76d8140..e5f10edf 100644
--- a/wqflask/base/webqtlConfig.py
+++ b/wqflask/base/webqtlConfig.py
@@ -8,7 +8,7 @@
 #
 #########################################
 
-from utility.tools import valid_path, mk_dir, assert_dir, flat_files, TEMPDIR
+from utility.tools import valid_path, mk_dir, assert_dir, assert_writable_dir, flat_files, TEMPDIR
 
 #Debug Level
 #1 for debug, mod python will reload import each time
@@ -60,24 +60,36 @@ ENSEMBLETRANSCRIPT_URL="http://useast.ensembl.org/Mus_musculus/Lucene/Details?sp
 #   HTMLPATH is replaced by GENODIR
 #   IMGDIR is replaced by GENERATED_IMAGE_DIR
 
-# Temporary storage:
+# Temporary storage (note that this TMPDIR can be set as an
+# environment variable - use utility.tools.TEMPDIR when you
+# want to reach this base dir
+assert_writable_dir(TEMPDIR)
+
 TMPDIR               = mk_dir(TEMPDIR+'/gn2/')
-CACHEDIR             = mk_dir(TEMPDIR+'/cache/')
+assert_writable_dir(TMPDIR)
+
+CACHEDIR             = mk_dir(TMPDIR+'/cache/')
 # We can no longer write into the git tree:
 GENERATED_IMAGE_DIR  = mk_dir(TMPDIR+'/generated/')
 GENERATED_TEXT_DIR   = mk_dir(TMPDIR+'/generated_text/')
 
+# Make sure we have permissions to access these
+assert_writable_dir(CACHEDIR)
+assert_writable_dir(GENERATED_IMAGE_DIR)
+assert_writable_dir(GENERATED_TEXT_DIR)
+
 # Flat file directories
 GENODIR              = flat_files('genotype')+'/'
+assert_dir(GENODIR)
+
+# JSON genotypes are OBSOLETE
 JSON_GENODIR         = flat_files('genotype/json')+'/'
 if not valid_path(JSON_GENODIR):
     # fall back on old location (move the dir, FIXME)
     JSON_GENODIR = flat_files('json')
-assert_dir(GENODIR)
 
+# Are we using the following...?
 PORTADDR = "http://50.16.251.170"
-
 INFOPAGEHREF = '/dbdoc/%s.html'
 CGIDIR = '/webqtl/' #XZ: The variable name 'CGIDIR' should be changed to 'PYTHONDIR'
 SCRIPTFILE = 'main.py'
-