Entering edit mode
# Load required package
require(TxDb.Hsapiens.UCSC.hg38.knownGene)
# Assign package to variable for easier use
txdb <- TxDb.Hsapiens.UCSC.hg38.knownGene
# Get promoter regions for genes (2000bp upstream, 0bp downstream)
df <- promoters(genes(txdb), upstream = 2000, downstream = 0)
# Get promoter regions for transcripts
promoters_txdb <- promoters(txdb)
# Get promoter regions for transcripts with 2000bp upstream
promoters_txdb <- promoters(txdb, upstream = 2000)
GRanges object with 6 ranges and 2 metadata columns:
seqnames ranges strand | tx_id tx_name
<Rle> <IRanges> <Rle> | <integer> <character>
ENST00000456328.2 chr1 9869-12068 + | 1 ENST00000456328.2
ENST00000450305.2 chr1 10010-12209 + | 2 ENST00000450305.2
ENST00000473358.1 chr1 27554-29753 + | 3 ENST00000473358.1
ENST00000469289.1 chr1 28267-30466 + | 4 ENST00000469289.1
ENST00000607096.1 chr1 28366-30565 + | 5 ENST00000607096.1
ENST00000606857.1 chr1 50473-52672 + | 6 ENST00000606857.1
-------
seqinfo: 640 sequences (1 circular) from hg38 genome
> 9869-12068
[1] -2199 # this is not 2000