multicore.samplePairs: Multicore Processing Wrappers

multicore.setupR Documentation

Multicore Processing Wrappers

Description

A set of wrapper functions for multicore processing, using the multicore package.

Usage

multicore.setup(max.cores = NULL)

multicore.samplePairs(sampleSet, symmetric.pairs = FALSE)

multicore.tapply(x, INDEX, FUN, ...)
multicore.lapply(x, FUN, ...)

Arguments

max.cores

integer specifying how many cores to request. NULL means use all available

sampleSet

character vector (or list of character vectors), usually SampleIDs, that need to be turned into a list of all pairs from sampleSet, for a subsequent multicore call to a function that expects two arguments, such as a differential expression operation. When sampleSet is a list, only pairs from within each element are generated.

symmetric.pairs

logical, are symmetric pairs needed. This is for cases where the function to be called is sensitive to the order of its 2 arguments (i.e. f(x1,x2) != f(x2,x1). If true, more pairs are generated.

x, INDEX, FUN, ...

the usual arguments passed on to the respective 'apply' function

Details

These are simple wrappers around the multicore routines, to facilitate parcelling computations that involve entire chromosomes or samples out to separate cores.

Value

For multicore.setup, the number of cores actually available. The function tries to load package multicore, and if successful, sets the number of cores to be used. This value can be subsequently returned by getOption("cores").

For multicore.samplePairs, a list of vectors (each of length 2), suitable for a call to multicore.lapply for a function expecting a vector of length 2 as its argument.

For multicore.tapply and multicore.lapply, the same type result as their primitive functions, after being gathered from the separate cores.

Note

All multicore functions turn off prescheduling ( mc.preschedule=FALSE), because we assume the processing time of each piece is highly variable.

Examples

multicore.samplePairs( list( c("Tom", "Dick", "Harry"), c("Jack","Jill")), symmetric.pairs=TRUE)

robertdouglasmorrison/DuffyTools documentation built on April 16, 2024, 6:31 a.m.