aboutsummaryrefslogtreecommitdiff
path: root/wqflask/maintenance/gen_select_dataset.py
diff options
context:
space:
mode:
authorzsloan2016-01-29 17:34:36 +0000
committerzsloan2016-01-29 17:34:36 +0000
commitd8beaebcc8e6a2d9a0ed16c479aeb8cb58989156 (patch)
tree08d4a410fbeb8c3e743a918595659d1505965d47 /wqflask/maintenance/gen_select_dataset.py
parentd31053619575f9458a5d81748157b5ff00f66bdc (diff)
downloadgenenetwork2-d8beaebcc8e6a2d9a0ed16c479aeb8cb58989156.tar.gz
Info button should now work for phenotype and genotype datasets
Diffstat (limited to 'wqflask/maintenance/gen_select_dataset.py')
-rwxr-xr-xwqflask/maintenance/gen_select_dataset.py45
1 files changed, 26 insertions, 19 deletions
diff --git a/wqflask/maintenance/gen_select_dataset.py b/wqflask/maintenance/gen_select_dataset.py
index fda46792..ea0d4a56 100755
--- a/wqflask/maintenance/gen_select_dataset.py
+++ b/wqflask/maintenance/gen_select_dataset.py
@@ -156,15 +156,6 @@ def build_types(species, group):
"""
- #print("""select distinct Tissue.Name
- # from ProbeFreeze, ProbeSetFreeze, InbredSet, Tissue, Species
- # where Species.Name = '{}' and Species.Id = InbredSet.SpeciesId and
- # InbredSet.Name = '{}' and
- # ProbeFreeze.TissueId = Tissue.Id and
- # ProbeFreeze.InbredSetId = InbredSet.Id and
- # ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and
- # ProbeSetFreeze.public > 0
- # order by Tissue.Name""".format(species, group))
Cursor.execute("""select distinct Tissue.Name
from ProbeFreeze, ProbeSetFreeze, InbredSet, Tissue, Species
where Species.Name = %s and Species.Id = InbredSet.SpeciesId and
@@ -199,6 +190,19 @@ def build_datasets(species, group, type_name):
"""Gets dataset names from database"""
dataset_text = dataset_value = None
if type_name == "Phenotypes":
+ print("GROUP:", group)
+ Cursor.execute("""select InfoFiles.GN_AccesionId from InfoFiles, PublishFreeze, InbredSet where
+ InbredSet.Name = %s and
+ PublishFreeze.InbredSetId = InbredSet.Id and
+ InfoFiles.InfoPageName = PublishFreeze.Name and
+ PublishFreeze.public > 0 order by
+ PublishFreeze.CreateTime desc""", (group))
+
+ results = Cursor.fetchone()
+ if results != None:
+ dataset_id = str(results[0])
+ else:
+ dataset_id = "None"
dataset_value = "%sPublish" % group
if group == 'MDP':
dataset_text = "Mouse Phenome Database"
@@ -206,20 +210,24 @@ def build_datasets(species, group, type_name):
dataset_text = "%s Published Phenotypes" % group
elif type_name == "Genotypes":
+ Cursor.execute("""select InfoFiles.GN_AccesionId from InfoFiles, GenoFreeze, InbredSet where
+ InbredSet.Name = %s and
+ GenoFreeze.InbredSetId = InbredSet.Id and
+ InfoFiles.InfoPageName = GenoFreeze.ShortName and
+ GenoFreeze.public > 0 order by
+ GenoFreeze.CreateTime desc""", (group))
+
+ results = Cursor.fetchone()
+ if results != None:
+ dataset_id = str(results[0])
+ else:
+ dataset_id = "None"
dataset_value = "%sGeno" % group
dataset_text = "%s Genotypes" % group
if dataset_value:
- return [(dataset_value, dataset_text)]
+ return [(dataset_id, dataset_value, dataset_text)]
else:
- #print("""select ProbeSetFreeze.Name, ProbeSetFreeze.FullName from
- # ProbeSetFreeze, ProbeFreeze, InbredSet, Tissue, Species where
- # Species.Name = '{}' and Species.Id = InbredSet.SpeciesId and
- # InbredSet.Name = '{}' and
- # ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and Tissue.Name = '{}'
- # and ProbeFreeze.TissueId = Tissue.Id and ProbeFreeze.InbredSetId =
- # InbredSet.Id and ProbeSetFreeze.public > 0 order by
- # ProbeSetFreeze.CreateTime desc""".format(species, group, type_name))
Cursor.execute("""select ProbeSetFreeze.Id, ProbeSetFreeze.Name, ProbeSetFreeze.FullName from
ProbeSetFreeze, ProbeFreeze, InbredSet, Tissue, Species where
Species.Name = %s and Species.Id = InbredSet.SpeciesId and
@@ -247,7 +255,6 @@ def main():
species = get_species()
groups = get_groups(species)
- print("groups:", groups)
types = get_types(groups)
datasets = get_datasets(types)