systems-biology/strain-design/SKILL.md
Computes metabolic-engineering strain designs on genome-scale models with StrainDesign (OptKnock, RobustKnock, minimal cut sets, OptCouple) and cameo (heuristic knockout and FSEOF over/under-expression targets), finding gene/reaction interventions that couple product formation to growth. Use when designing knockouts to overproduce a target chemical, choosing between OptKnock and RobustKnock, growth-coupling a product so evolution maintains it, computing minimal cut sets, finding amplification targets with FSEOF, or understanding why MILP strain design needs a strong solver and why a design is only a hypothesis.
npx skillsauth add GPTomics/bioSkills bio-systems-biology-strain-designInstall 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: StrainDesign 1.15+, COBRApy 0.29+, Python 3.10+ (cameo optional)
Before using code patterns, verify installed versions match. If versions differ:
pip show <package> then help(module.function) to check signaturesIf code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
Note: OptKnock/RobustKnock/MCS are MILP problems and are far harder than plain FBA; StrainDesign supports GLPK/SCIP (open source) and CPLEX/Gurobi (academic, much faster and more robust for genome-scale). Set a time_limit. Reaction-based designs must be translated back to gene knockouts via GPRs.
"Design knockouts to make my organism overproduce a chemical" -> Search for a set of gene/reaction interventions that couples product formation to growth, so the engineered strain cannot grow well without secreting the target.
straindesign.compute_strain_designs(model, sd_modules=[SDModule(model, OPTKNOCK, ...)]); cameo for heuristics/FSEOFThe core idea of computational strain design is growth-coupling. A naive "just delete the competing pathways" design is fragile: the cell will find an alternate flux route, or evolution in the bioreactor will erode production because making product costs the cell resources. A growth-COUPLED design instead makes product secretion obligatory for growth - the cell physically cannot reach high growth without also secreting the target, so selection maintains production instead of eroding it. This is why OptKnock is a BILEVEL optimization: the inner problem is the cell maximizing its own growth, the outer problem is the engineer maximizing product AT that inner optimum. Consequences:
max_cost), cap solutions, set a time limit, and use a strong solver (CPLEX/Gurobi for genome-scale). Reaction knockouts must be mapped back to gene deletions through the GPR to be realizable.| Goal | Method | Trade-off | |------|--------|-----------| | Growth-coupled knockouts, optimistic | OptKnock (Burgard 2003) | bilevel; assumes the cell cooperates at its growth optimum | | Growth-coupled knockouts, conservative | RobustKnock (Tepper & Shlomi 2010) | guarantees product in the worst-case inner optimum; harder | | Guaranteed intervention sets, enumerate all minimal | Minimal Cut Sets (von Kamp & Klamt 2014) | strong guarantees; enumerates smallest intervention sets | | Strong growth-coupling (obligatory) | OptCouple | maximizes the growth-coupling potential directly | | Over/under-EXPRESSION targets, not just knockouts | FSEOF (Choi 2010) / cameo | scans fluxes that rise with enforced product; amplification targets | | Heuristic/evolutionary search when MILP is intractable | OptGene / cameo | fast approximate designs; no optimality guarantee |
Prefer RobustKnock or MCS over plain OptKnock when the design must be trustworthy; OptKnock's optimism is a well-known way to overstate a design.
Goal: Find a small set of reaction knockouts that couples secretion of a target product to growth.
Approach: Build an OptKnock SDModule with the cell's growth as the inner objective and product secretion as the outer objective, plus a minimum-growth constraint so the design keeps the strain viable, then call compute_strain_designs with an intervention budget and solver. Translate the returned reaction knockouts back to gene deletions via the GPR.
import cobra
import straindesign as sd
model = cobra.io.load_model('textbook')
biomass = 'Biomass_Ecoli_core' # the model's actual biomass reaction id (verify per model)
optknock = sd.SDModule(
model, sd.OPTKNOCK,
inner_objective=biomass, # the cell maximizes growth
outer_objective='EX_ac_e', # the engineer maximizes acetate secretion
constraints=[f'{biomass} >= 0.3'], # keep the strain viable
)
solutions = sd.compute_strain_designs(
model, sd_modules=[optknock],
max_cost=3, # at most 3 interventions
max_solutions=3,
solver='glpk', # use 'cplex'/'gurobi' for genome-scale models
time_limit=120,
)
# solutions.reaction_sd is a list of intervention dicts {reaction_id: marker}; a knockout is
# marked -1.0 (not 0). Verify this marker for the installed StrainDesign version -- a wrong marker
# silently yields empty designs. For a knockout-only OptKnock module every entry is a knockout.
for design in solutions.reaction_sd:
print('knockouts:', [rid for rid, mark in design.items() if mark == -1.0])
from cobra.flux_analysis import production_envelope
# A genuinely growth-coupled design shows a NONZERO minimum product flux across the growth range:
# the strain cannot grow without secreting product. Apply the design's knockouts, then:
env = production_envelope(model, reactions=['EX_ac_e']) # objective defaults to biomass
# Inspect the lower bound of product at each growth level; if it can be zero at max growth, the
# coupling is weak (the OptKnock-optimism problem) -- consider RobustKnock. See flux-balance-analysis.
# Knockouts are not the only lever. FSEOF (flux scanning with enforced objective flux) finds
# reactions whose flux RISES as product formation is enforced -- candidate amplification/over-
# expression targets. cameo implements FSEOF and heuristic (evolutionary) design search:
# from cameo.strain_design import OptGene # heuristic knockout search
# from cameo.strain_design.deterministic import FSEOF
# Use FSEOF/over-expression when the bottleneck is low flux through an existing pathway rather than
# a competing drain that a knockout would remove.
| Symptom | Cause | Fix |
|---------|-------|-----|
| compute_strain_designs never finishes | MILP is hard and GLPK is slow on genome-scale | set time_limit, lower max_cost, use CPLEX/Gurobi |
| Design gives zero product when built | OptKnock optimism: the cell chose a different growth-optimal state | use RobustKnock, or check the production envelope's lower bound |
| Constraint parser rejects the biomass id | wrong reaction id string for this model | look up the actual objective reaction id (linear_reaction_coefficients) |
| Design not realizable in the lab | reaction knockouts have no clean gene mapping, or hit an essential gene | translate reaction KOs to gene KOs via GPR; exclude essential genes |
| Predicted overproduction never materializes | FBA has no regulation/kinetics/toxicity/stability | treat the design as a hypothesis; validate the envelope, then in vivo |
| No feasible design found | growth constraint too tight or product infeasible on the medium | relax the minimum-growth constraint; confirm the product can be made on the medium |
tools
End-to-end CLIP-seq pipeline from FASTQ to ENCODE-compliant binding sites, single-nucleotide crosslink maps, annotation, motifs, and (optionally) differential binding. Use when running the full Yeo lab eCLIP / iCLIP / iCLIP2 / iCLIP3 / irCLIP / PAR-CLIP analysis with SMInput control, protocol-specific UMI extraction, ENCODE STAR parameters, CLIPper or Skipper peak calling with stringent log2 FC and -log10 p thresholds, IDR rescue and self-consistency QC, and downstream motif registration with mCross or PEKA.
development
Detect, date, and contextualize whole-genome duplication (WGD / paleopolyploidy) events using wgd v2 (Chen et al 2024), KsRates (Sensalari 2022 substitution-rate-corrected Ks dating), DupGen_finder (Qiao 2019), MAPS (Li 2018 phylogenomic), POInT (Conant 2008 ordered-block), SLEDGe (2024 ML-based), Whale.jl (Bayesian DL+WGD), and synteny-anchored paranome construction. Use when identifying ancient polyploidy from Ks distributions and synteny block analysis, positioning WGD events relative to speciation, distinguishing tandem from segmental from WGD duplications, dating the 2R/3R vertebrate / fish / salmonid WGDs, building paranome and Ks-age mixture models, applying KsRates substitution-rate correction across lineages, or testing alternative biased-fractionation / dosage-balance models post-WGD.
tools
Build whole-genome alignments using Progressive Cactus (Armstrong 2020 reference-free clade-level WGA), Minigraph-Cactus (Hickey 2024 pangenome-aware), LASTZ chain/net (UCSC pipeline), MUMmer4 (Marçais 2018 pairwise), minimap2 -x asm5/10/20 (Li 2018 fast pairwise), AnchorWave (Song 2022 WGD-aware), and Mauve / progressiveMauve (bacterial). Operates the HAL toolkit (Hickey 2013) for downstream extraction including halSynteny, halLiftover, halBranchMutations, and hal2maf. Use when constructing multi-species alignments for comparative-annotation projection (TOGA), synteny detection, conservation analyses (phyloP / PhastCons), or pangenome graph construction; selecting between reference-free (Cactus) and reference-anchored (LASTZ chains/nets) approaches; tuning sensitivity for closely vs distantly related genomes; or producing HAL files for genome-wide downstream tools.
development
Detect syntenic blocks and structural rearrangements between genomes using MCScanX (Wang 2012), JCVI/MCScan (Tang 2008 Python), GENESPACE (Lovell 2022) for orthology-anchored riparian visualization, SyRI for structural variation, AnchorWave for sequence-level synteny, i-ADHoRe 3.0 for highly diverged species, SynNet for synteny networks, and ntSynt for multi-genome macrosynteny. Use when identifying collinear gene blocks across species, distinguishing macrosynteny from microsynteny, detecting inversions/translocations/duplications, anchoring orthology in WGD lineages, producing publication riparian plots, computing synteny block age via Ks (cross-references whole-genome-duplication), or running synteny-aware ortholog inference in polyploids.