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 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, 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]. When two edits fall at one site they are reported as a single chunk (d: YA[2]); when they fall apart they are reported separately (d: C[3], d: E[5]).

Supports max_indels=1 and max_indels=2; mutually exclusive with max_mismatches. At max_indels=2 the search is homogeneous — a match may use two insertions or two deletions, but never one of each (a mixed pair is a substitution, which mismatch search already covers). The two edits need not be adjacent.

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). Supports 1 or 2, and mutually exclusive with -m. At 2, a match uses two insertions or two deletions, never one of each.
  • -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.2.tar.gz (71.7 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.2-cp313-cp313-win_amd64.whl (312.0 kB view details)

Uploaded CPython 3.13Windows x86-64

pepmatch-1.17.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (428.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pepmatch-1.17.2-cp313-cp313-macosx_11_0_arm64.whl (390.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pepmatch-1.17.2-cp312-cp312-win_amd64.whl (311.9 kB view details)

Uploaded CPython 3.12Windows x86-64

pepmatch-1.17.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (428.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pepmatch-1.17.2-cp312-cp312-macosx_11_0_arm64.whl (391.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pepmatch-1.17.2-cp311-cp311-win_amd64.whl (312.4 kB view details)

Uploaded CPython 3.11Windows x86-64

pepmatch-1.17.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (429.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pepmatch-1.17.2-cp311-cp311-macosx_11_0_arm64.whl (392.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pepmatch-1.17.2-cp310-cp310-win_amd64.whl (312.5 kB view details)

Uploaded CPython 3.10Windows x86-64

pepmatch-1.17.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (429.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pepmatch-1.17.2-cp310-cp310-macosx_11_0_arm64.whl (392.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for pepmatch-1.17.2.tar.gz
Algorithm Hash digest
SHA256 b2eee8d6f0042935da1e91e32134dc01390c6a1a8598e99d301d7cededabbe8d
MD5 f59c6cc94b4e9e579867c7d6ab5ff782
BLAKE2b-256 132751d0c557a8e696feb163833e1c93a94a579b71208a823f6060c2988d9011

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pepmatch-1.17.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 48335178047870035d2c96d64e9341d5aeaa3198cae88178b586ccdd48c88af3
MD5 0154c642a155f76efcf3c21fcc582628
BLAKE2b-256 41a21efa7869c0b6dfd733d0222b37d32d564cd44f598a9dc1dc2db1149c86ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pepmatch-1.17.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2dd1d68176c3adb24af929f68e03e02f3c2b5980b5e2adf8362499a0bd6a23bf
MD5 90dca585c7414a1294c7a3c2767c3d46
BLAKE2b-256 8a0fd22cf626ca15d82fe7257d184d056d681b4aa9e9f700a06069f97808fe6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pepmatch-1.17.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c11fd5137650681fdebca9b0d6471e8e42b7ff1951144db6d8acf6a57d4961db
MD5 e4204ddf7276af06fae6472186f5fb20
BLAKE2b-256 7181f6cbe776bc39fcc2a54e2733bc05a976e76d39c7d7575683d0a63567c259

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pepmatch-1.17.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b3c750a50c011ee762509215d641bd5fc762579ed649074b75dc73c4a2d3fa13
MD5 67e6af66069d69059fa4df6da66f76b9
BLAKE2b-256 495a02b888ce08aff8f5a7608a21b8b94bb2820f6da490f8c7bd5b166216139f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pepmatch-1.17.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 25a041d5d4313cd60f421e38df349d89a823017d4d6e30ff7ac84651af5e4e09
MD5 aa57481653f816f7259aa41d90315ac4
BLAKE2b-256 f84bdddb87ff269a618df8272d853a76549a034cb4e81f430235cd6415872b5f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pepmatch-1.17.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 685683bd1f6c931219f3e2c129ffa204177d0c904570a043b39058879ecb593e
MD5 3f1044b2afcd675acf48013ce3ca8063
BLAKE2b-256 1b7b4de173f4e3a3035c98119602f1e4f40f6c4f1e3e49ba867bf39791cbb698

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pepmatch-1.17.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 da10ca2f9b75284ce6b5d156250426234c8d6f574ee215dbda0dc1ff0a9306b3
MD5 0f058d72153c88a20faceb219d758a6f
BLAKE2b-256 c6cd3bb6ce12ec80f9256288a3e8abdace4c8d13ae4f245d016a2f89b54bb5bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pepmatch-1.17.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 36184843ce9d314688bd6f33ea2316edcf92b78ddff54cc536a700fa7dfac043
MD5 8203bde4bc2f2c42c3510e02f5fa04f3
BLAKE2b-256 fd1920b59ee01280422dde4feeb27490973c7d3fc6eeb9d058ce5ba4f14b5acd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pepmatch-1.17.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 29e4732ed43470869675fef1e93de3f26c2fe916c747847e171a93a70cfa9dd0
MD5 d7000a21d3c5d539a321562531c6d5f0
BLAKE2b-256 78f0b523ec4c7d41019fb2c8d18f3486672eb495b5604d46d0fb1ab30d7d39a6

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pepmatch-1.17.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f2bf2579d6f98c1fc240ee876ad8a7e2c6a3923b0fd05b934974297ff0bc5719
MD5 cf231deb499f38d5278875ba5eeac7c2
BLAKE2b-256 9948e7aa68592d9af5be3cb4890d63400216c57cbf5e8e9fe871d48fd0ce992a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pepmatch-1.17.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 34e708bacff2db85e587a5638fea2740ad73a818676914e319dedc40125c8d51
MD5 18a1da3702f6f47608adedd5f32b2cd6
BLAKE2b-256 58803b6560e298bc960efa78224ac26110fc451d8e99e5a41485891272816ef6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pepmatch-1.17.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3668ba852a152924b53f25da910d54f3a42f28c06701db3573cdf8d641de528f
MD5 f0e25796ca812d25199f7ae8adbcf2fc
BLAKE2b-256 17f71775ea615e0959112df1f0aa34b197b8c68cce62cee09d30cc1955c8c099

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