permTestTxIA_customPick: Perform permutation test

View source: R/permTestTxIA_customPick.R

permTestTxIA_customPickR Documentation

Perform permutation test

Description

Perform permutation test for evaluating spatial association between RNA features and a specified kind of regions. The latter is defined by the customPick_function argument input by users. The difference between this function and permTestTx_customPick is that it is for RNA-related genomic features that have isoform ambiguity, i.e., features that one does not know which transcript they comes from.

Usage

permTestTxIA_customPick(RS1 = NULL, txdb = NULL, type = 'mature',
customPick_function = NULL, ntimes = 50,
ev_function_1 = overlapCountsTxIA, ev_function_2 = overlapCountsTx,  pval_z = FALSE, ...)

Arguments

RS1

The region set to be randomized. It should be in the GRanges or GRangesList format.

txdb

A TxDb object.

type

A character object. Default is "mature". It accepts options "mature", "full", "fiveUTR", "CDS" or "threeUTR", with which one can get corresponding types of transcriptome regions.

customPick_function

A custom function needs to be inputted by users. The customPick function should have two arguments: a TxDb object and a character object of transcript ids. It returns a specified region over each transcript.

ntimes

Randomization times.

ev_function_1

Evaluation function defines what statistic to be tested between RS1 and RS2. Default is overlapCountsTxIA.

ev_function_2

Evaluation function defines what statistic to be tested between each element in RSL and RS2. Default is overlapCountsTx.

pval_z

Boolean. Default is FALSE. If FALSE, the p-value is calculated based on the number of random evaluations is larger or less than the initial evaluation. If TRUE, the p-value is calculated based on a z-test.

...

Any additional parameters needed.

Details

permTestTxIA_customPick will assess the test statistic between RS1 and each region in RSL, and the relation between RS1 and RS2. Each RNA feature is only mapped with a part of region on its transcript (picked by the customPick_function). The output orig.ev is the weighted counts between RS1 and RS2. Each feature in RS1 related to n1 isoforms in RS2 and overlapped with n2 RS2 regions will contribute a value of n2/n1 to the total number of overlaps. This test function also randomizes input features per transcript. The set of randomized results is outputted as RSL. The overlapping counts between each set in RSL with RS2 is outputted as rand.ev.

Value

A list object, which is defined to be permTestTx.results class. It contains the following information:

  • RSL: Randomized region sets of RS1.

  • RS1: The feature set to be randomized.

  • RS2: The region set to be compared with the feature set.

  • orig.ev: The value of overlapping counts between RS1 and RS2.

  • rand.ev: The values of overlapping counts between each element in RSL and RS2.

  • pval: p-value of the test.

  • zscore: Standard score of the test.

See Also

plotPermResults

Examples

library(TxDb.Hsapiens.UCSC.hg19.knownGene)
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
file <- system.file(package="RgnTX", "extdata/m6A_sites_data.rds")
m6A_sites_data <- readRDS(file)
RS1 <- m6A_sites_data[1:500]

permTestTx_results <- permTestTxIA_customPick(RS1 = RS1,
                                            txdb = txdb,
                                            type = 'mature',
                                            customPick_function = getStopCodon,
                                            ntimes = 5)

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