I wrote a custom module for MultiQC and when I run it outside of Nextflow it is able to take in the inputs I expect and produce the table that I expect. However, I am not sure how I can get Nextflow to access this custom module that I wrote while using a singularity profile (to make sure that the other tools are reproducible) to get my desired reports.
Sorry I could have worded that better. I wrote a new module for MultiQC itself (like this ) I wrote the module in a conda environment that contains the MultiQC package and it produces the desired output. (All of this outside of the context of Nextflow). I don’t intend for the module I wrote to necessarily be used by other so perhaps I should go the plugin route.
I am now curious if it is possible to pass my new MultiQC module into the MultiQC Nextflow module within a Nextflow workflow.
Either way, the answer is the same anyway - if you made a MultiQC plugin then it needs to be installed in the same Python environment as MultiQC. So you need to make a custom Singularity image that contains both MultiQC and your plugin installed. Then provide this via the container process directive.
I’m not 100% on exactly what you did here. If you forked MultiQC and edited the source code to add a new module then yes, you should use a plugin instead. Otherwise you won’t be able to upgrade MultiQC.
The fact that plugins needs to be installed and so need custom container images is a common problem. Common ways to work around this are to use Custom Content - though it depends on what you’re trying to do, not everything is possible with this.
Very very soon (this week) we will be releasing MultiQC v1.22 which also allows you to write custom scripts and use MultiQC as a library. This is another method which is more akin to writing a plugin, and does not need custom images. This is very well suited to Nextflow pipelines. The docs are already here, more examples and blog post coming soon.
Yes, I was indeed referring to the nf-core module for MultiQC, should have been more specific with that. I did
pip install multiqc
in one of my conda environments and then edited the MultiQC source code where it was installed. I had an inkling that creating a singularity container would be necessary but it’s good to have that confirmed! And very cool to see v1.22 coming soon! This was very helpful indeed, thanks!
Yes don’t do pip install and edit the source code. Not only will you not be able to upgrade but it’s also super risky as it’s quite likely that your files could be overwritten / removed by pip doing stuff. Hopefully it should be an easy move to switch to one of the other methods mentioned