permTestTx_customAll: Perform permutation test

View source: R/permTestTx_customAll.R

permTestTx_customAllR Documentation

Perform permutation test

Description

Perform permutation test for evaluating spatial association between region sets. This permutation test function receives two region sets and a set of randomized region sets of one of them. It evaluates if there is an association between these two region sets.

Usage

permTestTx_customAll(RSL = NULL, RS1 = NULL, RS2 = NULL,
ev_function_1 = overlapCountsTx, ev_function_2 = overlapCountsTx, pval_t = FALSE, ...)

Arguments

RSL

Randomized region sets of RS1. It should be a list object and each element should be in the GRanges or GRangesList format.

RS1

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

RS2

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

ev_function_1

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

ev_function_2

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

pval_t

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

...

Any additional parameters needed.

Details

permTestTx_customAll will use evaluation function ev_function_1 to calculate the test statistic between RS1 and RS2, and use ev_function_2 to evaluate the statistic between RSL and RS2. It will also return a p-value and a z-score.

Value

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

  • 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.

Examples

library(TxDb.Hsapiens.UCSC.hg19.knownGene)
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
trans.ids1<- c("170")
RS1 <- randomizeTx(txdb = txdb, trans_ids = trans.ids1,
                    random_num = 20, random_length = 100)
RS2 <- randomizeTx(txdb = txdb, trans_ids = trans.ids1,
                    random_num = 20, random_length = 100)
trans.ids2 <-  c("170", "782", "974", "1364", "1387")
RSL <- randomizeTx(txdb = txdb, trans_ids = trans.ids2,
                    random_num = 20, random_length = 100, N = 10)
permTestTx_results <- permTestTx_customAll(RSL = RSL, RS1 = RS1, RS2 = RS2)

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