Skip to main content

PyO3 bindings and Python interface to sylph, an ultrafast method for containment ANI querying and taxonomic profiling.

Project description

🕊️ Pysylph Stars

PyO3 bindings and Python interface to sylph, an ultrafast method for containment ANI querying and taxonomic profiling.

Actions Coverage License PyPI Bioconda AUR Wheel Python Versions Python Implementations Source Mirror Issues Docs Changelog Downloads

🗺️ Overview

sylph is a method developed by Jim Shaw and Yun William Yu for fast and robust ANI querying or metagenomic profiling for metagenomic shotgun samples. It uses a statistical model based on Poisson coverage to compute coverage-adjusted ANI instead of naive ANI.

pysylph is a Python module, implemented using the PyO3 framework, that provides bindings to sylph. It directly links to the sylph code, which has the following advantages over CLI wrappers:

  • pre-built wheels: pysylph is distributed on PyPI and features pre-built wheels for common platforms, including x86-64 and Arm64.
  • single dependency: If your software or your analysis pipeline is distributed as a Python package, you can add pysylph as a dependency to your project, and stop worrying about the sylph binary being present on the end-user machine.
  • sans I/O: Everything happens in memory, in Python objects you control, making it easier to pass your sequences to pysylph without having to write them to a temporary file.

This library is still a work-in-progress, and in an experimental stage, with API breaks very likely between minor versions.

🔧 Installing

Pysylph can be installed directly from PyPI, which hosts some pre-built CPython wheels for x86-64 platforms, as well as the code required to compile from source with Rust and maturin:

$ pip install pysylph

🔖 Citation

Pysylph is scientific software, and builds on top of sylph. Please cite sylph if you are using it in an academic work, for instance as:

pysylph, a Python library binding to sylph (Shaw & Yu, 2024).

💡 Examples

🔨 Creating a database

A database is a collection of genomes sketched for fast querying.

Here is how to create a database into memory, using Biopython to load genomes:

sketcher = pysylph.Sketcher()
sketches = []

for path in pathlib.Path(".").glob("*.fasta"):
    contigs = [ str(record.seq) for record in Bio.SeqIO.parse(path, "fasta") ]
    sketch = sketcher.sketch_genome(name=path.stem, contigs=contigs)
    sketches.append(sketch)

database = pysylph.Database(sketches)

Sketcher methods are re-entrant and can be used to sketch multiple genomes in parallel using for instance a ThreadPool.

📝 Saving a database

The database can be saved to the binary format used by the sylph binary as well:

database.dump("genomes.syldb")

🗒️ Loading a database

A database previously created with sylph can be loaded transparently in pysylph:

database = pysylph.Database.load("genomes.syldb")

📊 Sketching a query

Samples must also be sketched before they can be used to query a database. Here is how to sketch a sample made of single-ended reads stored in FASTQ format:

reads = [str(record.seq) for record in Bio.SeqIO.parse("sample.fastq", "fastq")]
sample = sketcher.sketch_single(name="sample", reads=reads)

🔬 Querying a database

Once a sample has been sketched, it can be used to query a database for ANI containment or taxonomic profiling:

profiler = pysylph.Profiler()
results = profiler.query(sample, database)   # ANI containment
results = profiler.profile(sample, database) # taxonomic profiling

Profiler methods are re-entrant and can be used to query a database with multiple samples in parallel using for instance a ThreadPool.

🔎 See Also

Computing ANI for closed genomes? You may also be interested in pyskani, a Python package for computing ANI binding to skani, which was developed by the same authors.

💭 Feedback

⚠️ Issue Tracker

Found a bug ? Have an enhancement request ? Head over to the GitHub issue tracker if you need to report or ask something. If you are filing in on a bug, please include as much information as you can about the issue, and try to recreate the same bug in a simple, easily reproducible situation.

🏗️ Contributing

Contributions are more than welcome! See CONTRIBUTING.md for more details.

⚖️ License

This library is provided under the MIT License. It contains some code included verbatim from the the sylph source code, which was written by Jim Shaw and is distributed under the terms of the MIT License as well. Source distributions of pysylph vendors additional sources under their own terms using the cargo vendor command.

This project is in no way not affiliated, sponsored, or otherwise endorsed by the original sylph authors. It was developed by Martin Larralde during his PhD project at the Leiden University Medical Center in the Zeller team.

Download files

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

Source Distribution

pysylph-0.1.1.tar.gz (800.5 kB view details)

Uploaded Source

Built Distributions

pysylph-0.1.1-cp313-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.13 Windows x86-64

pysylph-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13 manylinux: glibc 2.17+ x86-64

pysylph-0.1.1-cp313-cp313-macosx_12_0_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.13 macOS 12.0+ x86-64

pysylph-0.1.1-cp312-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.12 Windows x86-64

pysylph-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pysylph-0.1.1-cp312-cp312-macosx_12_0_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.12 macOS 12.0+ x86-64

pysylph-0.1.1-cp311-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.11 Windows x86-64

pysylph-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pysylph-0.1.1-cp311-cp311-macosx_12_0_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.11 macOS 12.0+ x86-64

pysylph-0.1.1-cp310-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.10 Windows x86-64

pysylph-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pysylph-0.1.1-cp310-cp310-macosx_12_0_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.10 macOS 12.0+ x86-64

pysylph-0.1.1-cp39-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.9 Windows x86-64

pysylph-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pysylph-0.1.1-cp39-cp39-macosx_12_0_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.9 macOS 12.0+ x86-64

pysylph-0.1.1-cp38-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.8 Windows x86-64

pysylph-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pysylph-0.1.1-cp38-cp38-macosx_12_0_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.8 macOS 12.0+ x86-64

pysylph-0.1.1-cp37-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.7 Windows x86-64

pysylph-0.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

pysylph-0.1.1-cp37-cp37m-macosx_12_0_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.7m macOS 12.0+ x86-64

File details

Details for the file pysylph-0.1.1.tar.gz.

File metadata

  • Download URL: pysylph-0.1.1.tar.gz
  • Upload date:
  • Size: 800.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pysylph-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9b9f4110e2d18d019e7897da8df383a73adb39cbed1a0c5dac9793ea37a7560e
MD5 cd5756188ab2c0ce13f96bfef09e7e4c
BLAKE2b-256 a822dcd8d427a3ecd74004eabf9dee35f8bc0068d5fd1506dfc9c49606877c8e

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp313-none-win_amd64.whl.

File metadata

  • Download URL: pysylph-0.1.1-cp313-none-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pysylph-0.1.1-cp313-none-win_amd64.whl
Algorithm Hash digest
SHA256 a7acecade0a456449e5331897846cd8b134c52c21d295cdbc96d0f982b8b7814
MD5 58d358e9fd84d26785b113fea66dbd51
BLAKE2b-256 c890917f0342e8a90a8a2b439cf687f7a962c8873096e777a6a40628c99008dc

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pysylph-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d6519cdcfcd1c7c6940a891495cb38f2eb6e4052c1e990ef4b9f2e65e7a1a0a0
MD5 e1761c5dab16188bf9ef032ef5e81e27
BLAKE2b-256 82d52f87619ec8406fad628f0043054a5a161df5b26b11f3d44415c5b9d6f095

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp313-cp313-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pysylph-0.1.1-cp313-cp313-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 3547b59e4529f03cce3eebcbb47bb5fdc4818fd40b140b779bbbd7fb66518a89
MD5 83ca1c4b3f0c0ba2aa29c21f8304f183
BLAKE2b-256 8697c8cbfc9b2cef62af3ab129551bd08169108fada1c6baf71774c10c09dfbc

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp312-none-win_amd64.whl.

File metadata

  • Download URL: pysylph-0.1.1-cp312-none-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pysylph-0.1.1-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 d05422bc7731e32f5aebc0981058144ce04fd3512d7c68404746512a5f8c2b79
MD5 204ae8e8992d6b02412c75bf6b960082
BLAKE2b-256 b88289b220ad172461b8fe8d6746093c7a9eb1c727503dbba71a5203616538f7

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pysylph-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f866a2bb5861e8346fd783f29484427ea64834acfa5a2c48557dafeca06b5f3e
MD5 f073878688b242172fd1f42b9e6d9b36
BLAKE2b-256 e573d1969ebf1e2ac34d97278b2695c0d1cf9b45156ce696988144e70d3b3458

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp312-cp312-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pysylph-0.1.1-cp312-cp312-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 531415c39f75ea49ed154c192e0eac65b298c3e71cc66f7bc3d9df03132736ee
MD5 d749a3a97644b8494bb1697a61d58d8c
BLAKE2b-256 e58eb6cd1fdb8af2d33480b26e6aa4c9998e0af4332bfd54badf878d922b5964

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp311-none-win_amd64.whl.

File metadata

  • Download URL: pysylph-0.1.1-cp311-none-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pysylph-0.1.1-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 9cf091618d7772ce5d5bbfccdfc20db33818d6739ceed8d99a274d090c94f447
MD5 91a28c3d79c875595a2869d465718661
BLAKE2b-256 db7eb27875fbb562f5fc4b1cd60dc2a4a25993683bf11ebc37eb2e3371797416

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pysylph-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 17f17e2a73998895e9a18ab51ab5c5113adae16c7eb030b9a74edaae25550f6b
MD5 116dd1a8bcf6b4ed05138664e05cefd0
BLAKE2b-256 bcc90f5a0862b028c14197d346bbf7ca56ffd12b0f74a59c000a9db45258af50

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp311-cp311-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pysylph-0.1.1-cp311-cp311-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 17a831c2f64b9797348dacc494f27b0d5b9eda6306b5dbdf0d3aca372dd10552
MD5 8241f839d1da2ecd4fccf2124c0bfade
BLAKE2b-256 f84764f346c193bdf8c52d7c629edd39e42dbf0421f6ad57c5eecfa2b20e4ad6

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp310-none-win_amd64.whl.

File metadata

  • Download URL: pysylph-0.1.1-cp310-none-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pysylph-0.1.1-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 f7aee8f033a001b463165fc1d79f9072405f8f2da76ad204af621349896141ee
MD5 bc6b4b6f41c18748580db2afea766cae
BLAKE2b-256 4a22c8b91a3abcd7e4d3c3d8be4dbb695118a5c0dc2ba7e9a597682421d276cd

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pysylph-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 73dec312e0c207d0f67d69de60865f9ada286f88fe6cd09bb597b14d6fca36a7
MD5 1dee2628cd886d174ee34f9db5b977b8
BLAKE2b-256 ea2ec21c37a58cbf2ab24de7f13084c1933d1781579080a88b8b4b20f801c7c1

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp310-cp310-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pysylph-0.1.1-cp310-cp310-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 843e1263371f68d06ced6960ea22cd5169b8f40f190daa5bc18c6609fe387785
MD5 ad3d5bdbcd14c85552c5d3e20c3d8671
BLAKE2b-256 271a42a41c7c1a0d5e54177e107d2df3a848ce9ea4016a9760b9456e3f08fc07

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp39-none-win_amd64.whl.

File metadata

  • Download URL: pysylph-0.1.1-cp39-none-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pysylph-0.1.1-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 faed39d3652d15cbe81e5a9d2f5e32933e9eeb8ef5111050045c178c81bb89cb
MD5 11d4347574c73f82d68b44f22540f3ee
BLAKE2b-256 7b484830205044e6296ae6d3ce6fc6fe2b3d567d5cc501b7c3e8ccb1d785748e

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pysylph-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0cf194de03646d8ba14ac44ea5e7316ccb8c9079c78d9027c325120721722e8f
MD5 370badd0a43146422e0f063d82a00a15
BLAKE2b-256 0582b40c1d908042ba31e32d64606e1e0450d3ea47aba069ad54685ae6e502da

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp39-cp39-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pysylph-0.1.1-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 ef6485caca3ea0e99c41c739bfbafeeb9f4a659caef194efe2f2f8f0baabf12f
MD5 1147fa115d9b1abd3d9db11b6d374509
BLAKE2b-256 ae1b979cbbe0e7fddaa62296dfcc80bdb88ccaecd66133bef4e1d15ade94b7e7

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp38-none-win_amd64.whl.

File metadata

  • Download URL: pysylph-0.1.1-cp38-none-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pysylph-0.1.1-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 c505df587d5a76dc3d9e1e5e9de30af1c8f33313e3aa16f9883f22df52c739b6
MD5 5a650ec2c03d7f2a2d3b17851547bb7e
BLAKE2b-256 3be20dcc1084dc84c9b55a4971544d7979084f83f2e788ffaae42758fea4ad12

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pysylph-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bcd3e8f1802a56e5dfe96085f7dc3aaf416f7458a0c3dcd1191db684f0b9b7e1
MD5 d91fbe561c6a32722152b02f95cc13ec
BLAKE2b-256 1c5bfa275f8460cbf3637377b7525ebdac58ecc2cced52ef852a8b833e8b5a63

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp38-cp38-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pysylph-0.1.1-cp38-cp38-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 51e3567b38886c43259ceeb146aa89ef1868ba1fa1242da148c951edc95021c2
MD5 ed3a1784c88ce5f729a07d1f2b83807a
BLAKE2b-256 c33ea2426bd292a81091121f73e836458ef3924678970bd7cb63d153bda30ff5

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp37-none-win_amd64.whl.

File metadata

  • Download URL: pysylph-0.1.1-cp37-none-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.7, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pysylph-0.1.1-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 9b31c6d6ca78b016b06fecf7fbfe8f46bf3a3e40167ea7ae484387033adda3db
MD5 7f0a01e68ab9e59bd9a1e7d27bd86c20
BLAKE2b-256 70de7bbbe3ea66990a1f98ffa4f6d4be7a5d1a3e5677ba749e1de317c9415460

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pysylph-0.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 05b7dda8548267a8faa85f091f6167d7cab8647b07718775435f1c077e93c386
MD5 86c268e47b69f9003f0d02361713635e
BLAKE2b-256 2ff7794e17e0650358fed91896b9a7612765653917c69f8fade919fc85136d27

See more details on using hashes here.

File details

Details for the file pysylph-0.1.1-cp37-cp37m-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pysylph-0.1.1-cp37-cp37m-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 100a09c8de59fb50788d693b924315fab2cf3ab7ded732d4ae20229da211c6e1
MD5 ba934d038343f0f55ddbacbb63842a78
BLAKE2b-256 7ea75a506a0988a64141339f5e1c5429422bde95934beaa88a7d4440d6af7c4f

See more details on using hashes here.

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