Skip to main content

Snakeboost

Snakeboost provides enhancers and helpers to turbocharge your snakemake workflows. The project is currently in it's alpha stage.

Full Documentation

Script Enhancers

Overview

Script enhancer functions wrap around bash scripts given to the shell directive in Snakemake Rules. All enhancers have a common interface designed for easy use in your workflow. To illustrate, we'll take PipEnv as an example (it lets you use pip virtual environments!).

  1. Initiate the enhancer

Import the enhancer at the top of your Snakefile and instantiate it. Most enhancers take a few arguments defining their global settings.

from snakeboost import PipEnv

my_env = PipEnv(packages=["numpy", "flake8"], root=("/tmp"))
  1. Use the enhancer in a rule

When instantiated, enhancers can be called using the bash command as an argument.

rule lint_python:
    inputs: "some-script.py"
    shell:
        my_env.script("flake8 {input}")

Some enhancers, such as PipEnv, provide multiple functions (e.g. .script, .python, etc) that provide slightly different functionality. Others, such as Tar, have methods that return a modified instance.

rule inspect_tarball:
    inputs: "some_archive.tar.gz"
    shell:
        tar.using(inputs=["{input}"])("ls {input}/")

Snakeboost uses this slightly convoluted way of setting arguments to allow easy chaining of multiple enhancers. This leads us to step 3:

  1. Use boost() to chain multiple enhancers

Chaining many enhancers together can quickly lead to indentation hell:

rule lint_tarred_scripts:
    inputs: "script_archive.tar.gz"
    shell:
        xvfb-run(
            tar.using(inputs=["{input}"])(
                my_env.script(
                    "flake8 {input}/script.py"
                )
            )
        )

The boost() function lets you rewrite this as:

from snakeboost import Boost

boost = Boost()

rule lint_tarred_scripts:
    inputs: "script_archive.tar.gz"
    shell:
        boost(
            xvfb_run,
            tar.using(inputs=["{input}"]),
            my_env.script,
            "flake8 {input}/script.py"
        )

That makes your rules much cleaner! However, boost provides a much more important function, as discussed fully in the docs...

Enhancers

Current enhancers include:

  • PipEnv: Use pip environments in snakemake workflows
  • PyScript: Use python scripts along with pip envs and other Snakeboost enhancers
  • Tar: tar up your output files or untar input files before the job
  • Xvfb: Start a virtual X-server to run headless graphical commands (e.g. rendering) on servers without graphics support.

Contributing

If you have a small utility function for your Snakemake workflows, it would likely make a great addition to the Snakeboost ecosystem. Script enhancers should follow the basic interface of the other enhancers: a class initialized with global settings that exposes one or more functions that take a bash script as argument.

Snakebids uses Poetry for dependency management and pre-commit for Quality Assurance tests. If Poetry is not already installed on your system, follow the instructions on their website. Then clone the repo and initialize by running:

poetry install
poetry run pre-commit install

Metadata

Release files for snakeboost 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snakeboost 0.3.0
File Size Uploaded Provenance Actions
snakeboost-0.3.0.tar.gz 21.2 kB Without provenance Details for snakeboost-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for snakeboost 0.3.0
File Interpreter ABI Platform Actions
snakeboost-0.3.0-py3-none-any.whl Python 3 none any Details for snakeboost-0.3.0-py3-none-any.whl

Total release size: 45.1 kB

Release files / snakeboost-0.3.0.tar.gz

Download URL snakeboost-0.3.0.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
53a0098ef869b0c78252d3dd768291b5e2afe29a1f689c336d8a13acf9a3d7b7
BLAKE2b-256 checksum
How to use checksums
4ff67d58c89445e25d5e2cb11f601e4d71262876cca3117c177fac3177af0e39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.0 Linux/5.10.102.1-microsoft-standard-WSL2

Release files / snakeboost-0.3.0-py3-none-any.whl

Download URL snakeboost-0.3.0-py3-none-any.whl
Size 24.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6035d3e1c7e000be079f7bd7171102e6aeb751eb68eb9bcbd2fa800a625fe54f
BLAKE2b-256 checksum
How to use checksums
2611c20f3b0165753426bab0e21d21982b02f17d22104d87304b89a0cf2c3153
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.0 Linux/5.10.102.1-microsoft-standard-WSL2

Security for snakeboost 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page