Commit 6e1b2fb0 authored by Hanna  JULIENNE's avatar Hanna JULIENNE

improved docstring in

parent 9a9b371c
function for SNP imputation
This module contain the statistical library for imputation.
Notation style of matrices subset and vectors are based on the publication:
Bogdan Pasaniuc, Noah Zaitlen, Huwenbo Shi, Gaurav Bhatia, Alexander Gusev,
Joseph Pickrell, Joel Hirschhorn, David P. Strachan, Nick Patterson,
Alkes L. Price;
Fast and accurate imputation of summary statistics enhances evidence
of functional enrichment, Bioinformatics, Volume 30, Issue 20, 15 October 2014,
Pages 2906–2914
* add better docstring
import numpy as np
import scipy as sc
import scipy.linalg
def compute_mu(sig_i_t, sig_t_inv, zt):
Compute the estimation of z-score from neighborring snp
return,, zt))
def compute_var(sig_i_t, sig_t_inv, lamb, batch=True):
......@@ -37,7 +55,7 @@ def var_in_boundaries(var,lamb):
def impg_model(zt, sig_t, sig_i_t, lamb=0.01, rcond=0.01, batch=True):
zt : (vector) the vector of known Z scores
sig_t = sig_t.values
......@@ -52,15 +70,12 @@ def impg_model(zt, sig_t, sig_i_t, lamb=0.01, rcond=0.01, batch=True):
correct_inversion = check_inversion(sig_t, sig_t_inv)
var, ld_score = compute_var(sig_i_t, sig_t_inv, lamb, batch)
mu = compute_mu(sig_i_t, sig_t_inv, zt)
if np.any(mu > 30):
var_norm = var_in_boundaries(var, lamb)
R2 = (1-var_norm)
R2 = ((1+lamb)-var_norm)
mu = mu / np.sqrt(R2)
return({"var" : var, "mu" : mu, "ld_score" : ld_score, "condition_number" : condition_number, "correct_inversion":correct_inversion })
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment