A Python wrapper around Nextflow.
Project description
nextflow.py
nextflow.py is a Python wrapper around the Nextflow pipeline framework. It lets you run Nextflow pipelines from Python code.
import nextflow
pipeline = nextflow.Pipeline("main.nf")
execution = pipeline.run(params={"param1": "123"})
print(execution.status)
Installation
nextflow.py is available through PyPI:
pip install nextflow
You must install Nextflow itself separately: see the Nextflow Documentation for help with this.
Use
The starting point for any nextflow.py pipeline is the Pipeline object. This is initialised with a path to the file in question, and, optionally, the location of an accompanying config file and input schema (formatted acording to nf-core) guidelines:
pipeline1 = nextflow.Pipeline("pipelines/my-pipeline.nf")
pipeline2 = nextflow.Pipeline("main.nf", config="nextflow.config", schema="inputs.json")
These are executed with the run()
method. Arguments are:
-
location
(default"."
) - the directory the pipeline will be run from. This is where thework
directory will be created, and where the log file will be written to. -
params
(defaultNone
) - any inputs to be passed to the pipeline at runtime as a Python dictionary. -
profile
(defaultNone
) - any settings profiles to apply, as a list of profile names.
execution1 = pipeline1.run()
execution2 = pipeline2.run(location="./rundir", params={"param1": "123"}, profile=["docker", "test"])
Upon completion you get an Execution
object back. This is a record of the
execution that just ran, and you can interrogate various properties from it:
-
id
- The unique ID of that run, generated by Nextflow. -
datetime
- When the pipeline ran. -
duration
- how long the execution took. -
status
- the status Nextflow reports on completion. -
command
- the command used to run the pipeline. -
log
- the full text of the log file produced. -
nextflow_processes
- the associatedNextflowProcess
objects.
A NextflowProcess
is the record of the execution of a specific process within
the overall Pipeline execution. The precise attributes are generated
automatically at runtime based on the output of nextflow log
, but some useful
ones are:
-
process
- the process's name within Nextflow. -
name
- the unique name for this process execution. -
stdout
- the process's text output. -
stderr
- the process's error text output.
You can get all of the descriptive data at once with the fields
attribute.
Changelog
0.1
18th October, 2021
-
Basic Pipeline object.
-
Basic Execution object.
-
Basic ProcessExecution object.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for nextflowpy-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a4ddef6f53b41f4759d20a7db3a3409f67523ad743f3094b4afd6b9c2d28d8d |
|
MD5 | 4b5e7b8941f1e4d5bc6d5c5e137176a9 |
|
BLAKE2b-256 | c558c8e27f9579d0dd21ed5438b3dd943abe2b18f9f3eb579c684968c34f68b6 |