thank you Maxime, is it possible to write the code in NF files (!= .groovy) ?
Or if it's groovy file, should they be compiled before running nextflow or will they be compiled at runtime ? I would like to avoid a pre-compile step.
Hi all,
I would like to implement a custom java/groovy code in nextflow to help me document/parse the NF arguments params. Something like
class ArgumentFactory {
private static final ArgumentFactory INSTANCE = new ArgumentFactory();
public static ArgumentFactory getInstance() { return INSTANCE;}
(...)
}
and in another NF file
ArgumentFactory.getInstance().
name("reference").
description("path to the indexed FASTA reference").
put(params)
and in another NF file
if(params.help) {
ArgumentFactory.getInstance().printUsage();
}
How can I do this in 'pure' NF ? I know I could write a java library and use it using the -lib parameter, but I'd like to do this in pure NF.
EDIT: here is an implementation:
I think we're doing some similar stuff in nf-core to check for args within the json schema and also to validate params and other things. You might want to look into it.
All our custom groovy stuff is in lib/: https://github.com/nf-core/tools/tree/master/nf_core/pipeline-template/lib
thank you Maxime, is it possible to write the code in NF files (!= .groovy) ?
Or if it's groovy file, should they be compiled before running nextflow or will they be compiled at runtime ? I would like to avoid a pre-compile step.
I don't think there's any issue to write groovy code in .nf files. Not sure at all about the when the compilation will happen though...
I added an example above. The code compiles but I cannot use the class MyTest within the other NF file test.nf (even if if try to include it...)
Log in to answer this question.