Hi!
I'm working on a highly configurable R script. I have made a function in witch there are several more functions, like gseGO from clusterProfiler.
To be configurable by the user I would like to call this function by do.call(gseGO, parameter_list). Where parameter_list is a list of all the parameters the user will provide.
My problem is, that when I try a test run for do.call, I got an error. My code looks like this:
gse <- do.call(gseGO, c(geneList=cluster_data[[1]],
ont ="BP",
keyType = "ENTREZID",
nPerm = 10000,
minGSSize = 3,
maxGSSize = 800,
pvalueCutoff = 1,
verbose = TRUE,
OrgDb = config$organism_org,
pAdjustMethod = config$pAdjustMethod))
and the error is:
argument "geneList" is missing, with no default
But when I run this same code without do.call like this:
gse_bp <- gseGO(geneList=cluster_data[[1]],
ont ="BP",
keyType = "ENTREZID",
nPerm = 10000,
minGSSize = 3,
maxGSSize = 800,
pvalueCutoff = 1,
verbose = TRUE,
OrgDb = config$organism_org,
pAdjustMethod = config$pAdjustMethod)
It runs as it supposed to be with no problem.
And for the final code I would like something to look like this:
gse_bp <- do.call(gseGO, c(geneList=cluster_data[[1]],
ont ="BP",
keyType = "ENTREZID",
OrgDb = config$organism_org,
pAdjustMethod = config$pAdjustMethod,
parameter_list))
What could be the problem? Any idea?
Thank you in advance!
Thank you! And if I would like to make the parameter list how would I make it? If I have a list of parameters:
And give it to the function:
I still get an error:
I guess its because in the list the format is not correct for a parameter, but how can I make it work?
Remove the quotation marks otherwise the list will not consider the argument
At final, you need to have a single list so just concatenate your list of former arguments and the new list of arguments:
OK! I found it out! :)