From e7142c0785a9680b56d789f1db0a738d6172de55 Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Mon, 25 Nov 2013 22:53:46 +0000 Subject: Got the interval mapping results into a table --- wqflask/base/data_set.py | 12 +++++++++--- wqflask/base/trait.py | 26 +++++++++++++++++--------- 2 files changed, 26 insertions(+), 12 deletions(-) (limited to 'wqflask/base') 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): -- cgit v1.2.3