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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

sassy_rs-0.1.2-cp38-abi3-win_amd64.whl (194.2 kB view details)

Uploaded CPython 3.8+Windows x86-64

sassy_rs-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (348.9 kB view details)

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

sassy_rs-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl (313.6 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file sassy_rs-0.1.2-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: sassy_rs-0.1.2-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 194.2 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for sassy_rs-0.1.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 54eba15737728e9a40beddb1b90cd88bb52bef8f77587c477bd64cd0f51df92f
MD5 1fdcfcccd5e55d7be67aef00481215b6
BLAKE2b-256 f4ad701c4a019c6e0684fb06b0e2edb3d4dd5461bc4fbf5c17df2358ad8d123b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sassy_rs-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 938dcbd2db0217fdaf1bae3f69ffcd7a40ead3ee6c137faef9c454f8ff0c029d
MD5 69f4c9c1a10096f2ac93078ca3ec2ad2
BLAKE2b-256 d3bdcff5221edc7c6e0db4c06965726a930e58ad605a0e4cbc30402bf745b84f

See more details on using hashes here.

File details

Details for the file sassy_rs-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for sassy_rs-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f91850dbb07d1e9ed54a5929a5f0428cf60638cb07b17bc6328e833cedf00ae7
MD5 11329b351467829f04b0301f1f2ba164
BLAKE2b-256 a3829897c085e92c69edf2cc9e1cf52a584eb75d97906c28f14ac5cb08ac2470

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