about summary refs log tree commit diff
path: root/wqflask/base
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/base')
-rwxr-xr-xwqflask/base/data_set.py8
-rw-r--r--wqflask/base/species.py16
2 files changed, 22 insertions, 2 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 2182fe9e..612b9209 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -30,6 +30,7 @@ from htmlgen import HTMLgen2 as HT
 import reaper
 
 import webqtlConfig
+from base import species
 from dbFunction import webqtlDatabaseFunction
 from utility import webqtlUtil
 
@@ -145,7 +146,7 @@ class DataSet(object):
 
     def __init__(self, name):
 
-        assert name
+        assert name, "Need a name"
         self.name = name
         self.id = None
         self.type = None
@@ -155,7 +156,10 @@ class DataSet(object):
         self.check_confidentiality()
 
         self.retrieve_other_names()
-        self.group = DatasetGroup(self)   # sets self.group and self.group_id
+        
+        self.species = species.TheSpecies(self)
+        self.group = DatasetGroup(self)   # sets self.group and self.group_id and gets genotype
+    
        
         
     def get_desc(self):
diff --git a/wqflask/base/species.py b/wqflask/base/species.py
new file mode 100644
index 00000000..98941ce5
--- /dev/null
+++ b/wqflask/base/species.py
@@ -0,0 +1,16 @@
+from __future__ import print_function, division
+
+
+class TheSpecies(object):
+    def __init__(self, dataset):
+        self.dataset = dataset
+
+    @property
+    def chromosomes(self):
+        chromosomes = [("All", -1)]
+  
+        for counter, genotype in enumerate(self.dataset.group.genotype):
+            if len(genotype) > 1:
+                chromosomes.append((genotype.name, counter))
+                
+        return chromosomes