genomeImagePlot: Genome Image Plot

Description Usage Arguments Details Value See Also Examples

View source: R/genomeImagePlot.R

Description

Generate a plot that shows different classes of rearrangements along a given set of focal genome segments

Usage

1
2
3
4
5
genomeImagePlot(SYNT, focalgenome, ordfocal, remstr = "", main = "",
  remThld = 0.05, vspace = 0, hspace = 0.01, mar = NULL,
  xaxlab = NULL, xlab = "Position [Mb]", yaxlab = NULL, cex = 1,
  font.main = 3, makepdf = FALSE, newdev = TRUE,
  filename = "genome.pdf", colormodel = "srgb")

Arguments

SYNT

A list of matrices that store data on different classes of rearrangements and additional information. SYNT must have been generated with the computeRearrs function (optionally filtered with the filterRearrs function).

focalgenome

Data frame representing the focal genome, containing the mandatory columns $marker, $scaff, $start, $end, and $strand, and optional further columns. Markers need to be ordered by their map position.

ordfocal

Character vector with the IDs of the focal genome segments that will be plotted. Have to match (a subset of) IDs in focalgenome$scaff.

remstr

String that should be removed from the IDs in ordfocal to simplify the y-axis labels. Only relevant when yaxlab = NULL.

main

Title of the plot.

remThld

A numeric value between 0 (inclusive) and 0.5 (exclusive). Controls whether components of rearrangements that are less parsimonious to have changed position relative to the alternative components will be plotted. To plot all components, remThld needs to be smaller than remWgt used in the computeRearrs function.

vspace

A numeric value between 0 and 5. Controls the amount of vertical space between focal genome segments.

hspace

A numeric value between 0 and 1 that controls the proportion of horizontal space that is added to the last marker of a focal genome segment, calculated from the size of the largest focal genome segment.

mar

A numerical vector of the form c(bottom, left, top, right) that specifies the margins on the four sides of the plot. The default mar = NULL sets the margins automatically.

xaxlab

Data frame with two columns that gives the annotations of the x-axis. The column $pos specifies the position of tick-marks, and the column $lab specifies the labels of tick-marks. The default xaxlab = NULL makes annotations every 5 Mb.

xlab

Title for the x-axis.

yaxlab

Annotations of the y-axis. Must be the same length as ordfocal. The default yaxlab = NULL uses as annotations the names in ordfocal, simplified through removal of the string in remstr.

cex

Numerical value that specifies the amount of text magnification.

font.main

Font for the title of the plot. 1 corresponds to plain text, 2 to bold face, 3 to italic, and 4 to bold italic.

makepdf

Logical. Save plot as PDF. See filename and colormodel.

newdev

Logical. Opens a new default graphics device (but not "RStudioGD") via dev.new. Only relevant when makepdf = FALSE.

filename

Character string that gives the name of the PDF file when makepdf = TRUE.

colormodel

Character string that gives the color model for the PDF when makepdf = TRUE. Allowed values are "srgb", "cmyk", "gray", or "grey".

Details

Parameters SYNT, focalgenome, and ordfocal need to be specified, all other parameters have default or automatic settings.

focalgenome must contain the column $marker, a vector of either characters or integers with unique ortholog IDs that can be matched to the values in the rownames of SYNT. Values can be NA for markers that have no ortholog. $scaff must be a character vector giving the name of the focal genome segment (e.g., chromosome or scaffold) of origin of each marker. $start and $end must be numeric vectors giving the location of each marker on its focal genome segment. $strand must be a vector of "+" and "-" characters giving the reading direction of each marker. Additional columns are ignored and may store custom information, such as marker names. Markers need to be ordered by their map position within each focal genome segment, for example by running the orderGenomeMap function. focalgenome may contain additional rows that were absent when running the computeRearrs function. However, all markers present in SYNT need to be contained in focalgenome, with the subset of shared markers being in the same order. Having additional markers in focalgenome can be useful for example to include additional non-orthologous markers in the plot.

When makepdf = TRUE or newdev = TRUE, the width and height of the graphic will be set automatically. The dimensions are determined in inches, thus makepdf = FALSE and newdev = TRUE will produce an error or not work correctly when the default units of the default graphics device are not inches (such as bmp, jpeg, png, or tiff). This can be avoided by setting the default graphics device to one that has inches as default units. Setting both makepdf = FALSE and newdev = FALSE will allow to specify alternative, user-defined dimensions of the graphic. See examples below.

Value

A plot to the default graphics device (but not "RStudioGD") or a PDF file.

The plot visualizes the data contained in SYNT for each focal genome segment in ordfocal, arranged along the y-axis. The x-axis gives the map position of markers on their focal genome segment. Thin vertical lines (ticks) indicate the positions of markers, rearrangement breakpoints, and different classes of rearrangements within six rows per focal genome segment.

Starting at the bottom, the first row gives the map positions of all markers in focalgenome and of the subset of markers present in SYNT by gray and black ticks, respectively. The second row gives the positions of rearrangement breakpoints by red ticks. Ticks are drawn at the midpoints between the positions of the two markers present in SYNT that are adjacent to the breakpoints. Only markers with black ticks can receive colored ticks in the following rows. Maroon indicates markers that are part of inversions (IV); purple indicates markers that are part of syntenic moves (SM); blue indicates markers that are part of class II nonsyntenic moves (NM2); green indicates markers that are part of class I nonsyntenic moves (NM1).

Unless the argument remThld is set to a value smaller than that of remWgt in the computeRearrs function, only markers that are more parsimonious to have changed position relative to alternative markers are highlighted. Lighter tints denote markers that are part of large rearrangements, while darker shades denote markers that are part of small rearrangements. To distinguish between individual large rearrangements versus multiple short adjacent rearrangements, it may be helpful to take the position of breakpoints into account.

See Also

computeRearrs, filterRearrs, getBreakpoints, genomeRearrPlot. For more information about arguments that are passed to other functions, see dev.new, pdf, plot, par.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
SYNT<-computeRearrs(TOY24_focalgenome, TOY24_compgenome, doubled = TRUE)

genomeImagePlot(SYNT, TOY24_focalgenome, c("1", "2", "3"), main = "TOY24")

## change x-axis labels
op<-options(scipen=999)
myxaxlab<-data.frame(pos=seq(2*10^6,10^7,2*10^6),
                     lab=as.character(seq(2*10^3,10^4,2*10^3)))
options(op)
myxlab<-"Position [kb]"
genomeImagePlot(SYNT, TOY24_focalgenome, c("1", "2", "3"), main = "TOY24",
                xaxlab = myxaxlab, xlab = myxlab)

## Not run: 

## make PDF (automatically determine the width and height of the graphic)
genomeImagePlot(SYNT, TOY24_focalgenome, c("1", "2", "3"), main = "TOY24",
                makepdf = TRUE, newdev = FALSE, filename = "genome.pdf")

## make PDF (default dimensions, i.e., square format)
pdf(file = "genome.pdf")
genomeImagePlot(SYNT, TOY24_focalgenome, c("1", "2", "3"), main = "TOY24",
                makepdf = FALSE, newdev = FALSE)
dev.off()

## plot in R Studio window
op <- options(device = "RStudioGD")
genomeImagePlot(SYNT, TOY24_focalgenome, c("1", "2", "3"), main = "TOY24",
                newdev = FALSE)
options(op)

## make EPS, and set user-specified dimensions
setEPS()
postscript("genome.eps", width=4.5,height=3.42,pointsize=9)
genomeImagePlot(SYNT, TOY24_focalgenome, c("1", "2"), main = "TOY24",
                vspace = 1, makepdf = FALSE, newdev = FALSE)
dev.off()

## End(Not run)

dorolin/rearrvisr documentation built on Aug. 6, 2020, 1:32 a.m.