aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base
diff options
context:
space:
mode:
authorZachary Sloan2013-02-12 16:20:56 -0600
committerZachary Sloan2013-02-12 16:20:56 -0600
commitb3853925653cf6145d7fb56b71edfc824a2d051a (patch)
tree2c5a80d69daa9bcd7024955a22c459d7adab43d8 /wqflask/base
parentbf6e7bd8e473a10d80044fa6bf778b261d5ee6ff (diff)
downloadgenenetwork2-b3853925653cf6145d7fb56b71edfc824a2d051a.tar.gz
Edited marker_regression.py and data_set.py to store the p-values
and their corresponding markers to be used in the table of qtl results and other figures
Diffstat (limited to 'wqflask/base')
-rwxr-xr-xwqflask/base/data_set.py29
1 files changed, 27 insertions, 2 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 8ced1528..182e15e6 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -23,6 +23,8 @@
from __future__ import absolute_import, print_function, division
import os
+import json
+
from flask import Flask, g
from htmlgen import HTMLgen2 as HT
@@ -64,6 +66,21 @@ def create_dataset(dataset_name):
return dataset_class(dataset_name)
+class Markers(object):
+ """Todo: Build in cacheing so it saves us reading the same file more than once"""
+ def __init__(self, name):
+ json_data_fh = open(os.path.join(webqtlConfig.NEWGENODIR + name + '.json'))
+ self.markers = json.load(json_data)
+
+ def add_pvalues(p_values):
+ #for count, marker in enumerate(self.markers):
+ # marker['p_value'] = p_values[count]
+
+ for marker, p_value in itertools.izip(self.markers, p_values):
+ marker['p_value'] = p_value
+ #Using -log(p) for the LRS; need to ask Rob how he wants to get LRS from p-values
+ marker['lrs_value'] = -math.log10(marker['p_value']) * 4.61
+
class DatasetGroup(object):
"""
Each group has multiple datasets; each species has multiple groups.
@@ -84,6 +101,7 @@ class DatasetGroup(object):
self.f1list = None
self.parlist = None
self.allsamples = None
+ self.markers = Markers(self.name)
#def read_genotype(self):
@@ -91,9 +109,16 @@ class DatasetGroup(object):
#
# if not self.genotype: # Didn'd succeed, so we try method 2
# self.read_genotype_data()
-
+
+ #def read_genotype_json(self):
+ # '''Read genotype from json file'''
+ #
+ # json_data = open(os.path.join(webqtlConfig.NEWGENODIR + self.name + '.json'))
+ # markers = json.load(json_data)
+ #
+
def read_genotype_file(self):
- '''read genotype from .geno file instead of database'''
+ '''Read genotype from .geno file instead of database'''
#if self.group == 'BXD300':
# self.group = 'BXD'
#