GAPIT Manual
GAPIT Manual
Disclaimer: While extensive testing has been performed by the Zhiwu Zhang Lab at (2014 to present) at
Washington State University and Edward Buckler Lab (2012-2014) at Cornell University, respectively.
Results are, in general, reliable, correct, and appropriate. However, results are not guaranteed for any
specific set of data. We strongly recommend that users validate GAPIT results with other software
packages, such as SAS and TASSEL.
Support documents: Extensive support documents, including this user manual, source code,
demonstration scripts, data, and results, are available at GAPIT website hosted by Zhiwu Zhang
Laboratory: http://zzlab.net/GAPIT
Questions and comments: To benefit GAPIT community, questions and comments should be addressed
to GAPIT forum: https://groups.google.com/forum/#!forum/gapit-forum. The GAPIT team members will
periodically go through these questions and comments and address them accordingly. For countries with
restriction on Google, questions and comments are welcome to Jiabo Wang by email:
[email protected].
Citation: Multiple statistical methods are implemented in GAPIT version 1, 2 and 3. Citations of GAPIT
vary depending on methods and versions used in the analysis:
Method Method paper Version 11 Version 22 Version 33
The GAPIT project is partially supported by USDA, DOE, NSF, the Agricultural Research Center at
Washington State University, and Washington Grain Commission
1
GAPIT User Manual
Table of Contents
1 INTRODUCTION .......................................................................................................................................... 5
3 GWAS ...................................................................................................................................................... 13
2
GAPIT User Manual
6 TUTORIALS ............................................................................................................................................... 34
7 PROTOTYPE.............................................................................................................................................. 41
8 APPENDIX ................................................................................................................................................ 45
3
GAPIT User Manual
4
GAPIT User Manual
1 INTRODUCTION
1.1 Why GAPIT?
GAPIT implemented a series of methods for Genome Wide Association (GWAS) and Genomic Selection
(GS). The GWAS models include General Linear Model (GLM), Mixed Linear Model (MLM or Q+K),
Compressed MLM (CMLM), Enriched CMLM, SUPPER, Multiple Loci Mixed Model (MLMM),
FarmCPU and BLINK. The GS models include gBLUP, Compressed BLUP, and SUPER BLUP.
Figure 1.1. Methods implemented in GAPIT for GWAS and genomic selection. All the methods support
GWAS, including General Linear Model (GLM), Mixed Linear Model (MLM), Compressed MLM
(CMLM), Enriched CMLM (ECMLM), Settlement of MLM Under Progressively Exclusive Relationship
(SUPER), Fixed and random model Circulating Probability Unification (FarmCPU), and Bayesian-
information and Linkage-disequilibrium Iteratively Nested Keyway (BLINK). Some of these methods
support genomic selection, including MLM, CMLM, ECMLM, SUPER, and FarmCPU. The remaining
(GLM and BLINK) can be used for breeding through marker assisted selection (MAS).
5
GAPIT User Manual
The easiest way is to COPY/PASTE GAPIT tutorial script. Here are example code and outputs:
#Import data from Zhiwu Zhang Lab
myY <- read.table("http://zzlab.net/GAPIT/data/mdp_traits.txt", head = TRUE)
myGD=read.table(file="http://zzlab.net/GAPIT/data/mdp_numeric.txt",head=T)
myGM=read.table(file="http://zzlab.net/GAPIT/data/mdp_SNP_information.txt",head=T)
#GWAS
myGAPIT=GAPIT(
Y=myY[,c(1,2,3)], #fist column is ID
GD=myGD,
GM=myGM,
PCA.total=3,
model=c("FarmCPU", "Blink"),
Multiple_analysis=TRUE)
As demonstrated above, users can specify any one or multiple models. GAPIT accepts multiple input data
formats, including both numeric, hapmap, and PLINK genotype formats. GAPIT produces comprehensive
reports to interpret data and results in publication ready formats. For examples, the distribution of marker
density and decay of linkage equilibrium inform user if the markers are dense enough. When GWAS were
conducted with multiple traits, environments, or multiple models, GAPIT produces the integrated
Manhattan plots with overlapped associated markers highlighted. The above analysis should be completed
within couple minutes. In your current R working directory, you should find multiples files with three types
of extensions: pdf, csv, and txt. The three types of the Manhattan plots are displayed above.
6
GAPIT User Manual
7
GAPIT User Manual
2 Input Data
There are six types of input data: phenotype (Y), genotype in hapmap format (G), genotype data in
numerical format (GD), genotype map (GM), kinship (K), and covariate variables (CV), see Table 2.1.
Phenotypic data must be provided, and the rest are optional, including genotype data, map, kinship, and
covariate. Kinship can be provided by users or be generated from genotype data, or even omitted by suing
BLINK method. Genotypic data may not be needed for genomic prediction if the kinship matrix is provided.
Covariate variables (fixed effects), such as population structure represented by the Q matrix (subpopulation
proportion) or principal components (PCs), are optional. GAPIT provides the option to calculate PCs from
the genotypic data. All input files should be saved as a “Tab” delimited text file.
Notice: It is important that each taxa name is spelled, punctuated, and capitalized (R is case sensitive) the
same way in each of the input data sets. If this is not done, they will be excluded from the analysis.
Additionally, the taxa names must not be numeric.
Param
Default Options Description Tutorial files*
eter
Y NULL User Phenotype mdp_traits.txt
KI NULL User Kinship Matrix KSN.txt
CV NULL User Covariate Variables mdp_PC.txt
G NULL User Genotype Data in Hapmap Format mdp_genotype_test.hmp.txt
GD NULL User Genotype Data in Numeric Format mdp_numeric.txt
Genotype Map for Numeric
GM NULL User mdp_SNP_information.txt
Format
The tutorial file can be downloaded at: http://zzlab.net/GAPIT/GAPIT_Tutorial_Data.zip. These files can
read into R with following commands:
#Phenotypic Data
#myY <- read.table("mdp_traits.txt", head = TRUE)
#Kinship matrix
myKI <- read.table("KSN.txt", head = FALSE)
8
GAPIT User Manual
The file is “Tab” delimited. The first row consists of column labels (i.e., headers). The column labels
indicate the phenotype name, which is used for the remainder of the analysis.
The first 11 columns display attributes of the SNPs and the remaining columns show the nucleotides
observed at each SNP for each taxa. The first row contains the header labels and each remaining row
contains all the information for a single SNP. The first five individuals on the first seven SNPs from the
tutorial data (mdp_genotype.hmp.txt) are presented below.
This file can be read into R by typing the following command line:
myG <- read.table("mdp_genotype_test.hmp.txt", head = FALSE)
9
GAPIT User Manual
Although all of the first 11 columns are required, GAPIT uses only 3 of these: the “rs” column, which is
the SNP name (e.g. “PZB00859.1”); the “chrom” column, which is the SNP’s chromosome; and the “pos”,
which is the SNP’s base pair (bp) position. It is sufficient to fill in the requested information in the remaining
eight columns with “NA”s. To be consistent with HapMap naming conventions, missing genotypic data are
indicated by either “NN” (double bit) or “N” (single bit).
For genotypic data in HapMap format, GAPIT accepts genotypes in either double bit or in the standard
IUPAC code (single bit) as following:
Genotype AA CC GG TT AG CT CG AT GT AC
Code A C G T R Y S W K M
By default, the HapMap numericalization is performed so that the sign of the allelic effect estimate (in the
GAPIT output) is with respect to the nucleotide that is second in alphabetical order. For example, if the
nucleotides at a SNP are “A” and “T”, then a positive allelic effect indicates that “T” is favorable. Selecting
“Major.allele.zero = TRUE” in the GAPIT() function will result in the sign of the allelic effect estimate
being with respect to the minor allele. In this scenario, a positive allelic effect estimate will indicate that the
minor allele is favorable.
Homozygotes are denoted by “0” and “2” and heterozygotes are denoted by “1” in the “GD” file. Any
numeric value between “0” and “2” can represent imputed SNP genotypes. The first row is a header file
with SNP names, and the first column is the taxa name. The example file (mdp_numeric.txt from tutorial data set)
is as following:
This file can be read into R by typing the following command line:
myGD <- read.table("mdp_numeric.txt", head = TRUE)
The genetic map (“GM”) file contains the name and location of each SNP. The first column is the SNP id,
the second column is the chromosome, and the third column is the base pair position. As seen in the example,
the first row is a header file. The example file (mdp_SNP_information.txt from tutorial data set) is as following:
10
GAPIT User Manual
2.3 Kinship
The kinship matrix file (called “KI” in GAPIT) is formatted as an n by n+1 matrix where the first column
is the taxa name, and the rest is a square symmetric matrix. Unlike the other input data files, the first row
of the kinship matrix file does not consist of headers. The example (KSN.txt from tutorial data set) is as following:
11
GAPIT User Manual
12
GAPIT User Manual
3 GWAS
3.1 GWAS model overview
Currently, GAPIT has implemented more than ten models. The similarity and difference among seven
milestone models are summarized in the figure below. The simplest model (t test) is to directly detect the
association between a phenotype (y) and markers (Si) one at a time, where i=1 to m, and m is number of
markers. When a cofactor, such as population structure (Q) is introduced through a general linear model
(GLM), the cofactor may not only account residuals (e) partially, but also adjust some effect that does not
belong to the testing markers and consequently reduce false positives. The mixed linear model (MLM)
applies the same principle by adding individuals’ genetic effects as random cofactor effects with variance
structure defined by the kinship (K) among individuals. In both Q or Q+K models, Q and K stay the same.
There are no cofactors that are adjusted by the marker tests.
13
GAPIT User Manual
The optimization of groping in CMLM and optimization of kinship among groups in ECMLM are
thoroughly based on phenotypes. There is no impact from marker tests. The situation was changed by the
multiple loci mixed model (MLMM). Through marker association tests, the associated markers are fitted
as the cofactors for marker test. The cofactors are adjusted through forward and backward stepwise
regression of mixed model. However, both Q and K remain unchanged.
In the SUPER method, K is derived from the associated markers and is adjected accordingly by the marker
tests. As the K is derived from a smaller number of markers than the K in MLM and MLMM that are derived
from all the markers, the confounding between K and some of the markers becomes more severe. SUPER
eliminate the confounding by using the complimentary kinship derived from associated markers except for
the ones that are in strong linkage disequilibrium (LD) with the testing markers under a user-defined
threshold.
To eliminate the ambiguity of determining associated markers are in LD with a testing marker, FarmCPU
completely removes the confounding from kinship by using a fixed-effect model without a kinship derived
either from all markers, or associated markers. Instead, the kinship derived from the associated markers is
used to select the associated markers using the maximum likelihood method. This process overcomes the
model overfitting problems of stepwise regression. FarmCPU uses both the fixed effect model and the
random effect model iteratively.
In both SUPER and FarmCPU models, the bin approach is used to avoid selecting markers from the same
locations with bin size and the number of bins optimized using the maximum likelihood method. The
underlying assumption is that causal genes are distributed equally across the genome. BLINK eliminates
the assumption to improve statistical power by using the linkage disequilibrium (LD) method. Markers are
sorted with the most significantly associated maker on the top as reference. The remaining markers are
removed if they are in LD with the most associated marker. Among the remaining makers, the most
significantly associated maker is selected as the reference. The process is repeated until no markers can be
removed. The random effect model in FarmCPU to select associated markers using the maximum likelihood
method remains a high computing cost for a large number of individuals. BLINK approximate the
maximum likelihood using Bayesian Information Content (BIC) in a fixed-effect model to eliminate the
computational burden.
Two models use the fixed-effect model only which is the most computing efficient, including GLM and
BLINK. FarmCPU is a hybrid that uses both the fixed-effect model and the random effect model. The rest
use a fixed and random effects mixed model which is computationally expensive, including MLM, CMLM,
ECMLM, SUPER, and MLMM. CMLM uses groups and is cubic time faster than MLM. Due to additional
optimizations, ECMLM and SUPER are slower than CMLM. For a trial analysis, GLM and BLINK are
good to start with.
Regarding statistical power, multiple loci models (e.g. MLMM, FarmCPU, and BLINK) are superior to the
rest. Within multiple loci model category, FarmCPU is superior to MLMM11 and BLINK is superior to
FarmCPU13. Within the single locus model category, MLM is superior to GLM5, CMLM is superior to
MLM6, ECMLM is superior to ECMLM8, SUPER and MLM are superior to MLM9,10. These relationships
14
GAPIT User Manual
are summarized by the model stairs in the first chapter. The method on a higher stair has higher statistical
power than the one on a lower stair. The magnitude of the differences among models may change from case
to case, however, their order stays the same. The inversion of the order has not been found. Therefore,
BLINK is selected as the default GAPIT model because of its high computing efficiency and statistical
power. Users are welcome to use the following statement to justify the usage of BLINK.
“In addition to the capability to incorporate principal components as covariates to reduce false positives
due to population stratification, BLINK iteratively incorporates associated markers as covariates for
testing markers to eliminate their connection to the cryptic relationship among individuals. The associated
markers are selected according to linkage disequilibrium, optimized for Bayesian information content, and
reexamined across multiple tests to reduce false negatives”.
“Principal component analysis was performed with GAPIT (version 3)3 using all available SNPs. GAWAS
was conducted by GAPIT (version 3)3 using BLINK model17. The first principal components were fitted as
covariate variables to reduce the false positives due to population stratification”.
15
GAPIT User Manual
There are also parameters specific to models. For example, the CMLM model involves number of groups.
These model specific parameters will be described within the sections of specific models.
Table 3.5.1. GAPIT input parameters.
Parameter Default Options Description
GLM, MLM, CMLM, SUPER,
model Blink Choose one or multiple models to conduct GWAS
MLMM, FarmCPU, and Blink
kinship.algorithm VanRaden Zhang, Loiselle and EMMA Algorithm to Derive Kinship from Genotype
complete, ward, single,
kinship.cluster average Clustering algorithm to group individuals based on their kinship
mcquitty, median, and centroid
kinship.group Mean Max, Min, and Median Method to derive kinship among groups
LD.chromosome NULL User Chromosome for LD analysis
LD.location NULL User Location (center) of SNPs for LD analysis
LD.range NULL User Range around the Central Location of SNPs for LD Analysis
PCA.total 0 >0 Total Number of PCs as Covariates
PCA.scaling None Scaled, Centered.and.scaled Scale And/Or Center And Scale The SNPs Before Conducting PCA
SNP.FDR 1 >0 and <1 Threshold to Filter SNP on FDR
SNP.MAF 0 >0 and <1 Minor Allele Frequency to Filter SNPs in GWAS Reports
SNP.effect Add Dom Genetic Model
SNP.P3D TRUE FALSE Logic Variable to Use P3D or Not for Testing SNPs
SNP.fraction 1 >0 and <1 Fraction of SNPs Sampled to Estimate Kinship and PCs
SNP.test TRUE FALSE Logic Variable to Test SNPs or Not
Y = Xβ + Zu + e, (1)
where Y is the vector of observed phenotypes; β is an unknown vector containing fixed effects, including
the genetic marker, population structure (Q), and the intercept; u is an unknown vector of random additive
genetic effects from multiple background QTL for individuals/lines; X and Z are the known design matrices;
and e is the unobserved vector of residuals. The u and e vectors are assumed to be normally distributed with
a null mean and a variance of:
u G 0
Var =
e 0 R (2)
where G = σ2aK with σ2a as the additive genetic variance and K as the kinship matrix. Homogeneous
variance is assumed for the residual effect; i.e., R= σ2eI, where σ2e is the residual variance. The proportion
of the total variance explained by the genetic variance is defined as heritability (h2).
16
GAPIT User Manual
σ a2
h2 =
σ a2 + σ e2 , (3)
3.9 P3D/EMMAx
In addition to implementing compression, GAPIT uses EMMAx/P3D6,24 to reduce computing time for
MLM, CMLM, ECMLM, and SUPER. If specified, the additive genetic (σ2a) and residual (σ2e) variance
components will be estimated prior to conducting GWAS. These estimates are then used for each SNP
where a mixed model is fitted.
3.10 SUPER
SUPER is an advanced version of FaST-Select, developed Wang et al. in 2016. The major difference
between SUPER and FaST-Select is that SUPER uses bin approach to select associated markers. The entire
genome is divided into equal sized bins and each bin is represented by the most significant marker on the
bin. The bin size and number of bins selected are optimized using maximum likelihood method in a random
model with the kinship derived from the selected bins. Consequently, the confounding between the kinship
and some of markers become more severe than the kinship derived from all markers. SUPER eliminate the
confounding by using the complementary kinship derived from associated markers except the ones that are
in strong linkage disequilibrium (LD) with the testing markers under a user defined threshold. Both
simulation and real data demonstrated that SUPER had higher statistical power than regular MLM.
3.12 FarmCPU
To solve the problem of false positive control and confounding between testing markers and cofactors
simultaneously, an iterative method, named Fixed and random model Circulating Probability Unification
(FarmCPU), was developed in 201611. The associated markers detected from the iterations are fitted as the
cofactors to control false positives for testing the rest markers in a fixed effect model. To avoid the over
model fitting problem in stepwise regression, a random effect model is used to select the associated markers
using maximum likelihood method11.
In the cycle of fixed effect model of iterations, markers are tested against the associated markers, not the
confounded kinship used by MLM, CMLM, ECMLM, SUPER, and MLMM. In the cycle of random effect
model of iterations, markers are selected among a small number of associated markers using maximum
likelihood method to avoid the over model fitting problem in stepwise regression used by MLMM, which
select marker among all available markers. Consequently, FarmCPU exhibits higher statistical power than
MLMM11. As FarmCPU tests markers in a fixed effect model, it is computational efficient than the methods
that test markers in random effect model, such as MLM, CMLM, ECMLM, SUPER, and MLMM 11.
3.13 BLINK
BLINK method was designed to have both high statistical power and computational efficiency 13. It was
inspired by FarmCPU method with two major changes to achieve the objectives. One is to eliminate the
assumption that causal genes are evenly distributed across genome that required by FarmCPU. As the
assumption cause either inclusion of non causal genes, or missing the causal genes that are in the same bin
with another causal genes with stronger signal. BLINK works directly on markers instead of bins. Markers
that are in linkage disequilibrium (LD) with the most significant marker are excluded. For the second
remaining marker, the exclusion is conducted in the same way as the most significant marker, so on and so
forth until no marker can be excluded.
The other change is to use Bayesian Information Content (BIC) of a fixed effect model to approximate the
maximum likelihood of a random effect model to select the associated markers among the markers remained
the exclusion based on LD. As both the models of testing markers and selecting associated markers as
cofactors are fixed effect model, the computation complexity reach the maximum. A dataset with one
million individuals and one million markers can be solved in hours by using BLINK C version. The BLINK
R version can be run as standard alone, or through GAPIT. To run BLINK in GAPIT, simply specify model=
"Blink". The performances of the two versions were documented by the BLINK article on GigaScience 13.
18
GAPIT User Manual
4 Genomic Selection
Genomic selection, or genomic prediction termed in human genetics, is to use genetic markers across the
whole genome to predict individual performances if formats of phenotypes or predicted genetic merit. In
contrast to GWAS, there is a strong interaction between prediction methods and the traits measured in a
particular condition. The reversion of method superiorities has been found in many cases. The genomic
selection based on SUPER, named SUPER BLUP, has higher prediction accuracy than the genomic
selection based on MLM known as genomic BLUP (gBLUP) for traits controlled with a smaller number of
genes. The prediction accuracies are reversed for traits controlled by a large number of genes. The genomic
selection based on CMLM, named Compressed BLUP, has higher accuracy for traits with low heritability
than gBLUP. GAPIT implemented a series of methods for GWAS and genomic selection toward high
statistical power.
The groups created from compression belong to either a reference (R) or an inference (I) panel. All groups
in the reference panel have at least one individual with phenotypic data, and all groups in the inference
panel have no individuals with phenotypic data. Genomic prediction for groups in the inference panel is
based on phenotypic ties with corresponding groups in the reference panel.
The group kinship matrix is then partitioned into to R and I groups as follows:
k k RI
k= RR
k II
(4)
k IR ,
where kRR is the variance-covariance matrix for all groups in the reference panel, kRI is the covariance
matrix between the groups in the reference and inference panels, kIR = (kRI)’ is the covariance matrix
between the groups inference and reference panels, and kII is the variance-covariance matrix between the
groups in the inference panels.
Solving of mixed linear model is performed on the reference individuals.
yR =X R + ZR u R + eR , (5)
where all terms are as defined in Equation (1), and the “R” subscript denotes that only individuals in the
reference panel are considered.
The genomic prediction of the inference groups is derived Henderson’s formula (1984) as follows:
u I =K IR K -1RR uR , (6)
where kIR, kRR , and uR are as previously defined, and uI is the predicted genomic values of the individuals
in the inference group.
The reliability of genomic prediction is calculated as follows:
PEV
Reliability=1-
a2 19
GAPIT User Manual
(7)
where PEV is the prediction error variance which is the diagonal element in the inverse left-hand side of
the mixed model equation, and a is the genetic variance.
2
20
GAPIT User Manual
5 Output Results
GAPIT produces a series of output files that are saved in two formats. All tabular results are saved as comma
separated value (.csv) files, and all graphs are stored as printable document format (.pdf) files. This section
provides descriptions of these output files.
21
GAPIT User Manual
Figure 5.2 Frequency and accumulative frequency of marker density. Distribution of marker density is
displayed as a histogram and an accumulative distribution.
22
GAPIT User Manual
Figure 5.3 Linkage disequilibrium (LD) decay over distance. LDs were calculated on sliding windows with
100 adjacent genetic markers. Each dot represents a pair of distances between two markers on the window
and their squared correlation coefficient. The red line is the moving average of the 10 adjacent markers.
5.4 Heterozygosis
The frequency of heterozygous were calculated for both individuals and markers. High level of
heterozygosis indicated low quality. For example, over 50% of heterozygosis on inbred lines for some of
markers suggested they problematic (see bottom right).
23
GAPIT User Manual
24
GAPIT User Manual
Figure 5.6 Kinship plot. A heat map of the kinship matrix is created to indicate the relationship between
individuals.
Figure 5.7 Neighbor-Joining (NJ)-tree The whole population was divided into 5 clusters with each colors.
5.8 QQ-plot
The quantile-quantile (QQ) –plot is a useful tool for assessing how well the model used in GWAS accounts
for population structure and familial relatedness. In this plot, the negative logarithms of the P-values from
the models fitted in GWAS are plotted against their expected value under the null hypothesis of no
association with the trait. Because most of the SNPs tested are probably not associated with the trait, the
majority of the points in the QQ-plot should lie on the diagonal line. Deviations from this line suggest the
presence of spurious associations due to population structure and familial relatedness, and that the GWAS
model does not sufficiently account for these spurious associations. It is expected that the SNPs on the
upper right section of the graph deviate from the diagonal. These SNPs are most likely associated with the
trait under study. By default, the QQ-plots in GAPIT show only a subset of the larger P-values (i.e., less
significant P-values) to reduce the file size of the graph.
25
GAPIT User Manual
Figure 5.8 Quantile-quantile (QQ) –plot of P-values. The Y-axis is the observed negative base 10 logarithm
of the P-values, and the X-axis is the expected observed negative base 10 logarithm of the P-values under
the assumption that the P-values follow a uniform[0,1] distribution. The dotted lines show the 95%
confidence interval for the QQ-plot under the null hypothesis of no association between the SNP and the
trait.
26
GAPIT User Manual
Figure 5.9 Manhattan plot. The X-axis is the genomic position of the SNPs in the genome, and the Y-axis
is the negative log base 10 of the P-values. Each chromosome is colored differently. SNPs with stronger
associations with the trait will have a larger Y-coordinate value.
Table 5.10 GWAS results for all SNPs that were analyzed.
This table provides the SNP id, chromosome, bp position, P-value, minor allele frequency (maf), sample
size (nobs), R2 of the model without the SNP, R2 of the model with the SNP, and adjusted P-value following
a false discovery rate (FDR)-controlling procedure25.
27
GAPIT User Manual
This table provides the SNP id, chromosome, bp position, and the allelic effect estimate of each SNP
analyzed.
Figure 5.12.1. Compression profile with single group. The X-axis on all graphs display the summary
statistic method used to obtain the group kinship matrix. The rectangles with different colors indicate the
clustering algorithm used to group individuals.
Note: This graph is not created when multiple groups are specified.
When a range of groups (i.e., a range of dimensions for the group kinship matrix) is specified, a different
series of graphs are created. In this situation, the X-axis displays the group number. Lines with different
style and colors are used to present the combinations between clustering algorithm and the algorithm to
calculate kinship among groups.
28
GAPIT User Manual
Figure 5.12.2. Compression profile over multiple groups. The X-axis on each graph is the number of
groups considered, and the Y-axes on the graphs are the -2*log likelihood function, the estimated genetic
variance components, the estimated residual variance component, the estimated total variance, and the
heritability estimate. Each clustering method and group kinship type is represented as a line on each graph.
Notice: This graph is not created when only one group is specified.
Figure 5.13 The profile for the optimum compression. The optimal method to calculate group kinship is
“Mean”, the optimal clustering method is “average”, the number of groups (ie., the dimension of the
group kinship matrix) is 251, the value of -2*log likelihood function is 1800.11, and the heritability is
41.6%.
29
GAPIT User Manual
Table 5.14.1 Summary for Bayesian information criterion (BIC) model selection results.
The number of PCs/Covariates, the BIC value, and the log Likelihood function value are presented. In this
table, the optimal number of PCs to include in the GWAS model is 2.
Figure 5.15.1 Multiple traits or methods Manhattan and QQ plot. The dash line in the Figure A indicated
the common significant markers were detected by two methods or traits. The solid line in the Figure A
indicated the common significant markers were detected by more than two methods or traits.
30
GAPIT User Manual
Another multiple Manhattan plot with multiple symphysis could be created in the GAPIT now. The
square, triangle, circle, diamond, and inverted triangle indicated each GWAS results of multiple methods
or traits. Users also can define the type of points by “allpch” parameter.
Figure 5.15.2 Multiple traits or methods symphysis Manhattan plot. The dash line indicated the common
significant markers were detected by two methods or traits. The solid line indicated the common
significant markers were detected by more than two methods or traits.
The individual id (taxa), group, RefInf which indicates whether the individual is in the reference group (1)
or not (2), the group ID number, the BLUP, and the PEV of the BLUP.
31
GAPIT User Manual
Figure 5.17 Joint distribution of genomic breeding value and prediction error variance.
32
GAPIT User Manual
33
GAPIT User Manual
6 Tutorials
The “Getting started” section should be reviewed before running these tutorials, and it is assumed that the
GAPIT package and its required libraries have been installed. These tutorials begin with a scenario requiring
minimal user input. Subsequent scenarios require a greater amount of user input. Each scenario involves
two steps: reading in the data and then running the GAPIT() function. All tutorials are available on the
GAPIT home page, which also contains the R source code and results for all the scenarios.
The GAPIT maize demonstration data (described at www.panzea.org) are from a maize association panel
consisting of 281 diverse lines27. The genotypic data consist of 3,093 SNPs distributed across the maize
genome, and are available in HapMap and numeric format. The three phenotypes included are ear height,
days to pollination, and ear diameter. The kinship matrix was calculated using the method of Loiselle et
al.28 and the fixed effects used to account for population structure were obtained from STRUCTURE 29.
Notice: It is important that the correct paths to the directories are specified. Please note that two backward
slashes (“\\”) are necessary when specifying these paths.
6.1 A Basic Scenario
The user needs to provide two data sets (phenotype and genotype) and one input parameter. This parameter,
“PCA.total”, specifies the number of principal components (PCs) to include in the GWAS model. GAPIT
will automatically calculate the kinship matrix using the VanRaden method30, perform GWAS and genomic
prediction with the optimum compression level using the default clustering algorithm (average) and group
kinship type (Mean). The scenario assumes that the genotype data are saved in a single file in HapMap
format. If the working directory contains the tutorial data, the analysis can be performed by typing these
command lines:
34
GAPIT User Manual
35
GAPIT User Manual
The three genotype file used in these scenario are from the file used in Tutorial 5.1. Their results should
be identical.
6.5 Numeric Genotype Format
In this scenario, the genotype data set from Scenario 1 is formatted differently, specifically in numerical
format. Two genotype files are required. One file contains the genotypic data, and the other contains the
chromosome and base pair position of each SNP. These are passed to GAPIT through the “GD” and “GM”
parameters, respectively. The analysis can be performed by typing these command lines:
36
GAPIT User Manual
The three genotype file used in these scenario are the splits from the file used in the previous scenario.
Their results should be identical.
This scenario is the same as previous scenario except changing “file.fragment” from default (512) to 128.
As SNPs (minimume of two) are sampled withing each fragment, the final SNPs sampled would be
different for different length of fragment when the SNP sample fraction is less than 100%. The results in
this scenario would be different from the previous one.
37
GAPIT User Manual
6.10 SUPER
GAPIT also implements the SUPER GWAS method 9, which extracts a small subset of SNPs and uses
them in FaST-LMM. This method not only retains the computational advantage of FaST-LMM, but also
increases statistical power.
6.11 MLMM
Multiple Loci Mixied linear Model is published by Segura in 2012. The code of MLMM in GAPIT is:
myY <- read.table("mdp_traits.txt", head = TRUE)
myG <- read.table("mdp_genotype_test.hmp.txt", head = FALSE)
38
GAPIT User Manual
6.12 Farm-CPU
Fixed and random model Circulating Probability Unification (FarmCPU) is published by Xiaolei in 2016.
The code of Farm-CPU in GAPIT is:
6.13 BLINK
Bayesian-information and Linkage-disequilibrium Iteratively Nested Keyway (BLINK) is published by
Meng in 2018. The code of BLINK used in GAPIT is:
The BLINK C version execute file should be in the working directory and change mod 777.
(chmod 777 blink_versions)
The execute file can be downloaded at https://github.com/Menggg/BLINK/blob/master/
39
GAPIT User Manual
6.15 gBLUP
The gBLUP is based on the Mixed linear Model to predict phenotype, BLUP, and BLUE value.
6.16 cBLUP
The cBLUP is based on the compressed Mixed linear Model. It used optimum compression group kinship
instead of individual kinship.
myY <- read.table("mdp_traits.txt", head = TRUE)
myGD=read.table("http://zzlab.net/GAPIT/data/mdp_numeric.txt",head=T)
myGM=read.table("http://zzlab.net/GAPIT/data/mdp_SNP_information.txt",head=T)
6.17 sBLUP
The sBLUP is based on the SUPER Model. It used pseudo QTNs to build individual kinship.
40
GAPIT User Manual
7 Prototype
The usage of GAPIT described in previous chapters barely require knowledge of R. Users can simply
copy/paste the command lines from the user manual with a minimal keyboard typing such as changing
file names and path. All the results are saved in the format of text files and PDF files. GAPIT also output
R objects which can be used for advance purposes, including: 1) developing new statistical approaches or
software package using GAPIT output as a starting point; 2) comparing GAPIT with other new or existing
statistical methods or software packages; 3) studying a specific result from GAPIT. Using these objects
require knowledge of R. This chapter give examples to use GAPIT output R objects.
7.1 Statistical power comparison among methods
GAPIT.Power.compare() is an example function use multiple functions in GAPIT and the output R
objects to perform comparison of statistical power using different models. The deteils can be found in
GAPIT source code. The following is an example to use the function. Note: running 100 replicates may
take more than a day to finsh.
41
GAPIT User Manual
First, we randomly set 25% of original phenotype (Y) as missing (NA) and generate a genomic prediction
model by using their kinship. Then we record the correlation between the predicted phenotypic values and
the original phenotype. We repeat this process for 1000 times. The average correlation is used as the
criteria of genome prediction accuracy. The corresponding R code is displayed in the following box. The
accuracy (correlation coefficient) over the 100 replicates (for demonstration purposes only; we suggest
42
GAPIT User Manual
using 1000 replications) were 0.9203 and 0.6749 in the reference and inference (cross validation),
respectively. The standard deviations were 0.078 and 0.0054 in the reference and inference, respectively.
#Initial
#######################################################################################
t=100 #total replicates
s=1/5 #sample of inference, e.g. set it to 1/5 for five fold cross validation
Y.raw=myY[,c(1,3)]#choos a trait
Y.raw=Y.raw[!is.na(Y.raw[,2]),] #Remove missing data
n=nrow(Y.raw)
n.missing=round(n*s)
storage.ref=matrix(NA,t,1)
storage.inf=matrix(NA,t,1)
#Loop on replicates
for(rep in 1:t){
#Prediction
myGAPIT <- GAPIT(
Y=Y0,
KI=myKI,
CV=myCV,
model="gBLUP"
)
prediction=myGAPIT$Pred
storage=cbind(storage.ref,storage.inf)
colnames(storage)=c("Reference","Inference")
write.table(storage, "GAPIT.Cross.Validation.txt", quote = FALSE, sep = "\t", row.names = TRUE,col.names = NA)
repeated until all the individuals have been excluded at least once. The correlation between the originals
and the prediction (might be more than once) is used as the accuracy of prediction. The following
demonstrate the process with the same data in previous section.
#Initial
#######################################################################################
nj= 200 # number of Jack Knifes, nj>0, nj!=1
Y.raw=myY[,c(1,3)]#choos a trait
Y.raw=Y.raw[!is.na(Y.raw[,2]),] #Remove missing data
n=nrow(Y.raw)
if(nj>=1){nLoop=nj
}else{
nLoop=1/nj
}
assignment=ceiling((1:n)/(n/nLoop))
randomization=sample(1:n,n)
assignment=assignment[randomization]
nLoop=ceiling(nLoop)
#Loop on replicates
for(rep in 1:nLoop){
44
GAPIT User Manual
8 Appendix
45
GAPIT User Manual
4. There are many methods implemented in GAPIT, which one should I use?
A: Literature demonstrated the order of statistical power: BLINK > FarmCPU> MLMM > SUPER >
ECMLM > CMLM > MLM > GLM.
8. What should I do with “Error in file (file, "rt") : cannot open the connection”?
A: In most cases this error is caused by incorrect file name or number of file specific is more than exist.
46
GAPIT User Manual
11. How to fix the error of using covariates from STRUCTURE as fixed effects?
A: This error is occurring because the covariates from STRUCTURE are linearly dependent. In particular,
for a given individual/taxa, these covariates sum to 1. To circumvent this error, remove one of the
STRUCTURE covariates from the corresponding input file.
13. My trait was measured in multiple environments, how do I use them simultaneously?
A: They can be averaged across environments, and use means by GAPIT. The genetic and environmental
interaction was implemented in a separated software package: GEMT (http://zzlab.net/GEMT).
47
GAPIT User Manual
REFERENCES
1. Lipka, A. E. et al. GAPIT: genome association and prediction integrated tool. Bioinformatics 28, 2397–2399 (2012).
2. Tang, Y. et al. GAPIT Version 2: An Enhanced Integrated Tool for Genomic Association and Prediction. Plant
Genome 9, 1–9 (2016).
3. Wang, J. & Zhang, Z. GAPIT Version 3: Boosting Power and Accuracy for Genomic Association and Prediction.
Genomics. Proteomics Bioinformatics 19, 1–12 (2021).
4. Price, A. L. et al. Principal components analysis corrects for stratification in genome-wide association studies. Nat
Genet 38, 904–909 (2006).
5. Yu, J. M. et al. A unified mixed-model method for association mapping that accounts for multiple levels of relatedness.
Nat. Genet. 38, 203–208 (2006).
6. Zhang, Z. et al. Mixed linear model approach adapted for genome-wide association studies. Nat. Genet. 42, 355–360
(2010).
7. Zhang, Z., Todhunter, R. J., Buckler, E. S. & Van Vleck, L. D. Technical note: Use of marker-based relationships with
multiple-trait derivative-free restricted maximal likelihood. J. Anim. Sci. 85, 881–885 (2007).
8. Li, M. et al. Enrichment of statistical power for genome-wide association studies. BMC Biol. 12, 73 (2014).
9. Wang, Q., Tian, F., Pan, Y., Buckler, E. S. E. S. & Zhang, Z. A SUPER Powerful Method for Genome Wide
Association Study. PLoS One 9, e107684 (2014).
10. Segura, V. et al. An efficient multi-locus mixed-model approach for genome-wide association studies in structured
populations. Nature Genetics 44, 825–830 (2012).
11. Liu, X., Huang, M., Fan, B., Buckler, E. S. & Zhang, Z. Iterative Usage of Fixed and Random Effect Models for
Powerful and Efficient Genome-Wide Association Studies. PLoS Genet. 12, e1005767 (2016).
12. Wang, J. et al. Expanding the BLUP alphabet for genomic prediction adaptable to the genetic architectures of complex
traits. Heredity (Edinb). 121, 648–662 (2018).
13. Huang, M., Liu, X., Zhou, Y., Summers, R. M. & Zhang, Z. BLINK: A package for the next level of genome-wide
association studies with both individuals and markers in the millions. Gigascience giy154 (2019).
doi:10.1093/gigascience/giy154
14. Atwell, S. et al. Genome-wide association study of 107 phenotypes in Arabidopsis thaliana inbred lines. Nature 465,
627–631 (2010).
15. Zhang, Z. et al. Mixed linear model approach adapted for genome-wide association studies. Nat Genet 42, 355–360
(2010).
16. Purcell, S. et al. PLINK: A Tool Set for Whole-Genome Association and Population-Based Linkage Analyses. Am J
Hum Genet 81, 559-575. (2007).
17. Huang, M. et al. BLINK: A package for the next level of genome-wide association studies with both individuals and
markers in the millions. Gigascience giy154 (2018). doi:10.1093/gigascience/giy154
18. Pritchard, J. K., Stephens, M. & Donnelly, P. Inference of population structure using multilocus genotype data.
Genetics 155, 945–959 (2000).
19. Zhao, K. et al. An Arabidopsis example of association mapping in structured samples. PLoS Genet. 3, 0071–0082
(2007).
20. Yu, J. M. et al. A unified mixed-model method for association mapping that accounts for multiple levels of relatedness.
Nat. Genet. 38, 203–208 (2006).
21. Zhang, Z. et al. Mixed linear model approach adapted for genome-wide association studies. Nat. Genet. 42, 355–60
(2010).
22. Yu, J. et al. A unified mixed-model method for association mapping that accounts for multiple levels of relatedness.
Nat. Genet. 38, 203–208 (2006).
23. Purcell, S. et al. PLINK: a tool set for whole-genome association and population-based linkage analyses. Am J Hum
Genet 81, 559–575 (2007).
24. Kang, H. M. et al. Variance component model to account for sample structure in genome-wide association studies. Nat.
Genet. 42, 348–354 (2010).
48
GAPIT User Manual
25. Benjamini, Y. & Hochberg, Y. Controlling the false discovery rate: a practical and powerful approach to mutliple
testing. J.R. Statis. Soc. B. 57, 289–300 (1995).
26. Guo, G. et al. Canine hip dysplasia is predictable by genotyping. Osteoarthr. Cartil. 19, 420–429 (2011).
27. Flint-Garcia, S. A. et al. Maize association population: a high-resolution platform for quantitative trait locus dissection.
Plant J 44, 1054–1064 (2005).
28. Loiselle, B. A., Sork, V. L., Nason, J. & Graham, C. Spatial Genetic-Structure of a Tropical Understory Shrub,
Psychotria Officinalis (Rubiaceae). Am. J. Bot. 82, 1420–1425 (1995).
29. FALUSH, D., STEPHENS, M. & PRITCHARD, J. K. Inference of population structure using multilocus genotype
data: dominant markers and null alleles. Mol. Ecol. Notes 7, 574–578 (2007).
30. VanRaden, P. M. Efficient methods to compute genomic predictions. J Dairy Sci 91, 4414–4423 (2008).
31. Liu, X., Huang, M., Fan, B., Buckler, E. S. E. S. & Zhang, Z. Iterative Usage of Fixed and Random Effect Models for
Powerful and Efficient Genome-Wide Association Studies. PLoS Genet. 12, e1005767 (2016).
49