genebodies {BRGenomics} | R Documentation

## Extract Genebodies

### Description

This function returns ranges that are defined relative to the strand-specific start and end sites of regions of interest (usually genes).

### Usage

    genebodies(
      genelist,
      start = 300,
      end = -300,
      fix.start = "start",
      fix.end = "end",
      min.window = 0
    )

### Arguments

`genelist` | A GRanges object containing genes of interest.
`start` | Depending on `fix.start`, the distance from either the strand-specific start or end site to begin the returned ranges. If positive, the returned range will begin downstream of the reference position; negative numbers are used to return sites upstream of the reference. Set `start = 0` to return the reference position.
`end` | Identical to the `start` argument, but defines the strand-specific end position of returned ranges. `end` must be downstream of `start`.
`fix.start` | The reference point to use for defining the strand-specific start positions of returned ranges, either `"start"` or `"end"`.
`fix.end` | The reference point to use for defining the strand-specific end positions of returned ranges, either `"start"` or `"end"`. Cannot be set to `"start"` if `fix.start = "end"`.
`min.window` | When `fix.start = "start"` and `fix.end = "end"`, `min.window` defines the minimum size (width) of a returned range. However, when `fix.end = fix.start`, all returned ranges have the same width, and `min.window` simply size-filters the input ranges.

### Details

Unlike `GenomicRanges::promoters`, distances can be defined to be upstream or downstream by changing the sign of the argument, and both the start and end of the returned regions can be defined in terms of the strand-specific start or end site of the input ranges. For example, `genebodies(txs, -50, 150, fix.end = "start")` is equivalent to `promoters(txs, 50, 151)` (the downstream edge is off by 1 because `promoters` keeps the downstream interval closed). The default arguments return ranges that begin 300 bases downstream of the original start positions, and end 300 bases upstream of the original end positions.

### Value

A GRanges object that may be shorter than `genelist` due to filtering of short ranges. For example, using the default arguments, genes shorter than 600 bp would be removed.

### Author(s)

Mike DeBerardine

### See Also

`intra-range-methods`

### Examples

    data("txs_dm6_chr4") # load included transcript data
    txs <- txs_dm6_chr4[c(1, 2, 167, 168)]

    txs

    #--------------------------------------------------#
    # genebody regions from 300 bp after the TSS to
    # 300 bp before the polyA site
    #--------------------------------------------------#

    genebodies(txs, 300, -300)

    #--------------------------------------------------#
    # promoter-proximal region from 50 bp upstream of
    # the TSS to 100 bp downstream of the TSS
    #--------------------------------------------------#

    promoters(txs, 50, 101)

    genebodies(txs, -50, 100, fix.end = "start")

    #--------------------------------------------------#
    # region from 500 to 1000 bp after the polyA site
    #--------------------------------------------------#

    genebodies(txs, 500, 1000, fix.start = "end")

[Package BRGenomics version 0.99.31 Index]