GeneUpDownStream: Get Genes plus Up and Down Stream Regions

View source: R/GeneUpDownStream.R

GeneUpDownStreamR Documentation

Get Genes plus Up and Down Stream Regions

Description

Given a genes region or genomic region (GR), this function yields the GR plus the especified amount of DNA bases upstream and downstream the GR.

Usage

GeneUpDownStream(
  GR,
  upstream = 0,
  downstream = 0,
  extend = NULL,
  fix = NULL,
  onlyUP = FALSE,
  onlyDown = FALSE
)

Arguments

GR

A GRanges-class object containing the ranges of the genes or genomic regions to be extended upstream/downstream

upstream

Integer (Default: 0). The amount of DNA bases (bps) upstream of the GR.

downstream

Integer (Default: 0). The amount of DNA bases (bps) downstream of the GR.

extend

Integer (Default: NULL). If upstream == downstream, then simply you may use extend.

fix

A string with one of the three possible values: 'start', 'end' or 'center' to denoteg what to use as an anchor for each element in GR.

onlyUP

Logic (Default: FALSE). If TRUE returns the region upstream the GR.

onlyDown

Logic (Default: FALSE). If TRUE returns the region downstream the GR.

Details

Users can select whether to request only upstream, only downstream, or both, upstream and downstream. Please notice that for a gene on the negative strand, 'the start of the gene' corresponds to the 'end' of the gene in the GRanges object and the 'end of the gene' correspond to the 'start' of the gene in the GRanges object.

Examples

starts = c(65419, 450703, 923928, 944204)
ends = c(71585, 451697, 944581, 959309)
chrs = c(rep('chr1', 2), rep('chr2', 2))
gr = makeGRangesFromDataFrame(
        data.frame(seqnames = chrs, start = starts, end = ends,
                strand = c('+', '-', '+', '-'),
                genes = c('A', 'B', 'C', 'D')), keep.extra.columns = TRUE)

gr1 = GeneUpDownStream(GR = gr, upstream = 2000, downstream = 1000)

genomaths/MethylIT.utils documentation built on July 4, 2023, 12:05 a.m.