Skip to main content

Search tool for peptides and epitopes within a proteome, while considering potential residue substitutions.

Project description

PEPMatch Logo


Unit Tests

Author: Daniel Marrama

PEPMatch is a high-performance peptide search tool for finding short peptide sequences within a reference proteome. It handles three kinds of search out of the box: exact matches, mismatch (substitution) searches, and single-indel (insertion or deletion) matching. Powered by a Rust engine with Python bindings, it delivers sub-second search times across entire proteomes while maintaining a simple Python API.

Key Features

  • Blazing Fast: Rust-powered search engine with automatic multi-core parallelization via Rayon. Search thousands of peptides against the entire human proteome in seconds.
  • Unified Index Format: Single .pepidx binary format stores sequences, metadata, and k-mer index in one memory-mapped file. Preprocess once, search repeatedly.
  • Versatile Searching: Exact matches, mismatch (substitution) searches, single-indel (insertion/deletion) matching, best match mode, and discontinuous epitope support.
  • Counts-Only Mode: Get aggregate hit counts per peptide with O(unique queries) memory instead of O(hits) — built for massive query sets and dense reference matching.
  • Simple API: Two classes — Preprocessor and Matcher — handle everything.
  • Flexible I/O: Accepts queries from FASTA files, text files, or Python lists. Outputs to CSV, TSV, XLSX, JSON, or Polars DataFrame.

Requirements

Installation

pip install pepmatch

Quick Start

from pepmatch import Preprocessor, Matcher

# Preprocess a proteome (one-time step)
Preprocessor('human.fasta').preprocess(k=5)

# Search for exact matches
df = Matcher(
  query=['YLLDLHSYL', 'GLCTLVAML', 'FAKEPEPTIDE'],
  proteome_file='human.fasta',
  max_mismatches=0,
  k=5
).match()

print(df)

Preprocessing

Preprocessing builds a .pepidx index from your proteome FASTA file. This only needs to be done once per proteome and k-mer size. If a .pepidx file doesn't exist when you search, Matcher will create it automatically.

from pepmatch import Preprocessor

Preprocessor('human.fasta').preprocess(k=5)

CLI:

pepmatch-preprocess -p human.fasta -k 5

Flags

  • -p, --proteome (Required): Path to the proteome FASTA file.
  • -k, --kmer_size (Required): The k-mer size for indexing.
  • -n, --proteome_name: Custom name for the proteome.
  • -P, --preprocessed_files_path: Directory to save preprocessed files.

Matching

Exact Matching

from pepmatch import Matcher

df = Matcher(
  query='peptides.fasta',
  proteome_file='human.fasta',
  max_mismatches=0,
  k=5
).match()

Mismatch Searching

df = Matcher(
  query='neoepitopes.fasta',
  proteome_file='human.fasta',
  max_mismatches=3,
  k=3
).match()

Indel Searching

Search allowing insertions and deletions (indels) instead of substitution mismatches. The k-mer size is chosen automatically from your query lengths — no manual preprocessing needed.

df = Matcher(
  query='neoepitopes.fasta',
  proteome_file='human.fasta',
  max_indels=1
).match()

Each indel hit is annotated in an Indel Positions column with the edit type, residue, and 1-based query position — e.g. d: A[6] (deletion of A at query position 6) or i: X[6] (insertion of X before query position 6); an exact match reports []. In a repeat the exact position is ambiguous, so the inclusive range of all valid positions is reported, e.g. d: A[2,4].

Currently limited to max_indels=1; mutually exclusive with max_mismatches.

Best Match

Automatically finds the optimal match for each peptide by trying different k-mer sizes and mismatch thresholds. No manual preprocessing required.

df = Matcher(
  query='peptides.fasta',
  proteome_file='human.fasta',
  best_match=True
).match()

Discontinuous Epitope Searching

Search for non-contiguous residues defined by their positions.

df = Matcher(
  query=[
    "R377, Q408, Q432, H433, F436",
    "S2760, V2763, E2773, D2805, T2819"
  ],
  proteome_file='sars-cov-2.fasta',
  max_mismatches=1
).match()

Mixed Queries

Linear peptides and discontinuous epitopes can be searched together.

df = Matcher(
  query=[
    'YLLDLHSYL',
    'R377, Q408, Q432, H433, F436',
    'GLCTLVAML',
  ],
  proteome_file='sars-cov-2.fasta',
  max_mismatches=0
).match()

Counts-Only Mode

For large query sets where you only need how many times each peptide matches — not the full per-hit table — set counts_only=True. PEPMatch tallies hits per (peptide, mismatch level) directly, without reconstructing matched sequences, pulling metadata, or building per-hit rows. Memory scales with the number of unique queries, not the number of hits, so it stays bounded even when matching is extremely dense (e.g. searching a proteome against itself).

df = Matcher(
  query='peptides.fasta',
  proteome_file='human.fasta',
  max_mismatches=2,
  k=3,
  counts_only=True
).match()

Returns columns Query ID, Query Sequence, Mismatches, and Count — one row per peptide per mismatch level that has at least one hit. Honors output_format; not supported with best_match.

Query Input Formats

  • Python list: ['YLLDLHSYL', 'GLCTLVAML']
  • FASTA file: .fasta, .fas, .fa, .fna, .ffn, .faa, .mpfa, .frn
  • Text file: .txt with one peptide per line

CLI:

pepmatch-match -q peptides.fasta -p human.fasta -m 0 -k 5

Flags

  • -q, --query (Required): Path to the query file.
  • -p, --proteome_file (Required): Path to the proteome FASTA file.
  • -m, --max_mismatches: Maximum mismatches allowed (default: 0).
  • -i, --max_indels: Maximum indels allowed (default: 0). Currently limited to 1, and mutually exclusive with -m.
  • -k, --kmer_size: K-mer size (default: 5).
  • -P, --preprocessed_files_path: Directory containing preprocessed files.
  • -b, --best_match: Enable best match mode.
  • -f, --output_format: Output format — csv, tsv, xlsx, json (default: csv).
  • -o, --output_name: Output file name (without extension).
  • -v, --sequence_version: Disable sequence versioning on protein IDs.

Output Formats

  • dataframe / polars (default for API): Returns a Polars DataFrame. dataframe is kept as a backward-compatible alias for polars.
  • pandas: Returns a pandas DataFrame (converts the Polars result via .to_pandas()). Requires the optional extra: pip install 'pepmatch[pandas]'.
  • csv (default for CLI): CSV file.
  • tsv: Tab-separated file.
  • xlsx: Excel file.
  • json: JSON file.
# Polars (default) — same as output_format='dataframe'
df = Matcher(query='peptides.fasta', proteome_file='human.fasta', output_format='polars').match()

# pandas
df = Matcher(query='peptides.fasta', proteome_file='human.fasta', output_format='pandas').match()

Performance

Benchmarked searching ~2,000 peptides against the human proteome (~200,000 proteins):

Mode Time
Exact match (k=5) ~0.06s
1 mismatch (k=3) ~1.5s
2 mismatches (k=3) ~1.9s
3 mismatches (k=3) ~3.7s

Citation

If you use PEPMatch in your research, please cite:

Marrama D, Chronister WD, Westernberg L, et al. PEPMatch: a tool to identify short peptide sequence matches in large sets of proteins. BMC Bioinformatics. 2023;24(1):485. Published 2023 Dec 18. doi:10.1186/s12859-023-05606-4

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

pepmatch-1.17.1.tar.gz (54.5 kB view details)

Uploaded Source

Built Distributions

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

pepmatch-1.17.1-cp313-cp313-win_amd64.whl (291.8 kB view details)

Uploaded CPython 3.13Windows x86-64

pepmatch-1.17.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (410.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pepmatch-1.17.1-cp313-cp313-macosx_11_0_arm64.whl (370.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pepmatch-1.17.1-cp312-cp312-win_amd64.whl (291.7 kB view details)

Uploaded CPython 3.12Windows x86-64

pepmatch-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (410.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pepmatch-1.17.1-cp312-cp312-macosx_11_0_arm64.whl (370.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pepmatch-1.17.1-cp311-cp311-win_amd64.whl (292.1 kB view details)

Uploaded CPython 3.11Windows x86-64

pepmatch-1.17.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (410.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pepmatch-1.17.1-cp311-cp311-macosx_11_0_arm64.whl (373.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pepmatch-1.17.1-cp310-cp310-win_amd64.whl (292.2 kB view details)

Uploaded CPython 3.10Windows x86-64

pepmatch-1.17.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (410.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pepmatch-1.17.1-cp310-cp310-macosx_11_0_arm64.whl (373.3 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file pepmatch-1.17.1.tar.gz.

File metadata

  • Download URL: pepmatch-1.17.1.tar.gz
  • Upload date:
  • Size: 54.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pepmatch-1.17.1.tar.gz
Algorithm Hash digest
SHA256 bea225972dc56bc9a9adbd9aeb969ff9f45af2c9cc9e8f4c3658e94a321d0452
MD5 a254fad58be75d94ec654b5d7b00c129
BLAKE2b-256 8951427093249ab64d1ebeefa03570844bb4411a91b17b77665b2de20c6f16f3

See more details on using hashes here.

File details

Details for the file pepmatch-1.17.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pepmatch-1.17.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 291.8 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pepmatch-1.17.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e834e95f68ba817068b7e18166a753f09de3dc28a00f49a3df79e9ca423bf7ec
MD5 b2daf0aad31c29b6262f963ba7d39ccf
BLAKE2b-256 8f5532bcab8ebaf0c58e884c900e4bcbadc066c4a8e8fe5d6ca3f4a8140f6651

See more details on using hashes here.

File details

Details for the file pepmatch-1.17.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pepmatch-1.17.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 01f4db9853db62da093569bce48865d145dd8b2f3b63d6e946ec76f614e3c1ef
MD5 bfc0c3525b6ffd40416ef498101770b0
BLAKE2b-256 02dd9e59d6674c22668cf48508c8f745b7d08a6022baf2097cf978cfb1e450ad

See more details on using hashes here.

File details

Details for the file pepmatch-1.17.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pepmatch-1.17.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ea159e73971b4185257025b5aad0785ee860c0d5dea83976666e86a49d4f69e2
MD5 8badb694f1b00f553542a580e0328d7e
BLAKE2b-256 e954ac1457da7800e185e3b06ee2ae540586297eee2ac3555cc741a22a9c18aa

See more details on using hashes here.

File details

Details for the file pepmatch-1.17.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pepmatch-1.17.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 291.7 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pepmatch-1.17.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8c0e501e130c9f5077b58198940052d2fbf53eb26ff51ce954615788146e1b7b
MD5 72b178659806f684f0ffb74c69f7b82b
BLAKE2b-256 12f413c7046c8bf56dcdd3a77879a552b4f7da8565f57117b1b3f5f4d8c6d37d

See more details on using hashes here.

File details

Details for the file pepmatch-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pepmatch-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eefcc656967025a99701248721dc93f83306b95259bf6c314da9fdb365d9ae72
MD5 b544496b65f6cd96243d34ef15e38f35
BLAKE2b-256 ce7b126bfaa0a3a72b688a81b5ef3fb65571a3aa0776dc792bafe43aed761085

See more details on using hashes here.

File details

Details for the file pepmatch-1.17.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pepmatch-1.17.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ba25fa9787884767b8e4b359ccb36f7b1d25aff9ee286e888bc9fecdf79781dc
MD5 138bc5797e5fc4f077a39ad402a16b85
BLAKE2b-256 38b4e0cf52678a2c60b2eda1c0d3aaa26259c79fedda7a43b872f330d64f214a

See more details on using hashes here.

File details

Details for the file pepmatch-1.17.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pepmatch-1.17.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 292.1 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pepmatch-1.17.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 39d8170ca4d0c06a7219ab6460d144e419b0ef76199841c4d078c84dcaab1fd2
MD5 5d740b5dc58701a3407aef09cdb54935
BLAKE2b-256 b90f0ddca63c04eb09a13644d657acecb03336dc782b998839009f3e1ba8ad2c

See more details on using hashes here.

File details

Details for the file pepmatch-1.17.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pepmatch-1.17.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f6f5748db04de78cf1c75b19ffab017ec2329b8848f1e3744ed4d510a5fcbba4
MD5 bddc64145c94c7171c343a171f94f13d
BLAKE2b-256 be471e0463d4c00aa15580974418abd552e8cc64675b6b3a7cafa5e48e887cee

See more details on using hashes here.

File details

Details for the file pepmatch-1.17.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pepmatch-1.17.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6edcb36cba22bd8cd0658d017b5be34f0bf3252d3bfd78858920d735f5f20ccb
MD5 96ebb74563ee325ded9055ed6129ba73
BLAKE2b-256 eff77eef036ad25e208c62b4b34535a213be30faffd74df41bcab932177f3c9a

See more details on using hashes here.

File details

Details for the file pepmatch-1.17.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pepmatch-1.17.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 292.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pepmatch-1.17.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3c649a304169f240244ab9d13c83f00018efa2a82046705e668d5e1d04f0f4b4
MD5 4a56a6d6806b49ec7b1da8da95c73645
BLAKE2b-256 270e3d70b0b7ea9d31a7d5b1852403eb7b30364df2a2a995a3c1b4c5676a8019

See more details on using hashes here.

File details

Details for the file pepmatch-1.17.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pepmatch-1.17.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8866a56020a1220aaf91346c3f070c48d4620568d11333de9797fbdb1721c7eb
MD5 775e8e4a54c2054cf5b16107627b7a4c
BLAKE2b-256 4bd34e69b08578b9ed71d5874acd4358b1b994712e8e978f5d4a7bf51815205f

See more details on using hashes here.

File details

Details for the file pepmatch-1.17.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pepmatch-1.17.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2ff35d90b62a7c22c0340a4c62e486ac73eab62c5cbe3911e0808b67d149139c
MD5 17f96a8bbca723ec9aab16a3b44d2a01
BLAKE2b-256 e18bcd96d975ca9fe057fb86923327e85925b8a8fa0e72b0fd9fc405c1ae55f6

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