Functions are provided for quantifying evolution and selection on complex traits. The package implements effective handling and analysis algorithms scaled for genome-wide data and calculates a composite statistic, denoted Ghat, which is used to test for selection on a trait. The package provides a number of simple examples for handling and analysing the genome data and visualising the output and results. Beissinger et al., (2018) doi:10.1534/genetics.118.300857
To install the latest development snapshot (see latest changes below), type the following commands into the R console:
library(devtools)
::install_github("Medhat86/Ghat") devtools
To install the latest stable release from CRAN, type the following command into the R console:
install.packages("Ghat")
<- Maize_wqs[[1]]
maize <- Ghat(effects =maize[,1], change=maize[,2], method="scale",
result.adf perms=1000, plot="Ghat", num_eff=54.74819)
mtext(paste("WQS ADF test for selection, pval = ", round(result.adf$p.val,4)))
message (c(result.adf$Ghat , result.adf$Cor , result.adf$p.va))
library(Ghat)
library(parallel)
library(rrBLUP)
<- Maize_wqs[[2]]
phe <- Maize_wqs[[3]]
map <- Maize_wqs[[4]]
gen <-phe[which(is.na(phe[,2])==FALSE),]
phe <-gen[which(is.na(phe[,2])==FALSE),]
gen <- mixed.solve(phe[,2],
result Z= as.matrix(gen[,2:ncol(gen)]),
X= model.matrix(phe[,2]~phe[,3]),
K=NULL, SE=FALSE, return.Hinv=FALSE,
method="ML")
<- as.numeric(unlist(strsplit(gen$X,
CycleIndicator split="_C")) [seq(2,2*nrow(gen),2)])
<- gen[which(CycleIndicator == 1),]
Cycle1 <- gen[which(CycleIndicator == 3),]
Cycle3 <- list(Cycle1,Cycle3)
CycleList <- matrix(nrow=ncol(gen)-1,ncol=2)
frequencies for(i in 1:2){
<- colMeans(CycleList[[i]][,-1],na.rm=TRUE)/2
frequencies[,i]
}<- as.data.frame(frequencies)
frequencies names(frequencies) <- c("Cycle1","Cycle3")
<-frequencies$Cycle3-frequencies$Cycle1 change
<- ld_decay (gen=gen, map=map,
ld max_win_snp=2000, max.chr=10,
cores=1, max_r2=0.03)
<- Ghat(effects=result$u, change=change, method = "scale",
Ghat.adf perms=1000,plot="Ghat", num_eff = 54.74819)
message (paste("Ghat=" , Ghat.adf$Ghat,
"Cor=" , Ghat.adf$Cor ,
"P-val=", Ghat.adf$p.va, sep = " "))
Please visit https://github.com/Medhat86/Ghat for documentation and examples.
In case you want / have to cite my package, please use
citation('Ghat')
(https://CRAN.R-project.org/package=Ghat)
for citation information.
Since core functionality of package depends on the Ghat-Method, consider citing this refernce as well: “Tim Beissinger, Jochen Kruppa, David Cavero, Ngoc-Thuy Ha, Malena Erbe, Henner Simianer, A Simple Test Identifies Selection on Complex Traits, Genetics, Volume 209, Issue 1, 1 May 2018, Pages 321–333, https://doi.org/10.1534/genetics.118.300857”