Skip to main content

fast search and gather extensions for sourmash

Project description

pyo3_branchwater

PyPI

tl;dr Do fast and low-memory search/gather of many sourmash sketches via a sourmash plugin.

Details

This repo contains a PyO3-based Python wrapper around the core branchwater code. Branchwater is a fast, low-memory and multithreaded application for searching very large collections of FracMinHash sketches as generated by sourmash.

For details, see the Rust code in src/ and Python wrapper in python/.

Uses pyo3 for the Python-to-Rust wrapping.

This functionality can be used from within sourmash as a command-line plugin; see below quickstart.

Documentation

There is a quickstart below, as well as more documentation here.

Quickstart for manysearch.

To try out, you'll need to install a branch of sourmash that contains sourmash#2438.

This quickstart demonstrates manysearch using the 64 genomes from Awad et al., 2017.

First, install this code.

Install this repo in developer mode:

pip install -e .

Second, download sketches.

The following commands will download sourmash sketches for them and unpack them into the directory podar-ref/:

mkdir -p podar-ref
curl -JLO https://osf.io/4t6cq/download
unzip -u podar-reference-genomes-updated-sigs-2017.06.10.zip

Third, create lists of query and subject files.

manysearch takes in lists of signatures to search, so we need to create those files:

ls -1 podar-ref/{2,47,63}.* > query-list.txt
ls -1 podar-ref/* > podar-ref-list.txt

Fourth: Execute!

Now run manysearch:

sourmash scripts manysearch query-list.txt podar-ref-list.txt -o results.csv

You will (hopefully ;) see a set of results in results.csv.

Debugging help

If your file lists are not working properly, try running:

sourmash sig summarize query-list.txt
sourmash sig summarize podar-ref-list.txt

to make sure everything can be loaded.

Future thoughts

The speed and functions of this code will probably be brought into sourmash core in the future, most likely as part of sourmash#2230. However, in the meantime, this is a fun side project that makes use of sourmash plugins and Rust to provide some fast functionality that may be of use to some people, and it can serve as a testbed for future sourmash functionality.

Developer notes

Installing a development environment

You'll need sourmash, rust, and maturin.

A simple way to get up and running is to run:

mamba env create -n branchwatever-dev -f environment.yml

in the top directory of the repo, and then activate the environment and install in editable mode:

mamba activate branchwater-dev
pip install -e .

Running the tests locally

Executing:

make test

will run the Python tests.

Generating a release

  1. Bump version number in Cargo.toml and run make to update Cargo.lock. Then commit and push to origin/main.

  2. Make a new release on github with a matching version tag.

  3. Then pull, and:

make sdist
make upload_sdist

to create a new release on PyPI.

Building wheels

You can build a release wheel for your current platform with:

make wheel

and it will be placed under target/wheels/.


License

This software is under the AGPL license. Please see LICENSE.txt.

Authors

  • Luiz Irber
  • C. Titus Brown
  • Mohamed Abuelanin
  • N. Tessa Pierce-Ward

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

pyo3_branchwater-0.7.0.tar.gz (14.9 MB view details)

Uploaded Source

File details

Details for the file pyo3_branchwater-0.7.0.tar.gz.

File metadata

  • Download URL: pyo3_branchwater-0.7.0.tar.gz
  • Upload date:
  • Size: 14.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.13

File hashes

Hashes for pyo3_branchwater-0.7.0.tar.gz
Algorithm Hash digest
SHA256 300d80d478feec86aa6263fee14514f575e5c65d5d9070997c4ec9c67a967c7f
MD5 de145b03a0fd3ed01d6405483434054d
BLAKE2b-256 48455e84914add917f14efd5d85f49bc923f2fc1bbcf25011946e6e8c26ffe04

See more details on using hashes here.

Provenance

Supported by

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