ggcoverage: Create Coverage Plot.

View source: R/ggcoverage.R

ggcoverageR Documentation

Create Coverage Plot.

Description

Create Coverage Plot.

Usage

ggcoverage(
  data,
  region = "chr14:21,677,306-21,737,601",
  gtf.gr = NULL,
  extend = 2000,
  gene.name = "HNRNPC",
  gene.name.type = c("gene_name", "gene_id"),
  single.nuc = FALSE,
  mapping = NULL,
  color = NULL,
  rect.color = NA,
  facet.key = "Type",
  facet.order = NULL,
  facet.color = NULL,
  group.key = "Group",
  range.size = 3,
  range.position = c("in", "out"),
  plot.space = 0.2,
  mark.region = NULL,
  mark.color = "grey",
  mark.alpha = 0.5,
  show.mark.label = TRUE,
  mark.label.size = 4
)

Arguments

data

Coverage dataframe loaded by LoadTrackFile.

region

Region used to create coverage plot, eg: chr14:21,677,306-21,737,601 or chr14:21,677,306. Default: NULL.

gtf.gr

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

extend

Extend length of region. Default: 2000.

gene.name

The name of gene. Default: HNRNPC.

gene.name.type

Gene name type (filed of gtf.gr), chosen from gene_name and gene_id. Default: gene_name.

single.nuc

Logical value, whether to visualize at single nucleotide level. Default: FALSE.

mapping

Set of aesthetic mappings created by aes or aes_. Default: NULL.

color

Track color. Default: NULL (select automatically).

rect.color

The color of every bin. Default: NA.

facet.key

Sample type key to create coverage plot. Default: Type.

facet.order

The order of Coverage plot. Default: NULL.

facet.color

The color of sample text. Default: NULL (select automatically).

group.key

Group of samples. Default: NULL.

range.size

The label size of range text, used when range.position is in. Default: 3.

range.position

The position of y axis range, chosen from in (move y axis in the plot) and out (normal y axis). Default: in.

plot.space

The space between every facet. Default: 0.2.

mark.region

Mark region on the plot. Default: NULL.

mark.color

The color of marked region. Default: "grey".

mark.alpha

The alpha of marked region. Default: 0.5.

show.mark.label

Logical value, whether to show mark label (use label column in mark.region). Default: TRUE.

mark.label.size

The label size of mark label. Default: 4.

Value

A ggplot2 object.

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")
ggcoverage(data = track.df, color = "auto", range.position = "out")

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