Skip to main content

Pattern Searching Algorithms

This package provides single-pattern and multiple-pattern string searching algorithms in Python.
It is useful for students, programmers, and bioinformatics enthusiasts to learn, practice, and experiment with text and DNA/protein sequence analysis.


🎯 Relevance to Bioinformatics

Pattern searching is crucial for:

  • Finding motifs in DNA sequences (e.g., promoters, binding sites)
  • Identifying repeated sequences or mutations in genomes
  • Searching multiple motifs efficiently in large genomic datasets

These algorithms are foundational for sequence analysis, text processing, and bioinformatics data mining.


🧩 Single-Pattern Algorithms (Recherche d’un seul motif)

Algorithm Description
Naive Simple brute-force search for a single pattern.
Morris-Pratt Optimized for repeated patterns using prefix preprocessing.
Boyer-Moore Skips unmatched characters using bad character heuristic.
Rabin-Karp Uses hashing for pattern search.

Example:

from algorithms.single_pattern.naive import naive_search

text = "ABABDABACDABABCABAB"
pattern = "ABABCABAB"
naive_search(text, pattern)

🧩 Multiple-Pattern Algorithms (Recherche de plusieurs motifs)

Algorithm Description
Rabin-Karp (Multiple) Hash-based search for multiple patterns at once.
Aho-Corasick Builds a finite automaton for all patterns; very efficient.
Wu-Manber Optimized multiple-pattern search using block shifts.
Commentz-Walter Combines Boyer-Moore logic with multiple-pattern optimization.

Example:

from algorithms.multiple_pattern.aho_corasick import AhoCorasick

text = "ACGTACGTGACG"
patterns = ["ACG", "GAC"]
ac = AhoCorasick(patterns)
ac.search(text)

🚀 Usage

Clone the repository:

git clone https://github.com/HADIL19/Pattern-Searching.git
cd Pattern-Searching

Install the package locally:

pip install -e .

Run any algorithm:

python algorithms/single_pattern/naive.py
python algorithms/multiple_pattern/aho_corasick.py

📚 Resources

Check resources/pattern_searching_links.md for tutorials and detailed explanations:


⚖️ License

This project is licensed under the MIT License.
See the LICENSE file for full details.

You are free to **use, copy, modify, merge, publish, distribute, subl

Metadata

Release files for pattern-searching 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pattern-searching 0.1.3
File Size Uploaded
pattern_searching-0.1.3.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pattern-searching 0.1.3
File Interpreter ABI Platform
pattern_searching-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 17.4 kB

Release files / pattern_searching-0.1.3.tar.gz

Download URL pattern_searching-0.1.3.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
546739d6ae47c81c2b15f0eee96b8b4b98355d407a5d43020936da99bc9214ee
BLAKE2b-256 checksum
How to use checksums
8ed3637b0565ebbb5a6387396039176564bd381de5617d9fb5bb74faf662a881
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.

Transparency log

Release files / pattern_searching-0.1.3-py3-none-any.whl

Download URL pattern_searching-0.1.3-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
183c4171efc3beb76415ad058c4d73a419c4bd40a642682dc8bbb37939844727
BLAKE2b-256 checksum
How to use checksums
b4f60f3a0ee4743b23a1cfea35ec73923aaca8756a5172138c9db84e3687db23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page