Skip to main content

A Python wrapper for BBTools

Project description

ppby

A Python wrapper for BBTools.

Installation

  1. Lazy way - Clone this repository, download bbmap, and install the package:

    git clone https://github.com/urineri/ppby.git
    cd ppby
    cd vendor
    rm bb* -rf
    wget https://sourceforge.net/projects/bbmap/files/latest/download -O bbtools.tar.gz
    tar -xf bbtools.tar.gz
    cd ..
    pip install -e .
    generate-ppby-commands
    
  2. Unlazy way - is commented out below this line, that's how much it isn't suggested.

Dependencies

  • Java
  • BBmap (the above steps should download it to the vendor subdirectory...).
    If you rather this to use your own bbmap etc, go to the base.py script and comment out line 51, then uncomment line 52.
  • rich (for pretty printing)

Usage

After installation, you can use ppby in your Python scripts like this:

from ppby import bbduk

# Basic usage
bbduk(
    in_file="input.fastq",
    out="output.fastq",
    ktrim="r",
    k="23",
    mink="11",
    hdist="1",
    tbo=True,
    tpe=True,
    minlen="45",
    ref="adapters",
    ftm="5",
    maq="6",
    maxns="1",
    ordered=True,
    threads="4",
    overwrite="t",
    stats="stats.txt"
)

# Using Java flags alongside other arguments
bbduk(
    Xmx="2g",  # Set maximum heap size
    da=True,   # Enable assertions
    eoom=True, # Enable out-of-memory termination
    in_file="input.fastq",
    out="output.fastq",
    ktrim="r",
    k="23"
)

# To capture output
stdout, stderr = bbduk(
    capture_output=True,
    Xmx="2g",
    in_file="input.fastq",
    out="stdout.fastq",
    # ... other parameters ...
)

Notes:

  • in can be a protected word in python and other code, it is replaced by in_file in function calls. in1, in2 are still valid.
  • Java flags (such as Xmx, Xms, da, ea, eoom) are automatically recognized and handled appropriately. Include them in your function calls just like any other argument.
  • the capture_output argument might be switched (stderr --> out and vice verse).

License

This project is only a wrapper, please see the actual bbtools repository for license etc.
Neither the developers of bbtools nor of ppby take any responsibility for how you use this code. All accountability is on you.

Acknowledgments

This project only (crudely) wraps BBTools (a.k.a bbmap), which is developed by Brian Bushnell.
If you use ppby and things don't quite work like you'd like, don't expect the developer of bbmap to help you with this whacky python wrapper.
If Please see the BBTools website for more information about the underlying tools.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bbmapy-0.0.2.tar.gz (19.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bbmapy-0.0.2-py3-none-any.whl (145.8 kB view details)

Uploaded Python 3

File details

Details for the file bbmapy-0.0.2.tar.gz.

File metadata

  • Download URL: bbmapy-0.0.2.tar.gz
  • Upload date:
  • Size: 19.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for bbmapy-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0055e2be2d9b4de426c8203002c5737564fc28178249d2ecb71121dda7aedd09
MD5 829fd7b658737b97e231f248d0341a65
BLAKE2b-256 d3c6d6fd41aa03d9e1aaf14d2f2f89a5f6924164c4081b2c756f79ff37522901

See more details on using hashes here.

File details

Details for the file bbmapy-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: bbmapy-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 145.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for bbmapy-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2e602538450f31e6e9c94a7c9064e43cd67605f6e217c3626859c165aa0d4401
MD5 f62ba868ac50bc6d993aed3f42eb60a6
BLAKE2b-256 ee50156c9d70c8b53e6d79de68dfddbbf06860922793d8ebd30761810bf33765

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page