shiftTx: Shift over transcripts

View source: R/shiftTx.R

shiftTxR Documentation

Shift over transcripts

Description

Calculate positional shifting over transcript regions.

Usage

shiftTx(regions, start, width, direction, strand)

Arguments

regions

A feature set following the format indicated in vignette section 3. Either to be GRanges or GRangesList.

start

Starting positions. Each value represents a starting position in each input feature.

width

Widths. Each value represents a width of each region to be picked from each feature.

direction

Either to be character "left" or "right", which means the direction to which the starting position is shifting. The former means moving to the direction of 5' while the latter means moving to 3'.

strand

The strand type of the transcripts. It receives "+" or "-".

Value

A Granges object.

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
start <- as.numeric(max(end(cds.p)))
R.cds.last200 <- shiftTx(cds.p, start = start, width = width, direction = 'left', strand = "+")

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