iPRSue_estimates_BT: iPRSue_estimates_BT function

View source: R/iPRSue_estimates_BT.R

iPRSue_estimates_BTR Documentation

iPRSue_estimates_BT function

Description

Computes individual-level polygenic risk scores (PRS) with uncertainty estimates using a simulation-based approach for binary traits. This implementation follows the iPRSue framework, simulating multiple PRSs by sampling from the GWAS effect size distribution and deriving individual-level confidence intervals.

Usage

iPRSue_estimates_BT(
  gwas,
  target_pheno,
  target_geno_mat,
  no_of_PRSs = 500,
  significance_level = 0.05,
  seed = NULL
)

Arguments

gwas

A data frame with GWAS summary statistics for binary traits. Must contain beta and se columns representing estimated SNP effect sizes and their standard errors.

target_pheno

Character. Path to the target phenotype file. Assumes no header and individual IDs in the second column.

target_geno_mat

Character. Path to the genotype matrix of target individuals. No header is expected; columns correspond to SNPs.

no_of_PRSs

Integer. Number of simulations used to construct PRS uncertainty intervals. Default is 500.

significance_level

Numeric. Significance level for confidence intervals (e.g., 0.05 gives 95% CI). Default is 0.05.

seed

Integer or NULL. Random seed for reproducibility. If NULL, results may vary across runs. Default is NULL.

Details

For each SNP, the function simulates no_of_PRSs effect sizes from a normal distribution defined by its GWAS beta and SE. These sampled betas are multiplied by the genotype matrix to generate PRS replicates for each individual. Confidence intervals are then calculated using the specified significance level.

This function is designed for binary traits and should be used with GWAS summary statistics obtained from logistic regression.

Value

A data frame containing the following columns:

IID

Individual identifier (from target phenotype file).

PRS

Mean of simulated PRSs for each individual.

Variance

Variance across simulated PRSs.

Lower_Limit

Lower bound of the confidence interval.

Upper_Limit

Upper bound of the confidence interval.

Examples

## Not run: 
  # Step 1: Run GWAS on binary trait
  results <- GWAS_BT(
    plink_path = "./plink2",
    b_file = "./binary_file_prefix",
    discovery_pheno = "./discovery_phenotype_file",
    discovery_cov = "./discovery_covariate_file",
    thread = 48
  )
  
  # Step 2: Estimate individual PRS with uncertainty
  bpt <- system.file("Bpt.txt", package = "iPRSue", mustWork = TRUE)
  gt  <- system.file("Gt.txt",  package = "iPRSue", mustWork = TRUE)
  
  prs_estimates <- iPRSue_estimates_BT(
    gwas              = results,
    target_pheno      = bpt,
    target_geno_mat   = gt,
    no_of_PRSs        = 500,
    significance_level = 0.05,
    seed              = 123
  )
  head(prs_estimates)

## End(Not run)


iPRSue documentation built on Sept. 10, 2025, 10:39 a.m.