From e416b7b4fcabff05d1665ae5dbb962cfb61e471d Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Wed, 13 Feb 2013 14:26:52 -0600 Subject: Fixed some bugs related to getting the marker regression page working with Nick's code --- wqflask/base/data_set.py | 9 ++++----- wqflask/wqflask/marker_regression/marker_regression.py | 6 ++++-- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'wqflask') diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 182e15e6..d4e97370 100755 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -22,8 +22,10 @@ from __future__ import absolute_import, print_function, division import os +import math import json +import itertools from flask import Flask, g @@ -70,12 +72,9 @@ 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) + self.markers = json.load(json_data_fh) - def add_pvalues(p_values): - #for count, marker in enumerate(self.markers): - # marker['p_value'] = p_values[count] - + def add_pvalues(self, p_values): 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 diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index 1d005df4..c9451154 100755 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -458,7 +458,7 @@ class MarkerRegression(object): #json_data = open(os.path.join(webqtlConfig.NEWGENODIR + self.dataset.group.name + '.json')) #markers = json.load(json_data) - genotype_data = [marker['genotypes'] for marker in self.dataset.group.markers] + genotype_data = [marker['genotypes'] for marker in self.dataset.group.markers.markers] no_val_samples = self.identify_empty_samples() trimmed_genotype_data = self.trim_genotypes(genotype_data, no_val_samples) @@ -502,7 +502,9 @@ class MarkerRegression(object): # trait = self.vals, # nperm=self.num_perm) - self.lrs_values = [marker['lrs_value'] for marker in self.dataset.group.markers] + self.lrs_values = [marker['lrs_value'] for marker in self.dataset.group.markers.markers] + print("self.lrs_values is:", pf(self.lrs_values)) + print("int(self.num_perm*0.37-1)", pf(int(self.num_perm*0.37-1))) self.lrs_thresholds = Bunch( suggestive = self.lrs_values[int(self.num_perm*0.37-1)], -- cgit v1.2.3