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:
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 filetest.nf
(even if if try toinclude
it...)