brainstorming
Structured design dialogue that validates ideas before implementation begins.
genomics
Genomics and transcriptomics analysis strategies
Full skill instructions
RNA-seq counts:
Microarray intensities:
Single-cell RNA-seq:
Human genes:
Mouse genes:
Protein names:
Always verify gene symbols - aliases and outdated names are common.
import pandas as pd
import numpy as np
from scipy.stats import ttest_ind
from statsmodels.stats.multitest import multipletests
# Load expression data (genes × samples)
# Rows = genes, Columns = samples
expr_data = pd.read_csv("expression_data.csv", index_col=0)
# Define groups
group1_samples = ["Sample1", "Sample2", "Sample3"]
group2_samples = ["Sample4", "Sample5", "Sample6"]
results = []
for gene in expr_data.index:
group1_expr = expr_data.loc[gene, group1_samples]
group2_expr = expr_data.loc[gene, group2_samples]
# T-test
t_stat, p_value = ttest_ind(group1_expr, group2_expr)
# Fold change
mean1 = group1_expr.mean()
mean2 = group2_expr.mean()
log2fc = np.log2(mean1 / mean2) if mean2 > 0 else np.nan
results.append({
"gene": gene,
"log2FC": log2fc,
"p_value": p_value,
"mean_group1": mean1,
"mean_group2": mean2
})
results_df = pd.DataFrame(results)
# Multiple testing correction
results_df["p_adj"] = multipletests(results_df["p_value"], method="fdr_bh")[1]
# Define significant genes
significant = results_df[
(results_df["p_adj"] < 0.05) &
(abs(results_df["log2FC"]) > 1) # 2-fold change
]
print(f"Significant genes: {len(significant)}")
print(f"Upregulated: {sum(significant['log2FC'] > 0)}")
print(f"Downregulated: {sum(significant['log2FC'] < 0)}")
Visualize differential expression:
import matplotlib.pyplot as plt
plt.figure(figsize=(8, 6))
plt.scatter(
results_df["log2FC"],
-np.log10(results_df["p_adj"]),
alpha=0.5, s=10, c="gray"
)
# Highlight significant genes
sig_mask = (results_df["p_adj"] < 0.05) & (abs(results_df["log2FC"]) > 1)
plt.scatter(
results_df.loc[sig_mask, "log2FC"],
-np.log10(results_df.loc[sig_mask, "p_adj"]),
alpha=0.7, s=20, c="red", label="Significant"
)
plt.xlabel("log2 Fold Change")
plt.ylabel("-log10(adjusted p-value)")
plt.axhline(-np.log10(0.05), linestyle="--", color="black", linewidth=0.5)
plt.axvline(-1, linestyle="--", color="black", linewidth=0.5)
plt.axvline(1, linestyle="--", color="black", linewidth=0.5)
plt.title("Volcano Plot")
plt.legend()
plt.savefig("volcano_plot.png", dpi=300)
When: You have a list of significant genes and want to know which pathways are affected
# Define gene sets (pathways)
gene_sets = {
"Cell Cycle": ["TP53", "CDK1", "CCNB1", "CDC20", ...],
"Apoptosis": ["TP53", "BAX", "BCL2", "CASP3", ...],
"DNA Repair": ["TP53", "BRCA1", "BRCA2", "ATM", ...],
# ... more pathways
}
# Fisher's exact test for enrichment
from scipy.stats import fisher_exact
all_genes = set(expr_data.index)
sig_genes = set(significant["gene"])
enrichment_results = []
for pathway, pathway_genes in gene_sets.items():
pathway_genes = set(pathway_genes) & all_genes # Only genes in dataset
# 2x2 contingency table
a = len(sig_genes & pathway_genes) # Sig & in pathway
b = len(sig_genes - pathway_genes) # Sig & not in pathway
c = len(pathway_genes - sig_genes) # Not sig & in pathway
d = len(all_genes - sig_genes - pathway_genes) # Not sig & not in pathway
oddsratio, p_value = fisher_exact([[a, b], [c, d]], alternative='greater')
enrichment_results.append({
"pathway": pathway,
"overlap": a,
"pathway_size": len(pathway_genes),
"odds_ratio": oddsratio,
"p_value": p_value
})
enrich_df = pd.DataFrame(enrichment_results)
enrich_df["p_adj"] = multipletests(enrich_df["p_value"], method="fdr_bh")[1]
enrich_df = enrich_df.sort_values("p_adj")
print(enrich_df.head(10))
Common GO categories:
Resources:
KEGG = Kyoto Encyclopedia of Genes and Genomes
Provides curated pathway maps for:
Example pathways:
Observation: Many genes upregulated
Hypothesis: Shared transcription factor (TF)
Test:
# Check if significant genes share TF binding motifs
tf_targets = {
"TP53": ["BAX", "CDKN1A", "MDM2", "GADD45A", ...],
"MYC": ["CDK4", "CCND1", "E2F1", ...],
# ... more TFs
}
# Test for enrichment (same as pathway enrichment)
Interpretation: Enrichment suggests TF is active/inactive in condition
Observation: Genes in same pathway all up/down together
Interpretation: Pathway-level regulation (not individual genes)
Example:
All glycolysis genes ↑↑ → Increased glycolysis
All oxidative phosphorylation genes ↓↓ → Metabolic shift
Observation: Opposite regulation of related pathways
Example:
De novo biosynthesis genes ↓
Salvage pathway genes ↑
→ Metabolic switch to energy-efficient salvage
When: Identify genes that change together
from scipy.stats import pearsonr
# Compute pairwise correlations
genes = significant["gene"].tolist()[:50] # Top 50 for tractability
corr_matrix = expr_data.loc[genes].T.corr()
# Filter high correlations
high_corr = []
for i in range(len(genes)):
for j in range(i+1, len(genes)):
if abs(corr_matrix.iloc[i, j]) > 0.8:
high_corr.append({
"gene1": genes[i],
"gene2": genes[j],
"correlation": corr_matrix.iloc[i, j]
})
print(f"High correlations (|r| > 0.8): {len(high_corr)}")
Interpretation:
import networkx as nx
# Build network
G = nx.Graph()
for item in high_corr:
G.add_edge(item["gene1"], item["gene2"], weight=abs(item["correlation"]))
# Find communities (clusters of co-expressed genes)
from networkx.algorithms import community
communities = community.greedy_modularity_communities(G)
for i, comm in enumerate(communities):
print(f"Community {i}: {list(comm)}")
For gene function:
"[GENE] function"
"[GENE] role in [PROCESS]"
"[GENE] knockout phenotype"
For pathway context:
"[GENE] pathway"
"[GENE] interacting proteins"
"[GENE] regulation"
For disease relevance:
"[GENE] [DISEASE]"
"[GENE] mutation [DISEASE]"
H1: Transcriptional Regulation
"Condition X activates transcription factor [TF], upregulating
target genes [G1, G2, G3] in pathway [P]"
H2: Pathway Activation
"Condition X activates [pathway], evidenced by coordinated
upregulation of pathway genes and increased activity signature"
H3: Epigenetic Regulation
"Condition X alters chromatin state at [locus], changing
expression of genes [G1, G2]"
H4: Post-transcriptional Regulation
"MicroRNA [miR] is upregulated, suppressing target genes [G1, G2],
explaining decreased protein levels despite unchanged mRNA"
Before interpreting results:
❌ Ignoring log transformation
❌ Using nominal p-values for many genes
❌ Overinterpreting small fold changes
❌ Confusing gene expression with protein activity
❌ Cherry-picking genes
Strategy:
1. Identify differentially expressed metabolic enzymes
2. Map to KEGG pathways
3. Check if corresponding metabolites are changed
4. Build integrated metabolic model
Example:
Gene: PHGDH (phosphoglycerate dehydrogenase) ↑
Metabolite: Serine ↑
→ Integrated finding: Increased serine biosynthesis
Compare mRNA vs protein changes:
Gene expression is the messenger, not the message.
mRNA changes indicate potential for protein changes. Always consider:
Connect expression changes to phenotype through pathways and functional validation.
Structured design dialogue that validates ideas before implementation begins.
Comprehensive design intelligence for web and mobile UI/UX across 10 technology stacks.
Comprehensive implementation plans for multi-step tasks, breaking down specs into bite-sized, testable steps.
Introduction to the obra skills system with mandatory skill invocation rules and best practices.
Execute a written implementation plan with critical review and task checkpoints.
Delegate independent tasks to specialized agents working concurrently with isolated context.
Isolated git worktrees with smart directory selection and safety verification.
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
Plan searchable and shareable content that drives traffic, builds authority, and generates leads.
README-first repository scanner that extracts commands and classifies reproduction candidates without executing them.
Brainstorm and prioritize marketing strategies tailored to your SaaS stage, budget, and goals.
Plan and optimize your website's page hierarchy, navigation, URL structure, and internal linking.
The world's fastest calendar for remote work
Capture, organize, and utilize your knowledge effortlessly.
Instant Summaries of Audio & Video Interviews with AnySummary
Transform PDFs into engaging mind maps.
Chat with any PDF instantly
Create an optimal daily plan using your voice
A productivity platform to centralize organizational knowledge and workflows with contextual AI assistance.
AskYourPDF Pricing Plans: Tailored to Your Needs