knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(GAPIT3documentation)
knitr::opts_chunk$set(fig.align = "center")

A basic example

t1 <- Sys.time()

# system.file("extdata", "mdp_traits.txt.gz", package = "GAPIT3documentation")
# system.file("extdata", "mdp_genotype_test.hmp.txt.gz", package = "GAPIT3documentation")

#Step 1: Set data directory and import files
# myY <- read.table("mdp_traits.txt", head = TRUE)
# myG <- read.table("mdp_genotype_test.hmp.txt", head = FALSE)

myPhenoFile <- system.file("extdata", "mdp_traits.txt.gz",
                    package = "GAPIT3documentation")
myGenoFile <- system.file("extdata",
                          "mdp_genotype_test.hmp.txt.gz",
                          package = "GAPIT3documentation")

myPhenotypes <- read.table(myPhenoFile, header = TRUE)
myGenotypes  <- read.table(myGenoFile, header = FALSE)

head(myPhenotypes)
myGenotypes[1:4, 1:9]
#Step 2: Run GAPIT
#devtools::install_github("jiabowang/GAPIT3",force=TRUE)
library(GAPIT3)
#devtools::load_all("~/gits/GAPIT3/")
#myGAPIT <- GAPIT3documentation::GAPIT(
#

myGAPIT <- GAPIT3::GAPIT(
    G=myGenotypes,
    file.output = FALSE,
)
names(myGAPIT)
myGAPIT$GD[1:4, 1:6]
myGAPIT$G[1:4, 1:6]
myGAPIT$kinship[1:4, 1:6]
myGAPIT$chor_taxa


myGAPIT <- GAPIT(
#  Y=myPhenotypes,
  Y=myPhenotypes[, 1:2],
  G=myGenotypes,
  PCA.total=3,
  file.output = FALSE,
)
names(myGAPIT)
myGAPIT$GD[1:4, 1:6]
myGAPIT$G[1:4, 1:6]
myGAPIT$kinship[1:4, 1:6]
myGAPIT$chor_taxa

Return object

class(myGAPIT)
names(myGAPIT)
lapply(myGAPIT, class)
dim(myGAPIT$KI)
class(myGAPIT$KI)

theKin <- as.matrix(myGAPIT$KI[,-1])
distance.matrix <- dist(theKin, upper = TRUE)
hc <- hclust(distance.matrix) #, method = kinship.cluster)
plot(hc)
hcd <- as.dendrogram(hc)
plot(hcd)


plot(as.phylo(hc),
     #type = NJtree.type[tr],
     type = "fan",
     #tip.color =type_col[clusMember],  
     use.edge.length = TRUE, col = "gray80",
     cex=0.8)

par(mar = c(5, 4, 4, 2))

Outfiles

getwd()
list.files(path = ".", pattern = "^GAPIT.")
t99 <- Sys.time()
t99 - t1


knausb/GAPIT3documentation documentation built on Sept. 24, 2022, 11:38 a.m.