技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
data-model【数据与研究】Construct, inspect, validate, slice, copy, and mutate in-memory AnnData objects and their aligned annotations.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when a task asks how to build, inspect, validate, subset, copy, convert, or mutate an in-memory anndata.AnnData object. Typical prompts mention AnnData(...), X, obs, var, layers, obsm, varm, obsp, varp, uns, .raw, obs_names, var_names, views, copy-on-modify warnings, .to_df(), .copy(), .to_memory(), or shape/name validation.
.raw, to_df, copy, to_memory, and safe in-memory mutation patterns..h5ad, Zarr, backed reads/writes, lazy reads, element I/O, compression, and file lifecycle to ../storage-io/SKILL.md.anndata.concat, experimental.concat_on_disk, AnnCollection, batch labels, joins, and multi-object merging to ../combining-data/SKILL.md.anndata.acc references and register_anndata_namespace extension namespaces to ../accessors-extensions/SKILL.md.references/api-reference.md lists verified public signatures, construction forms, and method/property notes.references/object-model.md explains axis alignment, slot shape contracts, slicing, copy-on-modify views, .raw, and mutation rules.references/troubleshooting.md maps common construction and mutation failures to concrete recovery steps.scripts/inspect_anndata_structure.py prints a deterministic shape/key/name summary for a demo object, an .h5ad, or a Zarr store.(n_obs, n_vars) from X, from shape=..., or from the aligned annotations being supplied.obs with exactly n_obs rows and var with exactly n_vars rows; treat their indexes as obs_names and var_names.layers match (n_obs, n_vars), obsm rows match n_obs, varm rows match n_vars, obsp match (n_obs, n_obs), and varp match (n_vars, n_vars).uns; do not put axis-aligned arrays in uns when an aligned slot exists.adata[...] returns a view until copied or mutated; use .copy() before intentional independent edits.adata.raw = adata.copy() before replacing X or filtering variables; remember .raw follows observation slicing but keeps its own variable axis..shape, .obs_names.is_unique, .var_names.is_unique, slot keys, and the inspection script before handing them to storage, concat, or downstream analysis.python sub-skills/data-model/scripts/inspect_anndata_structure.py
python sub-skills/data-model/scripts/inspect_anndata_structure.py --h5ad example.h5ad
python sub-skills/data-model/scripts/inspect_anndata_structure.py --zarr example.zarr
When running from outside the skill directory, use the script's full path. The script does not write outputs, access the network, or mutate inputs.