about summary refs log tree commit diff
path: root/wqflask/maintenance
diff options
context:
space:
mode:
authorzsloan2016-02-18 17:14:26 +0000
committerzsloan2016-02-18 17:14:26 +0000
commit6d8503e53b48ba2e398ff7950d2a722ffc2b6026 (patch)
tree0805a4a77b464a2575519cdda466522b0f9ab14b /wqflask/maintenance
parent7f5536635ac20f7c670e4dc8e650f27d47503d78 (diff)
downloadgenenetwork2-6d8503e53b48ba2e398ff7950d2a722ffc2b6026.tar.gz
Edited gen_select_dataset to remove confidential datasets
Also hard-coded the removal of Macaque Monkey since I couldn't think of a good way to retroactively check if every dataset in a species is confidential
Diffstat (limited to 'wqflask/maintenance')
-rwxr-xr-xwqflask/maintenance/gen_select_dataset.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/wqflask/maintenance/gen_select_dataset.py b/wqflask/maintenance/gen_select_dataset.py
index ea0d4a56..e080050e 100755
--- a/wqflask/maintenance/gen_select_dataset.py
+++ b/wqflask/maintenance/gen_select_dataset.py
@@ -76,7 +76,7 @@ def parse_db_uri(db_uri):
 
 def get_species():
     """Build species list"""
-    Cursor.execute("select Name, MenuName from Species order by OrderId")
+    Cursor.execute("select Name, MenuName from Species where Species.Name != 'macaque monkey' order by OrderId")
     species = list(Cursor.fetchall())
     return species
 
@@ -90,8 +90,8 @@ def get_groups(species):
                        ProbeFreeze, GenoFreeze, PublishFreeze where Species.Name = %s
                        and InbredSet.SpeciesId = Species.Id and InbredSet.Name != 'BXD300' and
                        (PublishFreeze.InbredSetId = InbredSet.Id
-                            or GenoFreeze.InbredSetId = InbredSet.Id
-                            or ProbeFreeze.InbredSetId = InbredSet.Id)
+                        or GenoFreeze.InbredSetId = InbredSet.Id
+                        or ProbeFreeze.InbredSetId = InbredSet.Id)
                         group by InbredSet.Name
                         order by InbredSet.Name""", (species_name))
         groups[species_name] = list(Cursor.fetchall())
@@ -169,7 +169,9 @@ def build_types(species, group):
     results = []
     for result in Cursor.fetchall():
         if len(result):
-            results.append((result[0], result[0]))
+            these_datasets = build_datasets(species, group, result[0])
+            if len(these_datasets) > 0:
+                results.append((result[0], result[0]))
     
     return results
 
@@ -182,7 +184,10 @@ def get_datasets(types):
             #print("type_list: ", type_list)
             datasets[species][group] = {}
             for type_name in type_list:
-                datasets[species][group][type_name[0]] = build_datasets(species, group, type_name[0])
+                these_datasets = build_datasets(species, group, type_name[0])
+                if len(these_datasets) > 0:
+                    datasets[species][group][type_name[0]] = these_datasets
+
     return datasets
 
 
@@ -195,7 +200,8 @@ def build_datasets(species, group, type_name):
                     InbredSet.Name = %s and 
                     PublishFreeze.InbredSetId = InbredSet.Id and
                     InfoFiles.InfoPageName = PublishFreeze.Name and
-                    PublishFreeze.public > 0 order by
+                    PublishFreeze.public > 0 and 
+                    PublishFreeze.confidentiality < 1 order by
                     PublishFreeze.CreateTime desc""", (group))
 
         results = Cursor.fetchone()
@@ -214,7 +220,8 @@ def build_datasets(species, group, type_name):
                     InbredSet.Name = %s and 
                     GenoFreeze.InbredSetId = InbredSet.Id and
                     InfoFiles.InfoPageName = GenoFreeze.ShortName and
-                    GenoFreeze.public > 0 order by
+                    GenoFreeze.public > 0 and 
+                    GenoFreeze.confidentiality < 1 order by
                     GenoFreeze.CreateTime desc""", (group))
 
         results = Cursor.fetchone()
@@ -232,9 +239,9 @@ def build_datasets(species, group, type_name):
                     ProbeSetFreeze, ProbeFreeze, InbredSet, Tissue, Species where
                     Species.Name = %s and Species.Id = InbredSet.SpeciesId and
                     InbredSet.Name = %s and
-                    ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and Tissue.Name = %s
-                    and ProbeFreeze.TissueId = Tissue.Id and ProbeFreeze.InbredSetId =
-                    InbredSet.Id and ProbeSetFreeze.public > 0 order by
+                    ProbeSetFreeze.ProbeFreezeId = ProbeFreeze.Id and Tissue.Name = %s and 
+                    ProbeFreeze.TissueId = Tissue.Id and ProbeFreeze.InbredSetId = InbredSet.Id and 
+                    ProbeSetFreeze.confidentiality < 1 and ProbeSetFreeze.public > 0 order by
                     ProbeSetFreeze.CreateTime desc""", (species, group, type_name))
  
         dataset_results = Cursor.fetchall()