about summary refs log tree commit diff
path: root/wqflask/base
diff options
context:
space:
mode:
authorPjotr Prins2016-05-29 17:20:20 +0000
committerPjotr Prins2016-05-29 17:20:20 +0000
commit4b083f2cdfa493f7b2ccc3c30cc5bb6cad694d3a (patch)
treec2c2503d88868f13b06dd66328720486e72f647a /wqflask/base
parent33d817c81b4b22bc051dbde2b26c5d4de028369e (diff)
parent0d22d3bc72cfc35cb23efce3d1687477880a5b3e (diff)
downloadgenenetwork2-4b083f2cdfa493f7b2ccc3c30cc5bb6cad694d3a.tar.gz
Merge branch 'master' of github.com:genenetwork/genenetwork2
Diffstat (limited to 'wqflask/base')
-rw-r--r--wqflask/base/data_set.py6
-rw-r--r--wqflask/base/trait.py14
-rwxr-xr-xwqflask/base/webqtlCaseData.py3
-rw-r--r--[-rwxr-xr-x]wqflask/base/webqtlConfig.py2
4 files changed, 14 insertions, 11 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 053b45fc..4953e728 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -711,7 +711,7 @@ class PhenotypeDataSet(DataSet):
     def retrieve_sample_data(self, trait):
         query = """
                     SELECT
-                            Strain.Name, PublishData.value, PublishSE.error, NStrain.count
+                            Strain.Name, PublishData.value, PublishSE.error, NStrain.count, Strain.Name2
                     FROM
                             (PublishData, Strain, PublishXRef, PublishFreeze)
                     left join PublishSE on
@@ -803,7 +803,7 @@ class GenotypeDataSet(DataSet):
     def retrieve_sample_data(self, trait):
         query = """
                     SELECT
-                            Strain.Name, GenoData.value, GenoSE.error, GenoData.Id
+                            Strain.Name, GenoData.value, GenoSE.error, GenoData.Id, Sample.Name2
                     FROM
                             (GenoData, GenoFreeze, Strain, Geno, GenoXRef)
                     left join GenoSE on
@@ -1031,7 +1031,7 @@ class MrnaAssayDataSet(DataSet):
     def retrieve_sample_data(self, trait):
         query = """
                     SELECT
-                            Strain.Name, ProbeSetData.value, ProbeSetSE.error, ProbeSetData.Id
+                            Strain.Name, ProbeSetData.value, ProbeSetSE.error, ProbeSetData.Id, Strain.Name2
                     FROM
                             (ProbeSetData, ProbeSetFreeze, Strain, ProbeSet, ProbeSetXRef)
                     left join ProbeSetSE on
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 6c5ca8b2..d1c0be83 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -180,13 +180,15 @@ class GeneralTrait(object):
         samples = []
         vals = []
         the_vars = []
+        sample_aliases = []
         for sample_name, sample_data in self.data.items():
             if sample_data.value != None:
                 if not include_variance or sample_data.variance != None:
                     samples.append(sample_name)
                     vals.append(sample_data.value)
                     the_vars.append(sample_data.variance)
-        return  samples, vals, the_vars
+                    sample_aliases.append(sample_data.name2)
+        return  samples, vals, the_vars, sample_aliases
 
 
     #
@@ -230,7 +232,7 @@ class GeneralTrait(object):
 
         if results:
             for item in results:
-                name, value, variance, num_cases = item
+                name, value, variance, num_cases, name2 = item
                 if not samplelist or (samplelist and name in samplelist):
                     self.data[name] = webqtlCaseData(*item)   #name, value, variance, num_cases)
 
@@ -313,9 +315,9 @@ class GeneralTrait(object):
                 self.confidential = 0
                 if self.pre_publication_description and not self.pubmed_id:
                     self.confidential = 1
-                    
-                description = self.post_publication_description
                 
+                description = self.post_publication_description
+            
                 #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
@@ -329,7 +331,7 @@ class GeneralTrait(object):
                     #        
                     #    description = self.pre_publication_description
                 
-                if len(description) > 0:
+                if description:
                     self.description_display = description.strip()
                 else:
                     self.description_display = ""
@@ -479,7 +481,7 @@ class GeneralTrait(object):
                     else:
                         self.locus = self.lrs = self.additive = ""
                 
-                if self.locus_chr != "" and self.locus_mb != "":
+                if (self.dataset.type == 'Publish' or self.dataset.type == "ProbeSet") and self.locus_chr != "" and self.locus_mb != "":
                     #XZ: LRS_location_value is used for sorting
                     try:
                         LRS_location_value = int(self.locus_chr)*1000 + float(self.locus_mb)
diff --git a/wqflask/base/webqtlCaseData.py b/wqflask/base/webqtlCaseData.py
index 42763aed..99a34866 100755
--- a/wqflask/base/webqtlCaseData.py
+++ b/wqflask/base/webqtlCaseData.py
@@ -29,8 +29,9 @@ print("Mr. Mojo Risin 2")
 class webqtlCaseData(object):
     """one case data in one trait"""
 
-    def __init__(self, name, value=None, variance=None, num_cases=None):
+    def __init__(self, name, value=None, variance=None, num_cases=None, name2=None):
         self.name = name
+        self.name2 = name2                  # Other name (for traits like BXD65a)
         self.value = value                  # Trait Value
         self.variance = variance            # Trait Variance
         self.num_cases = num_cases          # Number of individuals/cases
diff --git a/wqflask/base/webqtlConfig.py b/wqflask/base/webqtlConfig.py
index 0358bcbf..d0016b33 100755..100644
--- a/wqflask/base/webqtlConfig.py
+++ b/wqflask/base/webqtlConfig.py
@@ -69,7 +69,7 @@ GENERATED_TEXT_DIR   = mk_dir(TMPDIR+'/generated_text/')
 
 # Flat file directories
 GENODIR              = flat_files('genotype')+'/'
-JSON_GENODIR         = assert_dir(GENODIR+'json/')
+JSON_GENODIR         = flat_files('json')+'/'
 
 PORTADDR = "http://50.16.251.170"