Skip to main content

PepLocus

Map mass-spectrometry peptides directly to eukaryotic genome assemblies, including splice-junction peptides. PepLocus searches all six reading frames, always treats I/L as equivalent, and can use GTF/GFF annotations or RNA-seq BAM evidence.

PepLocus overview

Install

pip install peplocus

Run

Map a peptide list to an assembly:

peplocus -a assembly.fa -p peptides.tsv --out results

Add annotation and/or RNA-seq evidence to find splice-junction placements:

peplocus -a assembly.fa -p peptides.tsv -g models.gtf -b rnaseq.bam --out results_spliced

-g accepts GTF or GFF. Either -g or -b can be used alone. A BAM index is not required.

Optional one-edit rescue searches peptides with no exact match for one amino-acid substitution, insertion or deletion:

peplocus -a assembly.fa -p peptides.tsv -g models.gtf --one-edit --out results_rescue

The default is 8 workers (--threads). Rescue uses a minimum query length of 9 aa; short candidates can be highly ambiguous. Use --min-rescue-length 12 for a more conservative search. --discover-junctions optionally searches for bounded canonical single-intron matches without supplied evidence.

Peptides can be a plain list, FASTA, CSV or TSV; FragPipe's Peptide Sequence column is recognised automatically. Assembly FASTA may be plain or gzip-compressed. Use a fresh output directory for each run.

peplocus -h

Results

File Contents
all_mappings.bed Exact and I/L-equivalent placements
tryptic_mappings.bed Placements with compatible tryptic or possible protein-terminal contexts
mappings.tsv Coordinates, sequences, evidence, cleavage contexts and mapping counts
peptides.tsv Per-peptide exact and rescue counts and status
unmapped.tsv Peptides with no exact match, including labeled rescue candidates
summary.json Parameters, counts, timings and search limits

BED files use standard BED12 coordinates, with peptide names in biological N-to-C orientation on both strands. Rescue candidates are kept separately in rescue/, with their own all/tryptic BED files and detailed TSV. A reusable junctions.tsv is also saved when splice evidence is supplied.

Contiguous matching is exhaustive for the chosen translation table. Splice mapping depends on available junctions and search limits. Placements show sequence compatibility; one-edit candidates are not confirmed variants, and tryptic compatibility alone does not establish biological origin.

Report an issue · MIT license

Optional adjacent-swap rescue (0.6.0)

--swap searches for one exchange of two neighbouring amino acids, for example PEPTDIE against a translated PEPTIDE. It is opt-in. The default minimum query length is 9 aa, shared with one-edit rescue.

# Adjacent swaps only
peplocus -a assembly.fa -p peptides.tsv -g models.gtf --swap --out swap_results

# Substitution/insertion/deletion rescue only
peplocus -a assembly.fa -p peptides.tsv -g models.gtf --one-edit --out edit_results

# Both methods, sharing target translation and splice traversal
peplocus -a assembly.fa -p peptides.tsv -g models.gtf --one-edit --swap --out combined_results

# More conservative length cutoff for either enabled rescue method
peplocus -a assembly.fa -p peptides.tsv --swap --min-rescue-length 12 --out longer_results

--rescue-one-edit remains an alias for --one-edit. Neither flag is enabled by default. The Python API accepts swap=True and one_edit=True; rescue_one_edit=True remains supported.

Eligibility and search scope

All exact stages finish first. A query with any exact/I/L-equivalent placement, even a nontryptic one, is excluded from both rescue methods. The query must also pass --min-rescue-length (default 9). Swapping identical residues, including I/L-equivalent pairs, is an exact match, not a swap event.

With both flags enabled, each eligible query is searched by both methods. A one-edit candidate does not suppress a swap candidate elsewhere. The results are the union of their distinct genomic placements. Each alignment contains one substitution, one insertion, one deletion, or one adjacent swap; a swap plus another edit is not allowed. Existing exact results do not change.

Rescue covers the six contiguous reading frames and the bounded splice paths supplied by GTF/GFF, BAM or reusable junction tables. It can span an exon junction or a split codon on either strand. It does not discover a new splice junction through an approximate match. Existing splice-path caps still apply. There are no additional swap seed, candidate or location caps, and all qualifying placements are reported rather than selecting a preferred hit.

Mixed search algorithm

PepLocus builds one reusable swap index for the eligible query set:

  • Below 12 aa: generate every distinct full-length adjacent-swap variant and search them together with the C-backed Aho–Corasick matcher. A query of length L contributes at most L−1 nontrivial variants.
  • At least 12 aa: use two exact anchors separated by one unused residue. For a query of length L, let m = floor((L−1)/2); the anchors are query[:m] and query[m+1:]. An adjacent pair cannot overlap both anchors across that gap, so at least one anchor survives every allowed swap. Fixed anchor offsets identify candidate starts, and the complete query is verified.

The 12-aa switch is an internal implementation choice, not the minimum rescue length. It avoids short-anchor candidate explosions while reducing index memory for longer queries. The search verifies exactly two adjacent differences with exchanged residues and rejects exact matches, ambiguous translated residues, nonadjacent changes and additional edits. Matches never cross a stop or unresolved codon. Both strategies are complete for a single adjacent swap within the searched target sequences; chunk ownership and location deduplication prevent repeated records at overlapping chunk edges.

When --one-edit and --swap are combined, one rescue stage shares translated targets, eligible queries, worker processes, splice paths and the output store. The two operation indexes are scanned separately within that traversal. The existing one-edit anchor search is unchanged when swap rescue is disabled.

Outputs and alignment convention

No new top-level output family is added. All approximate candidates stay in rescue/all_mappings.bed, rescue/tryptic_mappings.bed and rescue/mappings.tsv. Root peptides.tsv and unmapped.tsv retain the exact status and summarize the combined rescue multiplicity. Ambiguity is counted across all enabled rescue methods, separately for all and tryptic tracks. The default coordinate-verification step re-extracts and translates every reported target and validates its operation against the query.

A swap row has:

  • match_type and edit_type: adjacent_transposition;
  • edit_distance: 2, using ordinary Levenshtein distance after I/L normalization; this is one transposition under the Damerau convention;
  • edit_query_position: the 1-based position of the first swapped residue;
  • query_aa and reference_aa: the two residues in query and target order;
  • alignment_cigar: two substitutions (2X), with I/L-equivalent exact flanks as applicable;
  • edit_position_min and edit_position_max: that same first position.

One-edit rows retain match_type=one_edit, distance 1 and the existing substitution/insertion/deletion fields. Coordinates always cover the translated reference bases. In summary.json, runs using swaps have an approximate_rescue stage with enabled operations, counters, timings and separate all/tryptic counts; one-edit-only runs retain the one_edit_rescue stage for compatibility.

Digestion and interpretation

Query and reference cleavage contexts are classified separately. A swap near a peptide end can create or remove a K/R cleavage site or change the proline exception. The tryptic rescue subset uses the query in the actual reference flanks; reference compatibility and cleavage changes remain explicit in the mapping table. A reference-side change does not silently discard a candidate. Internal missed cleavages are not capped. Methionine-based contexts indicate plausibility, not a proven translation start.

A swap match establishes sequence compatibility, not a confirmed sequencing error, DNA variant or gene-model correction. Short and low-complexity queries can match by chance. The 9-aa default favors sensitivity; a 12-aa cutoff is more conservative. Keep rescue candidates separate when estimating exact coverage, identification error or independent support for annotations.

Temporary storage

Private exact/rescue SQLite databases use SLURM_TMPDIR when set, otherwise Python's temporary directory (TMPDIR or the system default). This keeps random database I/O off a shared output filesystem. On a cluster, point these variables to node-local scratch with sufficient space for the match store. Verified outputs are still published to --out, and temporary databases are removed when the run closes. No database is written beside the source inputs.

Metadata

Release files for peplocus 0.6.0

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

Source distribution (sdist)

Source distribution for peplocus 0.6.0
File Size Uploaded Provenance Actions
peplocus-0.6.0.tar.gz 42.2 kB Without provenance Details for peplocus-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for peplocus 0.6.0
File Interpreter ABI Platform Actions
peplocus-0.6.0-py3-none-any.whl Python 3 none any Details for peplocus-0.6.0-py3-none-any.whl

Total release size: 85.3 kB

Release files / peplocus-0.6.0.tar.gz

Download URL peplocus-0.6.0.tar.gz
Size 42.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5e62170699443cd67632d6a3367c42163191dbe4bf7bea7793dc4642cdae23ca
BLAKE2b-256 checksum
How to use checksums
1728d0329129b557e5dbfcd383884dc7077777297429b2a4819640f2b991703e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.15

Release files / peplocus-0.6.0-py3-none-any.whl

Download URL peplocus-0.6.0-py3-none-any.whl
Size 43.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c23f065d6efd28c295418933956007c156694fc374d9aefe7138f36af9557bba
BLAKE2b-256 checksum
How to use checksums
c2f66a80c7d00a05a91d64299bf4eb0fd80cc3c757dbaf4a8b33528baea86418
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.15

Security for peplocus 0.6.0

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