MetaSTAAR_worker_cov_cond: Generating covariance file for conditional analysis using...

View source: R/MetaSTAAR_worker_cov_cond.R

MetaSTAAR_worker_cov_condR Documentation

Generating covariance file for conditional analysis using MetaSTAARWorker

Description

The MetaSTAAR_worker_cov_cond function takes in genotype, the genotype of variants to be adjusted for in conditional analysis, the object from fitting the null model, variant information and adjusted variant information (unique identifier) to generate the conditional covariance file for the given variant-set, adjusting for a given list of variants.

Usage

MetaSTAAR_worker_cov_cond(
  genotype,
  genotype_adj,
  obj_nullmodel,
  variant_info,
  variant_adj_info
)

Arguments

genotype

an n*p genotype matrix (dosage matrix) of the target sequence, where n is the sample size and p is the number of genetic variants. If the input genotype matrix is sparse (e.g. dgCMatrix format), it is assumed that it has been flipped to represent minor allele coding.

genotype_adj

an n*p_adj genotype matrix (dosage matrix) of the target sequence, where n is the sample size and p_adj is the number of genetic variants to be adjusted for in conditional analysis (or a vector of a single variant with length n if p_adj is 1).

obj_nullmodel

an object from fitting the null model, which is the output from either fit_null_glm function for unrelated samples or fit_null_glmmkin function for related samples in the STAAR package.

variant_info

a data frame or matrix of variant information (unique identifier) with p rows (listed in the same order as the columns of genotype) and should contain the following 4 columns: chromosome (chr), position (pos), reference allele (ref), and alternative allele (alt).

variant_adj_info

a data frame or matrix of adjusted variant information (unique identifier) with p_adj rows (listed in the same order as the rows of genotype_adj) and should contain the following 4 columns: chromosome (chr), position (pos), reference allele (ref), and alternative allele (alt).

Value

a list with the following members:

GTPG_cond: the covariance matrix between all variants in the variant-set (rows) and all variants in the conditional variant-set (columns) (the covariance file for conditional analysis).

variant_info: the data frame or matrix of variant information (unique identifier) with p rows (listed in the same order as the rows of GTPG_cond) and 4 columns: chromosome (chr), position (pos), reference allele (ref), and alternative allele (alt).

variant_adj_info: the data frame or matrix of adjusted variant information (unique identifier) with p_adj rows (listed in the same order as the columns of GTPG_cond) and 4 columns: chromosome (chr), position (pos), reference allele (ref), alternative allele (alt), score statistic (U), and variance (V).

References

Li, X., et al. (2023). Powerful, scalable and resource-efficient meta-analysis of rare variant associations in large whole genome sequencing studies. Nature Genetics, 55(1), 154-164. (pub)


xihaoli/MetaSTAAR documentation built on Nov. 10, 2024, 5:26 a.m.