ukb_estimate_gxe: Estimate contribution of GRSxE to variance in outcome...

View source: R/ukb_estimate_gxe.R

ukb_estimate_gxeR Documentation

Estimate contribution of GRSxE to variance in outcome phenotype in UK Biobank

Description

Estimate contribution of GRSxE to variance in outcome phenotype in UK Biobank

Arguments

phenotype_name

A string containing the column name of the phenotype to use as outcome, e.g. '21001-0.0'

ukb_filename

A string or character vector containing the path to the file(s) containing the UK Biobank data

bgens_path

path to the folder containing the *.bgen files with the genetic data

snps

a character vector of SNP RSIDs or a data.frame-type structure containing a column named 'rsid' with SNP RSIDs, as well as an optional column named 'beta' containing the effect estimates of the alternate allele on the outcome

covariate_names

a string or character vector containing the names of any covariates to adjust for before estimating GxE

covariate_factor_names

a string or character vector containing the names of covariates to be considered as factors when adjusting for them

correct_age2_sex

logical indicating whether to adjust for age, age^2, and sex (in addition to any other covariates)

sample_ids

a data.frame containing the individual ids under the column name 'eid'. Any other included columns (e.g. genetic PCs) will be adjusted for. Required if sqc_filename or fam_filename are missing

sqc_filename

path to the UK Biobank sqc file (e.g. ukb_sqc_v2.txt). Required if sample_ids is missing

fam_filename

path to any *.fam file containing the sample ids for the values in sqc_filename. Required if sample_ids is missing

imp_sample_filename

path to a *.sample file containing the sample ids for the genetic data. The default is the first *.sample in the bgens_path folder

ids_to_remove

vector containing the ids of any samples to remove before analysis

npcs

number of genetic principal components to correct for before analysis

betas

vector of effects of SNPs on outcome. Ignored if snps contains a column named 'beta'. Must be in the same order as snps

sim_num

Number of permutations for bootstrap and fake GRSs

Value

ukb_estimate_gxe returns a list containing parameter estimates for alpha1, alpha2, beta, and gamma (xopt), their standard error (SExopt), and the associated p-values (Pxopt). The corresponding estimates for the fake GRS are stored in the xopt0, SExopt0, and Pxopt0, respectively.

In addition, the Xopt and Xopt0 matrices contain the estimates for each bootstrap and fake GRS.

The tdiff contains the t-statistic for the difference between the real data estimates and those from the fake GRS.

Examples

## Not run: 
  library( GxE )
  # Load GWAS results from the Neale lab
  snps = get_betas_from_neale( neale_filename = '21001_irnt.gwas.imputed_v3.both_sexes.tsv.gz',
                               variants_filename = 'variants.tsv.gz' )

  # UK Biobank files not provided
  gxe  =  ukb_gxe_interaction( phenotype_name = '21001-0.0',
                               ukb_filename   = 'uk_biobank/pheno/ukb21067.csv',
                               bgens_path     = 'uk_biobank/imp',
                               snps           = snps,
                               sqc_filename   = 'uk_biobank/geno/ukb_sqc_v2.txt',
                               fam_filename   = 'uk_biobank/plink/ukb1638_cal_chr1_v2_s488366.fam' )

  print( gxe )

## End(Not run)

JonSulc/GxE documentation built on March 29, 2022, 3:27 a.m.