Skip to main content

noLZSS

Build Wheels Documentation noLZSS Logo

Non-overlapping Lempel–Ziv–Storer–Szymanski factorization

High-performance Python library for text factorization using compressed suffix trees. The library provides efficient algorithms for finding non-overlapping factors in text data, with both in-memory and file-based processing capabilities. Based on a paper by Dominik Köppl - Non-Overlapping LZ77 Factorization and LZ78 Substring Compression Queries with Suffix Trees

Features

  • 🚀 High Performance: Uses compressed suffix trees (SDSL) for optimal factorization speed
  • 💾 Memory Efficient: File-based processing for large datasets without loading everything into memory
  • 🐍 Python Bindings: Easy-to-use Python interface with proper GIL management
  • 📊 Multiple Output Formats: Get factors as lists, counts, or binary files
  • 🔧 Flexible API: Support for both strings and files with optional performance hints
  • 🧬 Genomics Support: Specialized functions for FASTA file processing of nucleotide and protein sequences
  • ⚡ C++ Extensions: High-performance C++ implementations for memory-intensive operations

Installation

From Source (Development)

git clone https://github.com/OmerKerner/noLZSS.git
cd noLZSS
pip install -e .

Requirements

  • Python 3.8+
  • C++17 compatible compiler
  • CMake 3.20+

Quick Start

Basic Usage

import noLZSS

# Factorize a text string
text = b"abracadabra"
factors = noLZSS.factorize(text)
print(factors)  # [(0, 1, 0), (1, 1, 1), (2, 1, 2), (3, 1, 0), (4, 1, 4), (5, 1, 0), (6, 1, 6), (7, 4, 0)]

Working with Files

# Factorize text from a file
factors = noLZSS.factorize_file("large_text.txt")
print(f"Found {len(factors)} factors")

# Just count factors without storing them (memory efficient)
count = noLZSS.count_factors_file("large_text.txt")
print(f"Total factors: {count}")

# Write factors to binary file for later processing
noLZSS.write_factors_binary_file("input.txt", "factors.bin")

Genomics Applications

import noLZSS.genomics

# Process DNA sequences from FASTA file
results = noLZSS.genomics.read_nucleotide_fasta("sequences.fasta")
for seq_id, factors in results:
    print(f"Sequence {seq_id}: {len(factors)} factors")

Statistical Significance Analysis

Distinguish signal from noise in genomic factorizations by comparing with shuffled genomes:

from noLZSS.genomics import calculate_factor_length_threshold

result = calculate_factor_length_threshold(
    "genome_factors.bin",
    "shuffled_factors.bin",
    tau_expected_fp=1.0
)

print(f"Minimum significant factor length: {result['L_star']}")

See Factor Length Significance Analysis for detailed methodology.

Batch Processing

For processing multiple FASTA files, noLZSS provides batch processing scripts:

Local Batch Processing

# Process multiple files locally with parallel downloads and factorization
python -m noLZSS.genomics.batch_factorize \
    --file-list files.txt \
    --output-dir results \
    --mode with_reverse_complement \
    --max-workers 4

LSF Cluster Batch Processing

# Process on LSF cluster with optimal resource allocation
python -m noLZSS.genomics.lsf_batch_factorize \
    --file-list files.txt \
    --output-dir results \
    --max-threads 16 \
    --mode with_reverse_complement

The LSF batch processor:

  • Estimates time, memory, and disk requirements from benchmark data
  • Allocates optimal threads per job based on file size
  • Submits jobs with bsub and tracks completion
  • Provides consolidated failure reports without log spam

See LSF Batch Factorizer Documentation for details.

Algorithm Details

The library implements the Non-overlapping Lempel-Ziv-Storer-Szymanski (LZSS) factorization algorithm using:

  • Compressed Suffix Trees: Built using the SDSL (Succinct Data Structure Library)
  • Range Minimum Queries: For efficient lowest common ancestor computations
  • Sink-based Processing: Memory-efficient processing using callback functions

Reference Selection (ref_policy)

At each position the factor length is the maximum over all earlier non-overlapping occurrences, so the factor boundaries are fixed by the text. When several occurrences of that longest length exist, the ref_policy option chooses which one the ref field points to. Every factor-producing function (in-memory, file, FASTA, reference-guided, parallel, and the batch tools) accepts it:

ref_policy Reported reference Equal-length forward vs. reverse complement
"first" (default) Earliest occurrence (smallest start; for RC matches, smallest end) Forward match preferred
"last" Closest occurrence (largest start/end that still does not overlap the factor) Whichever occurrence ends closest to the factor; forward on an exact tie
import noLZSS

noLZSS.factorize("abcabcabc")                    # [(0,1,0), (1,1,1), (2,1,2), (3,3,0), (6,3,0)]
noLZSS.factorize("abcabcabc", ref_policy="last") # [(0,1,0), (1,1,1), (2,1,2), (3,3,0), (6,3,3)]

Under both policies a strictly longer match always wins and a reverse-complement match must have length ≥ 2. Factor counts, starts and lengths are identical under both policies, so count-based analyses are unaffected; count_* functions therefore take no ref_policy. The "last" policy builds an additional wavelet tree over the suffix array (about n log n extra bits) and performs one extra O(log n) query per factor; the overall O(n log n) bound is unchanged.

Performance

  • Time Complexity: 𝒪(𝑛 lgϵ 𝑛) for factorization, where n is input length, and 𝜖 ∈ (0,1]
  • Space Complexity: 𝒪(𝑛lg𝜎) for suffix tree construction, where 𝜎 is the alphabet size
  • Memory Usage: File-based processing uses minimal memory for large files
  • C++ Extensions: Specialized high-performance functions for memory-intensive genomics operations

Documentation

Complete documentation is available at omerkerner.github.io/noLZSS

The documentation includes:

  • Python API Reference: Complete Python API with examples and parameter descriptions
  • C++ API Reference: Auto-generated C++ API documentation from source code
  • Genomics Module: Specialized functions for biological sequence analysis
  • Examples and Tutorials: Comprehensive usage examples and best practices

Development

Building from Source

# Clone repository
git clone https://github.com/OmerKerner/noLZSS.git
cd noLZSS

# Install in development mode
pip install -e .

# Run tests
python -m pytest tests/

License

This project is licensed under the BSD 3-Clause License (see LICENSE).

The repository vendors third-party components (notably SDSL v3). Third-party license texts and attribution are provided in THIRD_PARTY_LICENSES.txt.

Citation

If you use this library in your research, please cite:

@software{noLZSS,
  title = {noLZSS: Non-overlapping Lempel-Ziv-Storer-Szymanski factorization},
  author = {Kerner, Omer},
  url = {https://github.com/OmerKerner/noLZSS},
  year = {2024}
}

Metadata

Release files for noLZSS 1.2.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 noLZSS 1.2.3
File Size Uploaded Provenance Actions
nolzss-1.2.3.tar.gz 5.6 MB Without provenance Details for nolzss-1.2.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for noLZSS 1.2.3
File Actions
nolzss-1.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details for nolzss-1.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
nolzss-1.2.3-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for nolzss-1.2.3-cp312-cp312-macosx_11_0_arm64.whl
nolzss-1.2.3-cp312-cp312-macosx_10_15_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.15+ x86-64 Details for nolzss-1.2.3-cp312-cp312-macosx_10_15_x86_64.whl
nolzss-1.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details for nolzss-1.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
nolzss-1.2.3-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for nolzss-1.2.3-cp311-cp311-macosx_11_0_arm64.whl
nolzss-1.2.3-cp311-cp311-macosx_10_15_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.15+ x86-64 Details for nolzss-1.2.3-cp311-cp311-macosx_10_15_x86_64.whl
nolzss-1.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details for nolzss-1.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
nolzss-1.2.3-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details for nolzss-1.2.3-cp310-cp310-macosx_11_0_arm64.whl
nolzss-1.2.3-cp310-cp310-macosx_10_15_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.15+ x86-64 Details for nolzss-1.2.3-cp310-cp310-macosx_10_15_x86_64.whl
nolzss-1.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details for nolzss-1.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
nolzss-1.2.3-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details for nolzss-1.2.3-cp39-cp39-macosx_11_0_arm64.whl
nolzss-1.2.3-cp39-cp39-macosx_10_15_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.15+ x86-64 Details for nolzss-1.2.3-cp39-cp39-macosx_10_15_x86_64.whl
nolzss-1.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details for nolzss-1.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
nolzss-1.2.3-cp38-cp38-macosx_11_0_arm64.whl CPython 3.8 CPython 3.8 macOS 11.0+ ARM64 Details for nolzss-1.2.3-cp38-cp38-macosx_11_0_arm64.whl
nolzss-1.2.3-cp38-cp38-macosx_10_15_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.15+ x86-64 Details for nolzss-1.2.3-cp38-cp38-macosx_10_15_x86_64.whl

Total release size: 13.4 MB

Release files / nolzss-1.2.3.tar.gz

Download URL nolzss-1.2.3.tar.gz
Size 5.6 MB
Tags Source
SHA-256 checksum
How to use checksums
e664c5c1f9631fd32db21a80abaf4d9d76348999ea01820cb8b7355c11a93efc
BLAKE2b-256 checksum
How to use checksums
afa400aaa536141a2dab551fa871bef9415b6dec3a902cb0f96cfa0ef5f38505
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / nolzss-1.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL nolzss-1.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 666.3 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
03d4b9c1c855153400aea54b98bcdd5716bb2009e34fa3be5eefd86f03891fa2
BLAKE2b-256 checksum
How to use checksums
c48317be04cdd6886cbb01d41c8107704cbf80cbad67d2b60bef94ee540b2444
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / nolzss-1.2.3-cp312-cp312-macosx_11_0_arm64.whl

Download URL nolzss-1.2.3-cp312-cp312-macosx_11_0_arm64.whl
Size 429.8 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e88169e61a4b3dc52cdcb597e5686d431a90c83bac43859adaf5ee862132d5db
BLAKE2b-256 checksum
How to use checksums
eb1db280788866053a5ccd788289f4fa0678f05f5d0a5fe9fba83ad3e3b2c05a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / nolzss-1.2.3-cp312-cp312-macosx_10_15_x86_64.whl

Download URL nolzss-1.2.3-cp312-cp312-macosx_10_15_x86_64.whl
Size 467.4 kB
Tags CPython 3.12 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
cf260d015d5b914ce56899c5dfb3aaf95250452b0b1af82766336a7b9d417f21
BLAKE2b-256 checksum
How to use checksums
dd7d957234d2036590fc3201784380ba72b8c219ae87f9042ba232889de4955e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / nolzss-1.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL nolzss-1.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 668.5 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
6f3a79f3174bcbbc897a46f7ea9b7f6ed2f100e514fc4cc2a6a998a2073efa33
BLAKE2b-256 checksum
How to use checksums
045323903cae22df9be7f762adc1df3163080d96212cfb12f1299f1634ad24d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / nolzss-1.2.3-cp311-cp311-macosx_11_0_arm64.whl

Download URL nolzss-1.2.3-cp311-cp311-macosx_11_0_arm64.whl
Size 429.4 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4be1fc77dd74cedebfffae699847c9f9475911e785f08552c22b95fb6fe0da6a
BLAKE2b-256 checksum
How to use checksums
d9744d99cf29787de7ab7722e7e046b2b648dd32e071db7e31c5f0605b9565a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / nolzss-1.2.3-cp311-cp311-macosx_10_15_x86_64.whl

Download URL nolzss-1.2.3-cp311-cp311-macosx_10_15_x86_64.whl
Size 465.7 kB
Tags CPython 3.11 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
3130c7638c091f8514e87dfab0e82cdcb2f1e9a71762a2f7e1778d4f2a6316c7
BLAKE2b-256 checksum
How to use checksums
749eeaeb050d6ff62485c4c6af508d691fdbac3c217c4bc6ef159f168f1a9449
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / nolzss-1.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL nolzss-1.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 667.4 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
84d2ff04dc0247b2c7100b490184f0bf1a615b8776bde7002b8c2e8bd8f8de7f
BLAKE2b-256 checksum
How to use checksums
3aed6457831f172a585b461b12475271abecff0d6b163ee123b63d87b91d625c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / nolzss-1.2.3-cp310-cp310-macosx_11_0_arm64.whl

Download URL nolzss-1.2.3-cp310-cp310-macosx_11_0_arm64.whl
Size 428.4 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c7428e6ed0ff41ca59bfc714fbf84989fb88f0a7292d0365965a04c18b351790
BLAKE2b-256 checksum
How to use checksums
bd65e86c5a3f21146419c50abbcc54f014aafc7c88e7d02cc94320d2a144b467
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / nolzss-1.2.3-cp310-cp310-macosx_10_15_x86_64.whl

Download URL nolzss-1.2.3-cp310-cp310-macosx_10_15_x86_64.whl
Size 464.4 kB
Tags CPython 3.10 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
52dec045577508cb8068a694b0441f4bd28a11ae012251028ebe130b64f9c2aa
BLAKE2b-256 checksum
How to use checksums
32985a0b599dbde34a7a4af748895fb585f124a928b505eb602daf12ee906308
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / nolzss-1.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL nolzss-1.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 667.3 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
d1e2cbc371e0cbdcdf01653b190fe2792b1d4cf5f8c07d9ffd059d1b0f860c0b
BLAKE2b-256 checksum
How to use checksums
4f9f3db61426af3fe0be80f2a84a0fa3696b9cdf4b69b68cf064c8779ec088f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / nolzss-1.2.3-cp39-cp39-macosx_11_0_arm64.whl

Download URL nolzss-1.2.3-cp39-cp39-macosx_11_0_arm64.whl
Size 428.5 kB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d49857fdfac860873c3a1eaf249c1984d7517c9c4fee047dada3d12f0107ff4e
BLAKE2b-256 checksum
How to use checksums
29cb10c7956a75d9309cb6403fba828a6530b4cceadd40bd69c8a44b5864e173
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / nolzss-1.2.3-cp39-cp39-macosx_10_15_x86_64.whl

Download URL nolzss-1.2.3-cp39-cp39-macosx_10_15_x86_64.whl
Size 464.5 kB
Tags CPython 3.9 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
2c000813ba87780f83bab7db5eb0c66bd0b5903a795b645197ac8e30481b470f
BLAKE2b-256 checksum
How to use checksums
b89359441753b452f1d91d38122d2d2cc00acbc550ad001946e4d5da01faab60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / nolzss-1.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL nolzss-1.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 660.7 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
ea110d89a7175b04b72d465dd930d83f638206f713167f09596c591b16259af9
BLAKE2b-256 checksum
How to use checksums
fb0ed3a94878b786f0ec43a7c56953bad1db48589f0255b6f547937bab5e5c12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / nolzss-1.2.3-cp38-cp38-macosx_11_0_arm64.whl

Download URL nolzss-1.2.3-cp38-cp38-macosx_11_0_arm64.whl
Size 428.8 kB
Tags CPython 3.8 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ad4da7a2d2fe67c0935e59a289027aa2506cf6a494e23296508734834ff96241
BLAKE2b-256 checksum
How to use checksums
9b469cdb5c9a93ccd8745f732cc0629d083d1893a4e0edd2200b986567cc7ba4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / nolzss-1.2.3-cp38-cp38-macosx_10_15_x86_64.whl

Download URL nolzss-1.2.3-cp38-cp38-macosx_10_15_x86_64.whl
Size 464.7 kB
Tags CPython 3.8 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
065311712abe7c78f6580a2a6fad40fcc47851f0cc8a44f7174232221b170540
BLAKE2b-256 checksum
How to use checksums
f07b3ee500f170eca69f3254c848741aba1120f084f803af1188bb32244d45cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for noLZSS 1.2.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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