Giter VIP home page Giter VIP logo

nektool's Introduction

Nektool

Cookiecutter profile for making a Nextflow-based bioinformatics tool

See Snaketool for a Snakemake-based template

Motivation

Writing reliable command line tools requires a lot of boilerplate to ensure input and generated files are valid, catch errors with subprocesses, log stderr messages etc. It's very time-consuming and annoying. Nextflow does a lot of heavy lifting in this regard and is an obvious alternative to a command line tool.

Building a Nextflow pipeline with a convenience launcher offers many advantages:

  • Developing command line applications is quicker and easier
  • Installing, running, and rerunning is easier and more convenient
  • You can have subcommands for utility scripts and Nextflow workflows
  • You can trick Snakemake users into running Nextflow
  • Your pipelines have a proper command line interface and help message!

Who is this for?

People who are already familiar with Nextflow and want to create either a Nextflow-powered command line tool or fancier Nextflow pipelines.

Usage

To create a new tool from this template, use Cookiecutter and follow the prompts.

cookiecutter https://github.com/beardymcjohnface/Nektool.git

and here's what you get:

my_nektool/
├── my_nektool
│   ├── __init__.py
│   ├── __main__.py
│   ├── util.py
│   ├── my_nektool.LICENSE
│   ├── my_nektool.VERSION
│   └── workflow
│       ├── nextflow.config
│       ├── params.yaml
│       └── workflow.nf
└── setup.py

The file __main__.py is the entry point. Once installed with pip it will be accessible on command line, in this example as my_nektool. Customise this file to add your own commandline options, help message etc. If you only have one Snakefile you wish to run then this file will need very little customisation.

The directory workflow/ contains an example Nextflow pipeline that will work with the example launcher.

How the launcher works

The launcher first copies the default parameters and config files to the working directory which will allow the user to cusomise them if they wish. The launcher reads in these files and combines it with command-line arguments to pass on to Snakemake. In this example it only has one option to pass: --input. The Launcher updates the config files in the working directory which will be passed to Nextflow. The launcher uses the rest of the command line arguments to launch Nextflow. Most of the command line arguments are boilerplate for running Nextflow and do not require much if any customisation.

Customising your tool

Check out the wiki page for a detailed example on customising your Nektool.

Installing and testing your tool

For development, cd to your Snaketool directory and install with pip:

cd my_nektool/
pip install -e .
my_nektool --help
my_nektool run --help

Test run the template:

my_nektool run --input yeet

A slightly more interesting test using any2fasta (in a conda environment) to convert a tiny FASTQ file to FASTA.

my_nektool run --use-conda --input my_nektool/workflow/tiny.fastq -entry convert2fasta 

Publishing your tool

Add your tool to pip and bioconda like you would any other python package. Better instructions TBA, watch this space!

nektool's People

Contributors

beardymcjohnface avatar rsuchecki avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.