stevekm / nf-niceutils

nice utility methods for Nextflow pipelines
MIT License
1 stars 0 forks source link
multiqc nextflow nextflow-plugin

nf-niceutils

A set of nice utility methods for use with Nextflow pipelines

Under Construction

This plugin is currently under construction. Please see the details in NOTES.md for development and usage. And check out examples/test.nf to see how the plugin is used in a Nextflow pipeline.

Usage

An example workflow is included so you can see how the plugin can be used.

Run the basic workflow with

nextflow run examples/test.nf

You will get the following files

If you have Docker running you can run the full example

nextflow run examples/test.nf -profile multiqc

This will also give you the following file

Some examples of the output are included in the repo here at examples/example_output.

Usage with your own pipelines

To use it with your own pipeline, currently you will need to make sure to include it in your nextflow.config;

plugins {
    id 'nf-niceutils'
}

and run it like this

NXF_PLUGINS_TEST_REPOSITORY=https://raw.githubusercontent.com/stevekm/nextflow-plugins-registry/main/plugins.json nextflow run main.nf

Some time soon hopefully I can get it pushed into the official Nextflow registry :)

Methods

(these are subject to change)

The following methods are the most useful ones offered by the plugin;

You can see examples of how to use each function inside the examples/test.nf script.

createProcessVersionFromYAMLstrList

    // create a MultiQC Software Versions Table YAML + HTML
    // versions_ch contains versions.yml files output by Nextflow processes
    mqc_versions_ch = versions_ch.map{ it.text }
        .collect()
        .map{ versions ->
            def processList = createProcessVersionFromYAMLstrList(versions)
            makeVersionsYAML(
                processList,
                workflow.manifest.name,
                workflow.manifest.homePage,
                workflow.manifest.version,
                workflow.nextflow.version.toString()
                )
        }.collectFile(storeDir: "${params.outdir}", name: "software_versions_mqc.yaml")

workflowSummaryTableStr

    // create a workflow summary table
    workflow_summary_ch = Channel.from(
        workflowSummaryTableStr(
            params,
            workflow.properties,
            workflow.manifest.properties,
            ['foo_key'] // some 'bad params' to exclude from the output
            )
    ).collectFile(storeDir: "${params.outdir}", name: "workflow_summary_mqc.yaml")