aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wqflask/wqflask/my_pylmm/pyLMM/gn2.py15
-rw-r--r--wqflask/wqflask/my_pylmm/pyLMM/lmm.py5
-rw-r--r--wqflask/wqflask/my_pylmm/pyLMM/runlmm.py4
-rw-r--r--wqflask/wqflask/my_pylmm/pyLMM/standalone.py5
4 files changed, 20 insertions, 9 deletions
diff --git a/wqflask/wqflask/my_pylmm/pyLMM/gn2.py b/wqflask/wqflask/my_pylmm/pyLMM/gn2.py
index f30cf1e6..7bceb089 100644
--- a/wqflask/wqflask/my_pylmm/pyLMM/gn2.py
+++ b/wqflask/wqflask/my_pylmm/pyLMM/gn2.py
@@ -45,15 +45,20 @@ def mprint(msg,data):
m = np.array(data)
print(msg,m.shape,"=\n",m)
+def fatal(msg):
+ logger.critical(msg)
+ raise Exception(msg)
+
def callbacks():
return dict(
write = sys.stdout.write,
writeln = print,
- debug = logging.debug,
- info = logging.info,
- warning = logging.warning,
- error = logging.error,
- critical = logging.critical,
+ debug = logger.debug,
+ info = logger.info,
+ warning = logger.warning,
+ error = logger.error,
+ critical = logger.critical,
+ fatal = fatal,
progress = progress,
mprint = mprint
)
diff --git a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py
index 035f31e8..8be3fc6f 100644
--- a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py
+++ b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py
@@ -66,7 +66,7 @@ except ImportError:
sys.stderr.write("WARNING: LMM standalone version missing the Genenetwork2 environment\n")
pass
-progress,mprint,debug,info = uses('progress','mprint','debug','info')
+progress,mprint,debug,info,fatal = uses('progress','mprint','debug','info','fatal')
#np.seterr('raise')
@@ -278,7 +278,7 @@ def run_other_old(pheno_vector,
print("Running the original LMM engine in run_other (old)")
print("REML=",restricted_max_likelihood," REFIT=",refit)
with Bench("Calculate Kinship"):
- kinship_matrix,genotype_matrix = calculate_kinship_old(genotype_matrix, tempdata)
+ kinship_matrix,genotype_matrix = calculate_kinship_new(genotype_matrix, tempdata)
print("kinship_matrix: ", pf(kinship_matrix))
print("kinship_matrix.shape: ", pf(kinship_matrix.shape))
@@ -408,6 +408,7 @@ def calculate_kinship_old(genotype_matrix, temp_data=None):
"""
info("call calculate_kinship_old")
+ fatal("THE FUNCTION calculate_kinship_old IS OBSOLETE, use calculate_kinship_new instead - see Genotype Normalization Problem on Pjotr's blog")
n = genotype_matrix.shape[0]
m = genotype_matrix.shape[1]
info("genotype 2D matrix n (inds) is: %d" % (n))
diff --git a/wqflask/wqflask/my_pylmm/pyLMM/runlmm.py b/wqflask/wqflask/my_pylmm/pyLMM/runlmm.py
index fc7a4b9d..ef0bdd7e 100644
--- a/wqflask/wqflask/my_pylmm/pyLMM/runlmm.py
+++ b/wqflask/wqflask/my_pylmm/pyLMM/runlmm.py
@@ -21,7 +21,7 @@ from optparse import OptionParser
import sys
import tsvreader
import numpy as np
-from lmm import gn2_load_redis, calculate_kinship_old
+from lmm import gn2_load_redis, calculate_kinship_new
from kinship import kinship, kinship_full
import genotype
import phenotype
@@ -190,7 +190,7 @@ elif cmd == 'kinship':
print "Genotype",G.shape, "\n", G
print "first Kinship method",K.shape,"\n",K
k1 = round(K[0][0],4)
- K2,G = calculate_kinship_old(np.copy(G).T,temp_data=None)
+ K2,G = calculate_kinship_new(np.copy(G).T,temp_data=None)
print "Genotype",G.shape, "\n", G
print "GN2 Kinship method",K2.shape,"\n",K2
k2 = round(K2[0][0],4)
diff --git a/wqflask/wqflask/my_pylmm/pyLMM/standalone.py b/wqflask/wqflask/my_pylmm/pyLMM/standalone.py
index 36bf8fd5..40b2021d 100644
--- a/wqflask/wqflask/my_pylmm/pyLMM/standalone.py
+++ b/wqflask/wqflask/my_pylmm/pyLMM/standalone.py
@@ -57,6 +57,10 @@ def mprint(msg,data):
m[-2][0:3]," ... ",m[-2][-3:],"\n ",
m[-1][0:3]," ... ",m[-1][-3:],"]")
+def fatal(msg):
+ logger.critical(msg)
+ raise Exception(msg)
+
def callbacks():
return dict(
write = sys.stdout.write,
@@ -66,6 +70,7 @@ def callbacks():
warning = logger.warning,
error = logger.error,
critical = logger.critical,
+ fatal = fatal,
progress = progress,
mprint = mprint
)