Shiny for Genetic Analysis Package (gap) Designs
Jing Hua Zhao
University of Cambridge
Cambridge, UK
https://jinghuazhao.github.io/
2026-06-23
Source:vignettes/shinygap.Rmd
shinygap.RmdThis is an initial attempt to enable easy calculation/visualization of study designs from R/gap which benchmarked relevant publications and eventually the app can produce more generic results.
One can run the app with R/gap installation as follows,
Alternatively, one can run the app from source using
gap/inst/shinygap. In fact, these are conveniently wrapped
up as runshinygap() function.
To set the default parameters, some compromises need to be made, e.g., Kp=[1e-5, 0.4], MAF=[1e-3, 0.8], alpha=[1e-8, 0.05], beta=[0.01, 0.4]. The slider inputs provide upper bounds of parameters.
The interactive Shiny GUI is available, and can be access from a
particular port: http://127.0.0.1:6421, say.
Family-based study
This is a call to fbsize().
Population-based study
This is a call to pbsize().
Case-cohort study
This is a call to ccsize() whose power
argument indcates power (TRUE) or sample size (FALSE) calculation.
Two-stage case-control design
We implement it in function whose format is
tscc(model, GRR, p1, n1, n2, M, alpha.genome, pi.samples, pi.markers, K)
which requires specification of disease model (multiplicative, additive, dominant, recessive), genotypic relative risk (GRR), the estimated risk allele frequency in cases (), total number of cases () total number of controls (), total number of markers (), the false positive rate at genome level (), the proportion of markers to be selected (, also used as the false positive rate at stage 1) and the population prevalence ().
Appendix: Theory
A. Family-based and population-based designs
This is detailed in the package vignettes gap, https://cran.r-project.org/package=gap, or jss1.
B. Case-cohort design
Our implemention is with respect to two aspects2.
C. Two-stage case-control design
Tests of allele frequency differences between cases and controls in a two-stage design are described here3. The usual test of proportions can be written as where and are the allele frequencies, and are the sample sizes, is the proportion of samples to be genotyped at stage 1. The test statistics for stage 1, for stage 2 as replication and for stages 1 and 2 in a joint analysis are then , , , respectively. Let , , and be the thresholds for these statistics, the false positive rates can be obtained according to and for replication-based and joint analyses, respectively.