/hvantk:ancestry-inference <query MatrixTable> [--reference <labelled MatrixTable>] <output directory>from hvantk
Assigns continental ancestry to cohort samples using hvantk: builds a labelled reference MatrixTable from 1000 Genomes, runs PCA and random-forest pipeline as a Slurm job, and reads predictions with confidence scores.
Ships in hvantk. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Read the hvantk:workflow-conventions skill (skills/workflow-conventions/SKILL.md)
first; this skill assumes its site-profile rule, its section contract and its
measurement contract. Jobs run through hpc-hail-job.
Each query sample gets a predicted continental ancestry, a probability, and principal component coordinates, from a model trained on a reference whose samples carry known labels; the run also reports how many samples stayed unassigned below the confidence threshold and the cross-validated accuracy on the reference. The outcome is a Hail table and a TSV of predictions, a statistics file, and optionally an HTML report.
Use it with any reference that shares a genome build with the query; the common case is the 1000 Genomes high-coverage callset with its super-population labels, which this skill builds. Not this skill: fine-scale or admixed ancestry (the model assigns one label), relatedness, and sex inference.
source "$HVANTK_SITE_PROFILE" && bash "$HVANTK_REPO/skills/_site/check-site-profile.sh";
stop and ask for any missing value. Every later command that reads a profile value
starts with the same source "$HVANTK_SITE_PROFILE" &&.hpc-hail-job (commit, digest, run notes).(locus, alleles) with a GT entry (or LGT and
LA), on a known build. hvantk hgc outputs qualify. Note its build and sample count.super_pop in the 1000 Genomes build below). If there is none, build one
(section 3 step 1). A nested struct does not count as a column; flatten it.--min-shared-variants lowered deliberately, and
the result read with that in mind.source "$HVANTK_SITE_PROFILE" && bash "$HVANTK_REPO/skills/ancestry-inference/templates/ancestry-job.sh" \
--prepare --vcf "$HVANTK_WORK/raw/1kg/<chromosome vcf>" --samples-table "$HVANTK_WORK/raw/1kg/samples.ht" \
--out "$HVANTK_WORK/references/1kg_<build>.mt" --cpus 16 --mem-gb 120 --time 0-01:30:00 --name <run>-prepare --wait
templates/prepare-1kg-reference.py imports the VCF, keeps biallelic SNPs with a
minor allele frequency above a threshold, thins to a target count, joins the 1000
Genomes sample table (hvantk reprocess onek-genomes:samples builds it, downloading
the panel) and writes super_pop as a flat column. references/reference-panel.md
says where the public files are and how to combine chromosomes.source "$HVANTK_SITE_PROFILE" && bash "$HVANTK_REPO/skills/ancestry-inference/templates/ancestry-job.sh" \
--query "$HVANTK_WORK/callsets/<name>/<name>.mt" --reference "$HVANTK_WORK/references/1kg_<build>.mt" \
--out "$HVANTK_WORK/ancestry/<name>" --cpus 16 --mem-gb 64 --time 0-01:00:00 --name <run>-ancestry --wait
It runs hvantk ancestry-inference -q ... -r ... --ancestry-col super_pop -o <out>/predictions.ht --output-dir <out> --export-tsv --generate-report,
plus any pipeline flags you pass with --extra.<out>/pipeline_stats.json: n_shared_variants, n_variants_after_filter,
cv_accuracy, n_query_assigned, n_query_unassigned. references/reading-results.md
says what each means and when to distrust a run.<out>/predictions.tsv: s, predicted_ancestry, ancestry_probability,
the per-population probabilities and the PCs. A sample below the confidence
threshold carries the literal value unassigned; do not fill it in by hand.--skip-ld-pruning is for already-pruned inputs only.--n-pcs beyond 20 rarely helps at the continental level; --n-pcs-classify below
--n-pcs keeps the classifier on the informative components.--min-shared-variants lowered deliberately, and the
run notes say so.--ancestry-col
names it).--min-prob 0.75 with a reference that does not
cover the cohort's ancestry, or admixed samples. Fix: read the probabilities; lower
the threshold only with a reason written down; never force a label.cv_accuracy of 1.0 on real data. Cause: too few reference samples per population,
or a synthetic reference. Fix: at least ten samples per label, a real panel.RuntimeError about scikit-learn. Cause: running outside the image without the ml
extra. Fix: the image has it; jobs run inside it.<out>/predictions.ht/_SUCCESS and <out>/predictions.tsv exist; the TSV has the
s, predicted_ancestry and ancestry_probability columns, one row per query
sample (_ancestry_source is query) and, after them, the reference samples.<out>/pipeline_stats.json reports n_shared_variants at or above the minimum you
accepted, a cv_accuracy you believe (section 5), and n_query_assigned plus
n_query_unassigned summing to the query's sample count.eval/check.py (opens in a new tab)eval/control.sh (opens in a new tab)eval/prepare_eval.py (opens in a new tab)eval/reference.json (opens in a new tab)eval/stage.sh (opens in a new tab)eval/task.md (opens in a new tab)references/reading-results.md (opens in a new tab)references/reference-panel.md (opens in a new tab)templates/ancestry-job.sh (opens in a new tab)templates/prepare-1kg-reference.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
ancestry-inference, population-genetics, pca, random-forest, hail, slurm
13 skills in this plugin
/callset-subset-exportUse when a sample subset of a joint callset must be delivered as a verified VCF: subsetting the lossless VDS by sample list, densifying and exporting with hvantk, verifying header samples and record counts, writing checksums and a manifest, per contig for large callsets. Also when sample names in a list do not match the callset, when per-contig VCFs refuse to concatenate, or when a delivery must go to a read-only share./cohort-attach-burdenUse when turning a case/control cohort into a gene-level table hvantk can join and rank: running the gene burden test on a cleaned MatrixTable (hvantk cohort burden), writing or checking the cohort manifest (hvantk cohort validate), and attaching the cohort's gene table to the gene index or the composed annotation matrix (hvantk cohort attach) as Slurm jobs, or attaching a gene-level table you already have. Also when attach stops with "mapped ... below the required", "duplicate row(s) for gene key", "missing declared column(s)" or "needs --hgnc", or burden rejects multi-allelic rows or an undefined case/control field./dataset-build-at-scaleUse when building one or many hvantk datasets with hvantk reprocess on a Slurm cluster from staged raw files: raw-directory conventions, staging downloads on the login node, fanning independent builds out as one array job, verifying every output against its plugin's committed schema contract, and checking upstream drift before a build. Also when a build fails with "expected exactly one file matching", "requires data you supply yourself", an HTTP error on a compute node, or an output-extension error.npx claudepluginhub bigbio/hvantk --plugin hvantk