about summary refs log tree commit diff
path: root/wqflask/base
diff options
context:
space:
mode:
authorZachary Sloan2013-11-25 22:53:46 +0000
committerZachary Sloan2013-11-25 22:53:46 +0000
commite7142c0785a9680b56d789f1db0a738d6172de55 (patch)
tree8cfa0efb5b9bdca3438da30820806a364390c2ff /wqflask/base
parent5143738870b8872a915432225acf01508de620ee (diff)
downloadgenenetwork2-e7142c0785a9680b56d789f1db0a738d6172de55.tar.gz
Got the interval mapping results into a table
Diffstat (limited to 'wqflask/base')
-rwxr-xr-xwqflask/base/data_set.py12
-rwxr-xr-xwqflask/base/trait.py26
2 files changed, 26 insertions, 12 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index cd8c1ac1..8296adea 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -318,12 +318,17 @@ class DatasetGroup(object):
 
         #determine default genotype object
         if self.incparentsf1 and genotype_1.type != "intercross":
-            self.genotype = genotype_2
+            #self.genotype = genotype_2
+            genotype = genotype_2
         else:
             self.incparentsf1 = 0
-            self.genotype = genotype_1
+            #self.genotype = genotype_1
+            genotype = genotype_1
 
-        self.samplelist = list(self.genotype.prgy)
+        #self.samplelist = list(self.genotype.prgy)
+        self.samplelist = list(genotype.prgy)
+        
+        return genotype
 
 
 #class DataSets(object):
@@ -1084,6 +1089,7 @@ class MrnaAssayDataSet(DataSet):
                             Strain.Name
                     """ % (escape(trait), escape(self.name))
         results = g.db.execute(query).fetchall()
+        print("RETRIEVED RESULTS HERE:", results)
         return results
     
     
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 731f99eb..74bc07bb 100755
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -154,7 +154,7 @@ class GeneralTrait(object):
                 result.append(None)
         return result
 
-    def export_informative(self, incVar=0):
+    def export_informative(self, include_variance=0):
         """
         export informative sample
         mostly used in qtl regression
@@ -163,12 +163,12 @@ class GeneralTrait(object):
         samples = []
         vals = []
         the_vars = []
-        for sample, value in self.data.items():
-            if value.val != None:
-                if not incVar or value.var != None:
-                    samples.append(sample)
-                    vals.append(value.val)
-                    the_vars.append(value.var)
+        for sample_name, sample_data in self.data.items():
+            if sample_data.value != None:
+                if not include_variance or sample_data.variance != None:
+                    samples.append(sample_name)
+                    vals.append(sample_data.value)
+                    the_vars.append(sample_data.variance)
         return  samples, vals, the_vars
 
 
@@ -235,11 +235,19 @@ class GeneralTrait(object):
         # Todo: is this necessary? If not remove
         self.data.clear()
 
+        if self.dataset.group.parlist:
+            all_samples_ordered = (self.dataset.group.parlist +
+                                   self.dataset.group.f1list +
+                                   self.dataset.group.samplelist)
+        elif self.dataset.group.f1list:
+            all_samples_ordered = self.dataset.group.f1list + self.dataset.group.samplelist
+        else:
+            all_samples_ordered = self.dataset.group.samplelist
+
         if results:
             for item in results:
-                #name, value, variance, num_cases = item
+                name, value, variance, num_cases = item
                 if not samplelist or (samplelist and name in samplelist):
-                    name = item[0]
                     self.data[name] = webqtlCaseData(*item)   #name, value, variance, num_cases)
 
     #def keys(self):