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 |
development
Installs 425 bioinformatics skills covering sequence analysis, RNA-seq, single-cell, variant calling, metagenomics, structural biology, and 56 more categories. Use when setting up bioinformatics capabilities or when a bioinformatics task requires specialized skills not yet installed.
testing
Chains a somatic (tumor-normal) SNV/indel and structural-variant pipeline end to end with GATK Mutect2 (or Strelka2), wiring the somatic-specific machinery - panel-of-normals and gnomAD germline-resource priors, GetPileupSummaries/CalculateContamination, and LearnReadOrientationModel FFPE/oxoG orientation-bias filtering fed into FilterMutectCalls. Use when calling somatic mutations from a tumor-normal pair (or tumor-only with PoN caveats), deciding which artifact filter removes which class of false positive, reasoning about VAF/purity/ploidy and clonal-vs-subclonal detection, adding somatic SV/CNV or TMB/MSI/signatures, or routing variants to AMP/ASCO/CAP tier and oncogenicity interpretation (never germline ACMG).
development
End-to-end pooled and single-cell CRISPR screen analysis from FASTQ to hit genes. Orchestrates library design QC, guide counting, six-stage screen QC (plasmid Gini, replicate Pearson, CEGv2 PR-AUC, copy-number artifact), method-appropriate hit calling across MAGeCK RRA/MLE, BAGEL2, drugZ, JACKS, and Chronos, cancer-cell-line copy-number correction (CRISPRcleanR / Chronos), batch correction for multi-batch screens, and the specialized branches for combinatorial paralog screens, single-cell Perturb-seq, base-editor variant-function screens, prime-editor screens, and in vivo bottleneck-aware screens. Use when analyzing any pooled CRISPR screen end-to-end, matching the hit-calling method to the experimental design, integrating copy-number correction into the pipeline, or branching the workflow for single-cell, combinatorial, base-editor, prime-editor, or in vivo variants.
development
Transcribe DNA to RNA and translate to protein using Biopython, with NCBI codon-table selection, CDS validation, and six-frame ORF finding. Use when converting a CDS or ORF to its amino-acid sequence, selecting a non-standard (mitochondrial, bacterial, ciliate) genetic code, validating a coding sequence, or scanning all reading frames.