You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice if the ld command could compute LD between SNPs. For now, I've just been using the haptools API:
importnumpyasnpfromhaptools.dataimportGenotypesVCFfromhaptools.ldimportpearson_corr_ldcausal_SNP="rs429358"gts=GenotypesVCF.load("tests/data/apoe.vcf.gz")
get_snp_gts=lambdasnp: gts.subset(variants=(snp,)).data[:, 0, :2].sum(axis=1)
target_gts=get_snp_gts(causal_SNP)
other_snps=set(gts.variants["id"])
other_snps.remove(causal_SNP)
ld= {vr: np.abs(pearson_corr_ld(target_gts, get_snp_gts(vr))) forvrinother_snps}
# get the top ten SNPs that have the highest LD with the causal SNPsorted(ld, key=ld.get, reverse=True)[:10]
on second thought, I'm not sure the snplist file format is the best either, since it requires that you provide a beta for each SNP
The text was updated successfully, but these errors were encountered:
It would be nice if the ld command could compute LD between SNPs. For now, I've just been using the haptools API:
on second thought, I'm not sure the snplist file format is the best either, since it requires that you provide a beta for each SNP
The text was updated successfully, but these errors were encountered: