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. searcher.search is the simple function to search one pattern
in one text, while searcher.search_many takes multiple patterns and multiple
texts and searches each pattern in each text, possibly in multiple threads.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sassy_rs-0.2.0.tar.gz.
File metadata
- Download URL: sassy_rs-0.2.0.tar.gz
- Upload date:
- Size: 5.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75a8cd843212bc200c5464b65f766bdfe4a219e1457c5d36bf5a4b39a32f45c4
|
|
| MD5 |
cb4a719b9ad9ebf233d479c90e292473
|
|
| BLAKE2b-256 |
55e8d517c27f19c7b700c866010eb616bb91c6a5d609135b3819146660d486eb
|
File details
Details for the file sassy_rs-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: sassy_rs-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cc34652df222a83047807e94f03cf532ea34a115f71854aec1766b1f98b6606
|
|
| MD5 |
e478bffafdc58a67b17381f3d3088b6b
|
|
| BLAKE2b-256 |
32f946273a941e7f0e1f859bec47c76719e34f93a5625c7082cbe4f693fb3ca2
|
File details
Details for the file sassy_rs-0.2.0-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: sassy_rs-0.2.0-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 461.6 kB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
154c773cdf53b128fb2b06770f44d14c9143884c55df2e7a6690fff6caf55fe9
|
|
| MD5 |
2388e8cfad029087d820d079b54a7c36
|
|
| BLAKE2b-256 |
157f5216c2e0cbb58941e36c9f039efc8671749cf9c10a439a4c3f9c40bf2c52
|