Skip to content

Implement new private_api/taxa/shared_peptides endpoint#100

Closed
pverscha wants to merge 5 commits into
developfrom
worktree-feature-shared-peptides
Closed

Implement new private_api/taxa/shared_peptides endpoint#100
pverscha wants to merge 5 commits into
developfrom
worktree-feature-shared-peptides

Conversation

@pverscha

@pverscha pverscha commented Jun 5, 2026

Copy link
Copy Markdown
Member

Add private_api/taxa/shared_peptides endpoint

shared_peptides

New endpoint POST /private_api/taxa/shared_peptides that accepts a list of taxon IDs at species or strain level, digests all proteins for each taxon, and returns the intersection — peptides present in every taxon after digestion. No index lookup is performed; the result is a pure set intersection across the digested proteomes. Protein retrieval for all taxa runs concurrently.

Parameters

  • taxon_ids — list of taxon IDs; each must be at species or strain rank (400 otherwise)
  • cleavage_regex — regex defining cleavage sites (default: [KR](?!P), tryptic digestion)
  • min_length — minimum peptide length to retain (default: 5)

Response

{
  "shared_peptides": ["PEPTIDE", ...]
}

Supporting changes

  • database::get_proteins_for_taxon — new function that retrieves all UniprotEntry records for a given taxon ID using search_after pagination, handling taxa with more than 10,000
    proteins correctly.
  • TaxonStore::get_rank — new accessor following the existing get_name pattern.
  • api/src/helpers/digestion — shared module for cleave_sequence, compile_cleavage_regex, validate_taxon_rank, and serde defaults; placed in helpers/ alongside lca_helper,
    ec_helper, etc. to keep controller files free of domain logic.
  • ApiError::InvalidRegexError — new error variant (HTTP 400) for invalid cleavage regex strings, distinct from the existing UnknownRankError.
  • fancy-regex — added as a dependency to support lookahead assertions in cleavage patterns (e.g. (?!P)).

@pverscha pverscha added the enhancement New feature or request label Jun 6, 2026
@pverscha

Copy link
Copy Markdown
Member Author

Merged with #101

@pverscha pverscha closed this Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant