Title: | Trio Data Analysis with Knockoff Statistics for FDR Control |
---|---|
Description: | Identification of putative causal variants in genome-wide association studies with the trio design. The package implements the methods in the paper: Yang, Y., Wang, C., Liu, L., Buxbaum, J., He, Z., & Ionita-Laza, I. (2022). KnockoffTrio: A knockoff framework for the identification of putative causal variants in genome-wide association studies with trio design. The American Journal of Human Genetics, 109(10), 1761-1776. |
Authors: | Yi Yang [aut, cre] |
Maintainer: | Yi Yang <[email protected]> |
License: | GPL-3 |
Version: | 1.0.2 |
Built: | 2024-12-11 07:18:56 UTC |
Source: | CRAN |
Identification of causal loci using KnockoffTrio's feature statistics
causal_loci(window, M = 10, fdr = 0.15)
causal_loci(window, M = 10, fdr = 0.15)
window |
The result window from KnockoffTrio. If there are multiple windows, please use rbind to combine the windows. |
M |
A positive integer for the number of knockoffs. The default is 10. |
fdr |
A real number in a range of (0,1) indicating the target FDR level. The default is 0.15. |
A list that contains:
A data frame for an updated window that includes an extra column for KnockoffTrio's Q-values. A locus with a Q-value <= the target FDR level, i.e., window$q<=fdr, is considered as causal.
A positive real number indicating the significance threshold for KnockoffTrio's feature statistics. A locus with a feature statistic >= thr.w, i.e., window$w>=thr.w is considered as causal. The loci selected by window$w>=thr.w are equivalent to those by window$q<=fdr. No loci are selected at the target FDR level if thr.w=Inf.
data(KnockoffTrio.example) dat.ko<-create_knockoff(KnockoffTrio.example$dat.hap,KnockoffTrio.example$pos,M=10) window<-KnockoffTrio(KnockoffTrio.example$dat,dat.ko,KnockoffTrio.example$pos) result<-causal_loci(window,M=10,fdr=0.15)
data(KnockoffTrio.example) dat.ko<-create_knockoff(KnockoffTrio.example$dat.hap,KnockoffTrio.example$pos,M=10) window<-KnockoffTrio(KnockoffTrio.example$dat,dat.ko,KnockoffTrio.example$pos) result<-causal_loci(window,M=10,fdr=0.15)
Create knockoff genotype data using phased haplotype data.
create_knockoff( dat.hap, pos, M = 10, maxcor = 0.7, maxbp = 80000, phasing.dad = NULL, phasing.mom = NULL )
create_knockoff( dat.hap, pos, M = 10, maxcor = 0.7, maxbp = 80000, phasing.dad = NULL, phasing.mom = NULL )
dat.hap |
A 6n*p matrix for the haplotype data, in which n is the number of trios and p is the number of variants. Each trio must consist of father, mother, and offspring (in this order). The haplotypes must be coded as 0 or 1. Missing haplotypes are not allowed. |
pos |
A numeric vector of length p for the position of p variants. |
M |
A positive integer for the number of knockoffs. The default is 10. |
maxcor |
A real number in a range of [0,1] for the correlation threshold in hierarchical clustering, such that variants from two different clusters do not have a correlation greater than maxcor when constructing knockoff parents. The default is 0.7. |
maxbp |
A positive integer for the size of neighboring base pairs used to generate knockoff parents. The default is 80000. |
phasing.dad |
A numeric vector of length n that contains 1 or 2 to indicate which paternal haplotype was transmitted to offspring in each trio. If NA, the function will calculate the phasing information based on the input haplotype matrix. |
phasing.mom |
A numeric vector of length n that contains 1 or 2 to indicate which maternal haplotype was transmitted to offspring in each trio. If NA, the function will calculate the phasing information based on the input haplotype matrix. |
A 3n*p*M array for the knockoff genotype data.
data(KnockoffTrio.example) dat.ko<-create_knockoff(KnockoffTrio.example$dat.hap,KnockoffTrio.example$pos,M=10)
data(KnockoffTrio.example) dat.ko<-create_knockoff(KnockoffTrio.example$dat.hap,KnockoffTrio.example$pos,M=10)
Calculate KnockoffTrio's feature statistics using original and knockoff genotype data.
KnockoffTrio( dat, dat.ko = NA, pos, start = NA, end = NA, size = c(1, 1000, 5000, 10000, 20000, 50000), p_value_only = FALSE, adjust_for_cov = FALSE, y = NA, chr = "1", xchr = FALSE, sex = NA )
KnockoffTrio( dat, dat.ko = NA, pos, start = NA, end = NA, size = c(1, 1000, 5000, 10000, 20000, 50000), p_value_only = FALSE, adjust_for_cov = FALSE, y = NA, chr = "1", xchr = FALSE, sex = NA )
dat |
A 3n*p matrix for the original genotype data, in which n is the number of trios and p is the number of variants. Each trio must consist of father, mother, and offspring (in this order). The genotypes must be coded as 0, 1, or 2. Missing genotypes are not allowed. |
dat.ko |
A 3n*p*M array for the knockoff genotype data created by function create_knockoff. M is the number of knockoffs. |
pos |
A numeric vector of length p for the position of p variants. |
start |
An integer for the first position of sliding windows. If NA, start=min(pos). Only used if you would like to use the same starting position for different cohorts/analyses. |
end |
An integer for the last position of sliding windows. If NA, end=max(pos). Only used if you would like to use the same ending position for different cohorts/analyses. |
size |
A numeric vector for the size(s) of sliding windows when scanning the genome |
p_value_only |
A logical value indicating whether to perform the knockoff analysis. When p_value_only is TRUE, only the ACAT-combined p-values are to be calculated for each window. When p_value_only is FALSE, dat.ko is required and KnockoffTrio's feature statistics are to be calculated for each window in addition to the p-values. |
adjust_for_cov |
A logical value indicating whether to adjust for covariates. When adjust_for_cov is TRUE, y is required. |
y |
A numeric vector of length n for the residual Y-Y_hat. Y_hat is the predicted value from the regression model in which the quantitative trait Y is regressed on the covariates. If Y is dichotomous, you may treat Y as quantitative when applying the regression model. |
chr |
A character for the name of the chromosome, e.g., "1", "2", ..., "22", and "X". |
xchr |
A logical value indicating whether the analysis is for the X chromosome. When xchr is TRUE, the analysis is for the X chromosome and sex is required. When xchr is FALSE, the analysis is for the autosomes. |
sex |
A numeric vector of length n for the sex of offspring. 0s indicate females and 1s indicate males. Sex is required when xchr is TRUE. |
A data frame for the analysis results. Each row contains the p-values and, if p_value_only is FALSE, KnockoffTrio's feature statistics for a window.
data(KnockoffTrio.example) dat.ko<-create_knockoff(KnockoffTrio.example$dat.hap,KnockoffTrio.example$pos,M=10) window<-KnockoffTrio(KnockoffTrio.example$dat,dat.ko,KnockoffTrio.example$pos)
data(KnockoffTrio.example) dat.ko<-create_knockoff(KnockoffTrio.example$dat.hap,KnockoffTrio.example$pos,M=10) window<-KnockoffTrio(KnockoffTrio.example$dat,dat.ko,KnockoffTrio.example$pos)
A toy example of the haplotype and genotype data for original trios
KnockoffTrio.example
KnockoffTrio.example
KnockoffTrio.example contains the following items:
A numeric genotype matrix of 3 trios and 5 variants. Each trio contains 3 rows in the order of father, mother and offspring. Each column represents a variant.
A numeric haplotype matrix of 3 trios and 5 variants. Each trio contains 6 rows in the order of father, mother and offspring. Each column represents a variant.
A numeric vector of length 5 for the position of 5 variants.
Meta-analysis for KnockoffTrio
meta_analysis(window, n = NA, M = 10)
meta_analysis(window, n = NA, M = 10)
window |
A list of windows for the analysis results from different cohorts/studies. |
n |
A positive integer vector for the number of trios in each cohort/study. For weighted meta-analysis, a study's weight is based on the number of trios. The default is NA for unweighted meta-analysis. |
M |
A positive integer for the number of knockoffs. The default is 10. |
A data frame for the meta-analysis results.
data(KnockoffTrio.example) dat.ko<-create_knockoff(KnockoffTrio.example$dat.hap,KnockoffTrio.example$pos,M=10) window<-data.matrix(KnockoffTrio(KnockoffTrio.example$dat,dat.ko,KnockoffTrio.example$pos)) window.list<-list(window,window) window.meta<-meta_analysis(window.list,M=10) result<-causal_loci(window.meta,M=10,fdr=0.15)
data(KnockoffTrio.example) dat.ko<-create_knockoff(KnockoffTrio.example$dat.hap,KnockoffTrio.example$pos,M=10) window<-data.matrix(KnockoffTrio(KnockoffTrio.example$dat,dat.ko,KnockoffTrio.example$pos)) window.list<-list(window,window) window.meta<-meta_analysis(window.list,M=10) result<-causal_loci(window.meta,M=10,fdr=0.15)