plot_genes: Plot gene locations for a genomic interval

View source: R/plot_genes.R

plot_genesR Documentation

Plot gene locations for a genomic interval

Description

Plot gene locations for a genomic interval, as rectangles with gene symbol (and arrow indicating strand/direction) below.

Usage

plot_genes(
  genes,
  minrow = 4,
  padding = 0.2,
  colors = c("black", "red3", "green4", "blue3", "orange"),
  scale_pos = 1,
  start_field = "start",
  stop_field = "stop",
  strand_field = "strand",
  name_field = "Name",
  ...
)

Arguments

genes

Data frame containing start and stop in Mbp, strand (as "-", "+", or NA), and Name.

minrow

Minimum number of rows of genes in the plot

padding

Proportion to pad with white space around the genes

colors

Vectors of colors, used sequentially and then re-used.

scale_pos

Factor by which to scale position (for example, to convert basepairs to Mbp)

start_field

Character string with name of column containing the genes' start positions.

stop_field

Character string with name of column containing the genes' stop positions.

strand_field

Character string with name of column containing the genes' strands. (The values of the corresponding field can be character strings "+" or "-", or numeric +1 or -1.)

name_field

Character string with name of column containing the genes' names.

...

Optional arguments passed to plot().

Value

None.

Hidden graphics parameters

Graphics parameters can be passed via .... For example, xlim to control the x-axis limits. These are not included as formal

Examples

genes <- data.frame(chr = c("6", "6", "6", "6", "6", "6", "6", "6"),
                    start = c(139988753, 140680185, 141708118, 142234227, 142587862,
                              143232344, 144398099, 144993835),
                    stop  = c(140041457, 140826797, 141773810, 142322981, 142702315,
                              143260627, 144399821, 145076184),
                    strand = c("-", "+", "-", "-", "-", NA, "+", "-"),
                    Name = c("Plcz1", "Gm30215", "Gm5724", "Slco1a5", "Abcc9",
                             "4930407I02Rik", "Gm31777", "Bcat1"),
                    stringsAsFactors=FALSE)

# use scale_pos=1e-6 because data in bp but we want the plot in Mbp
plot_genes(genes, xlim=c(140, 146), scale_pos=1e-6)

qtl2 documentation built on May 29, 2024, 11:46 a.m.