Browse code

Added library() statements to test.R and EBMTP.R so that the snow, Rmpi, and rpvm packages get loaded before objects are used.

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/multtest@48397 bc3139a8-67e5-0310-9ffc-ced21a209358

Katherine S. Pollard authored on 24/07/2010 21:55:59
Showing 2 changed files

... ...
@@ -281,6 +281,7 @@ EBMTP<-function(X,W=NULL,Y=NULL,Z=NULL,Z.incl=NULL,Z.test=NULL,na.rm=TRUE,test="
281 281
     ## Check installation of packages
282 282
       have_snow <- qRequire("snow")
283 283
       if(!have_snow) stop("The package snow is required to use a cluster. Either snow is not installed or it is not in the standard library location.")
284
+      library("snow")  #use library() since several functions are needed
284 285
       if (is.null(type))
285 286
          stop("Must specify type argument to use a cluster. Alternatively, provide a cluster object as the argument to cluster.")
286 287
       if (type=="SOCK")
... ...
@@ -290,16 +291,19 @@ EBMTP<-function(X,W=NULL,Y=NULL,Z=NULL,Z.incl=NULL,Z.test=NULL,na.rm=TRUE,test="
290 291
       else if (type=="MPI"){
291 292
          have_rmpi <- qRequire("Rmpi")
292 293
          if(!have_rmpi) stop("The package Rmpi is required for the specified type. Either Rmpi is not installed or it is not in the standard library location.")
293
-      }
294
+         library("Rmpi")
295
+       }
294 296
       else if (type=="PVM"){
295 297
          have_rpvm <- qRequire("rpvm")
296 298
          if(!have_rpvm) stop("The package rpvm is required for the specified type. Either rpvm is not installed or it is not in the standard library location.")
299
+         library("rpvm")
297 300
       }
298 301
       cluster <- makeCluster(cluster, type)
299 302
       clusterEvalQ(cluster, {library(Biobase); library(multtest)})
300 303
       if (is.null(dispatch)) dispatch=0.05
301 304
       }
302
-    } else if(inherits(cluster,c("MPIcluster", "PVMcluster", "SOCKcluster"))){
305
+    }
306
+    else if(inherits(cluster,c("MPIcluster", "PVMcluster", "SOCKcluster"))){
303 307
       clusterEvalQ(cluster, {library(Biobase); library(multtest)})
304 308
       if (is.null(dispatch)) dispatch=0.05
305 309
     }
... ...
@@ -342,6 +342,7 @@ MTP<-function(X,W=NULL,Y=NULL,Z=NULL,Z.incl=NULL,Z.test=NULL,na.rm=TRUE,test="t.
342 342
     ## Check installation of packages
343 343
       have_snow <- qRequire("snow")
344 344
       if(!have_snow) stop("The package snow is required to use a cluster. Either snow is not installed or it is not in the standard library location.")
345
+      library("snow")  #use library() since several functions are needed
345 346
       if (is.null(type))
346 347
          stop("Must specify type argument to use a cluster. Alternatively, provide a cluster object as the argument to cluster.")
347 348
       if (type=="SOCK")
... ...
@@ -351,16 +352,19 @@ MTP<-function(X,W=NULL,Y=NULL,Z=NULL,Z.incl=NULL,Z.test=NULL,na.rm=TRUE,test="t.
351 352
       else if (type=="MPI"){
352 353
          have_rmpi <- qRequire("Rmpi")
353 354
          if(!have_rmpi) stop("The package Rmpi is required for the specified type. Either Rmpi is not installed or it is not in the standard library location.")
355
+         library("Rmpi")
354 356
       }
355 357
       else if (type=="PVM"){
356 358
          have_rpvm <- qRequire("rpvm")
357 359
          if(!have_rpvm) stop("The package rpvm is required for the specified type. Either rpvm is not installed or it is not in the standard library location.")
360
+         library("rpvm")
358 361
       }
359 362
       cluster <- makeCluster(cluster, type)
360 363
       clusterEvalQ(cluster, {library(Biobase); library(multtest)})
361 364
       if (is.null(dispatch)) dispatch=0.05
362 365
       }
363
-    } else if(inherits(cluster,c("MPIcluster", "PVMcluster", "SOCKcluster"))){
366
+    }
367
+    else if(inherits(cluster,c("MPIcluster", "PVMcluster", "SOCKcluster"))){
364 368
       clusterEvalQ(cluster, {library(Biobase); library(multtest)})
365 369
       if (is.null(dispatch)) dispatch=0.05
366 370
     }