bio-systems-biology-gene-essentiality
Skill7 starsChanged 8 months agoMITView on GitHub
Predict essential genes and synthetic lethal pairs via in silico gene knockout screens using COBRApy single/double deletions. Use when: user wants to find essential genes in a metabolic model, simulate gene knockouts, identify synthetic lethality for drug targets, or screen for lethal gene pairs. Triggers: essential genes, gene knockout, synthetic lethality, gene deletion, drug target prediction, lethal gene pairs, single gene knockout, double deletion, growth phenotype prediction, essential reaction screen.
In this repository33 other files it gives its agents.
- hmdb-databaseSkill
- metabolights-databaseSkill
- metabolomics-workbench-databaseSkill
- cobrapySkill
- bio-metabolomics-clinical-reportingSkill
- bio-metabolomics-lipidomicsSkill
- bio-metabolomics-metabolite-annotationSkill
- bio-metabolomics-msdial-preprocessingSkill
- bio-metabolomics-normalization-qcSkill
- bio-metabolomics-pathway-mappingSkill
- bio-metabolomics-analysis-pharmacometabolomicsSkill
- bio-metabolomics-statistical-analysisSkill
- bio-metabolomics-targeted-analysisSkill
- bio-metabolomics-xcms-preprocessingSkill
- ms-format-conversionSkill
- gcms-processingSkill
- matchmsSkill
- nmr-metabolomicsSkill
- pyopenmsSkill
- bio-ms-data-processing-spatial-metabolomicsSkill
- bio-multi-omics-data-harmonizationSkill
- bio-multi-omics-mgwas-integrationSkill
- bio-multi-omics-microbiome-metabolomicsSkill
- bio-multi-omics-mixomics-analysisSkill
- bio-multi-omics-mofa-integrationSkill
- bio-multi-omics-similarity-networkSkill
- bioservicesSkill
- bio-systems-biology-context-specific-modelsSkill
- bio-systems-biology-flux-balance-analysisSkill
- isotope-flux-analysisSkill
- bio-systems-biology-metabolic-reconstructionSkill
- bio-systems-biology-model-curationSkill
- bio-systems-biology-network-visualizationSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Before using code patterns, verify installed versions match.
- Distinctive: line 19
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API …
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Version Compatibility
Reference examples tested with: COBRApy 0.29+
Before using code patterns, verify installed versions match. If versions differ:
- Python:
pip show <package>thenhelp(module.function)to check signatures
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
Gene Essentiality Analysis
"Predict which genes are essential for growth in my organism" → Perform in silico single and double gene knockouts on a metabolic model, identifying genes whose deletion abolishes growth and synthetic lethal pairs for drug target discovery.
- Python:
cobra.flux_analysis.single_gene_deletion(),cobra.flux_analysis.double_gene_deletion()(COBRApy)
Single Gene Knockouts
Goal: Identify essential genes by simulating single gene deletions and measuring growth impact on a metabolic model.
Approach: Perform in silico single gene deletions across all model genes, compare post-deletion growth to wild-type, and classify genes as essential (lethal), growth-reducing, or non-essential based on growth ratio thresholds.
import cobra
from cobra.flux_analysis import single_gene_deletion
model = cobra.io.load_model('textbook')
# Perform all single gene deletions
# Returns growth rate with each gene knocked out
deletion_results = single_gene_deletion(model)
# deletion_results is a DataFrame with:
# - ids: gene IDs (frozenset)
# - growth: growth rate after deletion
# - status: solver status
# Find essential genes (no growth when deleted)
# Essential: growth < 0.01 (allowing for numerical tolerance)
essential = deletion_results[deletion_results['growth'] < 0.01]
print(f'Essential genes: {len(essential)}')Classify Gene Essentiality
def classify_gene_essentiality(model, growth_threshold=0.1):
'''Classify genes by their impact on growth
Categories:
- Essential: Growth < 1% of WT (lethal)
- Growth-reducing: 1-50% of WT
- Non-essential: >50% of WT
'''
from cobra.flux_analysis import single_gene_deletion
# Get wild-type growth
wt_growth = model.optimize().objective_value
# Run deletions
results = single_gene_deletion(model)
results['relative_growth'] = results['growth'] / wt_growth
# Classify
results['classification'] = 'non-essential'
results.loc[results['relative_growth'] < 0.5, 'classification'] = 'growth-reducing'
results.loc[results['relative_growth'] < 0.01, 'classification'] = 'essential'
classification_counts = results['classification'].value_counts()
return results, classification_countsSynthetic Lethality
from cobra.flux_analysis import double_gene_deletion
# Warning: O(n^2) complexity - can be slow for large models
# For full E. coli (~1500 genes), this is ~1M combinations
# Subset to genes of interest
genes_of_interest = [g.id for g in model.genes[:50]]
# Run double deletions
double_results = double_gene_deletion(
model,
gene_list1=genes_of_interest,
gene_list2=genes_of_interest
)
# Find synthetic lethal pairs
# Synthetic lethal: double KO is lethal when singles are viable
# Get single deletion results first
single_results = single_gene_deletion(model, gene_list=genes_of_interest)
single_dict = {list(ids)[0]: growth for ids, growth in
zip(single_results['ids'], single_results['growth'])}Identify Synthetic Lethal Pairs
def find_synthetic_lethal_pairs(model, genes=None, growth_threshold=0.01):
'''Find synthetic lethal gene pairs
Synthetic lethality criteria:
- Single KO of gene A: viable (growth > threshold)
- Single KO of gene B: viable (growth > threshold)
- Double KO of A+B: lethal (growth < threshold)
Useful for:
- Drug combination targets
- Genetic interaction networks
- Backup pathway identification
'''
from cobra.flux_analysis import single_gene_deletion, double_gene_deletion
if genes is None:
genes = [g.id for g in model.genes]
# Single deletions
single = single_gene_deletion(model, gene_list=genes)
viable_singles = single[single['growth'] > growth_threshold]
viable_genes = [list(ids)[0] for ids in viable_singles['ids']]
# Double deletions (only for viable single KOs)
double = double_gene_deletion(model, gene_list1=viable_genes,
gene_list2=viable_genes)
# Find synthetic lethal pairs
sl_pairs = []
for _, row in double.iterrows():
genes_in_pair = list(row['ids'])
if len(genes_in_pair) == 2 and row['growth'] < growth_threshold:
sl_pairs.append({
'gene1': genes_in_pair[0],
'gene2': genes_in_pair[1],
'double_ko_growth': row['growth']
})
return sl_pairsCondition-Specific Essentiality
def compare_essentiality_conditions(model, conditions):
'''Compare gene essentiality across conditions
Args:
conditions: dict mapping condition name to media setup function
Example:
conditions = {
'aerobic': lambda m: m.reactions.EX_o2_e.lower_bound = -20,
'anaerobic': lambda m: m.reactions.EX_o2_e.lower_bound = 0
}
'''
from cobra.flux_analysis import single_gene_deletion
essentiality_by_condition = {}
for condition_name, setup_func in conditions.items():
with model:
setup_func(model)
results = single_gene_deletion(model)
essential = set(list(ids)[0] for ids in
results[results['growth'] < 0.01]['ids'])
essentiality_by_condition[condition_name] = essential
# Find condition-specific essential genes
all_essential = set.union(*essentiality_by_condition.values())
core_essential = set.intersection(*essentiality_by_condition.values())
condition_specific = {cond: ess - core_essential
for cond, ess in essentiality_by_condition.items()}
return {
'core_essential': core_essential,
'condition_specific': condition_specific,
'total_essential': len(all_essential)
}Robustness Analysis
def gene_robustness_analysis(model, gene_id, flux_levels=10):
'''Analyze growth as function of gene expression level
Instead of complete knockout, simulate reduced expression
by constraining reactions associated with the gene.
'''
from cobra.flux_analysis import flux_variability_analysis
gene = model.genes.get_by_id(gene_id)
# Get reactions associated with this gene
rxns = list(gene.reactions)
results = []
for level in [i/flux_levels for i in range(flux_levels + 1)]:
with model:
for rxn in rxns:
# Get FVA bounds at wild-type
fva = flux_variability_analysis(model, reaction_list=[rxn])
max_flux = fva.loc[rxn.id, 'maximum']
min_flux = fva.loc[rxn.id, 'minimum']
# Constrain to fraction of wild-type
rxn.upper_bound = max_flux * level
rxn.lower_bound = min_flux * level
sol = model.optimize()
results.append({
'expression_level': level,
'growth': sol.objective_value
})
return resultsRelated Skills
- systems-biology/flux-balance-analysis - Base FBA methods
- pathway-analysis/go-enrichment - Enrich essential gene sets
- clinical-databases/variant-prioritization - Link to disease genes
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

