Title: | Preparing Genotypic Datasets in Order to Run Genomic Analysis |
---|---|
Description: | Three functions to clean, summarize and prepare genomic datasets to Genome Selection and Genome Association analysis and to estimate population genetic parameters. |
Authors: | Italo Granato [aut, cre], Roberto Fritsche-Neto [aut, ths] |
Maintainer: | Italo Granato <[email protected]> |
License: | GPL-3 |
Version: | 0.9.7 |
Built: | 2025-02-28 04:32:21 UTC |
Source: | https://github.com/italo-granato/snpready |
It generates four different types of Genomic Relationship Matrix (GRM)
G.matrix(M, method=c("VanRaden", "UAR", "UARadj", "GK"), format=c("wide", "long"), plot = FALSE)
G.matrix(M, method=c("VanRaden", "UAR", "UARadj", "GK"), format=c("wide", "long"), plot = FALSE)
M |
|
method |
Method to built the GRM. Four methods are currently supported. |
format |
Type of object to be returned. |
plot |
If |
G.matrix provides four different types of relationship matrix. The VanRaden
represents the relationship matrix estimated as proposed by Vanraden (2008):
is the centered marker matrix. For any marker locus
,
where
is the vector of SNP genotypes coded as allele couting (0, 1 and 2).
UAR
is the genomic relationship matrices proposed by Yang et al. (2010) and named as Unified Additive Relationship (UAR). This matrix is then obtained by
where is the allele frequency at SNP
and
is the SNP genotype that takes a value of 0, 1 or 2 for the genotype of the
individual at SNP
.
The same authors proposed an adjustment in the original UAR matrix (
UARadj
) to reduce the bias in estimation of variance in the relationship in causal loci. Thus:
where , c is a constant dependent on MAF of causal variants assumed as 0.
GK
represents the Gaussian kernel, obtained by
where is the square of euclidian distance between two individuals
The
format
argument is the desired output format. For "wide"
, the relationship output produced is in matrix format, with dimension.
If
"long"
is the chosen format, the inverse of the relationship matrix is computed and converted to a table. In this case, the low triangular part of the relationship matrix
is changed to a table with three columns representing the respective rows, columns, and values (Used mainly by ASReml)
If the relationship matrix is not positive definite, a near positive definite matrix is created and solved, followed by a warning message.
It returns the GRM. If the method is VanRaden
, additive and dominance matrices are produced. Otherwise, only the additive form.
If plot
is TRUE
a heat map of the pairwise relationship is save as pdf into the working directory . Also, a 3D plot with the three first principal components is generated.
Pérez-Elizalde, S.,Cuevas, J.; Pérez-Rodríguez, P.; Crossa, J. (2015) Selection of The Bandwidth Parameter in a Bayesian Kernel Regression Model for Genomic-Enabled Prediction. J Agr Biol Envir S, 20-4:512-532
Yang, J., Benyamin, B., McEvoy, B.P., et al (2010) Common SNPs explain a large proportion of the heritability for human height. Nature Genetics 42:565-569
VanRaden, P.M. (2008) Efficient Methods to Compute Genomic Predictions. Journal of Dairy Science, 91:4414-4423
#(1) Additive and dominance relationship matrix data(maize.hyb) x <- G.matrix(maize.hyb, method = "VanRaden", format = "wide") A <- x$Ga D <- x$Gd
#(1) Additive and dominance relationship matrix data(maize.hyb) x <- G.matrix(maize.hyb, method = "VanRaden", format = "wide") A <- x$Ga D <- x$Gd
50 hybrids of maize genotyped with 492 SNP markers
A matrix with 50 rows and 492 columns, where hybrids are in rows and SNP markers in columns
#' data(maize.hyb)
#' data(maize.hyb)
A raw dataset of maize lines genotyped with 768 markers
A matrix with 70656 observations on the following 4 variables.
sample: identification of samples (name of individuals)
marker: identification of SNP markers
allele.1: Allele 1
allele.2: Allele 2
Lines genotyped from allogamous breeding laboratory - ESALQ/USP http://www.genetica.esalq.usp.br/alogamas/index2.html
data(maize.line) ## str(maize.line)
data(maize.line) ## str(maize.line)
Allows for estimating parameters of population genetics from genomic data. Besides, it also allows the estimate of same parameters considering subpopulations.
popgen(M, subgroups, plot = FALSE)
popgen(M, subgroups, plot = FALSE)
M |
Object of class |
subgroups |
A |
plot |
If |
The number of subgroups is defined by the user and accepts any data type (character
, integer
...) to distinguish subpopulations.
These two inputs must have the same sort for rows (genotypes).
Two-level lists are returned (whole
and bygroup
), one with general information for markers and individuals and another by subgroups (if applicable).
For whole
, a list containing estimates parameters for
For each marker it presents the allelic frequency ( and
),
Minor Allele Frequency (
), expected heterozygosity (
), observed
heterozygosity (
), Nei's Genetic Diversity (
) and Polymorphism Informative Content(
), proportion of missing (
),
statistic for the Hardy-Weinberg equilibrium test and its pvalue
It presents observed heterozygosity () and coefficient of inbreeding (
) estimated as excess of homozygous relative to the expected (Keller et al. (2011))
The same parameters as those for markers except PIC are returned for general population along with lower and upper boundaries
shows estimates of effective population size (), additive (
) and dominance (
) variances components, and a summary of number of groups, genotypes and markers
In the presence of subgroups
, the same populational parameters are estimated considering each subpopulation accompanied by its exclusive and fixed alleles. Moreover, a list with the F-statistics (,
and
) for genotypes and markers are exhibited. For genotypes, it shows the statistics considering all subpopulations and a pairwise framework, and for markers loci, the parameters are presented only considering all subpopulations.
The plot
produces a histogram for the estimates of ,
,
and
considering the whole population and subpopulations, when it is available. Also, a heat map of the pairwise
between populations is produced.
Weir, B.S. and C.C. Cockerham. (1984). Estimating F-Statistics for the Analysis of Population Structure. Evolution 38: 1358-1370. doi:10.2307/2408641.
Keller M.C., Visscher P.M., Goddard M.E. (2011) Quantification of inbreeding due to distant ancestors and its detection using dense single nucleotide polymorphism data. Genetics 189:237-249. doi: 10.1534/genetics.111.130922
# hybrid maize data data(maize.hyb) x <- popgen(maize.hyb) # using subpopulations PS<-c(rep(1,25), rep(2,25)) x <- popgen(maize.hyb, subgroups=PS)
# hybrid maize data data(maize.hyb) x <- popgen(maize.hyb) # using subpopulations PS<-c(rep(1,25), rep(2,25)) x <- popgen(maize.hyb, subgroups=PS)
This function gets genomic data ready to be used in packages or softwares that perform genomic predictions
raw.data(data, frame = c("long","wide"), hapmap=NULL, base=TRUE, sweep.sample=1, call.rate=0.95, maf=0.05, imput=TRUE, imput.type=c("wright", "mean","knni"), outfile=c("012","-101","structure"), plot = FALSE)
raw.data(data, frame = c("long","wide"), hapmap=NULL, base=TRUE, sweep.sample=1, call.rate=0.95, maf=0.05, imput=TRUE, imput.type=c("wright", "mean","knni"), outfile=c("012","-101","structure"), plot = FALSE)
data |
object of class |
frame |
Format of genomic data to be imputed. Two formats are currently supported. |
hapmap |
|
base |
|
sweep.sample |
|
call.rate |
|
maf |
Threshold for removing SNP by minor allele frequency. Must be between 0, 1 |
imput |
Should imputation of missing data be performed?. Default is |
imput.type |
Type of imputation. It can be "wright", "mean" or "knni". See |
outfile |
|
plot |
If |
The function allows flexible input of genomic data. Data might be in long format with 4 columns or in wide format where markers are in columns and individuals in rows. Both numeric and nitrogenous bases are accepted. Samples and markers can be eliminated based on missing data rate. Markers can also be eliminated based on the frequency of the minor allele. Three methods of imputation are currently implemented. One is carried out through combination of allele frequency and individual observed heterozygosity estimated from markers.
Hence, for missing values, genotypes are imputed based on their probability of occurrence. This probability depends both on genotype frequency and inbreeding of the individual a specific locus.
The second method is based on mean of SNP. Thus, each missing point in a SNP is replaced by mean of SNP
The "knni" imputes missing markers using the mean of the k-nearest markers. Nearest markers are found by computing the Euclidian distance between markers. If you use this option, please refer to the package impute (Hastie et al. 2017) in publications.
Returns a properly coded marker matrix output and a report specifying which individuals are removed by sweep.sample
and which markers are removed by "call.rate"
and maf
.
Also, a plot with proportion of removed markers and imputed data, for each chromosome, when the map is included, is produced when plot
is TRUE
data(maize.line) M <- as.matrix(maize.line) mrc <- raw.data(M, frame="long", base=TRUE, sweep.sample= 0.8, call.rate=0.95, maf=0.05, imput=FALSE, outfile="-101")
data(maize.line) M <- as.matrix(maize.line) mrc <- raw.data(M, frame="long", base=TRUE, sweep.sample= 0.8, call.rate=0.95, maf=0.05, imput=FALSE, outfile="-101")