Skip to main content

A Python wrapper for BBTools

Project description

bbmapy

A Python wrapper for BBTools.

Installation

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

    git clone https://github.com/urineri/bbmapy.git
    cd bbmapy
    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-bbmapy-commands
    

    The above should be automatically done if you are installing from pip (pypi)

  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).

Citation

BBMerge manuscript: https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0185056 Please cite this paper if you use bbmap in your work.

License

This project is only a wrapper, please see the actual bbtools repository for (license)[https://bitbucket.org/berkeleylab/jgi-bbtools/src/master/license.txt] 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.5.tar.gz (25.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.5-py3-none-any.whl (26.9 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bbmapy-0.0.5.tar.gz
  • Upload date:
  • Size: 25.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.5.tar.gz
Algorithm Hash digest
SHA256 d23544fe7d5d2478bb249cb48ab3fd8333e4fb1315969dfcd97c71eb4a6a44bf
MD5 8fe68eeffb4f748e97b1a89f22c79b5e
BLAKE2b-256 c788827d8cdd15ddc3cb043f8e440aa91e5b9e68430159ba04ed310ca36f803f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bbmapy-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 26.9 MB
  • 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2bfc6151312b076c56a5b473e8c4dd1b8ba83d894d1aadd82381043588de3fcd
MD5 0a84b1c7d0f973f34b81734e18a2657c
BLAKE2b-256 2a731bd8902d032f91777bea8b4915a2acc1c8c9ef3231d3d865909529d96005

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