-
mrpeg.peg.infer_peg(beta: Array | ndarray | bool_ | number | bool | int | float | complex, se: Array | ndarray | bool_ | number | bool | int | float | complex, eqtl: Array | ndarray | bool_ | number | bool | int | float | complex, perturb: Array | ndarray | bool_ | number | bool | int | float | complex, ld: Array | ndarray | bool_ | number | bool | int | float | complex, perm_number: int =
500, seed: int =12345, alt: bool =False) Array[source] The main inference function for identifying mediating genes using Mr. PEG.
Performs mediation effect estimation integrating GWAS, eQTL, and perturbation data with permutation-based null distribution inference.
- Parameters:
- beta: Array | ndarray | bool_ | number | bool | int | float | complex¶
GWAS effect sizes, array of shape (k,).
- se: Array | ndarray | bool_ | number | bool | int | float | complex¶
GWAS standard errors, array of shape (k,).
- eqtl: Array | ndarray | bool_ | number | bool | int | float | complex¶
eQTL Z-scores, array of shape (k,).
- perturb: Array | ndarray | bool_ | number | bool | int | float | complex¶
Perturbation effect size matrix, array of shape (k, t), where k is the number of perturbed genes and t is the number of downstream target genes.
- ld: Array | ndarray | bool_ | number | bool | int | float | complex¶
Linkage disequilibrium matrix, array of shape (k, k).
- perm_number: int =
500¶ Number of permutations for null distribution estimation. Must be positive; values below 100 may yield inaccurate p-values.
- seed: int =
12345¶ Random seed for permutation testing. Must be a positive integer.
- alt: bool =
False¶ Whether to use the alternative distribution assumption for the null model.
- Returns:
Array of shape (t, 6) where each row corresponds to a downstream gene and columns are:
gamma: Estimated mediation effect size.
gamma_se: Standard error of the effect size.
gamma_p: P-value from t-test.
gamma_perm_mean: Mean of the permutation null distribution.
gamma_perm_z: Z-score relative to permutation null.
gamma_null_p: Two-sided p-value from permutation null.
- Raises:
ValueError – If seed <= 0, perm_number <= 0, or input dimensions mismatch.
Example
>>> import numpy as np >>> from mrpeg.peg import infer_peg >>> beta = np.random.randn(10) >>> se = np.ones(10) * 0.1 >>> eqtl = np.random.randn(10) >>> perturb = np.random.randn(10, 5) >>> ld = np.eye(10) >>> results = infer_peg(beta, se, eqtl, perturb, ld, perm_number=10, seed=42) >>> results.shape (5, 6)