aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/data_set.py
diff options
context:
space:
mode:
authorZachary Sloan2013-08-07 18:39:09 -0500
committerZachary Sloan2013-08-07 18:39:09 -0500
commit8993b25262b7fc565c1be3548660a66afd4c3530 (patch)
treef04ee0f8c61ade5702f8561fc9fbf0e0594d47c9 /wqflask/base/data_set.py
parentcf42e71c07efc772c15956b75db374f0f2849cac (diff)
downloadgenenetwork2-8993b25262b7fc565c1be3548660a66afd4c3530.tar.gz
Fixed things with the dataset dropdowns and mRNA datasets
Improved the templates for a couple pages related to changing user password, etc
Diffstat (limited to 'wqflask/base/data_set.py')
-rwxr-xr-xwqflask/base/data_set.py36
1 files changed, 26 insertions, 10 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 58f08ae7..017c6052 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -436,7 +436,7 @@ class DataSet(object):
except TypeError:
print("Dataset {} is not yet available in GeneNetwork.".format(self.name))
pass
-
+
def get_trait_data(self):
self.samplelist = self.group.samplelist + self.group.parlist + self.group.f1list
query = """
@@ -470,11 +470,18 @@ class DataSet(object):
# method=method,
# returnNumber=returnNumber)
+ if self.type == "Publish":
+ dataset_type = "Phenotype"
+ else:
+ dataset_type = self.type
temp = ['T%s.value' % item for item in sample_ids_step]
- query = "SELECT {}.Name,".format(escape(self.type))
+ if self.type == "Publish":
+ query = "SELECT {}XRef.Id,".format(escape(self.type))
+ else:
+ query = "SELECT {}.Name,".format(escape(dataset_type))
data_start_pos = 1
query += string.join(temp, ', ')
- query += ' FROM ({}, {}XRef, {}Freeze) '.format(*mescape(self.type,
+ query += ' FROM ({}, {}XRef, {}Freeze) '.format(*mescape(dataset_type,
self.type,
self.type))
@@ -484,13 +491,22 @@ class DataSet(object):
and T{}.StrainId={}\n
""".format(*mescape(self.type, item, item, self.type, item, item))
- query += """
- WHERE {}XRef.{}FreezeId = {}Freeze.Id
- and {}Freeze.Name = '{}'
- and {}.Id = {}XRef.{}Id
- order by {}.Id
- """.format(*mescape(self.type, self.type, self.type, self.type,
- self.name, self.type, self.type, self.type, self.type))
+ if self.type == "Publish":
+ query += """
+ WHERE {}XRef.InbredSetId = {}Freeze.InbredSetId
+ and {}Freeze.Name = '{}'
+ and {}.Id = {}XRef.PhenotypeId
+ order by {}.Id
+ """.format(*mescape(self.type, self.type, self.type, self.name,
+ dataset_type, self.type, dataset_type ))
+ else:
+ query += """
+ WHERE {}XRef.{}FreezeId = {}Freeze.Id
+ and {}Freeze.Name = '{}'
+ and {}.Id = {}XRef.{}Id
+ order by {}.Id
+ """.format(*mescape(self.type, self.type, self.type, self.type,
+ self.name, dataset_type, self.type, self.type, dataset_type))
results = g.db.execute(query).fetchall()
trait_sample_data.append(results)