mecfs_bio.build_system.task.protein_coloc.coloc_abf
Colocalization of two traits at one locus by approximate Bayes factors (coloc.abf).
Follows Giambartolomei et al. 2014 and the coloc R package (approx.bf.estimates, combine.abf, sdY.est). The method assumes at most one causal variant per trait in the locus and needs no LD.
Glossary: - M: number of variants in the locus (both traits measured on the same M variants, same allele orientation). - z = beta / se, V = se^2. - W: prior standard deviation of the true effect. W = 0.15 * sdY for a quantitative trait (sdY is the trait's phenotypic standard deviation) and W = 0.2 for a case-control trait (log odds scale). - r = W^2 / (W^2 + V). - lABF: log approximate Bayes factor of a variant being causal versus no association, lABF = 0.5 * (log(1 - r) + r * z^2).
Hypotheses and their unnormalized log posteriors, with L1 = logsumexp(lABF1), L2 = logsumexp(lABF2) and L12 = logsumexp(lABF1 + lABF2): - H0, no association with either trait: 0. - H1, trait 1 only: log p1 + L1. - H2, trait 2 only: log p2 + L2. - H3, both traits, distinct causal variants: log p1 + log p2 + log(exp(L1 + L2) - exp(L12)). - H4, both traits, one shared causal variant: log p12 + L12. p1, p2 and p12 are the prior probabilities that a given variant is causal for trait 1 only, trait 2 only, or both.
When sdY of a quantitative trait is unknown it is estimated from the data: for a variant with minor allele frequency f, sample size n and standard error se, se^2 is approximately sdY^2 / (2 * n * f * (1 - f)). Rearranging, 2 * n * f * (1 - f) is approximately sdY^2 * (1 / se^2). So sdY^2 is the slope of the no-intercept regression
y_j = c * x_j + e_j, with y_j = 2 * n_j * f_j * (1 - f_j) and x_j = 1 / se_j^2,
over variants j, where e_j is the regression error (the deviation of y_j from c * x_j). The least squares solution is c = sum_j(x_j * y_j) / sum_j(x_j^2), and sdY = sqrt(c).
Classes:
-
CaseControlTraitModel–A case-control trait with effects on the log odds scale.
-
ColocAbf–coloc.abf: single causal variant per trait, no LD.
-
ColocInput–Summary statistics of two traits on the same M variants, in the same allele orientation.
-
ColocMethod– -
ColocPosteriors– -
ColocPriors– -
QuantitativeTraitModel–A quantitative trait; sd_y None means estimate sdY from allele frequency and N.
Functions:
-
combine_abf– -
estimate_sd_y–Estimate sdY as sqrt(c), c = sum_j(x_j * y_j) / sum_j(x_j^2), x = 1 / se^2, y = 2 * n * f * (1 - f).
-
log_abf–Per-variant lABF = 0.5 * (log(1 - r) + r * z^2), r = W^2 / (W^2 + V).
Attributes:
CaseControlTraitModel
ColocAbf
coloc.abf: single causal variant per trait, no LD.
Methods:
-
run–
Attributes:
-
name(str) – -
priors(ColocPriors) –
run
Source code in mecfs_bio/build_system/task/protein_coloc/coloc_abf.py
ColocInput
Summary statistics of two traits on the same M variants, in the same allele orientation.
maf and n of a trait are needed only when its model is quantitative with sd_y None.
Attributes:
-
beta1(ndarray) – -
beta2(ndarray) – -
maf1(ndarray | None) – -
maf2(ndarray | None) – -
model1(TraitModel) – -
model2(TraitModel) – -
n1(ndarray | None) – -
n2(ndarray | None) – -
se1(ndarray) – -
se2(ndarray) –
ColocMethod
ColocPosteriors
Attributes:
ColocPriors
QuantitativeTraitModel
combine_abf
Source code in mecfs_bio/build_system/task/protein_coloc/coloc_abf.py
estimate_sd_y
Estimate sdY as sqrt(c), c = sum_j(x_j * y_j) / sum_j(x_j^2), x = 1 / se^2, y = 2 * n * f * (1 - f).
Source code in mecfs_bio/build_system/task/protein_coloc/coloc_abf.py
log_abf
Per-variant lABF = 0.5 * (log(1 - r) + r * z^2), r = W^2 / (W^2 + V).