技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
anndata【数据与研究】Use AnnData to build, inspect, combine, store, lazily read, and extend annotated data matrices in memory and on disk.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this repo skill when a task involves anndata, AnnData, annotated data matrices, .h5ad, .zarr, backed mode, lazy reads, anndata.concat, AnnCollection, anndata.acc, or AnnData extension namespaces. AnnData is a Python package for annotated data matrices with aligned observations, variables, multidimensional annotations, pairwise arrays, layers, unstructured metadata, and native HDF5/Zarr storage.
pip install anndata or conda install -c conda-forge anndata when the project does not already provide it.xarray, dask, requests, and aiohttp: pip install "anndata[lazy]".import anndata as ad and from anndata import AnnData; avoid leading-underscore internals unless the task is explicitly repository maintenance.python - <<'PY'
import anndata as ad
from anndata import AnnData
print(ad.__name__, AnnData)
PY
scripts/smoke_anndata_core.py for a safe bundled smoke test covering construction, concat, H5AD, and optional Zarr round-trips.sub-skills/data-model/SKILL.md for constructing, inspecting, mutating, validating, slicing, copying, or repairing in-memory AnnData objects and aligned containers such as X, obs, var, layers, obsm, varm, obsp, varp, uns, and raw.sub-skills/storage-io/SKILL.md for .h5ad, Zarr, backed mode, lazy reads, sparse on-disk datasets, element-level read_elem/write_elem, encoding metadata, compression, chunking, and I/O troubleshooting.sub-skills/combining-data/SKILL.md for anndata.concat, mapping-vs-sequence keys, merge and join decisions, batch labels, duplicate names, pairwise graph retention, AnnCollection, and experimental.concat_on_disk.sub-skills/accessors-extensions/SKILL.md for anndata.acc.A references, reusable validation or plotting helpers, JSON/string reference forms, register_anndata_namespace, and extension namespace debugging.data-model: confirm X.shape == (len(obs), len(var)), choose stable obs_names and var_names, add aligned arrays only when their leading axes match, then run the bundled structure inspector when shape problems are likely.storage-io: choose .h5ad for single-file exchange or Zarr for directory/object-store workflows, validate round-trips with a tiny fixture, and use backed/lazy reads only when their access constraints fit the task.combining-data: decide axis, join, merge, uns_merge, label, keys, index_unique, fill_value, and whether memory pressure requires AnnCollection or concat_on_disk.accessors-extensions: represent fields with A.obs[...], A.obsm[...][:, i], or A.layers[...], validate references before indexing, and keep extension namespaces small and explicitly typed.references/troubleshooting.md for cross-cutting install/import, optional dependency, data validation, API misuse, storage backend, and workflow-routing issues before diving into sub-skill-specific troubleshooting.references/repo-provenance.md when deciding whether this generated skill is stale against a newer AnnData checkout or release.references/repo-routing-metadata.json is structured metadata used by DisCo's managed repo-skills-router import.scripts/smoke_anndata_core.py to validate import, core object construction, concat behavior, and optional H5AD/Zarr round-trips with tiny temporary fixtures.X and sparse layers when data is mostly zero; dense arrays are simpler for tiny examples but can hide memory pressure..raw as an intentional snapshot of original X, var, and varm; later .var mutations do not automatically update .raw.var..copy() before mutating subsets when parent preservation or warning-free behavior matters.join="inner" for conservative concat across features and join="outer" only when downstream code can handle missing values or sparse zero fill.anndata.concat, use mapping keys or sequence keys, not both, when creating batch labels.experimental APIs as useful but less stable; mention optional dependencies and deprecations such as AnnLoader moving toward annbatch.Loader when relevant.AnnData object before scaling to large files or many batches.shape, obs_names, var_names, label categories, .uns.keys(), and relevant .obsm/.varm/.obsp keys.