Skip to main content

oxli is a Rust library + Python interface for counting k-mers in genomic sequencing data.

Project description


oxli

oxli is a powerful Rust library with a simple Python interface for counting k-mers in genomic sequencing data.

Use oxli to bring fast kmer counting and comparison operations to your Python projects.

This library is written on top of the sourmash rust library, and the underlying code for dealing with sequence data is well tested.

Installation

Quick setup

oxli is available on conda-forge for Linux, Mac OS X, and Windows for Python versions 3.10, 3.11, and 3.12:

conda install oxli

This will install the oxli library for Python.

For developers

You can also try building oxli yourself and using it in development mode:

# Setup conda development env
mamba env create -f environment.yml -n oxli

# Install oxli in dev mode
pip install -e '.[test]'

Getting Started

See the the oxli Wiki for documentation on the Python API.

Basic Usage

Initialise a new KmerCountTable

# Import oxli
from oxli import KmerCountTable

# Create new count table
kct = KmerCountTable(ksize=4) # Count 4-mers

Adding k-mer counts.

# Add single k-mer with count()
kct.count("AAAA")
>>> 1

# Increment count
kct.count("AAAA")
>>> 2

# Forward and Reverse complement counted together
kct.count("TTTT")
>>> 3

# Add many k-mers from a longer sequence with consume
kct.consume("GGGGGGGGGG") # 7 x 4-mers of 'GGGG'

Lookup counts by k-mer.

# Retrieve kmer counts
kct.get('GGGG') # Count for GGGG/CCCC
>>> 7
kct.get('AAAA') #Count for AAAA/TTTT
>>> 3

Extracting k-mers from files.

# Screed for FASTA/FASTQ parsing
import screed

# Create new table
counts = KmerCountTable(ksize=21)

# Read fasta records and extract k-mers
for record in screed.open('doc/example.fa'):
    counts.consume(record.sequence)
>>> 349910

What's the history here?

First, oxli is channeling khmer, a package written by @ctb and many others. You shouldn't be too surprised to see useful functionality from khmer making an appearance in oxli.

The khmer package was useful for inspecting large collections of k-mers, but was hard to maintain and evolve.

In ~2016 @ctb's lab more or less switched over to developing sourmash, which was initially built on a similar tech stack to khmer (Python & C++).

At some point, @luizirber rewrote the sourmash C++ code into Rust.

This forced @ctb to learn Rust to maintain sourmash.

@ctb then decided he liked Rust an awful lot, and missed some of the khmer functionality.

And, voila! oxli was born.

Authors

Author: C. Titus Brown (@ctb), ctbrown@ucdavis.edu
with with miscellaneous features by @Adamtaranto

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

oxli-0.3.0.tar.gz (143.8 kB view hashes)

Uploaded Source

Built Distributions

oxli-0.3.0-pp310-pypy310_pp73-musllinux_1_2_x86_64.whl (2.0 MB view hashes)

Uploaded PyPy musllinux: musl 1.2+ x86-64

oxli-0.3.0-pp310-pypy310_pp73-musllinux_1_2_i686.whl (2.0 MB view hashes)

Uploaded PyPy musllinux: musl 1.2+ i686

oxli-0.3.0-pp310-pypy310_pp73-musllinux_1_2_armv7l.whl (2.0 MB view hashes)

Uploaded PyPy musllinux: musl 1.2+ ARMv7l

oxli-0.3.0-pp310-pypy310_pp73-musllinux_1_2_aarch64.whl (1.9 MB view hashes)

Uploaded PyPy musllinux: musl 1.2+ ARM64

oxli-0.3.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.9 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

oxli-0.3.0-pp310-pypy310_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.0 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ s390x

oxli-0.3.0-pp310-pypy310_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.9 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ppc64le

oxli-0.3.0-pp310-pypy310_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (1.9 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

oxli-0.3.0-pp310-pypy310_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.7 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARMv7l

oxli-0.3.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

oxli-0.3.0-cp312-none-win_amd64.whl (1.4 MB view hashes)

Uploaded CPython 3.12 Windows x86-64

oxli-0.3.0-cp312-none-win32.whl (1.3 MB view hashes)

Uploaded CPython 3.12 Windows x86

oxli-0.3.0-cp312-cp312-musllinux_1_2_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ x86-64

oxli-0.3.0-cp312-cp312-musllinux_1_2_i686.whl (2.0 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ i686

oxli-0.3.0-cp312-cp312-musllinux_1_2_armv7l.whl (2.0 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ ARMv7l

oxli-0.3.0-cp312-cp312-musllinux_1_2_aarch64.whl (1.9 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ ARM64

oxli-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.9 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

oxli-0.3.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.0 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ s390x

oxli-0.3.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.9 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ppc64le

oxli-0.3.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (1.9 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686

oxli-0.3.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.7 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARMv7l

oxli-0.3.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

oxli-0.3.0-cp312-cp312-macosx_11_0_arm64.whl (1.4 MB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

oxli-0.3.0-cp312-cp312-macosx_10_12_x86_64.whl (1.7 MB view hashes)

Uploaded CPython 3.12 macOS 10.12+ x86-64

oxli-0.3.0-cp311-none-win_amd64.whl (1.4 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

oxli-0.3.0-cp311-none-win32.whl (1.3 MB view hashes)

Uploaded CPython 3.11 Windows x86

oxli-0.3.0-cp311-cp311-musllinux_1_2_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ x86-64

oxli-0.3.0-cp311-cp311-musllinux_1_2_i686.whl (2.0 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ i686

oxli-0.3.0-cp311-cp311-musllinux_1_2_armv7l.whl (2.0 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ ARMv7l

oxli-0.3.0-cp311-cp311-musllinux_1_2_aarch64.whl (1.9 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ ARM64

oxli-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.9 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

oxli-0.3.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.0 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ s390x

oxli-0.3.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.9 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ppc64le

oxli-0.3.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (1.9 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

oxli-0.3.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.7 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARMv7l

oxli-0.3.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

oxli-0.3.0-cp311-cp311-macosx_11_0_arm64.whl (1.4 MB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

oxli-0.3.0-cp311-cp311-macosx_10_12_x86_64.whl (1.7 MB view hashes)

Uploaded CPython 3.11 macOS 10.12+ x86-64

oxli-0.3.0-cp310-none-win_amd64.whl (1.4 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

oxli-0.3.0-cp310-none-win32.whl (1.3 MB view hashes)

Uploaded CPython 3.10 Windows x86

oxli-0.3.0-cp310-cp310-musllinux_1_2_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ x86-64

oxli-0.3.0-cp310-cp310-musllinux_1_2_i686.whl (2.0 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ i686

oxli-0.3.0-cp310-cp310-musllinux_1_2_armv7l.whl (2.0 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ ARMv7l

oxli-0.3.0-cp310-cp310-musllinux_1_2_aarch64.whl (1.9 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ ARM64

oxli-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.9 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

oxli-0.3.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.0 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ s390x

oxli-0.3.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.9 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ppc64le

oxli-0.3.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (1.9 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

oxli-0.3.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.7 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARMv7l

oxli-0.3.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

oxli-0.3.0-cp310-cp310-macosx_11_0_arm64.whl (1.4 MB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

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