[Bioc-devel] set.seed and BiocParallel

Bemis, Kylie k@bem|@ @end|ng |rom northe@@tern@edu
Tue Mar 12 22:20:05 CET 2019


Hi all,

I remember similar questions coming up before, but couldn’t track any down that directly pertain to my situation.

Suppose I want to use bplapply() in a function to fit models to many features, and I am applying over features. The models are stochastic, and I want the results to be reproducible, and preferably use the same RNG seed for each feature. So I could do:

fitModels <- function(object, seed=1, BPPARAM=bpparam()) {
bplapply(object, function(x) {
set.seed(seed)
fitModel(x)
}, BPPARAM=BPPARAM)
}

But the BioC guidelines say not to use set.seed() inside function code, and I’ve seen other questions answered saying not to use “seed” as a function parameter in this way.

Is it preferable to check and modify .Random.seed directly, or is there some other standard way of doing this?

Thanks,
Kylie

~~~
Kylie Ariel Bemis
Khoury College of Computer Sciences
Northeastern University
kuwisdelu.github.io<https://kuwisdelu.github.io>









	[[alternative HTML version deleted]]



More information about the Bioc-devel mailing list