Usage
gtrellis_layout(data = NULL, category = NULL,
species = NULL, nrow = NULL, ncol = NULL,
n_track = 1, track_height = 1, track_ylim = c(0, 1),
track_axis = TRUE, track_ylab = "", title = NULL,
xlab = "Genomic positions", xaxis = TRUE, xaxis_bin = NULL,
equal_width = FALSE, compact = FALSE, border = TRUE, asist_ticks = TRUE,
xpadding = c(0, 0), ypadding = c(0, 0), gap = unit(1, "mm"),
byrow = TRUE, newpage = TRUE, add_name_track = FALSE,
name_fontsize = 10, name_track_fill = "#EEEEEE",
add_ideogram_track = FALSE, ideogram_track_height = unit(2, "mm"),
axis_label_fontsize = 6, lab_fontsize = 10, title_fontsize = 16,
legend = list(), legend_side = c("right", "bottom"),
padding = unit(c(2, 2, 2, 2), "mm"), remove_chr_prefix = FALSE)
Arguments
data
a data frame with at least three columns. The first three columns should be genomic categories (e.g. chromosomes), start positions and end positions. This data frame is used to extract ranges for each genomic category (minimal and maximal positions are taken as the range in the corresponding category).
category
subset of categories. It is also used for ordering.
species
Abbreviations of species. e.g. hg19 for human, mm10 for mouse. If this value is specified, the function will download chromInfo.txt.gz
from UCSC ftp automatically. Short scaffolds will be removed if they have obvious different length as others. Non-normal chromosomes will also be detected and removed. Sometimes this detection is not always correct and if you find chromosomes shown on the plot is not what you expect, set category
manually. The argument is passed to read.chromInfo
. nrow
Number of rows in the layout.
ncol
Number of columns in the layout.
n_track
Number of tracks in each genomic category.
track_height
height of tracks. It should be numeric which means the value is relative and will be scaled into percent, or a unit
object. track_ylim
ranges on y axes of tracks. The value can be a vector of length two which means all tracks share same y ranges, or a matrix with two columns, or a vector of length 2*n_track
which will be coerced into the two-column matrix by rows.
track_axis
whether show y axes for tracks. The value is logical that can be either length one or number of tracks.
track_ylab
labels for tracks on y axes. The value can be either length one or number of tracks.
xaxis
whether show x axes.
xaxis_bin
bin size for x axes.
equal_width
whether all columns in the layout have the same width. If TRUE
, short categories will be extended according to the longest category.
compact
For the catgories which are put in a same row, will they be put compactly without being aligned by columns.
border
whether show borders.
asist_ticks
if axes ticks are added on one side in rows or columns, whether add ticks on the other sides.
xpadding
padding on x axes in each cell. Numeric value means relative ratio corresponding to the cell width. Use I
to set it as absolute value which is measured in the data viewport (the coordinate system corresponding to the real data). Currently you cannot set it as a unit
object. ypadding
padding on y axes in each cell. Only numeric value is allowed currently.
gap
0 or a unit
object. If it is length two, the first element corresponds to the gaps between rows and the second corresponds to the gaps between columns. byrow
arrange categories (e.g. chromosomes) by rows or by columns in the layout.
add_name_track
whether add a pre-defined name track (insert before the first track). The name track is simply a track which only contains text. The default style of the name track is simple, but users can self define their own by add_track
. name_fontsize
font size for text in the name track. Note the font size also affects the height of name track.
name_track_fill
filled color for name track.
add_ideogram_track
whether to add a pre-defined ideogram track (insert after the last track). If the cytoband data for specified species is not available, this argument is ignored. The ideogram track simply contains rectangles with different colors, implemented by add_track
. ideogram_track_height
Height of ideogram track. The value should be a unit
object. axis_label_fontsize
font size for axis labels.
lab_fontsize
font size for x-labels and y-labels.
title_fontsize
font size for title.
legend
a grob
object, or a list of grob
objects. legend_side
side of the legend
padding
padding of the plot. Elements correspond to bottom, left, top, right paddings.
remove_chr_prefix
if chromosome names start with 'chr', whether to remove it.