geom_gene: Add Gene Annotation to Coverage Plot.

View source: R/geom_gene.R

geom_geneR Documentation

Add Gene Annotation to Coverage Plot.

Description

Add Gene Annotation to Coverage Plot.

Usage

geom_gene(
  gtf.gr,
  overlap.gene.gap = 0.1,
  gene.size = 1,
  utr.size = 2,
  exon.size = 4,
  arrow.size = 1,
  color.by = "strand",
  fill.color = c(`-` = "darkblue", `+` = "darkgreen"),
  show.utr = TRUE,
  arrow.gap = NULL,
  arrow.num = 50,
  arrow.length = 0.06,
  label.size = 3,
  label.vjust = 2,
  plot.space = 0.1,
  plot.height = 0.2
)

Arguments

gtf.gr

Granges object of GTF, created with import.gff. Default: NULL.

overlap.gene.gap

The gap between gene groups. Default: 0.1.

gene.size

The line size of gene. Default: 1.

utr.size

The line size of UTR. Default: 2.

exon.size

The line size of exon. Default: 4.

arrow.size

The line size of arrow. Default: 1.

color.by

Color the line by. Default: strand.

fill.color

Color used for color.by. Default: darkblue for - (minus strand), darkgreen for + (plus strand).

show.utr

Logical value, whether to show UTR. Default: TRUE.

arrow.gap

The gap distance between arrow. Default: NULL.

arrow.num

Total arrow num of whole region. Default: 50.

arrow.length

The length of arrow. Default: 0.06.

label.size

The size of gene label. Default: 3.

label.vjust

The vjust of gene label. Default: 2.

plot.space

Top and bottom margin. Default: 0.1.

plot.height

The relative height of gene annotation to coverage plot. Default: 0.2.

Value

Plot.

Examples

library(ggcoverage)
library(utils)
library(rtracklayer)
meta.file <- system.file("extdata", "RNA-seq", "meta_info.csv", package = "ggcoverage")
sample.meta <- utils::read.csv(meta.file)
# track folder
track.folder <- system.file("extdata", "RNA-seq", package = "ggcoverage")
# load bigwig file
track.df <- LoadTrackFile(
  track.folder = track.folder, format = "bw",
  meta.info = sample.meta
)
gtf.file <- system.file("extdata", "used_hg19.gtf", package = "ggcoverage")
gtf.gr <- rtracklayer::import.gff(con = gtf.file, format = "gtf")
basic.coverage <- ggcoverage(data = track.df, color = "auto", range.position = "out")
basic.coverage + geom_gene(gtf.gr = gtf.gr)

ggcoverage documentation built on Sept. 6, 2022, 9:06 a.m.