Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't find fixed_parameters when using nextflow #4

Open
jdeu1023 opened this issue Sep 20, 2024 · 0 comments
Open

Can't find fixed_parameters when using nextflow #4

jdeu1023 opened this issue Sep 20, 2024 · 0 comments

Comments

@jdeu1023
Copy link

I am trying to use fixed_parameters in my simulatr_function()s but they do not seem to be findable when using nextflow.

Here is a reproducible example:

library(simulatr)

parameter_grid <- expand.grid(
  n = c(25, 50, 100, 200, 500)    
)
parameter_grid$ground_truth <- 0  

fixed_parameters <- list(
  B = 1000,                    
  seed = 4,                   
  fixed_par = 3
)

generate_data_f <- function(n){
  list(data = rnorm(n))
}

generate_data_function <- simulatr_function(
  f = generate_data_f,                        
  arg_names = formalArgs(generate_data_f),    
  loop = TRUE
)

compute_data_mean <- function(data, fixed_par) {
  fixed_par
  list(mean = mean(data$data))
}

compute_data_mean_spec_f <- simulatr_function(f = compute_data_mean, arg_names = "fixed_par", loop = TRUE)

run_method_functions <- list(compute_data_mean = compute_data_mean_spec_f)

l1_error <- function(output, ground_truth) {
  abs(output$mean - ground_truth)
}

evaluation_functions <- list(l1_error = l1_error)

simulatr_spec <- simulatr_specifier(
  parameter_grid,
  fixed_parameters,
  generate_data_function, 
  run_method_functions,
  evaluation_functions
)

I can run this just fine locally in R, but when I run this using nextflow on the HPC3 cluster I get the following error:

 Error in (function (data, fixed_par)  :
    argument "fixed_par" is missing, with no default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant