Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Commit

Permalink
Use seed for nondeterministic processes vib-singlecell-nf/vsn-pipelin…
Browse files Browse the repository at this point in the history
  • Loading branch information
dweemx committed Feb 14, 2020
1 parent 0a60761 commit 326387d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions bin/run_pca_cv.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,21 @@ RunPCACV <- function(
to = 150,
by = 5,
maxit = 200,
seed = 617,
seed = NULL,
n.cores = 1,
verbose = T,
default.svd = F) {
set.seed(seed)
# Required by irlba::irlba for reproducibility
if(!is.null(seed)) {
set.seed(seed)
} else {
warnings("No seed is set!")
}
library(foreach)
library(doMC)
registerDoMC(cores = n.cores)
library(irlba)

if(default.svd) {
print("Default SVD is using for estimating the number PCs.")
}
Expand Down
2 changes: 1 addition & 1 deletion processes/runPCACV.nf
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ process PCACV__FIND_OPTIMAL_NPCS {
"""
${binDir}run_pca_cv.R \
--input-file ${f} \
${'--seed ' + (params.global.containsKey('seed') ? params.global.seed: params.seed)} \
${(processParams.containsKey('accessor')) ? '--accessor "' + processParams.accessor.replace('$','\\$') + '"': ''} \
${(processParams.containsKey('kFold')) ? '--k-fold ' + processParams.libraries: ''} \
${(processParams.containsKey('fromNPC')) ? '--from-n-pc ' + processParams.fromNPC: ''} \
${(processParams.containsKey('toNPC')) ? '--to-n-pc ' + processParams.toNPC: ''} \
${(processParams.containsKey('byNPC')) ? '--by-n-pc ' + processParams.byNPC: ''} \
${(processParams.containsKey('maxIters')) ? '--max-iters ' + processParams.libraries: ''} \
${(processParams.containsKey('seed')) ? '--seed ' + processParams.fromNPC: ''} \
${(processParams.containsKey('nCores')) ? '--n-cores ' + processParams.nCores: ''} \
${(processParams.containsKey('defaultSVD')) ? '--default-svd ' + processParams.defaultSVD: ''} \
${(processParams.containsKey('verbose')) ? '--verbose ' + processParams.verbose: ''} \
Expand Down

0 comments on commit 326387d

Please sign in to comment.