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.4.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.4-py3-none-any.whl (26.9 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bbmapy-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 b16b4e067de7766666b6bc669e01ea34f703939e971c43d156bda11509aab97a
MD5 0b98bfb891856ea9cfe5c258411ff518
BLAKE2b-256 2397c0fe8d9cbfa50e5d768f55d4367d78411c9bfa5bfba094867fb5ba3a2c1c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bbmapy-0.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3d7f677ca23bdfeda30274924e20534c1a1efba8a88e61b05b47cc992af2bb19
MD5 b6adafa7ef4b7fffc5735dc5e18f418a
BLAKE2b-256 5723af4546bac1c6aae33ba64b150191cdbdd2bbaa8aa43153ba35d0df419b7d

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