File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -833,6 +833,16 @@ do_inference = function(my_df,
833833 ifelse_pipe(pass_fit , ~ .x %> % add_attr(fit , " fit" ) )
834834}
835835
836+ detect_cores = function (){
837+
838+ if (.Platform $ OS.type == " unix" )
839+ system(" nproc" , intern = TRUE ) %> % as.integer %> % sum(- 1 )
840+ else if (.Platform $ OS.type == " windows" )
841+ parallel :: detectCores() %> % as.integer %> % sum(- 1 )
842+ else stop(" Your platform type is not recognised" )
843+
844+ }
845+
836846# ' pcc_seq main
837847# '
838848# ' @description This function calls the stan model.
@@ -876,7 +886,7 @@ ppc_seq = function(input.df,
876886 # For development purpose
877887 additional_parameters_to_save = c(),
878888 # For development purpose,
879- cores = system( " nproc " , intern = TRUE ) % > % as.integer % > % sum( - 1 ),
889+ cores = detect_cores( ),
880890 percent_false_positive_genes = " 1%" , pass_fit = F ,
881891 do_check_only_on_detrimental = parse_formula(formula ) %> % length %> % `>` (0 ),
882892 tol_rel_obj = 0.01 ,
You can’t perform that action at this time.
0 commit comments