Learn R Programming

gap (version 1.14)

Genetic Analysis Package

Description

As first reported [Zhao, J. H. 2007. "gap: Genetic Analysis Package". J Stat Soft 23(8):1-18. ], it is designed as an integrated package for genetic data analysis of both population and family data. Currently, it contains functions for sample size calculations of both population-based and family-based designs, probability of familial disease aggregation, kinship calculation, statistics in linkage analysis, and association analysis involving genetic markers including haplotype analysis with or without environmental covariates. Over years, the package has been developed in-between many projects hence also in line with the name (gap).

Copy Link

Version

Install

install.packages('gap')

Monthly Downloads

20,276

Version

1.14

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Jing Zhao

Last Published

February 19th, 2026

Functions in gap (1.14)

bt

Bradley-Terry model for contingency table
WriteGRMBin

A function to write GRM binary file
WriteGRM

A function to write GRM file
cis.vs.trans.classification

A cis/trans classifier
cnvplot

genomewide plot of CNVs
ccsize

Power and sample size for case-cohort design
gcontrol

genomic control
gc.lambda

Estimation of the genomic control inflation statistic (lambda)
chow.test

Chow's test for heterogeneity in two regressions
grid2d

Two-dimensional grid
h2.jags

Heritability estimation based on genomic relationship matrix using JAGS
geno.recode

Genotype recoding
genecounting

Gene counting for haplotype analysis
gap

Genetic analysis package
LDkl

LD statistics for two multiallelic markers
MCMCgrm

Mixed modeling with genetic relationship matrices
gc.em

Gene counting for haplotype analysis
circos.cnvplot

circos plot of CNVs.
circos.cis.vs.trans.plot

circos plot of cis/trans classification
fbsize

Sample size for family-based linkage and association design
hmht.control

Controls for highlights
hg38

Chromosomal lengths for build 38
chr_pos_a1_a2

SNP id by chr:pos+a1/a2
a2g

Allele-to-genotype conversion
ci2ms

Effect size and standard error from confidence interval
ab

Test/Power calculation for mediating effect
circos.mhtplot2

Another circos Manhattan plot
circos.mhtplot

circos Manhattan plot with gene annotation
AE3

AE model using nuclear family trios
get_sdy

Get sd(y) from AF, n, b, se
gcontrol2

genomic control based on p values
BFDP

Bayesian false-discovery probability
comp.score

score statistics for testing genetic linkage of quantitative trait
hwe.hardy

Hardy-Weinberg equilibrium test using MCMC
gcp

Permutation tests using GENECOUNTING
hwe.cc

A likelihood ratio test of population Hardy-Weinberg equilibrium for case-control studies
gif

Kinship coefficient and genetic index of familiality
hap

Haplotype reconstruction
cs

Credible set
htr

Haplotype trend regression
hap.control

Control for haplotype reconstruction
makeped

A function to prepare pedigrees in post-MAKEPED format
hwe.jags

Hardy-Weinberg equlibrium test for a multiallelic marker using JAGS
inv_chr_pos_a1_a2

Retrieval of chr:pos+a1/a2 according to SNP id
mht.control

Controls for mhtplot
h2l

Heritability under the liability threshold model
metareg

Fixed and random effects model for meta-analysis
kin.morgan

kinship matrix for simple pedigree
g2a

Conversion of a genotype identifier to alleles
h2_mzdz

Heritability estimation according to twin correlations
metap

Meta-analysis of p values
klem

Haplotype frequency estimation based on a genotype table of two multiallelic markers
h2G

Heritability and its variance
ReadGRMBin

A function to read GRM binary files
get_pve_se

Get pve and its standard error from n, z
get_b_se

Get b and se from AF, n, and z
snpHWE

Functions for single nucleotide polymorphisms
hap.em

Gene counting for haplotype analysis
mr

Mendelian randomization analysis
mhtplot

Manhattan plot
mr_forestplot

Mendelian Randomization forest plot
miamiplot2

Miami Plot
hwe

Hardy-Weinberg equlibrium test for a multiallelic marker
mtdt

Transmission/disequilibrium test of a multiallelic marker
masize

Sample size calculation for mediation analysis
ixy

Conversion of chrosome name from strings
invnormal

Inverse normal transformation
hap.score

Score statistics for association of traits with haplotypes
pgc

Preparing weight for GENECOUNTING
pfc.sim

Probability of familial clustering of disease
mia

Multiple imputation analysis for hap
miamiplot

Miami plot
pvalue

P value for a normal deviate
qtl2dplot

2D QTL plot
qqunif

Q-Q plot for uniformly distributed random variable
pedtodot_verbatim

Pedigree-drawing with graphviz
pfc

Probability of familial clustering of disease
log10pvalue

log10(p) for a P value including its scientific format
hg19

Chromosomal lengths for build 37
h2GE

Heritability and its variance when there is an environment component
hg18

Chromosomal lengths for build 36
logp

log(p) for a normal deviate z
qqfun

Quantile-comparison plots
snptest_sample

A utility to generate SNPTEST sample file
sentinels

Sentinel identification from GWAS summary statistics
mvmeta

Multivariate meta-analysis based on generalized least squares
pbsize

Power for population-based association design
xy

Conversion of chromosome names to strings
qtl2dplotly

2D QTL plotly
qtl3dplotly

3D QTL plot
s2k

Statistics for 2 by K table
runshinygap

Start shinygap
mtdt2

Transmission/disequilibrium test of a multiallelic marker by Bradley-Terry model
pbsize2

Power for case-control association design
pedtodot

Converting pedigree(s) to dot file(s)
read.ms.output

A utility function to read ms output
revStrand

Allele on the reverse strand
log10p

log10(p) for a normal deviate z
muvar

Means and variances under 1- and 2- locus (biallelic) QTL model
whscore

Whittemore-Halpern scores for allele-sharing
tscc

Power calculation for two-stage case-control design
qtlClassifier

A QTL cis/trans classifier
qtlFinder

Distance-based signal identification
labelManhattan

Annotate Manhattan or Miami Plot
plot.hap.score

Plot haplotype frequencies versus haplotype score statistics
print.hap.score

Print a hap.score object
mhtplot.trunc

Truncated Manhattan plot
mhtplot2

Manhattan plot with annotations
METAL_forestplot

forest plot as R/meta's forest for METAL outputs
KCC

Disease prevalences in cases and controls
ReadGRM

A function to read GRM file
allele.recode

Allele recoding
FPRP

False-positive report probability
ESplot

Effect-size plot
asplot

Regional association plot
LD22

LD statistics for two diallelic markers
b2r

Obtain correlation coefficients and their variance-covariances