proteomics/peptide-identification/SKILL.md
Peptide-spectrum matching and protein identification from MS/MS data. Use when identifying peptides from tandem mass spectra. Covers database searching, spectral library matching, and FDR estimation using target-decoy approaches.
npx skillsauth add GPTomics/bioSkills bio-proteomics-peptide-identificationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Reference examples tested with: MSnbase 2.28+
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.
"Identify peptides from my MS/MS spectra" -> Match tandem mass spectra against a protein database to identify peptide sequences, then control false discovery rate using target-decoy competition.
pyopenms for in-memory database search and PSM handlingcomet, MSFragger, X!Tandem for high-throughput database searchingMSnbase::readMSData() for importing search resultsGoal: Identify peptide sequences from tandem mass spectra by matching against a protein database.
Approach: Load a FASTA database, perform in-silico tryptic digestion to generate theoretical peptides, then match experimental spectra against theoretical fragment ion patterns to identify peptide-spectrum matches (PSMs).
from pyopenms import MSExperiment, MzMLFile, FASTAFile, ProteaseDigestion
from pyopenms import ModificationsDB, AASequence
# Load FASTA database
fasta_entries = []
FASTAFile().load('uniprot_human.fasta', fasta_entries)
# In-silico digestion
digestion = ProteaseDigestion()
digestion.setEnzyme('Trypsin')
digestion.setMissedCleavages(2)
peptides = []
for entry in fasta_entries:
seq = AASequence.fromString(entry.sequence)
result = []
digestion.digest(seq, result)
peptides.extend([(entry.identifier, str(p)) for p in result])
from pyopenms import IdXMLFile, ProteinIdentification, PeptideIdentification
protein_ids = []
peptide_ids = []
IdXMLFile().load('search_results.idXML', protein_ids, peptide_ids)
for pep_id in peptide_ids:
rt = pep_id.getRT()
mz = pep_id.getMZ()
for hit in pep_id.getHits():
sequence = hit.getSequence()
score = hit.getScore()
charge = hit.getCharge()
def calculate_fdr(scores, is_decoy, score_threshold):
above_threshold = scores >= score_threshold
n_target = ((~is_decoy) & above_threshold).sum()
n_decoy = (is_decoy & above_threshold).sum()
fdr = n_decoy / n_target if n_target > 0 else 1.0
return fdr
def find_score_at_fdr(scores, is_decoy, target_fdr=0.01):
sorted_scores = np.sort(scores)[::-1]
for threshold in sorted_scores:
fdr = calculate_fdr(scores, is_decoy, threshold)
if fdr <= target_fdr:
return threshold
return sorted_scores[-1]
library(MSnbase)
# Read mzIdentML results
psms <- readMzIdData('results.mzid')
# Filter to 1% FDR
psms_filtered <- psms[psms$qvalue <= 0.01, ]
# Unique peptides per protein
peptide_counts <- table(psms_filtered$accession)
from pyopenms import SpectraSTSearchAlgorithm, MSExperiment
# Load spectral library
library = MSExperiment()
MzMLFile().load('spectral_library.mzML', library)
# Match query spectra against library
# Returns similarity scores and library matches
development
Find restriction enzyme cut sites in DNA sequences using Biopython Bio.Restriction. Search with single enzymes, batches of enzymes, or commercially available enzyme sets. Returns cut positions for linear or circular DNA. Use when finding restriction enzyme cut sites in sequences.
development
Create restriction maps showing enzyme cut positions on DNA sequences using Biopython Bio.Restriction. Visualize cut sites, calculate distances between sites, and generate text or graphical maps. Use when creating or analyzing restriction maps.
development
Analyze restriction digest fragments using Biopython Bio.Restriction. Predict fragment sizes, get fragment sequences, simulate gel electrophoresis patterns, and perform double digests. Use when analyzing restriction digest fragment patterns.
development
Select restriction enzymes by criteria using Biopython Bio.Restriction. Find enzymes that cut once, don't cut, produce specific overhangs, are commercially available, or have compatible ends for cloning. Use when selecting restriction enzymes for cloning or analysis.