AGENT SKILL

genomics-vcf-operations

Load when summarising / filtering a VCF — variant classification (SNP / MNP / INS / DEL / COMPLEX), Ti/Tv ratio, QUAL / DP threshold filtering, INFO-field parsing. Skip when calling variants from BAM (run an external caller first); adding functional annotations (use genomics-variant-annotation).

License 许可
Apache-2.0
最近更新
2026-10-08
Stars
★ 161
Forks
27

01 前言 Front Matter

name
genomics-vcf-operations
tags
[ "genomics", "vcf", "bcftools", "filter", "ti-tv", "snv", "indel" ]
trigger
VCF, bcftools, variant filter, merge VCF
description
Load when summarising / filtering a VCF — variant classification (SNP / MNP / INS / DEL / COMPLEX), Ti/Tv ratio, QUAL / DP threshold filtering, INFO-field parsing. Skip when calling variants from BAM (run an external caller first); adding functional annotations (use genomics-variant-annotation).

02 资源文件 8

03 SKILL.md 正文

genomics-vcf-operations

When to use

Load this skill for the file-based analysis named in the description. The function library and CLI share the same calculations; no external aligner, assembler, caller or annotation service is started.

Use from a step

from skills._sdk.notebook import load_skill, read_input, write_output
library = load_skill("genomics-vcf-operations")
data = read_input("input.vcf", reader=library.read_records)
result = library.analyze(data)
write_output(result, "tables/result.csv")
write_output(library.distribution_figure(result), "figures/distribution.png")

Run examples/example_step.py through the step runner for a small, hand-worked synthetic fixture. It asserts known summary values. The reader materializes the input in memory; use bounded FASTQ reads or pre-filter large genomic files before loading them.

API

<!-- api:begin generated from _api.py; regenerate with run.py api <skill dir> --write -->

read_records(path: str | Path) -> pd.DataFrame

Read records through read_input(path, reader=library.read_records).

:param path: Input file in the format documented under Inputs and outputs.

:returns: Parsed records as a DataFrame. :raises ValueError: Input values or file structure cannot be parsed.

analyze(data: pd.DataFrame, *, min_qual: float=0.0, min_dp: int=0) -> pd.DataFrame

Compute vcf-operations summaries and return a new table, leaving data unchanged.

:param data: Records containing chrom, pos, ref, alt, qual, filter, dp, type. :param min_qual: CLI default 0 keeps all QUAL values; raise to filter. :param min_dp: CLI default 0 keeps all INFO/DP values; FORMAT/DP is ignored. :returns: Result table with diagnostics and summary in attrs['run_info']. :raises ValueError: Required columns are absent or records are empty or invalid.

run_info(data: pd.DataFrame, *, keep: bool=True) -> dict

Return analysis diagnostics and summary.

:param data: Result returned by analyze. :param keep: Keep diagnostics by default; the CLI passes False. :returns: Independent diagnostics dictionary. :raises ValueError: analyze has not populated diagnostics.

distribution_figure(data: pd.DataFrame)

Plot qual values without writing files.

:param data: Result table containing qual. :returns: Matplotlib Figure. :raises ValueError: The value column is absent or table is empty.

<!-- api:end -->

Methods and parameters

analyze returns a new DataFrame and leaves the input unchanged. run_info(result) returns the summary and method diagnostics. The CLI passes keep=False so diagnostics do not enter output tables. All calculations are deterministic; synthetic CLI demos retain seed 42.

Gotchas

  • analyze filters INFO/DP, not per-sample FORMAT/DP. Missing INFO/DP is treated as zero; each ALT becomes one row.
  • read_records preserves VCF header lines in attrs["vcf_headers"]. The legacy CLI filtered.vcf retains DP only and replaces sample genotypes with missing values; do not use it for genotype-preserving filtering.
  • analyze raises ValueError when no records pass filters, instead of the old CLI failing later with a missing summary key.

Inputs and outputs

Input files:

  • File types: .vcf
  • VCF structure: ##fileformat; columns: #CHROM, POS, ID, REF, ALT, QUAL, FILTER, INFO

CLI output files:

  • tables/variants.csv
  • filtered.vcf
  • report.md
  • result.json
  • Produces artifact genomics.filtered_variants as filtered.vcf (vcf)

The library writes no files. Steps use write_output; the CLI owns the listed artifacts. Public figure functions return matplotlib Figures and do not add new CLI outputs.

CLI

python skills/genomics/genomics-vcf-operations/genomics_vcf_operations.py --input input_file --output results/
python skills/genomics/genomics-vcf-operations/genomics_vcf_operations.py --demo --output /tmp/genomics_vcf_operations_demo

See also

  • references/parameters.md
  • references/methodology.md
  • references/output_contract.md

Dependencies

numpy, pandas, matplotlib

04 同仓库更多 Skills

TianGzlab
TianGzlab/OmicsClaw

demo-skill

A fixture skill for the skill environment tests. Use it for nothing else.

★ 161
TianGzlab
TianGzlab/OmicsClaw

fake-domains

Test fixture for the golden deployment in tests/entry. Load never; it has no script.

★ 161
TianGzlab
TianGzlab/OmicsClaw

replace-me-skill

Load when copying this directory to bootstrap a new OmicsClaw skill. Skip when an existing skill already covers the request.

★ 161
TianGzlab
TianGzlab/OmicsClaw

spatial-velocity

Load when estimating RNA velocity on a spatial AnnData with `layers["spliced"]` + `layers["unspliced"]` via scVelo (stochastic / deterministic / dynamical) or veloVI (deep generative). Skip when input lacks the spliced/unspliced layers (must be quantified upstream by velocyto / kb-python / STARsolo); non-spatial scRNA velocity (use sc-velocity).

★ 161
TianGzlab
TianGzlab/OmicsClaw

spatial-trajectory

Load when inferring pseudotime / lineage trajectories on a preprocessed spatial AnnData via DPT (default — diffusion pseudotime), CellRank (terminal-state + fate-probability), or Palantir (waypoint branch probabilities). Skip when the data has spliced/unspliced layers and you want velocity-driven dynamics (use spatial-velocity); non-spatial scRNA pseudotime (use sc-pseudotime).

★ 161
TianGzlab
TianGzlab/OmicsClaw

spatial-statistics

Load when running spatial autocorrelation / hotspot / co-occurrence / neighbourhood-enrichment / Ripley K stats on a clustered spatial AnnData via squidpy. Skip when ranking spatially variable genes (use spatial-genes); tissue domain detection (use spatial-domains).

★ 161