if (!file.exists("GAPIT_Tutorial_Data.zip"))
{
  download.file("http://zzlab.net/GAPIT/GAPIT_Tutorial_Data.zip", destfile = "GAPIT_Tutorial_Data.zip")
  unzip("GAPIT_Tutorial_Data.zip")
}
download.file("http://zzlab.net/GAPIT/data/CROP545_Covariates.txt", destfile = "CROPS545_Covariates.txt")
download.file("http://zzlab.net/GAPIT/data/CROP545_Phenotype.txt", destfile = "CROPS545_Phenotype.txt")
# Import the GAPIT demo data genotypes
gt_scan <- data.frame(read.table("GAPIT_Tutorial_Data/mdp_numeric.txt", header = T, stringsAsFactors = F, sep = "\t", nrows = 1))
classes <- sapply(gt_scan, class)
genotypes <- data.frame(read.table("GAPIT_Tutorial_Data/mdp_numeric.txt", header = T, row.names = 1, colClasses = classes, stringsAsFactors = F, sep = "\t"))

GM <- read.table("GAPIT_Tutorial_Data/mdp_SNP_information.txt", header = T, stringsAsFactors = F, sep = "\t")
CV <- read.table("CROPS545_Covariates.txt", header = T, stringsAsFactors = F, sep = "\t")
phenotypes <- read.table("CROPS545_Phenotype.txt", header = T, stringsAsFactors = F, sep = "\t")


#Load dependencies
if (!require("pacman")) install.packages("pacman")
pacman::p_load(mvgc,ggplot2,knitr,gridextra)
source("R/Function_qqplot.R")
source("R/Function_manhattan_QTN.R")
source("R/Function_manhattan.R")
source("R/FUNCTION_powerFDRtype1error.R")

Demo with QTN

#Create QTNs
n=nrow(genotypes)
m=ncol(genotypes)
NQTN=10
#Show the positions of the QTN
QTN.position=sample(m,NQTN,replace=F)
phenotypes_n_1=phenotypes[,2]
test=GWAStest(phenotypes_n_1,genotypes,CV,GM,PCA.M = 3,QTN.position)

Demo with QTN

phenotypes_n_1=phenotypes[,2]
test=GWAStest(phenotypes_n_1,genotypes,CV,GM,PCA.M = 3)


stp4freedom/GWhEAT documentation built on April 3, 2020, 4:21 a.m.