Skip to main content

Fast approximate string searching using SIMD

Project description

Sassy Python Bindings

🐍 The python bindings for Sassy

Installation

Pip.

pip install sassy-rs

(as sassy was already taken we chose sassy-rs)

From source. In the root of the repository, run:

maturin develop --features python

You need Maturin for this, see maturin:

Usage

A simple usage is as follows:

import sassy
pattern = b"ATCGATCG"
text = b"GGGGATCGATCGTTTT"
# alphabet: ascii, dna, uipac
searcher = sassy.Searcher("dna")
matches = searcher.search(pattern, text, k=1)
for i, match in enumerate(matches):
    print(f"Match {i+1}:")
    print(f"    Start: {match.text_start}")
    print(f"    End: {match.text_end}")
    print(f"    Cost: {match.cost}")
    print(f"    Strand: {match.strand}")
    print(f"    CIGAR: {match.cigar}")

This finds 3 matches:

Match 1:
    Start: 4
    End: 12
    Cost: 0
    Strand: +
    CIGAR: 8=
Match 2:
    Start: 6
    End: 14
    Cost: 1
    Strand: -
    CIGAR: 6=X=
Match 3:
    Start: 2
    End: 10
    Cost: 1
    Strand: -
    CIGAR: X7=

Further options are sassy.Searcher(alpha=0.5) to allow overhang alignments, and sassy.Searcher("dna", rc=False) to disable reverse complements for DNA or IUPAC strings.

See sassy/example.py for a larger example.

Troubleshooting

1. I could install sassy-rc but no modules/functions are found.

When creating an issue please include the output of print(dir(sassy)) if you were able to install sassy-rs but no functions/modules were found.

Your output might look like:

['__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']

Whereas it should look like:

['Searcher', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'features', 'sassy']

2. Other sassy issues.

If you were able to install sassy, but have other issues please also add the output of sassy.features().

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

sassy_rs-0.1.8.tar.gz (3.2 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

sassy_rs-0.1.8-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

sassy_rs-0.1.8-cp38-abi3-macosx_11_0_arm64.whl (329.4 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

Details for the file sassy_rs-0.1.8.tar.gz.

File metadata

  • Download URL: sassy_rs-0.1.8.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for sassy_rs-0.1.8.tar.gz
Algorithm Hash digest
SHA256 f0ec1ac725b2dd3a0d0127002c40dc2f5162e5f241c0f1bafebc7c6dcfce8bb6
MD5 0c807a4dad0796e5aea5f2c3cfd7cf72
BLAKE2b-256 26890ed9b789fd82701b6163372b797cf4b7842c17951a450f8e0b486a2f46e4

See more details on using hashes here.

File details

Details for the file sassy_rs-0.1.8-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for sassy_rs-0.1.8-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9179d17d84532628ae1f7808941f8bd96eb58a0a7597a4effb5b4b9974cea4c4
MD5 c8adbbd55b9d5f4e2cffa4932f717a5b
BLAKE2b-256 c4087ae6bd6e78257f3db0b3c83576de0508eff7179ecbacaa820fc63da490c2

See more details on using hashes here.

File details

Details for the file sassy_rs-0.1.8-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for sassy_rs-0.1.8-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e202e6cf65b0f4b720fd3e7bd35e956c2d713c627206e9588b5fe4f7ed3257a0
MD5 49b5529ae90d11c355b55507bd7380c5
BLAKE2b-256 7ba5ab6b4884867f659717953d59698ed2b3a79f67c5c52dea92d7c70dcb59c3

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