aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility/helper_functions.py
diff options
context:
space:
mode:
authorzsloan2017-02-06 14:04:54 -0600
committerGitHub2017-02-06 14:04:54 -0600
commita8cd1fb49a78c67044ac32ad963c6109b2f96420 (patch)
tree61a671d316e11ce587d635e8d1e563272428d524 /wqflask/utility/helper_functions.py
parent5bf5c4091d14666c07a8d490551b931e80e614f0 (diff)
parent3f245a43dc1ec4258e952b575c4f0e3c4e3f7985 (diff)
downloadgenenetwork2-a8cd1fb49a78c67044ac32ad963c6109b2f96420.tar.gz
Merge pull request #240 from zsloan/master
Various changes
Diffstat (limited to 'wqflask/utility/helper_functions.py')
-rw-r--r--wqflask/utility/helper_functions.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/wqflask/utility/helper_functions.py b/wqflask/utility/helper_functions.py
index 377f6b26..cf16879f 100644
--- a/wqflask/utility/helper_functions.py
+++ b/wqflask/utility/helper_functions.py
@@ -5,6 +5,9 @@ from base import data_set
from base.species import TheSpecies
from wqflask import user_manager
+
+from flask import Flask, g
+
import logging
logger = logging.getLogger(__name__ )
@@ -41,3 +44,20 @@ def get_trait_db_obs(self, trait_db_list):
name=trait_name,
cellid=None)
self.trait_list.append((trait_ob, dataset_ob))
+
+def get_species_groups():
+
+ species_query = "SELECT SpeciesId, MenuName FROM Species"
+ species_ids_and_names = g.db.execute(species_query).fetchall()
+
+ species_and_groups = []
+ for species_id, species_name in species_ids_and_names:
+ this_species_groups = {}
+ this_species_groups['species'] = species_name
+ groups_query = "SELECT InbredSetName FROM InbredSet WHERE SpeciesId = %s" % (species_id)
+ groups = [group[0] for group in g.db.execute(groups_query).fetchall()]
+
+ this_species_groups['groups'] = groups
+ species_and_groups.append(this_species_groups)
+
+ return species_and_groups