bentsherman / nf-boost

Experimental features for Nextflow
Apache License 2.0
31 stars 0 forks source link
nextflow

nf-boost

while we wait for four five two
a very special plugin, just for you

Nextflow plugin for experimental features that want to become core features!

Currently includes the following features:

Getting Started

To use nf-boost, include it in your Nextflow config and add any desired settings:

plugins {
  id 'nf-boost'
}

boost {
  cleanup = true
}

The plugin requires Nextflow version 23.10.0 or later.

New in version 0.4.0: requires Nextflow 24.04.0 or later.

If a release hasn't been published to the main registry yet, you can still use it by specifying the following environment variable so that Nextflow can find the plugin:

export NXF_PLUGINS_TEST_REPOSITORY="https://github.com/bentsherman/nf-boost/releases/download/0.3.2/nf-boost-0.3.2-meta.json"

Examples

Check out the examples directory for example pipelines that demonstrate how to use the features in this plugin.

Reference

Configuration

boost.cleanup

Set to true to enable automatic cleanup (default: false). Temporary files will be automatically deleted as soon as they are no longer needed.

The default cleanup observer uses publishDir directives to determine whether a file should be published before it is deleted. Setting boost.cleanup = 'v2' will use an alternate cleanup observer which uses the new workflow publish definition instead of publishDir to track publishing.

Limitations:

boost.cleanupInterval

Specify how often to scan for cleanup (default: '60s').

Functions

mergeCsv( records, path, [opts] )

Save a list of records (i.e. tuples or maps) to a CSV file.

Available options:

mergeText( items, path, [opts] )

Save a list of items (i.e. files or strings) to a text file.

Available options:

Operators

exec( name, body )

The exec operator creates and invokes an inline native (i.e. exec) process with the given name, as well as a closure which corresponds to the exec: section of a native process.

The inline process can be configured from the config file like any other process, including the use of process selectors (i.e. withName).

Limitations:

scan( [seed], accumulator )

The scan operator is similar to reduce -- it applies an accumulator function sequentially to each value in a channel -- however, whereas reduce only emits the final result, scan emits each partially accumulated value.

then( onNext, [opts] )

then( [others...], opts )

thenMany( onNext, emits: <emits>, [opts] )

thenMany( [others...], emits: <emits>, opts )

The then operator is a generic operator that can be used to implement nearly any operator you can imagine.

It accepts any of three event handlers: onNext, onComplete, and onError (similar to subscribe). Each event handler has access to the following methods:

When there is only one source channel, the done() method will be called automatically when the source channel sends the onComplete event. You can still call it manually, e.g. to finalize the output earlier. When there are multiple source channels, you are responsible for calling done() at the appropriate time -- if you don't call it, your operator will wait forever.

When there are multiple source channels, onNext and onComplete events are synchronized. This way, you don't need to worry about making your event handlers thread-safe, because they will be invoked on one event at a time.

Available options:

Development

The easiest way to build and test nf-boost locally is to run make install. This will build the plugin and install it to your Nextflow plugins directory (e.g. ~/.nextflow/plugins), using the version defined in MANIFEST.MF. Finally, specify the plugin in your Nextflow config with this exact version. You can then use it locally like a regular plugin.

Refer to the nf-hello README for more information about building and publishing Nextflow plugins.