# NOT RUN {
sfiles <- list.files(path=system.file("files/structure",package="pophelper"),
full.names=TRUE)
slist <- readQ(sfiles)
# basic
plotQMultiline(slist[1],exportpath=getwd())
# multiple files
plotQMultiline(slist[1:3],exportpath=getwd())
# adjust samples per line (spl) and lines per page (lpp)
plotQMultiline(slist[1],spl=30,exportpath=getwd())
plotQMultiline(slist[1],lpp=8,exportpath=getwd())
plotQMultiline(slist[1],spl=75,lpp=10,exportpath=getwd())
# sort individuals
plotQMultiline(slist[1],sortind="all",exportpath=getwd())
plotQMultiline(slist[1],sortind="Cluster1",exportpath=getwd())
plotQMultiline(slist[1],sortind="label",exportpath=getwd())
# use custom individual labels
inds <- read.delim(system.file("files/structureindlabels.txt",
package="pophelper"),header=FALSE,stringsAsFactors=FALSE)
rownames(slist[[1]]) <- inds$V1
plotQMultiline(slist[1],useindlab=TRUE,exportpath=getwd())
# change cluster colours
plotQMultiline(slist[1],clustercol=c("steelblue","coral"),exportpath=getwd())
# change bar width and height
plotQMultiline(slist[1],barsize=1,spl=149,indlabsize=3,height=5,exportpath=getwd())
# read group labels
md <- read.delim(system.file("files/metadata.txt", package="pophelper"),
header=TRUE,stringsAsFactors=FALSE)
# plot with one group label set
plotQMultiline(qlist=slist[1],grplab=md[,2,drop=FALSE],exportpath=getwd())
plotQMultiline(qlist=slist[1],grplab=md[,2,drop=FALSE],useindlab=TRUE,exportpath=getwd())
# sort ind within groups
plotQMultiline(qlist=slist[1],grplab=md[,2,drop=FALSE],sortind="Cluster1",exportpath=getwd())
plotQMultiline(qlist=slist[1],grplab=md[,2,drop=FALSE],sortind="all",exportpath=getwd())
plotQMultiline(qlist=slist[1],grplab=md[,2,drop=FALSE],sortind="label",exportpath=getwd())
# subset or reorder groups
plotQMultiline(qlist=slist[1],grplab=md[,2,drop=FALSE],subsetgrp=c("CatB"),exportpath=getwd())
plotQMultiline(qlist=slist[1],grplab=md[,2,drop=FALSE],
subsetgrp=c("Cat B","CatA"),exportpath=getwd())
# using multiple group label sets
plotQMultiline(qlist=slist[1],grplab=md,ordergrp=TRUE,exportpath=getwd())
# subset on a group from second group label set
plotQMultiline(qlist=slist[1],grplab=md,selgrp="cat",subsetgrp="CatB",exportpath=getwd())
# }
Run the code above in your browser using DataLab