8
8
# ##################################################
9
9
10
10
METHYL_OBJ_FILE_01 <- system.file(" extdata" , " methylObj_001.RDS" ,
11
- package = " methylInheritance" )
11
+ package = " methylInheritance" )
12
12
13
13
METHYL_OBJ_01 <- readRDS(METHYL_OBJ_FILE_01 )
14
14
15
- TEST_DIR <- system.file(" extdata" , " TEST" , package = " methylInheritance" )
15
+ TEST_DIR <- system.file(" extdata" , " TEST" , package = " methylInheritance" )
16
16
17
17
data(" methylInheritanceResults" )
18
18
@@ -41,15 +41,15 @@ test.runPermutation_methylKitData_not_valid_RDS <- function() {
41
41
message <- paste0(" test.runPermutation_methylKitData_not_valid_RDS() " ,
42
42
" - Not valid file for methylKitData did not generated expected message." )
43
43
44
- checkEquals(obs , exp , msg = message )
44
+ checkEquals(obs , exp , msg = message )
45
45
}
46
46
47
47
# # Test when all parameters valid
48
48
test.runPermutation_good_001 <- function () {
49
49
50
50
if (! dir.exists(" test_002" )) {
51
- dir.create(" test_002/SITES/" , recursive = TRUE )
52
- dir.create(" test_002/TILES/" , recursive = TRUE )
51
+ dir.create(" test_002/SITES/" , recursive = TRUE )
52
+ dir.create(" test_002/TILES/" , recursive = TRUE )
53
53
}
54
54
55
55
obs <- runPermutation(methylKitData = METHYL_OBJ_FILE_01 , runObservationAnalysis = FALSE ,
@@ -119,25 +119,26 @@ test.runObservation_methylKitData_not_valid <- function() {
119
119
message <- paste0(" test.runObservation_methylKitData_not_valid() " ,
120
120
" - Not valid file for methylKitData did not generated expected message." )
121
121
122
- checkEquals(obs , exp , msg = message )
122
+ checkEquals(obs , exp , msg = message )
123
123
}
124
124
125
125
# # Test when all parameters valid
126
126
test.runObservation_good_001 <- function () {
127
127
128
128
if (! dir.exists(" test_002" )) {
129
- dir.create(" test_002/SITES/" , recursive = TRUE )
129
+ dir.create(" test_002/SITES/" , recursive = TRUE )
130
130
}
131
131
132
132
obs <- runObservation(
133
- methylKitData = METHYL_OBJ_FILE_01 , type = " sites" ,
134
- outputDir = " test_002" , nbrCoresDiffMeth = 1 ,
135
- minReads = 10 , minMethDiff = 5 , qvalue = 0.05 ,
136
- maxPercReads = 99.9 , destrand = FALSE , minCovBasesForTiles = 2 ,
137
- tileSize = 1000 , stepSize = 100 , vSeed = 200 , saveInfoByGeneration = FALSE )
133
+ methylKitData = METHYL_OBJ_FILE_01 , type = " sites" ,
134
+ outputDir = " test_002" , nbrCoresDiffMeth = 1 ,
135
+ minReads = 10 , minMethDiff = 5 , qvalue = 0.05 ,
136
+ maxPercReads = 99.9 , destrand = FALSE , minCovBasesForTiles = 2 ,
137
+ tileSize = 1000 , stepSize = 100 , vSeed = 200 ,
138
+ saveInfoByGeneration = FALSE )
138
139
139
- obsV <- methylInheritance :: loadAllRDSResults(permutationResultsDir = NULL ,
140
- analysisResultsDir = " test_002" )
140
+ obsV <- methylInheritance :: loadAllRDSResults(permutationResultsDir = NULL ,
141
+ analysisResultsDir = " test_002" )
141
142
142
143
exp <- list ()
143
144
exp [[" OBSERVATION" ]] <- list ()
@@ -152,8 +153,8 @@ test.runObservation_good_001 <- function() {
152
153
message <- paste0(" test.runObservation_good_001() " ,
153
154
" - All valid parameters did not generated expected result." )
154
155
155
- checkEquals(obs , 0 , msg = message )
156
- checkEquals(obsV $ OBSERVATION , exp $ OBSERVATION , msg = message )
156
+ checkEquals(obs , 0 , msg = message )
157
+ checkEquals(obsV $ OBSERVATION , exp $ OBSERVATION , msg = message )
157
158
}
158
159
159
160
@@ -176,7 +177,7 @@ test.extractInfo_good_01 <- function() {
176
177
message <- paste0(" test.extractInfo_good_01() " ,
177
178
" - Valid parameters for formatForGraph did not generated expected results." )
178
179
179
- checkEquals(obs , exp , msg = message )
180
+ checkEquals(obs , exp , msg = message )
180
181
}
181
182
182
183
@@ -231,7 +232,7 @@ test.loadAllRDSResults_good_01 <- function() {
231
232
" - Valid parameters for loadAllRDSResults() " ,
232
233
" did not generated expected results." )
233
234
234
- checkEquals(obs , exp , msg = message )
235
+ checkEquals(obs , exp , msg = message )
235
236
}
236
237
237
238
@@ -270,7 +271,7 @@ test.mergePermutationAndObservation_permutation_not_list <- function() {
270
271
message <- paste0(" test.mergePermutationAndObservation_permutation_not_list() " ,
271
272
" - Not a list for permutationResults did not generated expected results." )
272
273
273
- checkEquals(obs , exp , msg = message )
274
+ checkEquals(obs , exp , msg = message )
274
275
}
275
276
276
277
# # Test result when all parameters are good
@@ -322,7 +323,7 @@ test.mergePermutationAndObservation_good_01 <- function() {
322
323
" - Valid parameters for mergePermutationAndObservation() " ,
323
324
" did not generated expected results." )
324
325
325
- checkEquals(obs , exp , msg = message )
326
+ checkEquals(obs , exp , msg = message )
326
327
}
327
328
328
329
# ##########################################################
@@ -340,9 +341,9 @@ test.plotGraph_good_01 <- function() {
340
341
message <- paste0(" test.plotGraph_good_01() " ,
341
342
" - Valid parameters for plotGraph did not generated expected results." )
342
343
343
- checkTrue(" gtable" %in% class( obs ), msg = message )
344
- checkEquals(class (obs [[1 ]]) , " list" , msg = message )
345
- checkEquals(class (obs [[2 ]]) , " data.frame" , msg = message )
344
+ checkTrue(is( obs , " gtable" ), msg = message )
345
+ checkTrue(is (obs [[1 ]], " list" ) , msg = message )
346
+ checkTrue(is (obs [[2 ]], " data.frame" ) , msg = message )
346
347
}
347
348
348
349
@@ -366,9 +367,9 @@ test.plotConvergenceGraph_good_01 <- function() {
366
367
message <- paste0(" test.plotConvergenceGraph_good_01() " ,
367
368
" - Valid parameters for plotGraph did not generated expected results." )
368
369
369
- checkTrue(" ggplot" %in% class( obs ), msg = message )
370
- checkTrue(is(obs [[1 ]], " data.frame" ), msg = message )
371
- checkTrue(is(obs [[2 ]], " list" ), msg = message )
370
+ checkTrue(is( obs , " ggplot" ), msg = message )
371
+ checkTrue(is(obs [[1 ]], " data.frame" ), msg = message )
372
+ checkTrue(is(obs [[2 ]], " list" ), msg = message )
372
373
373
374
}
374
375
@@ -396,7 +397,7 @@ test.loadConvergenceData_good_01 <- function() {
396
397
message <- paste0(" test.loadConvergenceData_good_01() " ,
397
398
" - Valid parameters for loadConvergenceData did not generated expected results." )
398
399
399
- checkEquals(class (data ) , " data.frame" , msg = message )
400
+ checkTrue(is (data , " data.frame" ) , msg = message )
400
401
checkEquals(data , expected , msg = message )
401
402
}
402
403
@@ -456,12 +457,14 @@ test.loadConvergenceData_two_different_directories_by_5 <- function() {
456
457
expected <- data.frame (NBR_PERMUTATIONS = c(5 ,5 ,10 ,10 ),
457
458
ELEMENT = rep(" SITES" , 4 ), ANALYSIS = rep(" iAll" , 4 ),
458
459
POSITION = rep(1 , 4 ), TYPE = rep(c(" HYPER" , " HYPO" ), 2 ),
459
- SIGNIFICANT_LEVEL = c(0.83333333333333337034 , 0.33333333333333331483 ,
460
- 0.72727272727272729291 , 0.27272727272727270709 ))
460
+ SIGNIFICANT_LEVEL = c(0.83333333333333337034 ,
461
+ 0.33333333333333331483 ,
462
+ 0.72727272727272729291 ,
463
+ 0.27272727272727270709 ))
461
464
462
465
message <- paste0(" test.loadConvergenceData_two_different_directories() " ,
463
466
" - Using two different directories for observation and permutation with loadConvergenceData did not generated expected results." )
464
467
465
- checkEquals(class (data ) , " data.frame" , msg = message )
466
- checkEquals(data , expected , msg = message )
468
+ checkTrue(is (data , " data.frame" ) , msg = message )
469
+ checkEquals(data , expected , msg = message )
467
470
}
0 commit comments