about summary refs log tree commit diff
path: root/wqflask/utility
diff options
context:
space:
mode:
authorzsloan2016-08-16 20:30:38 +0000
committerzsloan2016-08-16 20:30:38 +0000
commite695e8d162ca04f41694a525e93ced1b9d23a85b (patch)
tree015683118b0b9b673b5f4a80e64ad8aea2c7e97f /wqflask/utility
parent87f9b37d253c99beb0b4f1df795b8188e3197558 (diff)
downloadgenenetwork2-e695e8d162ca04f41694a525e93ced1b9d23a85b.tar.gz
Users can now select specific traits from collection when using collection tools (correlation matrix, wgcna, etc)
To do the above, changed the way form submission worked for those features; previously each feature had its own form, but that was dumb so instead I wrote a javascript function that just changed a single form's target url

Duplicate traits can no longer by added to collections

Fixed the digits for a few table columns in collection (additive effect, etc).
Diffstat (limited to 'wqflask/utility')
-rw-r--r--wqflask/utility/helper_functions.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/wqflask/utility/helper_functions.py b/wqflask/utility/helper_functions.py
index 15f60765..149ee553 100644
--- a/wqflask/utility/helper_functions.py
+++ b/wqflask/utility/helper_functions.py
@@ -4,6 +4,8 @@ from base.trait import GeneralTrait
 from base import data_set
 from base.species import TheSpecies
 
+from wqflask import user_manager
+
 
 def get_species_dataset_trait(self, start_vars):
     #assert type(read_genotype) == type(bool()), "Expecting boolean value for read_genotype"
@@ -23,13 +25,15 @@ def get_species_dataset_trait(self, start_vars):
 
 
 def get_trait_db_obs(self, trait_db_list):
-
+    if isinstance(trait_db_list, basestring):
+        trait_db_list = trait_db_list.split(",")
+        
     self.trait_list = []
-    for i, trait_db in enumerate(trait_db_list):
-        if i == (len(trait_db_list) - 1):
-            break
-        trait_name, dataset_name = trait_db.split(":")
-        #print("dataset_name:", dataset_name)
+    for trait in trait_db_list:
+        data, _separator, hmac = trait.rpartition(':')
+        data = data.strip()
+        assert hmac==user_manager.actual_hmac_creation(data), "Data tampering?"
+        trait_name, dataset_name = data.split(":")
         dataset_ob = data_set.create_dataset(dataset_name)
         trait_ob = GeneralTrait(dataset=dataset_ob,
                                name=trait_name,