calculateShift: Calculate positional shifting over transcriptome

View source: R/calculateShift.R

calculateShiftR Documentation

Calculate positional shifting over transcriptome

Description

The first step of calculating positional shift over transcriptome regions.

Usage

calculateShift(regions, disp, direction = "right", strand = "+")

Arguments

regions

A feature set, which should be a GRangesList object.

disp

A data frame object. It should have three columns, which are 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; names: corresponding transcript ids.

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

Either to be "+" or "-".

Value

A GRanges object.

See Also

extractRegions

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 = "+"
)

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