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()

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 (default for API): Returns a Polars DataFrame.
  • csv (default for CLI): CSV file.
  • tsv: Tab-separated file.
  • xlsx: Excel file.
  • json: JSON file.

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.0.tar.gz (48.0 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.0-cp313-cp313-win_amd64.whl (283.8 kB view details)

Uploaded CPython 3.13Windows x86-64

pepmatch-1.17.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (403.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pepmatch-1.17.0-cp313-cp313-macosx_11_0_arm64.whl (365.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pepmatch-1.17.0-cp312-cp312-win_amd64.whl (283.9 kB view details)

Uploaded CPython 3.12Windows x86-64

pepmatch-1.17.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (403.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pepmatch-1.17.0-cp312-cp312-macosx_11_0_arm64.whl (365.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pepmatch-1.17.0-cp311-cp311-win_amd64.whl (284.1 kB view details)

Uploaded CPython 3.11Windows x86-64

pepmatch-1.17.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (403.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pepmatch-1.17.0-cp311-cp311-macosx_11_0_arm64.whl (367.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pepmatch-1.17.0-cp310-cp310-win_amd64.whl (284.4 kB view details)

Uploaded CPython 3.10Windows x86-64

pepmatch-1.17.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (403.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pepmatch-1.17.0-cp310-cp310-macosx_11_0_arm64.whl (368.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for pepmatch-1.17.0.tar.gz
Algorithm Hash digest
SHA256 d949ada06b95a08e1e0a03993008baa1d7e573117658955ca8d67e668d57b717
MD5 9da26a586270b0d0a6933e13325b7289
BLAKE2b-256 7ceb4fb94f33bcff1e9a75ccb458e33eadaa9374003896ba22c1a6c3575f7f4f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pepmatch-1.17.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 715e5f7fd69eb6e87707c027d51161e94faf5db47f589a525f92328ba9c1eba6
MD5 9310c091dc088e4e6e87e7fa665420c7
BLAKE2b-256 c10e804f94bc9f4848c8fadbd6a2c17ba76ff415cb4f85487f2ddef351f4f261

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pepmatch-1.17.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cdf2124d96f6c602c97a94fab2aa3f42b4c69549b8a9cd9ed3017df7873b5568
MD5 8b9451919b63b7be06cd929d361887ba
BLAKE2b-256 040c1a8652e722302ed78d8e8b41a957510b542c37ecc48b9cf6589eb2250016

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pepmatch-1.17.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ea20522b4ccf2edd2786b52bc9ce347ae6456a56aeb2c465bd23b0d0e0130ab2
MD5 cc19da708775f884b433058e59fb985d
BLAKE2b-256 cbeced03b5e78f070ab68bb832570144969e21ebe5f423b91874c417ab238b84

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pepmatch-1.17.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e27eeb89381dcb62fe50f490cdfd80b7e900ab3192aad8f573700022ac0aa056
MD5 6f9225a898df479413971827b66cb7d1
BLAKE2b-256 87f858a5740986e83a1149913c09681b966533aab9d688eef57e45df6581a045

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pepmatch-1.17.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e1922b6f8f55d6662d66a68998dc7ee4a8d874c2234afe272081edbefacd2fac
MD5 b50d02e2f25eb7c15a65c6c619911322
BLAKE2b-256 7413875de0818279f99bbc3dc90002c4f0bf73fbcba88ce645cef42de733c7c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pepmatch-1.17.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d9a4d73bb386b278aa61c5121741fa62216d3fd89327fd8dc1ce3ed8b2519fc1
MD5 5cbddac9a67a3d7755bef1632e84f7a8
BLAKE2b-256 9d379363c50dc94b5d78e383e9afc38c4eea8c0154b3f6b178561a8d10a2fd57

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pepmatch-1.17.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 30f258c1a4b18249c3f58344deb3e570ff7419ed5a60302e6e86550a5fb8bf12
MD5 92b2123eabab72081f184b8e65884e83
BLAKE2b-256 9371b1e098c1476d4aea3240c2ff447e412bd2c804836b132bcbdef04ced4c1c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pepmatch-1.17.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 654367760c698ec498c66691e853e90fa4497b270a905ae26aa710e8108997d7
MD5 e1353abf4e37cfa66748ebe9708815ec
BLAKE2b-256 b0a983523d2c9b8feea7e07c22a864b8b4fab3506f64974dac0d442940783c2d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pepmatch-1.17.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5f34a69871efe850964042c4b0d016d0c64e97dee2eac985a37006f610a22886
MD5 fd7ee1f675cb41687e25225aa8ca2abc
BLAKE2b-256 72356c7251a36852f960ee2645eb3589f825bc895355acb53a90e152e099df97

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pepmatch-1.17.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 10b720ac6a22d4794f607398e0fbe279da497aae0f4e5afc4b9244b24dbd8d23
MD5 af2230550e29512f4ca754466474f237
BLAKE2b-256 b30a18791ab09c165b75682dae812115373fb7ed743bac064377d215c389a6af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pepmatch-1.17.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 47b962a3e85822bcf946ccd30be64587e23ca4d606cda913da02a43a1118893d
MD5 d2d4b3b9c1dbacfbcb95507738d2bac5
BLAKE2b-256 ff0447c7db5c2168cbb20c91451fdb0b72f1975a7f49d8a74768e38dde2c994e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pepmatch-1.17.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 224661ea67bd98bf614ee641dfbb6f55b2993394fb42fed9a536405460a63420
MD5 62cc84f27fd52ada25fab3ddd0e2892a
BLAKE2b-256 27168884765d508069814630ddb66a77fe5968a1217b89716a021cc1af86ed05

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