Skip to contents

Looks up a gene symbol in transcript annotations and returns a region string suitable for BPCells trackplot functions.

Usage

gene_region(
  transcripts,
  gene_symbol,
  upstream = 1e+05,
  downstream = 1e+05,
  extend_bp = 1e+05,
  strand_aware = TRUE
)

Arguments

transcripts

(data.frame) Transcript annotations with columns gene_name, feature, chr, start, end, and (when strand_aware = TRUE) strand.

gene_symbol

(character) Gene symbol to look up (e.g. "CD34").

upstream

(numeric) Base pairs to extend upstream of the TSS. Default 1e5. Used only when strand_aware = TRUE.

downstream

(numeric) Base pairs to extend downstream of the TSS. Default 1e5. Used only when strand_aware = TRUE.

extend_bp

(numeric) Base pairs to extend on each side of the gene body. Default 1e5. Used only when strand_aware = FALSE.

strand_aware

(logical) If TRUE (default), anchor on the TSS (min(start) for + strand, max(end) for - strand) and extend by upstream/downstream. If FALSE, extend extend_bp on each side of the full gene body (legacy behavior).

Value

A region string in "chr:start-end" format (0-based, BED-style).