smtpred.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:smtpred 作者: uqrmaie1 项目源码 文件源码
def get_gcovmat(h2, rg):
    """
    Args: h2: vector with SNP heritabilities
          rg: vector with genetic correlations
    Returns: numpy trait by trait array with h2 on diagonal and genetic covariance on offdiagnoals
    """
    mat = numpy.zeros((len(h2), len(h2)))
    mat[numpy.triu_indices(len(h2), 1)] = rg
    mat = mat + mat.T
    mat = mat * numpy.sqrt(numpy.outer(h2, h2))
    numpy.fill_diagonal(mat, h2)
    return numpy.array(mat)


# When input files are score files, not beta files, mtot may be unknown.
# Here mtot=1e6 is assumed. The absolute value of the expected variances for each trait is irrelevant for the multi-trait weighting, so it doesn't matter too much what this value is, expecially if M > N.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号