inst/tests/test-average.pval.replicates.R

context("testing average.pval.replicates")

################################################################################
# use the same data from test-avg.replicates.R
################################################################################

test_that("test that input data exists", {
	expect_true( file.exists(system.file("examples", "x.LumiBatch.example.RDa", package="pwbc")) )
	expect_true( file.exists(system.file("examples", "x.LumiBatch.avg.RDa", package="pwbc")) )
})

test_that("average.pval.replicates on LumiBatch::detection", {
	require(lumi) || stop("required package 'lumi' is not installed")
	load( system.file("examples", "x.LumiBatch.example.RDa", package="pwbc") ) # load x.LumiBatch object
	classes <- as.factor(sub("\\.[1-9]$", "", sampleNames(x.LumiBatch)))
	res <- average.pval.replicates(detection(x.LumiBatch), classes)
	expected.res <- structure(c(0, 0, 0, 0.000576773848447771, 0.0212575514187466, 
	0, 0.010126210287107, 0, 0.639342622487847, 0.148029086148037, 
	0.355973476868095, 0.35898831197672, 0.00508307403781658, 0, 
	0.0793072014839238, 0, 0.604009156037874, 0.052258126581635, 
	0.0324049855859185, 0.204724206815059, 0.000213991810532085, 
	0.997417589011901, 0.897439246268496, 0.117174453054524, 0, 0, 
	0, 0, 0.143307378786932, 0.00733559937416643, 0.219532073813563, 
	0.724544342792326, 0, 0.00725209395303339, 0.566784220529356, 
	0, 0, 0.0305031985267943, 0, 0.473198522766922, 5.61188068343039e-07, 
	0, 0, 0.0119325380843444, 0.125870939827365, 0, 0.0976446204283871, 
	0.835260300918574, 0.0653617479366164, 0.0976549973453378, 0.57662902256998, 
	0.753759142834185, 0.000122621611305351, 2.91221996898953e-07, 
	0.0246730672058938, 0, 0.447644412137572, 0.289737210436556, 
	0.0579070403681431, 0.807127125298851, 0.200964993537725, 0.989544330900573, 
	0.490213734824736, 0.48881054968848, 0, 0, 0, 0, 0.422585762369243, 
	0.050051075103864, 0.327176782218432, 0.691644590581831, 0, 1.24232098673399e-05, 
	0.024220544412801, 0, 0, 0.128817393589367, 0, 0.643855342840723, 
	0.00129869999999999, 0, 0.00129869999999999, 0.2311688, 0.3493506, 
	0, 0.7896104, 0.0350649, 0.4402598, 0.2857143, 0.8740259, 0.6831169, 
	0.2558442, 0.00129869999999999, 0.2220779, 0.00129869999999999, 
	0.2571428, 0.361039, 0.2571428, 0.7857143, 0.374026, 0.9662338, 
	0.9025974, 0.1948052, 0.00129869999999999, 0, 0, 0, 0.5493506, 
	0.0168831, 0.1467533, 0.6389611, 0, 0.2363636, 0.722078, 0.00129869999999999, 
	0, 0.1909091, 0, 0.5844156), .Dim = c(40L, 3L), .Dimnames = list(
	    c("ILMN_3237291", "ILMN_3214052", "ILMN_1821724", "ILMN_1891277", 
	    "ILMN_1757137", "ILMN_3210171", "ILMN_1774937", "ILMN_1727880", 
	    "ILMN_2326376", "ILMN_1741977", "ILMN_3243953", "ILMN_1737760", 
	    "ILMN_3232701", "ILMN_1748836", "ILMN_1736056", "ILMN_1721087", 
	    "ILMN_3242786", "ILMN_1681979", "ILMN_2259223", "ILMN_1691467", 
	    "ILMN_3182275", "ILMN_1794818", "ILMN_1732782", "ILMN_3294263", 
	    "ILMN_1746720", "ILMN_1760982", "ILMN_2262462", "ILMN_1706094", 
	    "ILMN_1799137", "ILMN_2282477", "ILMN_2132309", "ILMN_1719340", 
	    "ILMN_2402972", "ILMN_3225649", "ILMN_1736448", "ILMN_1651949", 
	    "ILMN_2072178", "ILMN_1790688", "ILMN_1815083", "ILMN_1665873"
	    ), c("mutant", "normal", "reference")))
		
	expect_equivalent(res, expected.res)
	
})
drmjc/microarrays documentation built on May 15, 2019, 2:26 p.m.