From 5a3f413da480123e3ad943b5f556e0a557f185cc Mon Sep 17 00:00:00 2001 From: Zachary Sloan Date: Thu, 9 May 2013 22:54:34 +0000 Subject: Just added some print statements so I can show matrix/vector shapes to Tony --- wqflask/base/data_set.py | 2 +- .../wqflask/marker_regression/marker_regression.py | 5 +++-- wqflask/wqflask/my_pylmm/pyLMM/lmm.py | 24 +++++++++++++++------- 3 files changed, 21 insertions(+), 10 deletions(-) (limited to 'wqflask') diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 1520b180..d7328441 100755 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -385,7 +385,7 @@ class PhenotypeDataSet(DataSet): continue # for now if not webqtlUtil.hasAccessToConfidentialPhenotypeTrait(privilege=self.privilege, userName=self.userName, authorized_users=this_trait.authorized_users): description = this_trait.pre_publication_description - this_trait.description_display = description + this_trait.description_display = unicode(description, "utf8") if not this_trait.year.isdigit(): this_trait.pubmed_text = "N/A" diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index 6ae1318e..334ce631 100755 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -78,8 +78,9 @@ class MarkerRegression(object): genotype_matrix = np.array(trimmed_genotype_data).T - print("pheno_vector is: ", pf(pheno_vector)) - print("genotype_matrix is: ", pf(genotype_matrix)) + print("pheno_vector: ", pf(pheno_vector)) + print("genotype_matrix: ", pf(genotype_matrix)) + print("genotype_matrix.shape: ", pf(genotype_matrix.shape)) t_stats, p_values = lmm.run( pheno_vector, diff --git a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py index fc021a0b..62fb0fbd 100644 --- a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py +++ b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py @@ -58,6 +58,10 @@ def run_human(pheno_vector, identifier = str(uuid.uuid4()) + print("pheno_vector: ", pf(pheno_vector)) + print("kinship_matrix: ", pf(kinship_matrix)) + print("kinship_matrix.shape: ", pf(kinship_matrix.shape)) + lmm_vars = pickle.dumps(dict( pheno_vector = pheno_vector, covariate_matrix = covariate_matrix, @@ -70,12 +74,12 @@ def run_human(pheno_vector, pheno_vector = pheno_vector[keep] #print("pheno_vector shape is now: ", pf(pheno_vector.shape)) covariate_matrix = covariate_matrix[keep,:] - print("kinship_matrix shape is: ", pf(kinship_matrix.shape)) + #print("kinship_matrix shape is: ", pf(kinship_matrix.shape)) #print("len(keep) is: ", pf(keep.shape)) kinship_matrix = kinship_matrix[keep,:][:,keep] n = kinship_matrix.shape[0] - print("n is:", n) + #print("n is:", n) lmm_ob = LMM(pheno_vector, kinship_matrix, covariate_matrix) @@ -86,7 +90,7 @@ def run_human(pheno_vector, p_values = [] t_stats = [] - print("input_file: ", plink_input_file) + #print("input_file: ", plink_input_file) with Bench("Opening and loading pickle file"): with gzip.open(plink_input_file, "rb") as input_file: @@ -103,6 +107,8 @@ def run_human(pheno_vector, with Bench("Create list of inputs"): inputs = list(plink_input) + + print("len(genotypes): ", len(inputs)) with Bench("Divide into chunks"): results = chunks.divide_into_chunks(inputs, 64) @@ -116,7 +122,7 @@ def run_human(pheno_vector, timestamp = datetime.datetime.utcnow().isoformat() - print("Starting adding loop") + #print("Starting adding loop") for part, result in enumerate(results): #data = pickle.dumps(result, pickle.HIGHEST_PROTOCOL) holder = pickle.dumps(dict( @@ -126,10 +132,10 @@ def run_human(pheno_vector, result = result ), pickle.HIGHEST_PROTOCOL) - print("Adding:", part) + #print("Adding:", part) Redis.rpush(key, zlib.compress(holder)) - print("End adding loop") - print("***** Added to {} queue *****".format(key)) + #print("End adding loop") + #print("***** Added to {} queue *****".format(key)) for snp, this_id in plink_input: #with Bench("part before association"): if count > 2000: @@ -157,6 +163,10 @@ def run_human(pheno_vector, return p_values, t_stats +#class HumanAssociation(object): +# def __init__(self): +# + def human_association(snp, n, keep, -- cgit v1.2.3