genetracks_grob: Create gene tracks grob

View source: R/genetracks_grob.R

genetracks_grobR Documentation

Create gene tracks grob

Description

Plot gene annotation tracks from ensembldb data using the grid package to create a grob.

Usage

genetracks_grob(
  locus,
  filter_gene_name = NULL,
  filter_gene_biotype = NULL,
  border = FALSE,
  cex.text = 0.7,
  gene_col = ifelse(showExons, "blue4", "skyblue"),
  exon_col = "blue4",
  exon_border = "blue4",
  showExons = TRUE,
  maxrows = NULL,
  text_pos = "top",
  highlight = NULL,
  highlight_col = "red",
  blanks = c("fill", "hide")
)

Arguments

locus

Object of class 'locus' generated by locus().

filter_gene_name

Vector of gene names to display.

filter_gene_biotype

Vector of gene biotypes to be filtered. Use ensembldb::listGenebiotypes() to display possible biotypes. For example, ensembldb::listGenebiotypes(EnsDb.Hsapiens.v75)

border

Logical whether a bounding box is plotted.

cex.text

Font size for gene text.

gene_col

Colour for gene lines.

exon_col

Fill colour for exons.

exon_border

Border line colour outlining exons (or genes if showExons is FALSE). Set to NA for no border.

showExons

Logical whether to show exons or simply show whole gene as a rectangle. If showExons = FALSE colours are specified by exon_border for rectangle border and gene_col for the fill colour.

maxrows

Specifies maximum number of rows to display in gene annotation panel.

text_pos

Character value of either 'top' or 'left' specifying placement of gene name labels.

highlight

Vector of genes to highlight.

highlight_col

Single colour or vector of colours for highlighted genes.

blanks

Controls handling of genes with blank names: "fill" replaces blank gene symbols with ensembl gene ids. "hide" hides genes which are missing gene symbols.

Details

This function is called by gg_genetracks(). It can be used to generate a grob of the gene annotation tracks on their own.

Value

A grob object.

Examples

if(require(EnsDb.Hsapiens.v75)) {
data(SLE_gwas_sub)
loc <- locus(SLE_gwas_sub, gene = 'IRF5', flank = c(7e4, 2e5), LD = "r2",
             ens_db = "EnsDb.Hsapiens.v75")
g <- genetracks_grob(loc)
grid::grid.newpage()
grid::grid.draw(g)
}

myles-lewis/locuszoomr documentation built on Oct. 25, 2024, 7:24 p.m.