Agent skill

Bio Causal Genomics Mediation Analysis

by aipoch in aipoch/medical-research-skills

Decompose genetic effects into direct and indirect paths through mediating variables using the mediation R package.

MITAuto-check passedResearch & Science

Install Bio Causal Genomics Mediation Analysis

skills CLI
$ npx skills add aipoch/medical-research-skills --skill bio-causal-genomics-mediation-analysis -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install aipoch/medical-research-skills bio-causal-genomics-mediation-analysis --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/aipoch/medical-research-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/'scientific-skills/Data Analysis/bio-causal-genomics-mediation-analysis' .claude/skills/bio-causal-genomics-mediation-analysis && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
bio-causal-genomics-mediation-analysis
GitHub stars
1.9k
Used in
1 other repo
Token cost
~2.6k tokens
SKILL.md length
418 words
Files
4
Skills in repo
578
Repo updated
First seen
Licence
MIT

At a glance

Decompose genetic effects into direct and indirect paths through mediating variables using the mediation R package.

  • Testing whether a molecular..
  • SKILL.md covers Version Compatibility, Framework, Basic Mediation with the… and Interpreting Results, plus 7 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Tasks that involve Dispute resolution

What it does

Bio Causal Genomics Mediation Analysis is an agent skill from aipoch/medical-research-skills. Decompose genetic effects into direct and indirect paths through mediating variables using the mediation R package. Tests whether gene expression, methylation, or other molecular phenotypes mediate the effect of genetic variants on disease. Use when testing whether a molecular...

Its SKILL.md is about 2.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files (for example `POLISH_CHANGELOG.md`, `eval_report_bio-causal-genomics-mediation-analysis_result.json` and `usage-guide.md`).

It sits in Research & Science, covering Dispute resolution and Bioinformatics. The repository describes itself as: Hundreds of agent skills for medical research, including protocol design, data analysis, evidence insights, and academic writing. The licence is MIT.

When your agent uses it

  • Testing whether a molecular..
  • Tasks that involve Dispute resolution
  • Tasks that involve Bioinformatics

Example prompts

  • “/bio-causal-genomics-mediation-analysis”

What it can do on your machine

Read from SKILL.md and the folder at commit 686e09d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are r).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Bio Causal Genomics Mediation Analysis loads about 2.6k tokens when it runs. Until then it costs about 80 tokens; SKILL.md has 418 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~80
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from aipoch/medical-research-skills at commit 686e09d, republished under its MIT licence (© aipoch). 418 words, ~2,578 tokens.

Download SKILL.mdSave it as .claude/skills/bio-causal-genomics-mediation-analysis/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
bio-causal-genomics-mediation-analysis
description
Decompose genetic effects into direct and indirect paths through mediating variables using the mediation R package. Tests whether gene expression, methylation, or other molecular phenotypes mediate the effect of genetic variants on disease. Use when testing whether a molecular...
license
MIT
author
AIPOCH

Source: https://github.com/aipoch/medical-research-skills

Version Compatibility

Reference examples tested with: R stats (base), ggplot2 3.5+

Before using code patterns, verify installed versions match. If versions differ:

  • R: packageVersion('<pkg>') then ?function_name to verify parameters

If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.

Mediation Analysis

"Test whether gene expression mediates the effect of this variant on disease" → Decompose the total genetic effect into direct and indirect (mediated) paths through a molecular phenotype, estimating ACME, ADE, and proportion mediated with bootstrap confidence intervals.

  • R: mediation::mediate() for causal mediation analysis

Framework

Causal mediation decomposes the total effect of a treatment (genotype) on an outcome (phenotype) into:

  • ACME (Average Causal Mediation Effect) - Indirect effect through the mediator
  • ADE (Average Direct Effect) - Direct effect not through the mediator
  • Total effect = ACME + ADE
  • Proportion mediated = ACME / Total effect

Typical genomic applications:

  • SNP -> gene expression (mediator) -> disease
  • SNP -> DNA methylation (mediator) -> gene expression
  • SNP -> protein levels (mediator) -> clinical outcome

Basic Mediation with the mediation Package

Goal: Decompose a genetic effect into direct and indirect (mediated) paths through a molecular phenotype.

Approach: Fit separate models for mediator and outcome, then run mediate() with bootstrap to estimate ACME (indirect), ADE (direct), and proportion mediated.

r
library(mediation)

# --- Step 1: Fit mediator model ---
# How does the treatment (genotype) affect the mediator (expression)?
mediator_model <- lm(expression ~ genotype + age + sex + pc1 + pc2, data = dat)

# --- Step 2: Fit outcome model ---
# How do treatment and mediator jointly affect the outcome?
# For binary outcome, use glm with family = binomial
outcome_model <- glm(
  disease ~ genotype + expression + age + sex + pc1 + pc2,
  data = dat, family = binomial
)

# --- Step 3: Run mediation analysis ---
# treat: name of treatment variable (genotype)
# mediator: name of mediator variable (expression)
# boot = TRUE: Use nonparametric bootstrap for CIs
# sims: Number of bootstrap simulations (1000 minimum for publication)
med_result <- mediate(
  mediator_model, outcome_model,
  treat = 'genotype', mediator = 'expression',
  boot = TRUE, sims = 1000
)

summary(med_result)
# Key outputs:
# ACME: Indirect effect (through expression)
# ADE: Direct effect (not through expression)
# Total Effect: ACME + ADE
# Prop. Mediated: ACME / Total

Interpreting Results

r
# Extract key quantities
acme <- med_result$d0           # Indirect (mediated) effect
acme_ci <- med_result$d0.ci     # 95% CI for ACME
ade <- med_result$z0            # Direct effect
total <- med_result$tau.coef    # Total effect
prop_med <- med_result$n0       # Proportion mediated

cat('ACME (indirect):', round(acme, 4), '\n')
cat('ACME 95% CI:', round(acme_ci[1], 4), 'to', round(acme_ci[2], 4), '\n')
cat('ADE (direct):', round(ade, 4), '\n')
cat('Total effect:', round(total, 4), '\n')
cat('Proportion mediated:', round(prop_med, 3), '\n')

# Significant ACME (CI excludes 0): Evidence for mediation
# Proportion mediated > 0.2: Meaningful mediation
# Proportion mediated > 0.8: Mediator explains most of the effect

eQTL Mediation

Goal: Test whether gene expression mediates the effect of an eQTL on a disease outcome across multiple genes.

Approach: Wrap the mediation workflow in a function, loop over candidate genes, and adjust p-values for multiple testing.

r
library(mediation)

run_eqtl_mediation <- function(dat, snp_col, expr_col, outcome_col, covariates) {
  covar_formula <- paste(covariates, collapse = ' + ')

  med_formula <- as.formula(paste(expr_col, '~', snp_col, '+', covar_formula))
  out_formula <- as.formula(paste(outcome_col, '~', snp_col, '+', expr_col, '+', covar_formula))

  med_model <- lm(med_formula, data = dat)

  if (length(unique(dat[[outcome_col]])) == 2) {
    out_model <- glm(out_formula, data = dat, family = binomial)
  } else {
    out_model <- lm(out_formula, data = dat)
  }

  result <- mediate(
    med_model, out_model,
    treat = snp_col, mediator = expr_col,
    boot = TRUE, sims = 1000
  )

  data.frame(
    snp = snp_col, gene = expr_col,
    acme = result$d0, acme_p = result$d0.p,
    ade = result$z0, ade_p = result$z0.p,
    total = result$tau.coef, total_p = result$tau.p,
    prop_mediated = result$n0
  )
}

# Example: test mediation for multiple genes
genes <- c('GENE_A', 'GENE_B', 'GENE_C')
covars <- c('age', 'sex', 'pc1', 'pc2', 'pc3')

mediation_results <- do.call(rbind, lapply(genes, function(g) {
  run_eqtl_mediation(dat, 'rs12345', g, 'disease_status', covars)
}))

# Adjust for multiple testing
mediation_results$acme_fdr <- p.adjust(mediation_results$acme_p, method = 'BH')
Show full SKILL.md (171 more words)Show less

Multi-Omics Mediation

Goal: Test cascading mediation chains across multiple molecular layers (e.g., SNP -> methylation -> expression -> disease).

Approach: Fit sequential models for each link in the chain and run separate mediation analyses for each mediator-outcome pair.

r
# Test mediation chains: SNP -> methylation -> expression -> disease
library(mediation)

# Step 1: SNP -> methylation
mod_meth <- lm(methylation ~ genotype + age + sex, data = dat)

# Step 2: methylation -> expression (controlling for genotype)
mod_expr <- lm(expression ~ methylation + genotype + age + sex, data = dat)

# Step 3: expression -> disease (controlling for methylation and genotype)
mod_disease <- glm(
  disease ~ expression + methylation + genotype + age + sex,
  data = dat, family = binomial
)

# Test methylation as mediator of SNP -> expression
med_meth_expr <- mediate(mod_meth, mod_expr, treat = 'genotype', mediator = 'methylation',
                         boot = TRUE, sims = 1000)

# Test expression as mediator of methylation -> disease
med_expr_disease <- mediate(mod_expr, mod_disease, treat = 'methylation', mediator = 'expression',
                            boot = TRUE, sims = 1000)

High-Dimensional Mediation (HDMA)

Goal: Test thousands of potential mediators simultaneously (e.g., all CpG sites) to identify which mediate a genetic effect.

Approach: Use HIMA's penalized regression to jointly select significant mediators from a high-dimensional mediator matrix and estimate their indirect effects.

r
# For testing many potential mediators simultaneously (e.g., all CpG sites)
# install.packages('HIMA')
library(HIMA)

# X: treatment (genotype), M: high-dimensional mediators, Y: outcome
# HIMA uses penalized regression to select significant mediators

result <- hima(
  X = dat$genotype,
  Y = dat$disease,
  M = as.matrix(dat[, mediator_cols]),
  COV.XM = as.matrix(dat[, covariate_cols]),
  Y.family = 'binomial',
  M.family = 'gaussian',
  penalty = 'MCP'    # Minimax concave penalty (default)
)

# Results: significant mediators with estimated indirect effects
significant_mediators <- result[result$BH.FDR < 0.05, ]

Assumptions and Diagnostics

r
# --- Sequential ignorability assumption ---
# 1. No unmeasured confounders between treatment and mediator
# 2. No unmeasured confounders between mediator and outcome
# 3. No unmeasured confounders between treatment and outcome
# This assumption is UNTESTABLE but can be probed with sensitivity analysis

# --- Sensitivity analysis ---
# Tests how robust results are to unmeasured confounding
sens <- medsens(med_result, rho.by = 0.1, effect.type = 'indirect', sims = 1000)
summary(sens)

# rho: Correlation between residuals of mediator and outcome models
# At what rho does ACME cross zero? (larger |rho| = more robust)
# rho at which ACME = 0 is called the sensitivity parameter
# |rho| > 0.3: Reasonably robust to unmeasured confounding

plot(sens)

Visualization

r
library(ggplot2)

plot_mediation_diagram <- function(acme, ade, total, prop_med) {
  cat('Mediation Path Diagram:\n\n')
  cat('  Genotype ---[a]---> Mediator ---[b]---> Outcome\n')
  cat('      |                                     ^\n')
  cat('      +----------[c\' (ADE)]----------------+\n')
  cat('\n')
  cat('  Indirect (a*b = ACME):', round(acme, 4), '\n')
  cat('  Direct (c\' = ADE):', round(ade, 4), '\n')
  cat('  Total (c):', round(total, 4), '\n')
  cat('  Proportion mediated:', round(prop_med, 3), '\n')
}

plot_mediation_results <- function(results_df) {
  results_df$gene <- factor(results_df$gene, levels = results_df$gene[order(results_df$prop_mediated)])

  ggplot(results_df, aes(x = gene, y = prop_mediated)) +
    geom_col(fill = 'steelblue', alpha = 0.7) +
    geom_hline(yintercept = 0.2, linetype = 'dashed', color = 'red', alpha = 0.5) +
    coord_flip() +
    labs(x = NULL, y = 'Proportion Mediated', title = 'Mediation by Gene Expression') +
    theme_minimal()
}
  • mendelian-randomization - Causal inference using genetic instruments
  • colocalization-analysis - Test if signals share a causal variant
  • population-genetics/association-testing - GWAS for treatment-outcome associations
  • multi-omics-integration/mofa-integration - Multi-omics data for mediation chains

Input Validation

This skill accepts requests that match the documented purpose of bio-causal-genomics-mediation-analysis and include enough context to complete the workflow safely.

Do not continue the workflow when the request is out of scope, missing a critical input, or would require unsupported assumptions. Instead respond:

bio-causal-genomics-mediation-analysis only handles its documented workflow. Please provide the missing required inputs or switch to a more suitable skill.

© aipoch, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files in scientific-skills/Data Analysis/bio-causal-genomics-mediation-analysis of aipoch/medical-research-skills.

  • SKILL.md
  • POLISH_CHANGELOG.md
  • eval_report_bio-causal-genomics-mediation-analysis_result.json
  • usage-guide.md

Open the folder on GitHubat commit 686e09d

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in aipoch/medical-research-skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Bio Causal Genomics Mediation Analysis next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Bio Causal Genomics Mediation Analysis compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Bio Causal Genomics Mediation Analysis this skillaipoch/medical-research-skills1.9k1 repos~2.6kAutomated safety check: PassMIT
Bio Causal Genomics Mediation AnalysisGPTomics/bioSkills1.2k2 repos~8.6kAutomated safety check: PassMIT
Bio Workflows Causal Genomics PipelineGPTomics/bioSkills1.2k2 repos~5.5kAutomated safety check: PassMIT
Bio Causal Genomics Mendelian RandomizationGPTomics/bioSkills1.2k2 repos~8.7kAutomated safety check: PassMIT
Multi AI Researchmajiayu000/spellbook287—~2kAutomated safety check: PassMIT
Alphagenome Single Variant Analysisgoogle-deepmind/science-skills3.2k2 repos~3kAutomated safety check: NotesApache-2.0

Similar skills

  • Decompose total effects into direct and indirect paths through mediators using mediation, CMAverse 4-way, HIMA/HIMA2 high-dimensional, BAMA, two-step / MVMR mediation, or double-ML medDML.

    1.2k GitHub starsUsed in 2 repos~8.6k tokens
    Research & ScienceAuto-check passed
  • End-to-end post-GWAS causal inference pipeline orchestrating heritability partitioning, genetic correlation, Mendelian randomization with CHP-aware sensitivity (CAUSE / LHC-MR), colocalization…

    1.2k GitHub starsUsed in 2 repos~5.5k tokens
    Research & ScienceAuto-check passed
  • Estimate causal effects of an exposure on an outcome from GWAS summary statistics using genetic instruments.

    1.2k GitHub starsUsed in 2 repos~8.7k tokens
    Research & ScienceAuto-check passed
  • Multi AI Research

    majiayu000/spellbook

    Parallel multi-AI cross-validation research workflow (大版本). An agent skill from majiayu000/spellbook.

    287 GitHub stars~2k tokensUpdated 3 days ago
    Research & ScienceAuto-check passed
  • Alphagenome Single Variant Analysis

    google-deepmind/science-skills

    Analyzes genetic variant effects on gene expression (RNA-seq), chromatin accessibility (DNASE), histone marks (ChIP), and transcription factors using the AlphaGenome API.

    3.2k GitHub starsUsed in 2 repos~3k tokens
    Research & ScienceAuto-check: notes
  • 13C Metabolic Flux Analysis

    K-Dense-AI/scientific-agent-skills

    Estimates reaction fluxes inside cells from steady-state carbon-13 labeling data with a bundled mfapy-based solver, and reports which fluxes the data pin down.

    48k GitHub starsUsed in 1 repo~3.2k tokens
    Research & ScienceAuto-check passed

More from aipoch/medical-research-skills

All 578 skills in this repo
  • Academic Poster Generator

    aipoch/medical-research-skills

    Complete workflow for generating academic research posters from PDF literature; use when you need to extract paper content from PDFs and produce a LaTeX-based poster…

    1.9k GitHub stars~2.2k tokensUpdated 24 days ago
    Auto-check passed
  • Diagnostic Study Quality Assessment Quadas

    aipoch/medical-research-skills

    Analyzes clinical diagnostic accuracy studies for bias using the QUADAS-2 tool.

    1.9k GitHub stars~1.4k tokensUpdated 24 days ago
    Auto-check passed
  • Exploratory Data Analysis

    aipoch/medical-research-skills

    Perform comprehensive exploratory data analysis on scientific data files across 200+ file formats.

    1.9k GitHub stars~3.7k tokensUpdated 24 days ago
    Auto-check passed
  • Iso Certification

    aipoch/medical-research-skills

    A toolkit for preparing ISO 13485:2016 certification documentation for medical device QMS.

    1.9k GitHub stars~1.8k tokensUpdated 24 days ago
    Auto-check passed
  • Journal Skills

    aipoch/medical-research-skills

    Recommends target journals for manuscript submission by analyzing the paper topic/abstract and the journal distribution of similar PubMed literature; use when users ask for journal…

    1.9k GitHub stars~1.7k tokensUpdated 24 days ago
    Auto-check passed
  • Latex Posters

    aipoch/medical-research-skills

    Creates academic-poster writing packages for LaTeX using beamerposter, tikzposter, or baposter.

    1.9k GitHub stars~1.3k tokensUpdated 24 days ago
    Auto-check passed

Questions about Bio Causal Genomics Mediation Analysis

What does Bio Causal Genomics Mediation Analysis do?

Decompose genetic effects into direct and indirect paths through mediating variables using the mediation R package. Bio Causal Genomics Mediation Analysis is an agent skill from aipoch/medical-research-skills. Decompose genetic effects into direct and indirect paths through mediating variables using the mediation R package.

When should I use Bio Causal Genomics Mediation Analysis?

Bio Causal Genomics Mediation Analysis fits situations like: testing whether a molecular.; tasks that involve Dispute resolution; tasks that involve Bioinformatics.

How do I install Bio Causal Genomics Mediation Analysis in Claude Code?

Run `npx skills add aipoch/medical-research-skills --skill bio-causal-genomics-mediation-analysis -a claude-code`. Or copy the skill folder (scientific-skills/Data Analysis/bio-causal-genomics-mediation-analysis in aipoch/medical-research-skills) into .claude/skills/bio-causal-genomics-mediation-analysis in your project. Claude Code loads it when a task matches its description.

How do I install Bio Causal Genomics Mediation Analysis in Codex?

Run `npx skills add aipoch/medical-research-skills --skill bio-causal-genomics-mediation-analysis -a codex`. Or copy the skill folder (scientific-skills/Data Analysis/bio-causal-genomics-mediation-analysis in aipoch/medical-research-skills) into .agents/skills/bio-causal-genomics-mediation-analysis in your project. Codex loads it when a task matches its description.

Can I use Bio Causal Genomics Mediation Analysis in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add aipoch/medical-research-skills --skill bio-causal-genomics-mediation-analysis -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/bio-causal-genomics-mediation-analysis, .gemini/skills/bio-causal-genomics-mediation-analysis, .github/skills/bio-causal-genomics-mediation-analysis and .opencode/skills/bio-causal-genomics-mediation-analysis in your project.

What does Bio Causal Genomics Mediation Analysis need to run?

SKILL.md names no scripts, command-line tools or credentials: Bio Causal Genomics Mediation Analysis is instructions for the agent only.

Does Bio Causal Genomics Mediation Analysis access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Bio Causal Genomics Mediation Analysis safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Bio Causal Genomics Mediation Analysis use?

Bio Causal Genomics Mediation Analysis is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Bio Causal Genomics Mediation Analysis use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Bio Causal Genomics Mediation Analysis?

Skills that share tags, products or a category with Bio Causal Genomics Mediation Analysis: Bio Causal Genomics Mediation Analysis (GPTomics/bioSkills, 1.2k stars), Bio Workflows Causal Genomics Pipeline (GPTomics/bioSkills, 1.2k stars), Bio Causal Genomics Mendelian Randomization (GPTomics/bioSkills, 1.2k stars) and Multi AI Research (majiayu000/spellbook, 287 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Bio Causal Genomics Mediation Analysis?

aipoch (a GitHub organization) maintains it in aipoch/medical-research-skills, which has 1,937 GitHub stars. The repository holds 578 skills in this directory. The repository was last updated on September 17, 2026.

Source: aipoch/medical-research-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.