getNearbyPAdist: Get distance between nearby pAs

View source: R/R_funclib_movAPA.r

getNearbyPAdistR Documentation

Get distance between nearby pAs

Description

getNearbyPAdist calcualtes distance between adjacent pAs within each gene or within a given 'ftr' (e.g., 3UTR) of each gene. This function can be used to determine the 'minDist' and 'maxDist' parameters in get3UTRAPApd.

Usage

getNearbyPAdist(
  pacds,
  ftrs = "3UTR",
  within = "gene",
  return = "summary",
  verbose = TRUE
)

Arguments

pacds

a PACdataset, which should contain gene and/or ftr columns in its anno slot.

ftrs

default is 3UTR, used to filter pacds. It couls be a vector like c('3UTR','intron'). If it is NULL, then will not filter pacds by ftr.

within

should be gene (default) or ftr, which means to calculate distance within each gene or ftr (but still within each gene).

return

can be summary/mean/median/df/other any character. mean to return the mean distance value; summary (default) to return summary of distance; median to return median distance; df to return the data.frame; others to not return anything but just print summary.

verbose

TRUE to print the summary of distance.

Value

Depends on the ‘return' parameter. If return=’df', then a data.frame with two columns (id, distance). The id depends on the 'within' parameter, would be like 'chrX.-.1756' (chr.strand.gene) or 'chrX.-.1756.3UTR' (chr.strand.gene.ftr).

See Also

get3UTRAPApd

Examples

data(PACds)
## summary of distance
s=getNearbyPAdist(PACds, ftrs='3UTR', within='gene')
## mean distance
getNearbyPAdist(PACds, ftrs='3UTR', within='gene', return='mean')
## all distance in a data frame
d=getNearbyPAdist(PACds, ftrs='3UTR', within='gene', return='df')
## median distance, and not print summary
d[d$distance==max(d$distance), ]
getNearbyPAdist(PACds, ftrs='3UTR', within='gene', return='median', verbose=FALSE)
## just print summary, not return anything
getNearbyPAdist(PACds, ftrs='3UTR', within='gene', return='null')
## not filter ftrs, but within=ftr, this will calculate within each gene's each ftr
getNearbyPAdist(PACds, ftrs=NULL, within='ftr', return='null')

BMILAB/movAPA documentation built on Jan. 3, 2024, 11:09 p.m.