extractRegions: Extract regions

View source: R/extractRegions.R

extractRegionsR Documentation

Extract regions

Description

This function receives three arguments: the scope region set, the target region set and the type of strand. It returns a subset of target region set, which is the intersection of the target region set and the scope region set.

Usage

extractRegions(regions_A, R, strand = "+")

Arguments

regions_A

The scope region set. A GRangesList object. The name of each list element should be the transcript id that it pertains to.

R

The target region set. A GRanges object.

strand

The strand type of the transcripts. It has options "+" and "-".

Value

A GRangesList object.

See Also

calculateShift

Examples

# Take five transcripts.
# Extract the last 200 nt regions from their CDS part.
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
trans.id.pstv <- c("170", "782", "974", "1364", "1387")
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene

# download the CDS part of all transcriptome
cds.tx0 <- cdsBy(txdb, use.names = FALSE)

# pick the CDS part of these five transcripts
cds.p <- cds.tx0[trans.id.pstv]

width <- 200
disp.p.l <- data.frame(
    start = as.numeric(max(end(cds.p))),
    distance = width - 1,
    names = trans.id.pstv
)
R.p.l <- calculateShift(regions = cds.p, disp = disp.p.l, direction = "left", strand = "+")

R.cds.last200 <- extractRegions(regions_A = cds.p, R = R.p.l, strand = "+")

yue-wang-biomath/RgnTX documentation built on Aug. 24, 2023, 1:12 p.m.