Imaging Genetics Models Skill

SkillProductivity

Use this skill whenever the user needs imaging-genetics analysis: variant-imaging association scans, kinship-aware linear mixed models, polygenic or pathway scores, PLS/CCA links between genotype and imaging phenotypes, or audited PLINK2 command construction. Triggers include 'imaging genetics', 'GWAS', 'PLINK2', 'variant association', 'kinship', 'LMM', 'PRS', 'polygenic score', 'PLS', 'CCA', 'genotype imaging phenotype', and 'pathway score'.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Imaging Genetics Models Skill skill

What this skill tells your AI

The instructions your AI receives, as published by cuhk-aim-group/neuroclaw in skills/imaging-genetics-models/SKILL.md and read by ahel’s review.

Overview

imaging-genetics-models provides matrix-based association, polygenic scoring, and multivariate genotype-imaging analysis. It also builds explicit PLINK2 commands without embedding or redistributing the external executable.

Supported modes

ModeRequired arraysOutput
associationgenotype, phenotypecovariate-adjusted variant tests
lmmabove plus kinshipkinship-aware variant tests
prsgenotype, weightssubject polygenic score
plsX, Ypaired latent components
ccaX, Ycanonical variates

Population structure, ancestry, batch, age, sex, site, and relatedness must be handled before genetic effects are interpreted.


Installation

pip install numpy pandas scipy scikit-learn statsmodels joblib

For genome-wide command-line analyses, install PLINK2 separately and execute the generated command through NeuroClaw's audited shell workflow.


Workflows

1. Variant-imaging association

Create an NPZ bundle:

genotype:   [subjects, variants]
phenotype:  [subjects] or [subjects, phenotypes]
variant_id: [variants] (optional)
covariates: [subjects, covariates] (optional)
kinship:    [subjects, subjects] (required only for `lmm`)
python skills/imaging-genetics-models/scripts/train_reference.py \
  --input imaging_genetics.npz \
  --model association \
  --output-dir run_models_output/imaging_gwas

Use --model lmm when the bundle contains a kinship matrix.

2. Polygenic score

genotype:   [subjects, variants]
weights:    [variants]
subject_id: [subjects] (optional)
python skills/imaging-genetics-models/scripts/train_reference.py \
  --input prs_bundle.npz \
  --model prs \
  --output-dir run_models_output/prs

3. PLS or CCA

X: [subjects, genetic features]
Y: [subjects, imaging phenotypes]
python skills/imaging-genetics-models/scripts/train_reference.py \
  --input imaging_genetics.npz \
  --model cca \
  --components 3 \
  --output-dir run_models_output/cca

Fit dimensionality reduction and covariate residualization inside the training data when the analysis is evaluated predictively.


Input / Output Summary

ModeMain output
Association/LMMassociation_results.csv
PRSpredictions.csv with polygenic_score
PLS/CCApredictions.csv with paired component scores
PLS/CCA modelcheckpoint.joblib
All modesmetrics.json, config.json, run_manifest.json

Never split related individuals across train and test folds. Record genome build, allele orientation, QC thresholds, ancestry definition, and phenotype construction with every analysis.


Testing

pytest models/tests/test_extended_models.py -q
python skills/imaging-genetics-models/scripts/train_reference.py --help

Directory Reference

models/imaging_genetics/
├── association.py      association, LMM, and polygenic score utilities
├── multivariate.py     PLS and CCA
├── plink.py            audited PLINK2 command builder
└── train.py            matrix-analysis CLI

skills/imaging-genetics-models/
├── SKILL.md
└── scripts/train_reference.py

Reference

  • PLINK2 remains an external executable with independent installation terms.
  • Association outputs include effect estimates and multiplicity-ready P values.

Created At: 2026-07-26 HKT Last Updated At: 2026-07-29 HKT Author: chengwang96

Signals

GitHub stars
85
Forks
4
Last commit
Sep 2026

ahel review

  • K1binfo
    installs-packages

Automated review, not a security audit. Ruleset v1+k2.

Advanced
Catalog kind
skill
Gateway key
imaging-genetics-models
Source
github.com/cuhk-aim-group/neuroclaw