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.10.tar.gz (3.4 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.10-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.6 MB view details)

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

sassy_rs-0.1.10-cp38-abi3-macosx_11_0_arm64.whl (305.5 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: sassy_rs-0.1.10.tar.gz
  • Upload date:
  • Size: 3.4 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.10.tar.gz
Algorithm Hash digest
SHA256 7ee49bcfc5fb88cb1514573ade1ead827b82b8e512be9764bafeb067f13e5048
MD5 791ad56c5a5455613b86483b0d48e423
BLAKE2b-256 223ec70f5d9791cdffb08bdd943c5f3293fe13653b0ce2800c7f40b2527bba9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sassy_rs-0.1.10-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c4228f26fd46afb0866891afff5fb6008402ea5af0071fa49046751409da1d4f
MD5 1377c6a6ab88e5de9c57e36c06e4f2c3
BLAKE2b-256 4a0988ad8608183cefa87da4e6af31c01bbf34ddb5839b9ec5a7b27d241de392

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sassy_rs-0.1.10-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8a7e428982426ba18908261be43242bb45ffe6d0776cb8b25aa277ecc1215e1f
MD5 7400e4a87516962e4b33a70246dac021
BLAKE2b-256 fe3f0c4cd9592fa8cdd9f85a0915a9725c78666e3391317998b4b6681f555f2f

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