BI

bio-proteomics-protein-inference

Resolves protein identification ambiguity by grouping shared peptides and applying statistical inference models.

Install

mkdir -p .claude/skills/bio-proteomics-protein-inference && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/19504" && unzip -o skill.zip -d .claude/skills/bio-proteomics-protein-inference && rm skill.zip

Installs to .claude/skills/bio-proteomics-protein-inference

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Protein grouping and inference from peptide identifications. Use when resolving protein ambiguity from shared peptides. Handles protein groups and protein-level FDR control using parsimony and probabilistic approaches.
218 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Group peptide-spectrum matches into protein groups
  • Resolve shared-peptide ambiguity using parsimony
  • Calculate protein-level false discovery rates
  • Apply probabilistic protein inference methods

How it works

The skill builds a peptide-to-protein mapping and applies parsimony principles to select a minimal protein set that explains all observed peptides. It then groups proteins with identical evidence and calculates FDR based on group scores.

Inputs & outputs

You give it
idXML file containing peptide and protein identifications
You get back
List of protein groups with scores and FDR values

When to use bio-proteomics-protein-inference

  • Resolve shared-peptide protein ambiguity
  • Calculate protein-level false discovery rates
  • Group peptide-spectrum matches into proteins

About this skill

Version Compatibility

Reference examples tested with: pyOpenMS 3.1+

Before using code patterns, verify installed versions match. If versions differ:

  • Python: pip show <package> then help(module.function) to check signatures
  • R: packageVersion("<pkg>") then ?function_name to verify parameters

If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.

Protein Inference

"Resolve protein groups from my peptide identifications" → Group peptide-spectrum matches into protein groups, resolving shared-peptide ambiguity using parsimony or probabilistic methods, then apply protein-level FDR.

  • Python: pyopenms.ProteinInference() for parsimony-based grouping
  • R: Bioconductor protein inference workflows

The Protein Inference Problem

Peptides can map to multiple proteins (shared peptides), making protein identification ambiguous.

# Example: Peptide mapping
peptide_to_proteins = {
    'PEPTIDEK': ['P12345', 'P67890'],      # Shared between paralogs
    'UNIQUER': ['P12345'],                  # Unique to P12345
    'ANOTHERONE': ['P12345'],               # Unique to P12345
    'SHAREDK': ['P67890', 'P11111'],        # Shared
}

# P12345 has 2 unique peptides -> confident identification
# P67890 has 0 unique peptides -> subset, may be grouped with P12345

Parsimony Principle

Goal: Resolve protein identification ambiguity from shared peptides by finding the minimal protein set explaining all observed peptides.

Approach: Build a peptide-to-protein mapping, then greedily select proteins that cover the most unassigned peptides until all peptides are accounted for, producing a minimal explanatory protein list.

def apply_parsimony(peptide_protein_map):
    '''Find minimal set of proteins explaining all peptides'''
    proteins = set()
    for prots in peptide_protein_map.values():
        proteins.update(prots)

    protein_peptides = {p: set() for p in proteins}
    for pep, prots in peptide_protein_map.items():
        for p in prots:
            protein_peptides[p].add(pep)

    covered_peptides = set()
    selected_proteins = []

    # Greedy: select protein covering most uncovered peptides
    while covered_peptides != set(peptide_protein_map.keys()):
        best_protein = max(protein_peptides.keys(),
                          key=lambda p: len(protein_peptides[p] - covered_peptides))
        new_coverage = protein_peptides[best_protein] - covered_peptides
        if not new_coverage:
            break
        selected_proteins.append(best_protein)
        covered_peptides.update(new_coverage)

    return selected_proteins

Protein Groups

def create_protein_groups(peptide_protein_map):
    '''Group proteins with identical peptide evidence'''
    protein_peptides = {}
    for pep, prots in peptide_protein_map.items():
        for p in prots:
            protein_peptides.setdefault(p, set()).add(pep)

    # Group by peptide set
    peptide_set_to_proteins = {}
    for protein, peptides in protein_peptides.items():
        key = frozenset(peptides)
        peptide_set_to_proteins.setdefault(key, []).append(protein)

    groups = []
    for peptides, proteins in peptide_set_to_proteins.items():
        groups.append({
            'proteins': proteins,
            'peptides': list(peptides),
            'n_peptides': len(peptides),
            'is_group': len(proteins) > 1
        })

    return groups

pyOpenMS Protein Inference

from pyopenms import ProteinIdentification, PeptideIdentification
from pyopenms import BasicProteinInferenceAlgorithm

# Load identifications
protein_ids = []
peptide_ids = []
IdXMLFile().load('search_results.idXML', protein_ids, peptide_ids)

# Run inference
inference = BasicProteinInferenceAlgorithm()
inference.run(peptide_ids, protein_ids)

# Results include protein groups and scores
for protein_id in protein_ids:
    for hit in protein_id.getHits():
        accession = hit.getAccession()
        score = hit.getScore()

R: Protein Inference with ProteinInference

library(ProteinInference)

# From peptide-protein mapping
protein_groups <- infer_proteins(
    peptides = psm_data$peptide,
    proteins = psm_data$protein,
    method = 'parsimony'
)

# Count unique peptides per group
protein_groups$n_unique <- sapply(protein_groups$peptides, function(p) {
    sum(sapply(p, function(pep) length(peptide_to_protein[[pep]]) == 1))
})

Protein-Level FDR

def protein_fdr(protein_groups, target_fdr=0.01):
    '''Calculate protein-level FDR from group scores'''
    sorted_groups = sorted(protein_groups, key=lambda x: x['score'], reverse=True)

    target_count = 0
    decoy_count = 0

    for group in sorted_groups:
        if group['is_decoy']:
            decoy_count += 1
        else:
            target_count += 1
        group['fdr'] = decoy_count / target_count if target_count > 0 else 1.0

    # Q-value
    min_fdr = 1.0
    for group in reversed(sorted_groups):
        min_fdr = min(min_fdr, group['fdr'])
        group['qvalue'] = min_fdr

    return [g for g in sorted_groups if g['qvalue'] <= target_fdr and not g['is_decoy']]

Related Skills

  • peptide-identification - Input for protein inference
  • quantification - Quantify inferred proteins
  • database-access/uniprot-access - Protein annotations

When not to use it

  • When peptide identifications are missing
  • When protein-level FDR control is not required

Prerequisites

pyOpenMS 3.1+

Limitations

  • Requires pyOpenMS version 3.1 or higher
  • Depends on accurate peptide-to-protein mapping

How it compares

Unlike manual grouping, this skill automates the application of parsimony and probabilistic algorithms to resolve shared-peptide ambiguity systematically.

Compared to similar skills

bio-proteomics-protein-inference side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
bio-proteomics-protein-inference (this skill)04moNo flagsIntermediate
quant-analyst1032moNo flagsAdvanced
umap-learn61moReviewIntermediate
embedding-strategies82moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

quant-analyst

zenobi-us

Expert quantitative analyst specializing in financial modeling, algorithmic trading, and risk analytics. Masters statistical methods, derivatives pricing, and high-frequency trading with focus on mathematical rigor, performance optimization, and profitable strategy development.

103355

umap-learn

K-Dense-AI

UMAP dimensionality reduction. Fast nonlinear manifold learning for 2D/3D visualization, clustering preprocessing (HDBSCAN), supervised/parametric UMAP, for high-dimensional data.

6100

embedding-strategies

wshobson

Select and optimize embedding models for semantic search and RAG applications. Use when choosing embedding models, implementing chunking strategies, or optimizing embedding quality for specific domains.

890

building-automl-pipelines

jeremylongshore

Build automated machine learning pipelines, including feature engineering, model selection, and performance evaluation.

688

model-compare

rawwerks

Compare 3D CAD models using boolean operations (IoU, Dice, precision/recall). Use when evaluating generated models against gold references, diffing CAD revisions, or computing similarity metrics for ML training. Triggers on: model diff, compare models, IoU, intersection over union, model similarity, CAD comparison, STEP diff, 3D evaluation, gold reference, generated model, precision recall 3D.

783

matchms

davila7

Mass spectrometry analysis. Process mzML/MGF/MSP, spectral similarity (cosine, modified cosine), metadata harmonization, compound ID, for metabolomics and MS data processing.

674

Search skills

Search the agent skills registry