validateIsoformPair: Validate the randomness of isoform pair via permutation

View source: R/validateIsoformPair.R

validateIsoformPairR Documentation

Validate the randomness of isoform pair via permutation

Description

Validate the randomness of isoform pair via permutation

Usage

validateIsoformPair(iso.pair.names = NULL, isoformLevel.data,
  geneLevel.data = NULL, per.num = 10000, tbreak = 10, esp.val = 0.5,
  useExt = FALSE, useParallel = FALSE)

Arguments

iso.pair.names

A vector of names of isoform pairs in the format: gene.isoform1.isoform2

isoformLevel.data

A data matrix of isoform expression

geneLevel.data

A data matrix of gene expression

per.num

A number of permutation

tbreak

The number of breaks to create bins

esp.val

A small value added to denominator of X2 formula

useExt

A boolean value to allow the left-most and right-most bins extending to infinity

useParallel

An option for using parallel (=TRUE)

Value

A list containing results of X2 tests and p-values

Examples

library("TxDb.Hsapiens.UCSC.hg19.knownGene")
library("AnnotationDbi")
txdb=TxDb.Hsapiens.UCSC.hg19.knownGene
#The txdb also can be imported from a gtf file by using package GenomicFeatures
data(isoformDataSample)
#preprocessing
isoformDataSample=ifelse(isoformDataSample <= 3,0,isoformDataSample)
isoformDataSample=isoformDataSample[which(rowSums(isoformDataSample)>0),]
#tranform read count dataset to log scale
isoformDataSample=ifelse(isoformDataSample==0,0,log2(isoformDataSample))
#now data is ready
tbreak=round(sqrt(ncol(isoformDataSample)))
model.res=doMixtureModelMatrix(isoformLevel.data=isoformDataSample,txdb=txdb,tbreak=tbreak)
#library(doParallel)
#registerDoParallel(cores=4)
set.seed(2015)
iso.pair.names=names(model.res$nq.list)
res=validateIsoformPair(iso.pair.names=iso.pair.names,
   isoformLevel.data=isoformDataSample,per.num=100,tbreak=tbreak,useParallel=FALSE)
PVAL.X2.list=unlist(res[names(res)=="pval"])
hist(PVAL.X2.list)
fdr.val=p.adjust(PVAL.X2.list,method="BH")
length(which(fdr.val <= 0.05))

nghiavtr/ISOP documentation built on April 21, 2023, 3:57 p.m.