https://github.com/philipkremer123/carriage_pneumo_heritability
Raw File
Tip revision: 73c4fa5c8d24d76945308b2616fbb5572d0c39b4 authored by philipkremer123 on 26 April 2022, 06:51:28 UTC
Update code
Tip revision: 73c4fa5
code
##heritability analyses & confidence intervals in Dutch and Maela cohorts##

##heritability analyses with limix

#!/usr/bin/python
import sys
import numpy as np
from numpy import dot, exp, sqrt
from limix.her import estimate

#new load kinship matrix
K = np.loadtxt("kinship_matrix.txt")

#load array of trait values
x = np.loadtxt("array.txt")
y = x.astype(int)

#run and print estimate
print(estimate(y, 'bernoulli', K, verbose=False))

##confidence intervals with ALBI
#generate kinship_eigenvalues file (in R)
>require(ggmix)
>kinship_matrix=read.table("kinship_matrix.txt", h=F)
>kinship_decomp=eigen(kinship_matrix)
>write.table(kinship_decomp$values, "kinship_eigenvalues.txt", sep="\t")

#kinship_estimates file contains the estimate obtained in Limix
albi.py --kinship_eigenvalues kinship_eigenvalues.txt --estimates_filename kinship_estimates.txt > heritability_confidence_intervals.txt'
back to top