movAPAindex: Get APA index

movAPAindexR Documentation

Get APA index

Description

movAPAindex calculates APA index by different metrics for each condition.

Usage

movAPAindex(
  PACds,
  method,
  choose2PA = NULL,
  RUD.includeNon3UTR = FALSE,
  clearPAT = 0,
  sRUD.oweight = FALSE
)

Arguments

PACds

a PACdataset.

method

Can be WUL, RUD, SLR, smartRUD.

  • "RUD": Relative Usage of Distal Poly(A) Sites (Ji 2009) (3UTRAPA with/without non-3UTR PACs, choose2PA=NULL/PD/MOST)

  • "smartRUD": a smarter RUD index. It first calls get3UTRAPApd to obtain proximal and distal PAs in a smarter way.

  • "WUL": Weighted UTR length (Jia 2017; Ultisky) (3UTRAPA, choose2PA=NULL/PD/MOST)

  • "SLR": short to long ratio (Begik 2017) (3UTRAPA, choose2PA=PD/most). Similar to RED (relative expression difference) (W Li 2015; Arefeen 2018). RED is equivalent to divide the SLR index but just choose PD/most PA.

  • "RS": Patrick et al. 2016, sum(abs_ratio/2) (3UTRAPA if choose2PA!=null; allAPA if =NULL)

choose2PA

specify whether and how to choose two PACs. The value can be NULL, PD (choose only proximal and distal sites), farest (choose two PACs that are with the longest distance), most (choose two PACs with the most abundance).

RUD.includeNon3UTR

only used when method=RUD, to use all PA or just 3UTR PA.

clearPAT

set PAC counts to 0 when it is <= clearPAT. This is important to deal with single-cell data. For example, if a gene only has 1 read in a cell, then the RUD of its one pA with 1 read would be 1 (which is not very reasonable). Using clearPAT=1, the gene would be set as 0 count, then its pA's RUD would be NaN. Using clearPAT>=1, some genes may be removed in the final APA index list due to its both pAs are all 0s after setting clearPAT.

sRUD.oweight

default is FALSE, if T and method=smartRUD, then output a list including RUD and weights matrix. Otherwise, only output a matrix of RUD. This option is used to remove the effect of low expressed PACs. Otherwise, PAC with tag=1 may have high impact on RUD/SLR calculations. After clearPAT, some results will be set as NaN.

Details

This funtion uses all samples to filter APA sites, and then gets index for each sample. So there might be NaN for some samples without enough PAC (tag=0). The final result may have NaN but will not have Inf (it has been assigned the max value for Inf element). For method=WUL, NaN happens when the PAC expression in sample A for gene X is 0.

For method=RUD or smartRUD (distal/gene), NaN happens when the PAC expression in sample A for gene X is 0.

For method=SLR (short/long), NaN happens when both the proximal and distal PAC is 0; Inf happens when distal PAC=0 but proximal not 0.

For method=smartRUD, the PACds should be the result of get3UTRAPApd.

Value

A matrix/dgCMatrix with rownames denoting genes, columns are samples, and values are the APA index values. Also includes other method-specific columns.

See Also

Other comparison functions: movAPAindexDiff(), movAPAswitch(), movDEGene(), movDEPAC(), movPAindex(), movUTRtrend(), plotCummPAindex()

Examples

## smart RUD
data(scPACds)
PACds=get3UTRAPApd(scPACds)
## set counts in genes of individual samples with only 1 total PATs as 0,
## then the RUD of pAs in these genes would be Nan.
## if not set clearPAT=1, then if one gene has only total 1 read in a sample,
## then a PA with 1 read would be RUD=1!
rudw=movAPAindex(PACds, method="smart", sRUD.oweight=TRUE, clearPAT=1)
head(rudw$rud[, 1:2]);  head(rudw$weight[, 1:2])
rud=movAPAindex(PACds, method="smart", sRUD.oweight=F)
head(rud[, 1:2])

## WUL
data(PACds)
gs=movAPAindex(PACds, method="WUL", choose2PA=NULL)
gs=movAPAindex(PACds, method="SLR", choose2PA='PD', clearPAT=5)

## GPI index for only proximal PAC
geneGPI2=movAPAindex(PACds, method="GPI", choose2PA=NULL) #use all 3UTR PACs

geneGPI=movAPAindex(PACds, method="GPI", choose2PA='PD') #use only proximal&distal PACs
PACds1=get3UTRAPAds(PACds, sortPA=TRUE, choose2PA='PD')
geneGPI1=movAPAindex(PACds1, method="GPI", choose2PA='PD')
identical(geneGPI1, geneGPI) ## SAME
## use movPAindex to get GPI (but also including distal GPI)
paGeo=movPAindex(PACds1, method='geo')

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