distructExport: Generate files for DISTRUCT.

Description Usage Arguments Details Value Examples

View source: R/pophelper.R

Description

Create DISTRUCT input files from a qlist.

Usage

1
2
3
4
5
6
7
8
9
distructExport(qlist = NULL, grplabbottom = NA, grplabtop = NA,
  grpmean = FALSE, overwritedirs = FALSE, printtitle = FALSE,
  clustercol = NA, grayscale = FALSE, printcolorbrewer = FALSE,
  sepline = T, seplinewidth = 0.2, borderlinewidth = 1.2,
  indlinewidth = 0.2, fontsize = 6, topdist = 5, bottomdist = -7,
  figheight = 36, indwidth = 1, orientation = 0, xorigin = NA,
  yorigin = NA, xscale = 1, yscale = 1, toplabangle = 60,
  bottomlabangle = 60, echodata = TRUE, printdata = FALSE,
  quiet = FALSE, useexe = FALSE)

Arguments

qlist

A qlist (list of dataframes). An output from readQ.

grplabbottom

A character vector of group labels to be plotted below the plot. The vector must be the same length as number of individuals. See details.

grplabtop

An optional character vector of group labels to be plotted above the plot. The vector must be the same length as number of individuals. See details.

grpmean

A logical indicating if individual values are to be plotted (F) or group means are to be plotted (T).

overwritedirs

A logical indicating if existing directories must be overwritten (T) automatically or not (F).

printtitle

A logical indicating if the filename must be printed as the title on the plot.

clustercol

A character vector of colours equal to the number of clusters. Note these are not R colours. Use distructColours() or refer to DISTRUCT manual for colours. With multiple files, number of colours must equal input file with highest number of clusters.

grayscale

A logical indicating if clusters must be shown in grayscale.

printcolorbrewer

A logical indicating if the colours provided in clustercol are ColorBrewer colours. See details.

sepline

A logical indicating if divider lines must be drawn between groups (T).

seplinewidth

A numeric indicating width of sepline.

borderlinewidth

A numeric indicating width of border around the plot.

indlinewidth

A numeric indicating width of border around individual bars and ticks.

fontsize

A numeric indicating font size of group labels.

topdist

A numeric indicating distance of top labels from the top edge of the plot.

bottomdist

A numeric indicating distance of bottom labels from the bottom edge of the plot. Usually a negative number.

figheight

A numeric indicating height of the plot.

indwidth

A numeric indicating width of each individual bar. The width of the plot depends on this value.

orientation

An integer (0,1,2,3) indicating orientation of the plot. See details.

xorigin

A numeric indicating lower left x-coordinate of the plot. See details.

yorigin

A numeric indicating lower left y-coordinate of the plot. See details.

xscale

A numeric indicating scaling for the x direction.

yscale

A numeric indicating scaling for the y direction.

toplabangle

A numeric between 0 and 180 indicating angle of top labels.

bottomlabangle

A numeric between 0 and 180 indicating angle of bottom labels.

echodata

A logical. Not really sure what this does.

printdata

A logical indicating if head and tail of data must be shown in display on running DISTRUCT.

quiet

A logical TRUE or FALSE. Set to TRUE by default to print verbose statements to screen.

useexe

A logical indicating if DISTRUCT executable is automatically run based on system OS (experimental). Does not work on UNIX systems.

Details

Orientation
0 for horizontal orientation (default)
1 for vertical orientation
2 for reverse horizontal orientation
3 for reverse vertical orientation

Origin
Default values of origin for a given orientation:
orientation, xorigin, yorigin
0,72,288
1,360,72
2,540,504
3,288,720
If plot exceeds canvas size, consider shifting xorigin to the left and/or decreasing indwidth.

Colorbrewer colours
Colorbrewer colours are not automatically generated for now. Refer to DISTRUCT manual for colour names.
Replace the colour names in xx-colours.txt output file with selected colorbrewer colours (ex: Accent_3_qual_1).

useexe
This option automatically runs the DISTRUCT executable that is provided with this package. Note that the executable is 64bit LSB requiring a 64bit system. The DISTRUCT executable was obtained from here https://web.stanford.edu/group/rosenberglab/distruct.html. Remember to cite DISTRUCT if this option is used.

See the vignette for more details.

Value

The function does not return anything. The function creates directories for each input file and populates it with files necessary to run DISTRUCT. The files are individual q-matrix file (xx-indq.txt), population q-matrix file (xx-popq.txt), a cluster colour file (xx-colours.txt) and drawparams file. If group labels were defined, then (xx-poplab-bottom.txt) or (xx-poplab-top.txt) are also exported. The DISTRUCT executable is run in this directory to generate an xx.ps file.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
# read some data
slist <- readQ(list.files(path=system.file("files/structure",package="pophelper"),full.names=TRUE))
grps1 <- read.delim(system.file("files/structuregrplabels.txt",package="pophelper"),header=FALSE, stringsAsFactor=F)
grps2 <- read.delim(system.file("files/structuregrplabels2.txt",package="pophelper"),header=FALSE, stringsAsFactor=F)

# plot without labels
distructExport(slist[1])

# plot with bottom group label
distructExport(slist[1],grplabbottom=grps1$V1)

# plot with top group label
distructExport(slist[1],grplabtop=grps2$V1)

# plot group mean values
distructExport(slist[1],grplabbottom=grps1$V1,grpmean=T)

# automatically run DESTRUCT
distructExport(slist[1],useexe=T)

## End(Not run)

royfrancis/pophelper documentation built on Aug. 21, 2018, 4:48 a.m.