View source: R/permTestTx_customPick.R
permTestTx_customPick | R Documentation |
Perform permutation test for evaluating spatial association between a feature set and the customPick regions. The latter is defined by the customPick_function
argument provided by users.
permTestTx_customPick(RS1 = NULL, txdb = NULL, type = "mature",
customPick_function = NULL, ntimes = 50, ev_function_1 = overlapCountsTx,
ev_function_2 = overlapCountsTx, pval_z = FALSE, ...)
RS1 |
The feature set to be randomized. It should be in the |
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 custom function should have two arguments: a TxDb object and a character object of transcript ids. It returns a part of region of each transcript. |
ntimes |
Randomization times. |
ev_function_1 |
Evaluation function defines what statistic to be tested between |
ev_function_2 |
Evaluation function defines what statistic to be tested between each element in |
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. |
Each feature in RS1
is only mapped with the customPick regions over its transcript (picked by the customPick_function
). The output orig.ev
is the number of features that have overlap with its customPick region.
The set of randomized region sets is outputted as RSL
. The overlapping counts between each set in RSL
with RS2
is outputted as rand.ev
.
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.
plotPermResults
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
exons.tx0 <- exonsBy(txdb)
trans.ids <- sample(names(exons.tx0), 100)
RS1 <- randomizeTx(txdb, trans.ids, random_num = 100,
random_length = 200, type = 'CDS')
getCDS = function(txdb, trans.id){
cds.tx0 <- cdsBy(txdb, use.names=FALSE)
cds.names <- as.character(intersect(names(cds.tx0), trans.id))
cds = cds.tx0[cds.names]
return(cds)
}
permTestTx_results <- permTestTx_customPick(RS1,txdb,
customPick_function = getCDS, ntimes = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.