Install any skill in seconds. Free to start, no credit card required.
Get Started Free →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.
.claude/skills/bio-proteomics-protein-inference/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-11 | ✗→✓ | ▲ Improved | — | — |
| case-03 | ✗→✓ | ▲ Improved | — | — |
| case-14 | ✗→✓ | ▲ Improved | — | — |
| case-13 | ✗→✓ | ▲ Improved | — | — |
| case-21 | ✗→✗ | = Same ✗ | — | — |
Reference examples tested with: pyOpenMS 3.1+
Before using code patterns, verify installed versions match. If versions differ:
pip show <package> then help(module.function) to check signaturespackageVersion("<pkg>") then ?function_name to verify parametersIf code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
"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.
pyopenms.ProteinInference() for parsimony-based groupingPeptides can map to multiple proteins (shared peptides), making protein identification ambiguous.
python# 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
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.
pythondef 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
pythondef 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
pythonfrom 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()
rlibrary(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)) })
pythondef 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']]
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 21 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +18 percentage points is the difference between those two pass rates over the 21 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.