I’m making use of groovy classes in nextflow for things like allowing the user to run only part of the complete workflow based on params. Currently, I don’t see a way to include classes using NF’s include directive.
Instead, either the class needs to be defined in the same .nf module where the instances of the class are instantiated, or the class needs to be compiled and included using groovy’s import keyword. It would be very convenient if I could put uncompiled classes either in a .nf script or a .groovy script and include them. Is there a way to do that that I’m missing?
It works to put the above code in a common.groovy file which gets imported via evaluate (new File("common.groovy")) statement in the .nf files that want to use MyClass.
It looks like there’s no equivalent for loading methods/closures, so I wound up implementing methods as static class methods and importing the class using this same system.