mirror of
https://github.com/K-Dense-AI/scientific-agent-skills.git
synced 2026-12-06 19:44:01 +08:00
feat(skills): onekgpd v1.1: retargets the Dnaerys Client v0.2.0 required for the latest KGP live database
This commit is contained in:
1 parent
4d97e293dc
commit
1e2f2dcca8
3 files changed
+37
-24
No files matched your search
+10
-5
@@ -13,7 +13,7 @@ description: >
|
||||
license: MIT
|
||||
compatibility: Requires Python >=3.12. Variant and sample queries require outbound network access to the public 1000 Genomes query endpoint over TLS; the sample/population metadata commands run fully offline over a data file bundled in the skill. No credentials, API keys, or environment variables are used.
|
||||
allowed-tools: Write Bash
|
||||
metadata: {"version": "1.0", "skill-author": "Dnaerys"}
|
||||
metadata: {"version": "1.1", "skill-author": "Dnaerys"}
|
||||
---
|
||||
|
||||
# OneKGPd: Individual-Level Queries over the 1000 Genomes Project
|
||||
@@ -183,6 +183,9 @@ filtering is not necessarily echoed back on the returned variant.
|
||||
> `--gnomad-exomes-af-gt 0` selects variants that *are* in gnomAD exomes; a
|
||||
> returned `gnomad_exomes_af` of `0.0` means the variant is absent from gnomAD
|
||||
> exomes. The same convention for gnomAD genomes AF.
|
||||
> Conversely, `--gnomad-exomes-af-lt` / `--gnomad-genomes-af-lt` bounds **include**
|
||||
unannotated variants: "AF < X in gnomAD" includes variants with gnomAD AF = 0,
|
||||
i.e. unannotated; pair it with `--gnomad-*-af-gt 0` to require presence in gnomAD.
|
||||
|
||||
> [!NOTE]
|
||||
> `am_score` of `0.0` means not scored or not annotated by AlphaMissense - it does not mean `benign`.
|
||||
@@ -230,7 +233,7 @@ The full per-flag tables live in
|
||||
|
||||
- `count-variants` — count variants in a region, cohort-wide.
|
||||
- `select-variants` — select variants in a region, cohort-wide. Use `--limit N`
|
||||
(hard cap, default 1000) **or** `--page-size N` (retrieve the full set in
|
||||
(hard cap, default 200) **or** `--page-size N` (retrieve the full set in
|
||||
pages); the two are mutually exclusive. The summary flags `truncated` when
|
||||
the cap is reached.
|
||||
- `count-variants-in-samples` — as `count-variants`, restricted to
|
||||
@@ -238,9 +241,11 @@ The full per-flag tables live in
|
||||
- `select-variants-in-samples` — as `select-variants`, restricted to
|
||||
`--samples NAME1,NAME2,...` (required).
|
||||
|
||||
Each returned variant carries these 19 keys: `chr`, `start`, `end`, `ref`,
|
||||
`alt`, `af`, `ac`, `an`, `homc`, `hetc`, `misc`, `homfc`, `hetfc`, `misfc`,
|
||||
`gnomad_exomes_af`, `gnomad_genomes_af`, `am_score`, `amino_acids`, `biallelic`.
|
||||
Each returned variant carries these 22 keys: `chr`, `start`, `end`, `ref`,
|
||||
`alt`, `af`, `ac`, `an`, `hom_samples`, `het_samples`, `mis_samples`,
|
||||
`hom_samples_fx`, `het_samples_fx`, `mis_samples_fx`, `hom_samples_mxy`,
|
||||
`het_samples_mxy`, `mis_samples_mxy`, `gnomad_exomes_af`, `gnomad_genomes_af`,
|
||||
`am_score`, `amino_acids`, `biallelic`.
|
||||
ClinVar significance and VEP consequence are filter criteria only and are not
|
||||
returned. Full schema:
|
||||
[references/onekgpd_commands.md](references/onekgpd_commands.md).
|
||||
|
||||
@@ -71,6 +71,10 @@ Mutual exclusions enforced: `--biallelic-only`/`--multiallelic-only`,
|
||||
AlphaMissense score bounds. Setting a `*-gt` ≥ its matching `*-lt` defines an
|
||||
empty range and returns nothing.
|
||||
|
||||
The `--gnomad-exomes-af-lt` / `--gnomad-genomes-af-lt` bounds **include** unannotated
|
||||
variants: "AF < X in gnomAD" includes variants with gnomAD AF = 0, i.e. unannotated;
|
||||
pair it with `--gnomad-*-af-gt 0` to require presence in gnomAD.
|
||||
|
||||
---
|
||||
|
||||
## Commands
|
||||
@@ -183,19 +187,22 @@ and VEP consequence are **not** echoed back on a returned variant):
|
||||
| `end` | int | 1-based inclusive end. |
|
||||
| `ref` | str | Reference allele. |
|
||||
| `alt` | str | Alternate allele. |
|
||||
| `af` | float | 1000 Genomes dataset allele frequency. |
|
||||
| `ac` | float | Dataset allele count (0.5 for male non-PAR het calls on sex chromosomes). |
|
||||
| `af` | float | Dataset allele frequency. |
|
||||
| `ac` | float | Dataset allele count (0.5 for male non-PAR het calls on on X and Y chromosomes). |
|
||||
| `an` | int | Dataset allele number. |
|
||||
| `homc` | int | Homozygous allele count. |
|
||||
| `hetc` | int | Heterozygous allele count. |
|
||||
| `misc` | int | Missing (no-call) allele count. |
|
||||
| `homfc` | int | Female homozygous count (sex chromosomes). |
|
||||
| `hetfc` | int | Female heterozygous count (sex chromosomes). |
|
||||
| `misfc` | int | Female missing count (sex chromosomes). |
|
||||
| `hom_samples` | int | Number of all samples with a homozygous genotype. |
|
||||
| `het_samples` | int | Number of all samples with a heterozygous genotype. |
|
||||
| `mis_samples` | int | Number of all samples with a missing (no-call) genotype. |
|
||||
| `hom_samples_fx` | int | Number of female samples with a homozygous genotype, X chromosome only (0 outside X). |
|
||||
| `het_samples_fx` | int | Number of female samples with a heterozygous genotype, X chromosome only (0 outside X). |
|
||||
| `mis_samples_fx` | int | Number of female samples with a missing (no-call) genotype, X chromosome only (0 outside X). |
|
||||
| `hom_samples_mxy` | int | Number of male samples with a homozygous genotype, X & Y chromosomes only (0 outside X and Y). |
|
||||
| `het_samples_mxy` | int | Number of male samples with a heterozygous genotype, X & Y chromosomes only (0 outside X and Y). |
|
||||
| `mis_samples_mxy` | int | Number of male samples with a missing (no-call) genotype, X & Y chromosomes only (0 outside X and Y). |
|
||||
| `gnomad_exomes_af` | float | gnomAD v4.1 exomes AF. `0.0` = absent from gnomAD exomes. |
|
||||
| `gnomad_genomes_af` | float | gnomAD v4.1 genomes AF. `0.0` = absent from gnomAD genomes. |
|
||||
| `am_score` | float | AlphaMissense score. `0.0` = not annotated. |
|
||||
| `amino_acids` | str | Amino-acid substitution (HGVSp / VEP `Amino_acids`). |
|
||||
| `amino_acids` | str | HGVSp Amino-acid substitution. |
|
||||
| `biallelic` | bool | Whether the site was biallelic in the input VCFs. |
|
||||
|
||||
---
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# /// script
|
||||
# requires-python = ">=3.12"
|
||||
# dependencies = ["dnaerys"]
|
||||
# dependencies = ["dnaerys>=0.2.0,<0.3.0"]
|
||||
# ///
|
||||
"""OneKGPd — individual-level queries over the 1000 Genomes Project.
|
||||
|
||||
@@ -50,7 +50,6 @@ from dnaerys import (
|
||||
|
||||
DEFAULT_ENDPOINT = "db.dnaerys.org:443" # public 1000 Genomes instance (fixed)
|
||||
DEFAULT_VARIANT_LIMIT = 200 # hard cap when neither --limit nor --page-size given
|
||||
DEFAULT_BUFFER_SIZE = 5000 # paginate_variants buffer (matches client default)
|
||||
MAX_RETRIES = 3 # bounded retry attempts on retryable errors
|
||||
RETRY_BASE_DELAY = 1.0 # seconds; exponential backoff: 1, 2, ...
|
||||
PREVIEW_ROWS = 10 # rows shown in a stdout summary preview
|
||||
@@ -226,7 +225,7 @@ def _build_annotation_filter(args) -> AnnotationFilter | None:
|
||||
|
||||
def _chr_to_str(chrom) -> str:
|
||||
"""Render a ``Chromosome`` enum as ``chr17`` / ``chrX`` / ``chrMT``."""
|
||||
return "chr" + chrom.name[len("CHR_"):]
|
||||
return "chr" + chrom.name[len("CHR"):]
|
||||
|
||||
|
||||
def _region_one_label(r: Region) -> str:
|
||||
@@ -258,12 +257,15 @@ def _variant_to_dict(v) -> dict:
|
||||
"af": v.af,
|
||||
"ac": v.ac,
|
||||
"an": v.an,
|
||||
"homc": v.homc,
|
||||
"hetc": v.hetc,
|
||||
"misc": v.misc,
|
||||
"homfc": v.homfc,
|
||||
"hetfc": v.hetfc,
|
||||
"misfc": v.misfc,
|
||||
"hom_samples": v.hom_samples,
|
||||
"het_samples": v.het_samples,
|
||||
"mis_samples": v.mis_samples,
|
||||
"hom_samples_fx": v.hom_samples_fx,
|
||||
"het_samples_fx": v.het_samples_fx,
|
||||
"mis_samples_fx": v.mis_samples_fx,
|
||||
"hom_samples_mxy": v.hom_samples_mxy,
|
||||
"het_samples_mxy": v.het_samples_mxy,
|
||||
"mis_samples_mxy": v.mis_samples_mxy,
|
||||
"gnomad_exomes_af": v.gnomad_exomes_af,
|
||||
"gnomad_genomes_af": v.gnomad_genomes_af,
|
||||
"am_score": v.am_score,
|
||||
@@ -367,7 +369,6 @@ def _run_select_variants(args, samples: list[str] | None) -> None:
|
||||
if page_size is not None:
|
||||
pq = client.paginate_variants(
|
||||
page_size=page_size,
|
||||
buffer_size=DEFAULT_BUFFER_SIZE,
|
||||
region=region,
|
||||
regions=regions,
|
||||
samples=samples,
|
||||
|
||||
Reference in new issue
Block a user