Skip to contents

Conveniently look up the region of a gene by gene symbol. The value returned by this function can be used as the region argument for trackplot functions such as trackplot_coverage() or trackplot_gene()

Usage

gene_region(
  genes,
  gene_symbol,
  extend_bp = c(10000, 10000),
  gene_mapping = human_gene_mapping
)

Arguments

genes

Transcipt features given as GRanges, data.frame, or list. See help("genomic-ranges-like") for details on format and coordinate systems. Required attributes:

  • chr, start, end: genomic position

  • strand: +/- or TRUE/FALSE for positive or negative strand

  • gene_name: Symbol or gene ID

gene_symbol

Name of gene symbol or ID

extend_bp

Bases to extend region upstream and downstream of gene. If length 1, extension is symmetric. If length 2, provide upstream extension then downstream extension as positive distances.

gene_mapping

Named vector where names are gene symbols or IDs and values are canonical gene symbols

Value

List of chr, start, end positions for use with trackplot functions.

Examples

## Prep data
genes <- read_gencode_transcripts(
  file.path(tempdir(), "references"), release = "42",
  annotation_set = "basic",
  features = "transcript"
)

## Get gene region
gene_region(genes, "CD19", extend_bp = 1e5)
#> $chr
#> [1] "chr16"
#> 
#> $start
#> [1] 28831970
#> 
#> $end
#> [1] 29039342
#>