library(ggr)
library(knitr)

Let's read two example files provided with the package

mymap<-read.table(system.file("extdata","Nguepjop.et.al.2016.map.txt",package="ggr"))
myg<-read.table(system.file("extdata","Nguepjop.et.al.2016.txt",package="ggr"))

The files look like that:

kable(head(mymap))
kable(head(myg))

The map needs to be converted to the R/qtl format

mymap<-as.map(mymap)
mymap

Let's get the genotype codes that are used in the genotype table myg :

codes<-unique(c(as.matrix(myg[,-1])))
codes

We will need a vector of named colors, using codes as names, to plot the genotypes blocs

mycolors<-c("green","yellow","red","white")
names(mycolors)<-codes
mycolors

Let's use the gg function with myg, mymap and mycolors. There is a couple of parameters to explore, especially parameters of the maplot function that is used to plot the map.

gg(x = myg,map = mymap,col =mycolors,lmarg = 0.06 ,inter=0.1,sw=-1,first = 0.05,position=F)


jframi/ggr documentation built on June 25, 2019, 2:47 p.m.