@pikaa-ai/pikaa 0.3.23 → 0.3.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/brand/orbit-logo-option4-whale.jpg +0 -0
- package/assets/brand/orbit-logo.jpg +0 -0
- package/assets/brand/orbit-logo.png +0 -0
- package/assets/brand/orbit-logo.svg +3 -0
- package/dist/cli.js +407 -219
- package/dist/index.js +7 -2
- package/package.json +1 -2
- package/skills/adaptyv/SKILL.md +0 -240
- package/skills/aeon/SKILL.md +0 -402
- package/skills/analytical-method-validation/SKILL.md +0 -299
- package/skills/anndata/SKILL.md +0 -431
- package/skills/arbor/SKILL.md +0 -152
- package/skills/arboreto/SKILL.md +0 -267
- package/skills/astropy/SKILL.md +0 -353
- package/skills/autoskill/SKILL.md +0 -233
- package/skills/benchling-integration/SKILL.md +0 -229
- package/skills/bgpt-paper-search/SKILL.md +0 -75
- package/skills/bids/SKILL.md +0 -237
- package/skills/biopython/SKILL.md +0 -472
- package/skills/bioservices/SKILL.md +0 -399
- package/skills/bulk-rnaseq/SKILL.md +0 -198
- package/skills/cellxgene-census/SKILL.md +0 -283
- package/skills/cirq/SKILL.md +0 -370
- package/skills/citation-management/SKILL.md +0 -329
- package/skills/clinical-decision-support/SKILL.md +0 -238
- package/skills/clinical-decision-support/references/README.md +0 -62
- package/skills/clinical-reports/SKILL.md +0 -248
- package/skills/clinical-reports/references/README.md +0 -34
- package/skills/cobrapy/SKILL.md +0 -496
- package/skills/consciousness-council/SKILL.md +0 -151
- package/skills/dask/SKILL.md +0 -482
- package/skills/database-lookup/SKILL.md +0 -386
- package/skills/datamol/SKILL.md +0 -200
- package/skills/deepchem/SKILL.md +0 -244
- package/skills/deepspot-m/SKILL.md +0 -175
- package/skills/deeptools/SKILL.md +0 -412
- package/skills/depmap/SKILL.md +0 -301
- package/skills/dhdna-profiler/SKILL.md +0 -184
- package/skills/diffdock/SKILL.md +0 -488
- package/skills/dnanexus-integration/SKILL.md +0 -325
- package/skills/docx/SKILL.md +0 -99
- package/skills/esm/SKILL.md +0 -334
- package/skills/etetoolkit/SKILL.md +0 -327
- package/skills/exa-search/SKILL.md +0 -102
- package/skills/executing-plans/SKILL.md +0 -14
- package/skills/experimental-design/SKILL.md +0 -234
- package/skills/exploratory-data-analysis/SKILL.md +0 -280
- package/skills/flowio/SKILL.md +0 -310
- package/skills/fluidsim/SKILL.md +0 -279
- package/skills/frontend-design/SKILL.md +0 -100
- package/skills/generate-image/SKILL.md +0 -304
- package/skills/geniml/SKILL.md +0 -310
- package/skills/genomic-coordinates/SKILL.md +0 -189
- package/skills/genomic-intelligence/SKILL.md +0 -243
- package/skills/geomaster/README.md +0 -105
- package/skills/geomaster/SKILL.md +0 -366
- package/skills/geopandas/SKILL.md +0 -250
- package/skills/get-available-resources/SKILL.md +0 -260
- package/skills/gget/SKILL.md +0 -153
- package/skills/ginkgo-cloud-lab/SKILL.md +0 -106
- package/skills/glycoengineering/SKILL.md +0 -339
- package/skills/gtars/SKILL.md +0 -282
- package/skills/guardian-rails/SKILL.md +0 -54
- package/skills/histolab/SKILL.md +0 -243
- package/skills/hugging-science/SKILL.md +0 -132
- package/skills/hypogenic/SKILL.md +0 -290
- package/skills/hypothesis-generation/SKILL.md +0 -264
- package/skills/imaging-data-commons/SKILL.md +0 -496
- package/skills/infographics/SKILL.md +0 -315
- package/skills/iso-standards-readiness/SKILL.md +0 -352
- package/skills/lab-hardware-cad/SKILL.md +0 -372
- package/skills/labarchive-integration/SKILL.md +0 -216
- package/skills/lamindb/SKILL.md +0 -408
- package/skills/latchbio-integration/SKILL.md +0 -227
- package/skills/latex-posters/SKILL.md +0 -369
- package/skills/latex-posters/references/README.md +0 -439
- package/skills/liteparse/SKILL.md +0 -295
- package/skills/literature-review/SKILL.md +0 -263
- package/skills/markdown-mermaid-writing/SKILL.md +0 -322
- package/skills/market-research-reports/SKILL.md +0 -337
- package/skills/markitdown/SKILL.md +0 -264
- package/skills/matchms/SKILL.md +0 -276
- package/skills/matlab/SKILL.md +0 -274
- package/skills/matplotlib/SKILL.md +0 -378
- package/skills/medchem/SKILL.md +0 -321
- package/skills/modal/SKILL.md +0 -468
- package/skills/molecular-dynamics/SKILL.md +0 -458
- package/skills/molfeat/SKILL.md +0 -348
- package/skills/ncats-arax/SKILL.md +0 -178
- package/skills/networkx/SKILL.md +0 -440
- package/skills/neurokit2/SKILL.md +0 -323
- package/skills/neuropixels-analysis/SKILL.md +0 -412
- package/skills/nextflow/SKILL.md +0 -195
- package/skills/omero-integration/SKILL.md +0 -222
- package/skills/onekgpd/SKILL.md +0 -371
- package/skills/ontology-term-resolution/SKILL.md +0 -147
- package/skills/open-notebook/SKILL.md +0 -297
- package/skills/openpiv/SKILL.md +0 -469
- package/skills/opentrons-integration/SKILL.md +0 -322
- package/skills/optimize-for-gpu/SKILL.md +0 -176
- package/skills/owasp-top10/SKILL.md +0 -48
- package/skills/pacsomatic/LICENSE +0 -21
- package/skills/pacsomatic/SKILL.md +0 -150
- package/skills/paper-lookup/SKILL.md +0 -263
- package/skills/paperclip/SKILL.md +0 -413
- package/skills/paperzilla/SKILL.md +0 -159
- package/skills/parallel-web/SKILL.md +0 -128
- package/skills/pathml/SKILL.md +0 -222
- package/skills/pathogen-variant-surveillance/SKILL.md +0 -208
- package/skills/pathway-enrichment/SKILL.md +0 -194
- package/skills/pdf/SKILL.md +0 -322
- package/skills/peer-review/SKILL.md +0 -288
- package/skills/penetration-testing/SKILL.md +0 -31
- package/skills/pennylane/SKILL.md +0 -240
- package/skills/phylogenetics/SKILL.md +0 -409
- package/skills/pi-agent/SKILL.md +0 -83
- package/skills/pkpd-modeling/SKILL.md +0 -381
- package/skills/polars/SKILL.md +0 -393
- package/skills/polars-bio/SKILL.md +0 -379
- package/skills/ponytail/SKILL.md +0 -31
- package/skills/ponytail-audit/SKILL.md +0 -18
- package/skills/pptx/SKILL.md +0 -246
- package/skills/pptx-posters/SKILL.md +0 -258
- package/skills/primekg/SKILL.md +0 -99
- package/skills/protocolsio-integration/SKILL.md +0 -236
- package/skills/pufferlib/SKILL.md +0 -328
- package/skills/pydeseq2/SKILL.md +0 -369
- package/skills/pydicom/SKILL.md +0 -381
- package/skills/pyhealth/SKILL.md +0 -124
- package/skills/pylabrobot/SKILL.md +0 -216
- package/skills/pymatgen/SKILL.md +0 -404
- package/skills/pymc/SKILL.md +0 -310
- package/skills/pymoo/SKILL.md +0 -276
- package/skills/pyopenms/SKILL.md +0 -179
- package/skills/pysam/SKILL.md +0 -330
- package/skills/pytdc/SKILL.md +0 -297
- package/skills/pytorch-lightning/SKILL.md +0 -191
- package/skills/pyzotero/SKILL.md +0 -137
- package/skills/qiskit/SKILL.md +0 -259
- package/skills/qutip/SKILL.md +0 -317
- package/skills/rdkit/SKILL.md +0 -94
- package/skills/relsa-severity-assessment/SKILL.md +0 -354
- package/skills/research-grants/SKILL.md +0 -296
- package/skills/research-grants/references/README.md +0 -287
- package/skills/research-lookup/README.md +0 -106
- package/skills/research-lookup/SKILL.md +0 -338
- package/skills/rowan/SKILL.md +0 -398
- package/skills/scanpy/SKILL.md +0 -303
- package/skills/scholar-evaluation/SKILL.md +0 -296
- package/skills/scientific-brainstorming/SKILL.md +0 -282
- package/skills/scientific-critical-thinking/SKILL.md +0 -180
- package/skills/scientific-schematics/SKILL.md +0 -370
- package/skills/scientific-slides/SKILL.md +0 -379
- package/skills/scientific-visualization/SKILL.md +0 -285
- package/skills/scientific-writing/SKILL.md +0 -356
- package/skills/scikit-bio/SKILL.md +0 -470
- package/skills/scikit-learn/SKILL.md +0 -324
- package/skills/scikit-survival/SKILL.md +0 -313
- package/skills/scvelo/SKILL.md +0 -328
- package/skills/scvi-tools/SKILL.md +0 -201
- package/skills/seaborn/SKILL.md +0 -254
- package/skills/security-auditor/SKILL.md +0 -37
- package/skills/shap/SKILL.md +0 -282
- package/skills/simpy/SKILL.md +0 -283
- package/skills/stable-baselines3/SKILL.md +0 -325
- package/skills/statistical-analysis/SKILL.md +0 -446
- package/skills/statistical-power/SKILL.md +0 -200
- package/skills/statsmodels/SKILL.md +0 -238
- package/skills/sympy/SKILL.md +0 -354
- package/skills/systematic-debugging/SKILL.md +0 -35
- package/skills/tamarind/SKILL.md +0 -285
- package/skills/tdd/SKILL.md +0 -26
- package/skills/tiledbvcf/SKILL.md +0 -456
- package/skills/timesfm-forecasting/SKILL.md +0 -408
- package/skills/timesfm-forecasting/examples/global-temperature/README.md +0 -178
- package/skills/torch-geometric/SKILL.md +0 -458
- package/skills/torchdrug/SKILL.md +0 -241
- package/skills/transformers/SKILL.md +0 -195
- package/skills/treatment-plans/SKILL.md +0 -174
- package/skills/treatment-plans/references/README.md +0 -19
- package/skills/umap-learn/SKILL.md +0 -488
- package/skills/uncertainty-and-units/SKILL.md +0 -384
- package/skills/usfiscaldata/SKILL.md +0 -171
- package/skills/vaex/SKILL.md +0 -204
- package/skills/venue-templates/SKILL.md +0 -269
- package/skills/verification-before-completion/SKILL.md +0 -22
- package/skills/waypoint-bio/SKILL.md +0 -273
- package/skills/what-if-oracle/SKILL.md +0 -184
- package/skills/writing-plans/SKILL.md +0 -15
- package/skills/xlsx/SKILL.md +0 -110
- package/skills/zarr-python/SKILL.md +0 -241
package/skills/cobrapy/SKILL.md
DELETED
|
@@ -1,496 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: cobrapy
|
|
3
|
-
description: Constraint-based metabolic modeling (COBRA). FBA, FVA, gene knockouts, flux sampling, SBML models, for systems biology and metabolic engineering analysis.
|
|
4
|
-
license: GPL-2.0 license
|
|
5
|
-
allowed-tools: Read Write Edit Bash
|
|
6
|
-
compatibility: Requires Python 3.9+ (cobra 0.30+ dropped 3.8). Install with uv pip install. GLPK (swiglpk) is the default solver; CPLEX/Gurobi optional. load_model fetches from bundled data, BiGG, or BioModels (network required for remote models).
|
|
7
|
-
metadata:
|
|
8
|
-
version: "1.1"
|
|
9
|
-
skill-author: K-Dense Inc.
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# COBRApy - Constraint-Based Reconstruction and Analysis
|
|
13
|
-
|
|
14
|
-
## Overview
|
|
15
|
-
|
|
16
|
-
COBRApy is a Python library for constraint-based reconstruction and analysis (COBRA) of metabolic models, essential for systems biology research. Work with genome-scale metabolic models, perform computational simulations of cellular metabolism, conduct metabolic engineering analyses, and predict phenotypic behaviors.
|
|
17
|
-
|
|
18
|
-
**Version note:** Examples target **cobra 0.31.1** on PyPI (import `cobra`). Docs: [cobrapy.readthedocs.io](https://cobrapy.readthedocs.io/en/latest/). Repo: [opencobra/cobrapy](https://github.com/opencobra/cobrapy).
|
|
19
|
-
|
|
20
|
-
## When to Use This Skill
|
|
21
|
-
|
|
22
|
-
Use this skill when:
|
|
23
|
-
- Loading, building, or exporting genome-scale metabolic models (SBML, JSON, YAML)
|
|
24
|
-
- Running FBA, pFBA, FVA, or flux sampling on COBRA models
|
|
25
|
-
- Performing gene or reaction knockout screens and production envelope analysis
|
|
26
|
-
- Designing or optimizing growth media and exchange constraints
|
|
27
|
-
- Gap-filling infeasible models or validating model consistency
|
|
28
|
-
|
|
29
|
-
## Installation
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
uv pip install "cobra==0.31.1"
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
MATLAB model I/O (optional):
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
uv pip install "cobra[array]==0.31.1"
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
COBRApy uses [optlang](https://optlang.readthedocs.io/) for solvers. GLPK installs automatically via `swiglpk`. For large MILPs/QPs, cobra 0.29+ adds a **hybrid** solver (HIGHS/OSQP); `model.solver = "osqp"` now routes through hybrid and may error on plain LPs in a future release—prefer `model.solver = "hybrid"` when available.
|
|
42
|
-
|
|
43
|
-
## Core Capabilities
|
|
44
|
-
|
|
45
|
-
COBRApy provides comprehensive tools organized into several key areas:
|
|
46
|
-
|
|
47
|
-
### 1. Model Management
|
|
48
|
-
|
|
49
|
-
Load existing models from repositories or files:
|
|
50
|
-
```python
|
|
51
|
-
from cobra.io import load_model
|
|
52
|
-
|
|
53
|
-
# Bundled locally (no network): textbook, iJO1366, salmonella
|
|
54
|
-
model = load_model("textbook") # alias for e_coli_core (95 reactions)
|
|
55
|
-
model = load_model("e_coli_core") # same core E. coli model
|
|
56
|
-
model = load_model("iJO1366") # genome-scale E. coli (bundled)
|
|
57
|
-
model = load_model("salmonella") # Salmonella iYS1720 (bundled)
|
|
58
|
-
|
|
59
|
-
# Remote (BiGG / BioModels; requires network, cached after first fetch)
|
|
60
|
-
model = load_model("iML1515") # E. coli genome-scale on BiGG
|
|
61
|
-
|
|
62
|
-
# Load from files
|
|
63
|
-
from cobra.io import read_sbml_model, load_json_model, load_yaml_model
|
|
64
|
-
model = read_sbml_model("path/to/model.xml")
|
|
65
|
-
model = load_json_model("path/to/model.json")
|
|
66
|
-
model = load_yaml_model("path/to/model.yml")
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Save models in various formats:
|
|
70
|
-
```python
|
|
71
|
-
from cobra.io import write_sbml_model, save_json_model, save_yaml_model
|
|
72
|
-
write_sbml_model(model, "output.xml") # Preferred format
|
|
73
|
-
save_json_model(model, "output.json") # For Escher compatibility
|
|
74
|
-
save_yaml_model(model, "output.yml") # Human-readable
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### 2. Model Structure and Components
|
|
78
|
-
|
|
79
|
-
Access and inspect model components:
|
|
80
|
-
```python
|
|
81
|
-
# Access components
|
|
82
|
-
model.reactions # DictList of all reactions
|
|
83
|
-
model.metabolites # DictList of all metabolites
|
|
84
|
-
model.genes # DictList of all genes
|
|
85
|
-
|
|
86
|
-
# Get specific items by ID or index
|
|
87
|
-
reaction = model.reactions.get_by_id("PFK")
|
|
88
|
-
metabolite = model.metabolites[0]
|
|
89
|
-
|
|
90
|
-
# Inspect properties
|
|
91
|
-
print(reaction.reaction) # Stoichiometric equation
|
|
92
|
-
print(reaction.bounds) # Flux constraints
|
|
93
|
-
print(reaction.gene_reaction_rule) # GPR logic
|
|
94
|
-
print(metabolite.formula) # Chemical formula
|
|
95
|
-
print(metabolite.compartment) # Cellular location
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### 3. Flux Balance Analysis (FBA)
|
|
99
|
-
|
|
100
|
-
Perform standard FBA simulation:
|
|
101
|
-
```python
|
|
102
|
-
# Basic optimization
|
|
103
|
-
solution = model.optimize()
|
|
104
|
-
print(f"Objective value: {solution.objective_value}")
|
|
105
|
-
print(f"Status: {solution.status}")
|
|
106
|
-
|
|
107
|
-
# Access fluxes
|
|
108
|
-
print(solution.fluxes["PFK"])
|
|
109
|
-
print(solution.fluxes.head())
|
|
110
|
-
|
|
111
|
-
# Fast optimization (objective value only)
|
|
112
|
-
objective_value = model.slim_optimize()
|
|
113
|
-
|
|
114
|
-
# Change objective
|
|
115
|
-
model.objective = "ATPM"
|
|
116
|
-
solution = model.optimize()
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Parsimonious FBA (minimize total flux):
|
|
120
|
-
```python
|
|
121
|
-
from cobra.flux_analysis import pfba
|
|
122
|
-
solution = pfba(model)
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
Geometric FBA (find central solution):
|
|
126
|
-
```python
|
|
127
|
-
from cobra.flux_analysis import geometric_fba
|
|
128
|
-
solution = geometric_fba(model)
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### 4. Flux Variability Analysis (FVA)
|
|
132
|
-
|
|
133
|
-
Determine flux ranges for all reactions:
|
|
134
|
-
```python
|
|
135
|
-
from cobra.flux_analysis import flux_variability_analysis
|
|
136
|
-
|
|
137
|
-
# Standard FVA
|
|
138
|
-
fva_result = flux_variability_analysis(model)
|
|
139
|
-
|
|
140
|
-
# FVA at 90% optimality
|
|
141
|
-
fva_result = flux_variability_analysis(model, fraction_of_optimum=0.9)
|
|
142
|
-
|
|
143
|
-
# Loopless FVA (eliminates thermodynamically infeasible loops)
|
|
144
|
-
fva_result = flux_variability_analysis(model, loopless=True)
|
|
145
|
-
|
|
146
|
-
# FVA for specific reactions
|
|
147
|
-
fva_result = flux_variability_analysis(
|
|
148
|
-
model,
|
|
149
|
-
reaction_list=["PFK", "FBA", "PGI"]
|
|
150
|
-
)
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### 5. Gene and Reaction Deletion Studies
|
|
154
|
-
|
|
155
|
-
Perform knockout analyses:
|
|
156
|
-
```python
|
|
157
|
-
from cobra.flux_analysis import (
|
|
158
|
-
single_gene_deletion,
|
|
159
|
-
single_reaction_deletion,
|
|
160
|
-
double_gene_deletion,
|
|
161
|
-
double_reaction_deletion
|
|
162
|
-
)
|
|
163
|
-
|
|
164
|
-
# Single deletions
|
|
165
|
-
gene_results = single_gene_deletion(model)
|
|
166
|
-
reaction_results = single_reaction_deletion(model)
|
|
167
|
-
|
|
168
|
-
# Double deletions (uses multiprocessing)
|
|
169
|
-
double_gene_results = double_gene_deletion(
|
|
170
|
-
model,
|
|
171
|
-
processes=4 # Number of CPU cores
|
|
172
|
-
)
|
|
173
|
-
|
|
174
|
-
# Manual knockout using context manager
|
|
175
|
-
with model:
|
|
176
|
-
model.genes.get_by_id("b0008").knock_out()
|
|
177
|
-
solution = model.optimize()
|
|
178
|
-
print(f"Growth after knockout: {solution.objective_value}")
|
|
179
|
-
# Model automatically reverts after context exit
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
### 6. Growth Media and Minimal Media
|
|
183
|
-
|
|
184
|
-
Manage growth medium:
|
|
185
|
-
```python
|
|
186
|
-
# View current medium
|
|
187
|
-
print(model.medium)
|
|
188
|
-
|
|
189
|
-
# Modify medium (must reassign entire dict)
|
|
190
|
-
medium = model.medium
|
|
191
|
-
medium["EX_glc__D_e"] = 10.0 # Set glucose uptake
|
|
192
|
-
medium["EX_o2_e"] = 0.0 # Anaerobic conditions
|
|
193
|
-
model.medium = medium
|
|
194
|
-
|
|
195
|
-
# Calculate minimal media
|
|
196
|
-
from cobra.medium import minimal_medium
|
|
197
|
-
|
|
198
|
-
# Minimize total import flux
|
|
199
|
-
min_medium = minimal_medium(model, minimize_components=False)
|
|
200
|
-
|
|
201
|
-
# Minimize number of components (uses MILP, slower)
|
|
202
|
-
min_medium = minimal_medium(
|
|
203
|
-
model,
|
|
204
|
-
minimize_components=True,
|
|
205
|
-
open_exchanges=True
|
|
206
|
-
)
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
### 7. Flux Sampling
|
|
210
|
-
|
|
211
|
-
Sample the feasible flux space:
|
|
212
|
-
```python
|
|
213
|
-
from cobra.sampling import sample
|
|
214
|
-
|
|
215
|
-
# Sample using OptGP (default, supports parallel processing)
|
|
216
|
-
samples = sample(model, n=1000, method="optgp", processes=4)
|
|
217
|
-
|
|
218
|
-
# Sample using ACHR
|
|
219
|
-
samples = sample(model, n=1000, method="achr")
|
|
220
|
-
|
|
221
|
-
# Validate samples
|
|
222
|
-
from cobra.sampling import OptGPSampler
|
|
223
|
-
sampler = OptGPSampler(model, processes=4)
|
|
224
|
-
sampler.sample(1000)
|
|
225
|
-
validation = sampler.validate(sampler.samples)
|
|
226
|
-
print(validation.value_counts()) # Should be all 'v' for valid
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
### 8. Production Envelopes
|
|
230
|
-
|
|
231
|
-
Calculate phenotype phase planes:
|
|
232
|
-
```python
|
|
233
|
-
from cobra.flux_analysis import production_envelope
|
|
234
|
-
|
|
235
|
-
# Standard production envelope
|
|
236
|
-
envelope = production_envelope(
|
|
237
|
-
model,
|
|
238
|
-
reactions=["EX_glc__D_e", "EX_o2_e"],
|
|
239
|
-
objective="EX_ac_e" # Acetate production
|
|
240
|
-
)
|
|
241
|
-
|
|
242
|
-
# With carbon yield
|
|
243
|
-
envelope = production_envelope(
|
|
244
|
-
model,
|
|
245
|
-
reactions=["EX_glc__D_e", "EX_o2_e"],
|
|
246
|
-
carbon_sources="EX_glc__D_e"
|
|
247
|
-
)
|
|
248
|
-
|
|
249
|
-
# Visualize (use matplotlib or pandas plotting)
|
|
250
|
-
import matplotlib.pyplot as plt
|
|
251
|
-
envelope.plot(x="EX_glc__D_e", y="EX_o2_e", kind="scatter")
|
|
252
|
-
plt.show()
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
### 9. Gapfilling
|
|
256
|
-
|
|
257
|
-
Add reactions to make models feasible:
|
|
258
|
-
```python
|
|
259
|
-
from cobra.flux_analysis import gapfill
|
|
260
|
-
|
|
261
|
-
# Provide a universal reaction database (SBML/JSON); not bundled in cobra 0.31+
|
|
262
|
-
from cobra.io import read_sbml_model
|
|
263
|
-
universal = read_sbml_model("path/to/universal_reactions.xml")
|
|
264
|
-
|
|
265
|
-
# Perform gapfilling
|
|
266
|
-
with model:
|
|
267
|
-
# Remove reactions to create gaps for demonstration
|
|
268
|
-
model.remove_reactions([model.reactions.PGI])
|
|
269
|
-
|
|
270
|
-
# Find reactions needed
|
|
271
|
-
solution = gapfill(model, universal)
|
|
272
|
-
print(f"Reactions to add: {solution}")
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
### 10. Model Building
|
|
276
|
-
|
|
277
|
-
Build models from scratch:
|
|
278
|
-
```python
|
|
279
|
-
from cobra import Model, Reaction, Metabolite
|
|
280
|
-
|
|
281
|
-
# Create model
|
|
282
|
-
model = Model("my_model")
|
|
283
|
-
|
|
284
|
-
# Create metabolites
|
|
285
|
-
atp_c = Metabolite("atp_c", formula="C10H12N5O13P3",
|
|
286
|
-
name="ATP", compartment="c")
|
|
287
|
-
adp_c = Metabolite("adp_c", formula="C10H12N5O10P2",
|
|
288
|
-
name="ADP", compartment="c")
|
|
289
|
-
pi_c = Metabolite("pi_c", formula="HO4P",
|
|
290
|
-
name="Phosphate", compartment="c")
|
|
291
|
-
|
|
292
|
-
# Create reaction
|
|
293
|
-
reaction = Reaction("ATPASE")
|
|
294
|
-
reaction.name = "ATP hydrolysis"
|
|
295
|
-
reaction.subsystem = "Energy"
|
|
296
|
-
reaction.lower_bound = 0.0
|
|
297
|
-
reaction.upper_bound = 1000.0
|
|
298
|
-
|
|
299
|
-
# Add metabolites with stoichiometry
|
|
300
|
-
reaction.add_metabolites({
|
|
301
|
-
atp_c: -1.0,
|
|
302
|
-
adp_c: 1.0,
|
|
303
|
-
pi_c: 1.0
|
|
304
|
-
})
|
|
305
|
-
|
|
306
|
-
# Add gene-reaction rule
|
|
307
|
-
reaction.gene_reaction_rule = "(gene1 and gene2) or gene3"
|
|
308
|
-
|
|
309
|
-
# Add to model
|
|
310
|
-
model.add_reactions([reaction])
|
|
311
|
-
|
|
312
|
-
# Add boundary reactions
|
|
313
|
-
model.add_boundary(atp_c, type="exchange")
|
|
314
|
-
model.add_boundary(adp_c, type="demand")
|
|
315
|
-
|
|
316
|
-
# Set objective
|
|
317
|
-
model.objective = "ATPASE"
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
## Common Workflows
|
|
321
|
-
|
|
322
|
-
### Workflow 1: Load Model and Predict Growth
|
|
323
|
-
|
|
324
|
-
```python
|
|
325
|
-
from cobra.io import load_model
|
|
326
|
-
|
|
327
|
-
# Load model (textbook = fast tutorial; iJO1366 / iML1515 for genome-scale)
|
|
328
|
-
model = load_model("textbook")
|
|
329
|
-
|
|
330
|
-
# Run FBA
|
|
331
|
-
solution = model.optimize()
|
|
332
|
-
print(f"Growth rate: {solution.objective_value:.3f} /h")
|
|
333
|
-
|
|
334
|
-
# Show active pathways
|
|
335
|
-
print(solution.fluxes[solution.fluxes.abs() > 1e-6])
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
### Workflow 2: Gene Knockout Screen
|
|
339
|
-
|
|
340
|
-
```python
|
|
341
|
-
from cobra.io import load_model
|
|
342
|
-
from cobra.flux_analysis import single_gene_deletion
|
|
343
|
-
|
|
344
|
-
# Load model
|
|
345
|
-
model = load_model("textbook")
|
|
346
|
-
baseline = model.slim_optimize()
|
|
347
|
-
|
|
348
|
-
# Perform single gene deletions
|
|
349
|
-
results = single_gene_deletion(model)
|
|
350
|
-
|
|
351
|
-
# Find essential genes (growth < threshold)
|
|
352
|
-
essential_genes = results[results["growth"] < 0.01]
|
|
353
|
-
print(f"Found {len(essential_genes)} essential genes")
|
|
354
|
-
|
|
355
|
-
# Find genes with minimal impact
|
|
356
|
-
neutral_genes = results[results["growth"] > 0.9 * baseline]
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
### Workflow 3: Media Optimization
|
|
360
|
-
|
|
361
|
-
```python
|
|
362
|
-
from cobra.io import load_model
|
|
363
|
-
from cobra.medium import minimal_medium
|
|
364
|
-
|
|
365
|
-
# Load model
|
|
366
|
-
model = load_model("textbook")
|
|
367
|
-
|
|
368
|
-
# Calculate minimal medium for 50% of max growth
|
|
369
|
-
target_growth = model.slim_optimize() * 0.5
|
|
370
|
-
min_medium = minimal_medium(
|
|
371
|
-
model,
|
|
372
|
-
target_growth,
|
|
373
|
-
minimize_components=True
|
|
374
|
-
)
|
|
375
|
-
|
|
376
|
-
print(f"Minimal medium components: {len(min_medium)}")
|
|
377
|
-
print(min_medium)
|
|
378
|
-
```
|
|
379
|
-
|
|
380
|
-
### Workflow 4: Flux Uncertainty Analysis
|
|
381
|
-
|
|
382
|
-
```python
|
|
383
|
-
from cobra.io import load_model
|
|
384
|
-
from cobra.flux_analysis import flux_variability_analysis
|
|
385
|
-
from cobra.sampling import sample
|
|
386
|
-
|
|
387
|
-
# Load model
|
|
388
|
-
model = load_model("textbook")
|
|
389
|
-
|
|
390
|
-
# First check flux ranges at optimality
|
|
391
|
-
fva = flux_variability_analysis(model, fraction_of_optimum=1.0)
|
|
392
|
-
|
|
393
|
-
# For reactions with large ranges, sample to understand distribution
|
|
394
|
-
samples = sample(model, n=1000)
|
|
395
|
-
|
|
396
|
-
# Analyze specific reaction
|
|
397
|
-
reaction_id = "PFK"
|
|
398
|
-
import matplotlib.pyplot as plt
|
|
399
|
-
samples[reaction_id].hist(bins=50)
|
|
400
|
-
plt.xlabel(f"Flux through {reaction_id}")
|
|
401
|
-
plt.ylabel("Frequency")
|
|
402
|
-
plt.show()
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
### Workflow 5: Context Manager for Temporary Changes
|
|
406
|
-
|
|
407
|
-
Use context managers to make temporary modifications:
|
|
408
|
-
```python
|
|
409
|
-
# Model remains unchanged outside context
|
|
410
|
-
with model:
|
|
411
|
-
# Temporarily change objective
|
|
412
|
-
model.objective = "ATPM"
|
|
413
|
-
|
|
414
|
-
# Temporarily modify bounds
|
|
415
|
-
model.reactions.EX_glc__D_e.lower_bound = -5.0
|
|
416
|
-
|
|
417
|
-
# Temporarily knock out genes
|
|
418
|
-
model.genes.b0008.knock_out()
|
|
419
|
-
|
|
420
|
-
# Optimize with changes
|
|
421
|
-
solution = model.optimize()
|
|
422
|
-
print(f"Modified growth: {solution.objective_value}")
|
|
423
|
-
|
|
424
|
-
# All changes automatically reverted
|
|
425
|
-
solution = model.optimize()
|
|
426
|
-
print(f"Original growth: {solution.objective_value}")
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
## Key Concepts
|
|
430
|
-
|
|
431
|
-
### DictList Objects
|
|
432
|
-
Models use `DictList` objects for reactions, metabolites, and genes - behaving like both lists and dictionaries:
|
|
433
|
-
```python
|
|
434
|
-
# Access by index
|
|
435
|
-
first_reaction = model.reactions[0]
|
|
436
|
-
|
|
437
|
-
# Access by ID
|
|
438
|
-
pfk = model.reactions.get_by_id("PFK")
|
|
439
|
-
|
|
440
|
-
# Query methods
|
|
441
|
-
atp_reactions = model.reactions.query("atp")
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
### Flux Constraints
|
|
445
|
-
Reaction bounds define feasible flux ranges:
|
|
446
|
-
- **Irreversible**: `lower_bound = 0, upper_bound > 0`
|
|
447
|
-
- **Reversible**: `lower_bound < 0, upper_bound > 0`
|
|
448
|
-
- Set both bounds simultaneously with `.bounds` to avoid inconsistencies
|
|
449
|
-
|
|
450
|
-
### Gene-Reaction Rules (GPR)
|
|
451
|
-
Boolean logic linking genes to reactions:
|
|
452
|
-
```python
|
|
453
|
-
# AND logic (both required)
|
|
454
|
-
reaction.gene_reaction_rule = "gene1 and gene2"
|
|
455
|
-
|
|
456
|
-
# OR logic (either sufficient)
|
|
457
|
-
reaction.gene_reaction_rule = "gene1 or gene2"
|
|
458
|
-
|
|
459
|
-
# Complex logic
|
|
460
|
-
reaction.gene_reaction_rule = "(gene1 and gene2) or (gene3 and gene4)"
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
### Exchange Reactions
|
|
464
|
-
Special reactions representing metabolite import/export:
|
|
465
|
-
- Named with prefix `EX_` by convention
|
|
466
|
-
- Positive flux = secretion, negative flux = uptake
|
|
467
|
-
- Managed through `model.medium` dictionary
|
|
468
|
-
|
|
469
|
-
## Best Practices
|
|
470
|
-
|
|
471
|
-
1. **Use context managers** for temporary modifications to avoid state management issues
|
|
472
|
-
2. **Validate models** before analysis using `model.slim_optimize()` to ensure feasibility
|
|
473
|
-
3. **Check solution status** after optimization - `optimal` indicates successful solve
|
|
474
|
-
4. **Use loopless FVA** when thermodynamic feasibility matters
|
|
475
|
-
5. **Set fraction_of_optimum** appropriately in FVA to explore suboptimal space
|
|
476
|
-
6. **Parallelize** computationally expensive operations (sampling, double deletions) — start with small `n` and `processes=1` on genome-scale models
|
|
477
|
-
7. **Prefer SBML format** for model exchange and long-term storage
|
|
478
|
-
8. **Use slim_optimize()** when only objective value needed for performance
|
|
479
|
-
9. **Validate flux samples** to ensure numerical stability
|
|
480
|
-
10. **Confirm output paths** before writing CSV/PNG files from workflow examples
|
|
481
|
-
|
|
482
|
-
## Troubleshooting
|
|
483
|
-
|
|
484
|
-
**Infeasible solutions**: Check medium constraints, reaction bounds, and model consistency
|
|
485
|
-
**Slow optimization**: Try different solvers (GLPK, CPLEX, Gurobi) via `model.solver`
|
|
486
|
-
**Unbounded solutions**: Verify exchange reactions have appropriate upper bounds
|
|
487
|
-
**Import errors**: Ensure correct file format and valid SBML identifiers
|
|
488
|
-
|
|
489
|
-
## References
|
|
490
|
-
|
|
491
|
-
For detailed workflows and API patterns, refer to:
|
|
492
|
-
- `references/workflows.md` - Comprehensive step-by-step workflow examples
|
|
493
|
-
- `references/api_quick_reference.md` - Common function signatures and patterns
|
|
494
|
-
|
|
495
|
-
Official documentation: https://cobrapy.readthedocs.io/en/latest/
|
|
496
|
-
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: consciousness-council
|
|
3
|
-
description: Run a multi-perspective Mind Council deliberation on any question, decision, or creative challenge. Use this skill whenever the user wants diverse viewpoints, needs help making a tough decision, asks for a council/panel/board discussion, wants to explore a problem from multiple angles, requests devil's advocate analysis, or says things like "what would different experts think about this", "help me think through this from all sides", "council mode", "mind council", or "deliberate on this". Also trigger when the user faces a dilemma, trade-off, or complex choice with no obvious answer.
|
|
4
|
-
allowed-tools: Read Write
|
|
5
|
-
license: MIT license
|
|
6
|
-
metadata:
|
|
7
|
-
version: "1.0"
|
|
8
|
-
skill-author: AHK Strategies (ashrafkahoush-ux)
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Consciousness Council
|
|
12
|
-
|
|
13
|
-
A structured multi-perspective deliberation system that generates genuine cognitive diversity on any question. Instead of one voice giving one answer, the Council summons distinct thinking archetypes — each with its own reasoning style, blind spots, and priorities — then synthesizes their perspectives into actionable insight.
|
|
14
|
-
|
|
15
|
-
## Why This Exists
|
|
16
|
-
|
|
17
|
-
Single-perspective thinking has a ceiling. When you ask one mind for an answer, you get one frame. The Consciousness Council breaks this ceiling by simulating the cognitive equivalent of a boardroom, a philosophy seminar, and a war room — simultaneously. It's not roleplay. It's structured epistemic diversity.
|
|
18
|
-
|
|
19
|
-
The Council is inspired by research in collective intelligence, wisdom-of-crowds phenomena, and the observation that the best decisions emerge when genuinely different reasoning styles collide.
|
|
20
|
-
|
|
21
|
-
## How It Works
|
|
22
|
-
|
|
23
|
-
The Council has three phases:
|
|
24
|
-
|
|
25
|
-
### Phase 1 — Summon the Council
|
|
26
|
-
|
|
27
|
-
Based on the user's question, select 4-6 Council Members from the archetypes below. Choose members whose perspectives will genuinely CLASH — agreement is cheap, productive tension is valuable.
|
|
28
|
-
|
|
29
|
-
**The 12 Archetypes:**
|
|
30
|
-
|
|
31
|
-
| # | Archetype | Thinking Style | Asks | Blind Spot |
|
|
32
|
-
| --- | ------------------ | -------------------------------------- | -------------------------------------------- | ----------------------------------------- |
|
|
33
|
-
| 1 | **The Architect** | Systems thinking, structure-first | "What's the underlying structure?" | Can over-engineer simple problems |
|
|
34
|
-
| 2 | **The Contrarian** | Inversion, devil's advocate | "What if the opposite is true?" | Can be contrarian for its own sake |
|
|
35
|
-
| 3 | **The Empiricist** | Data-driven, evidence-first | "What does the evidence actually show?" | Can miss what can't be measured |
|
|
36
|
-
| 4 | **The Ethicist** | Values-driven, consequence-aware | "Who benefits and who is harmed?" | Can paralyze action with moral complexity |
|
|
37
|
-
| 5 | **The Futurist** | Long-term, second-order effects | "What does this look like in 10 years?" | Can discount present realities |
|
|
38
|
-
| 6 | **The Pragmatist** | Action-oriented, resource-aware | "What can we actually do by Friday?" | Can sacrifice long-term for short-term |
|
|
39
|
-
| 7 | **The Historian** | Pattern recognition, precedent | "When has this been tried before?" | Can fight the last war |
|
|
40
|
-
| 8 | **The Empath** | Human-centered, emotional intelligence | "How will people actually feel about this?" | Can prioritize comfort over progress |
|
|
41
|
-
| 9 | **The Outsider** | Cross-domain, naive questions | "Why does everyone assume that?" | Can lack domain depth |
|
|
42
|
-
| 10 | **The Strategist** | Game theory, competitive dynamics | "What are the second and third-order moves?" | Can overthink simple situations |
|
|
43
|
-
| 11 | **The Minimalist** | Simplification, constraint-seeking | "What can we remove?" | Can oversimplify complex problems |
|
|
44
|
-
| 12 | **The Creator** | Divergent thinking, novel synthesis | "What hasn't been tried yet?" | Can chase novelty over reliability |
|
|
45
|
-
|
|
46
|
-
**Selection heuristic:** Match the question type to the most productive tension:
|
|
47
|
-
|
|
48
|
-
- **Business decisions** → Strategist + Pragmatist + Ethicist + Futurist + Contrarian
|
|
49
|
-
- **Technical architecture** → Architect + Minimalist + Empiricist + Outsider
|
|
50
|
-
- **Personal dilemmas** → Empath + Contrarian + Futurist + Pragmatist
|
|
51
|
-
- **Creative challenges** → Creator + Outsider + Historian + Minimalist
|
|
52
|
-
- **Ethical questions** → Ethicist + Contrarian + Empiricist + Empath + Historian
|
|
53
|
-
- **Strategy/competition** → Strategist + Historian + Futurist + Contrarian + Pragmatist
|
|
54
|
-
|
|
55
|
-
These are starting points — adapt based on the specific question. The goal is productive disagreement, not consensus.
|
|
56
|
-
|
|
57
|
-
### Phase 2 — Deliberation
|
|
58
|
-
|
|
59
|
-
Each Council Member delivers their perspective in this format:
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
🎭 [ARCHETYPE NAME]
|
|
63
|
-
|
|
64
|
-
Position: [One-sentence stance]
|
|
65
|
-
|
|
66
|
-
Reasoning: [2-4 sentences explaining their logic from their specific lens]
|
|
67
|
-
|
|
68
|
-
Key Risk They See: [The danger others might miss]
|
|
69
|
-
|
|
70
|
-
Surprising Insight: [Something non-obvious that emerges from their frame]
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
**Critical rules for deliberation:**
|
|
74
|
-
|
|
75
|
-
- Each member MUST disagree with at least one other member on something substantive. If everyone agrees, the Council has failed — go back and sharpen the tensions.
|
|
76
|
-
- Perspectives should be genuinely different, not just "agree but with different words."
|
|
77
|
-
- The Contrarian should challenge the most popular position, not just be generically skeptical.
|
|
78
|
-
- Keep each member's contribution focused and sharp. Depth over breadth.
|
|
79
|
-
|
|
80
|
-
### Phase 3 — Synthesis
|
|
81
|
-
|
|
82
|
-
After all members speak, deliver:
|
|
83
|
-
|
|
84
|
-
```
|
|
85
|
-
⚖️ COUNCIL SYNTHESIS
|
|
86
|
-
|
|
87
|
-
Points of Convergence: [Where 3+ members agreed — these are high-confidence signals]
|
|
88
|
-
|
|
89
|
-
Core Tension: [The central disagreement that won't resolve easily — this IS the insight]
|
|
90
|
-
|
|
91
|
-
The Blind Spot: [What NO member addressed — the question behind the question]
|
|
92
|
-
|
|
93
|
-
Recommended Path: [Actionable recommendation that respects the tension rather than ignoring it]
|
|
94
|
-
|
|
95
|
-
Confidence Level: [High / Medium / Low — based on how much convergence vs. divergence emerged]
|
|
96
|
-
|
|
97
|
-
One Question to Sit With: [The question the user should keep thinking about after this session]
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Council Configurations
|
|
101
|
-
|
|
102
|
-
The user can customize the Council:
|
|
103
|
-
|
|
104
|
-
- **"Quick council"** or **"fast deliberation"** → Use 3 members, shorter responses
|
|
105
|
-
- **"Deep council"** or **"full deliberation"** → Use 6 members, extended reasoning
|
|
106
|
-
- **"Add [archetype]"** → Include a specific archetype
|
|
107
|
-
- **"Without [archetype]"** → Exclude a specific archetype
|
|
108
|
-
- **"Custom council: [list]"** → User picks exact members
|
|
109
|
-
- **"Anonymous council"** → Don't reveal which archetype is speaking until synthesis (reduces anchoring bias)
|
|
110
|
-
- **"Devil's advocate mode"** → Every member must argue AGAINST whatever seems most intuitive
|
|
111
|
-
- **"Rounds mode"** → After initial positions, members respond to each other for a second round
|
|
112
|
-
|
|
113
|
-
## What Makes a Good Council Question
|
|
114
|
-
|
|
115
|
-
The Council works best on questions where:
|
|
116
|
-
|
|
117
|
-
- There's genuine uncertainty or trade-offs
|
|
118
|
-
- Multiple valid perspectives exist
|
|
119
|
-
- The user is stuck or going in circles
|
|
120
|
-
- The stakes are high enough to warrant multi-angle thinking
|
|
121
|
-
- The user's own bias might be limiting their view
|
|
122
|
-
|
|
123
|
-
The Council adds less value on:
|
|
124
|
-
|
|
125
|
-
- Pure factual questions with clear answers
|
|
126
|
-
- Questions where the user has already decided and just wants validation
|
|
127
|
-
- Trivial choices with low stakes
|
|
128
|
-
|
|
129
|
-
If the question seems too simple for a full Council, say so — and offer a quick 2-perspective contrast instead.
|
|
130
|
-
|
|
131
|
-
## Tone and Quality
|
|
132
|
-
|
|
133
|
-
- Write each archetype's voice with enough distinctiveness that the user could identify them without labels.
|
|
134
|
-
- The Synthesis should feel like genuine integration, not just a list of what each member said.
|
|
135
|
-
- "Core Tension" is the most important part of the synthesis — it should name the real trade-off the user faces.
|
|
136
|
-
- "One Question to Sit With" should be genuinely thought-provoking, not generic.
|
|
137
|
-
- Never let the Council devolve into everyone agreeing politely. Productive friction is the point.
|
|
138
|
-
|
|
139
|
-
## Example
|
|
140
|
-
|
|
141
|
-
**User:** "Should I quit my stable corporate job to start a company?"
|
|
142
|
-
|
|
143
|
-
**Council Selection:** Pragmatist, Futurist, Empath, Contrarian, Strategist (5 members — high-stakes life decision with financial, emotional, and strategic dimensions)
|
|
144
|
-
|
|
145
|
-
Then run the full 3-phase deliberation.
|
|
146
|
-
|
|
147
|
-
## Attribution
|
|
148
|
-
|
|
149
|
-
Created by AHK Strategies — consciousness infrastructure for the age of AI.
|
|
150
|
-
Learn more: https://ahkstrategies.net
|
|
151
|
-
Powered by the Mind Council architecture from TheMindBook: https://themindbook.app
|