anndata
Skill by K-Dense-AI
Explains how to create, read, write, and subset AnnData objects for annotated data matrices. It is aimed at single-cell analysts working with .h5ad and Zarr files in the scverse ecosystem.
Install anndata
Built from the published package, never by AI.
git clone --depth 1 https://github.com/K-Dense-AI/scientific-agent-skills /tmp/scientific-agent-skills && mkdir -p ~/.claude/skills && cp -r /tmp/scientific-agent-skills/skills/anndata ~/.claude/skills/anndataRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/K-Dense-AI/scientific-agent-skills /tmp/scientific-agent-skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/scientific-agent-skills/skills/anndata ~/.gemini/antigravity-cli/skills/anndataAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill covers AnnData, a Python package for annotated data matrices. An AnnData object stores measurements in X next to observation metadata (obs), variable metadata (var), and extra annotations in obsm, varm, obsp, varp, and uns. The skill gives code for creating objects, reading and writing h5ad and Zarr files, and using anndata.io for other formats such as CSV, MTX, and Loom.
It also covers concatenating datasets with ad.concat, subsetting and copying data, backed mode for large files, and best practices for memory use. The skill points to scanpy for analysis workflows and to other skills for probabilistic models and population-scale queries. It is intended for single-cell genomics users and anyone who needs annotated data storage in Python.
Written from the project's SKILL.md and checked against it.
What it can do
- Create AnnData objectsBuilds an AnnData object from a matrix with obs and var metadata tables.
- Read and write h5ad and ZarrLoads and saves .h5ad and .zarr files, with optional compression.
- Alternative formatsReads CSV, MTX, and Loom files through anndata.io helpers.
- Backed modeOpens large h5ad files with backed='r' so X stays on disk.
- Concatenate datasetsCombines multiple AnnData objects along observations or variables with ad.concat.
- Subset and transformFilters by metadata or indices, copies or views data, and converts strings to categoricals.
- Lazy collectionsDescribes AnnCollection for lazy concatenation of backed objects (experimental).
- Scverse integrationShows how AnnData connects with scanpy and muon for analysis and multimodal data.
- Best practice guidanceCovers sparse matrices, raw data snapshots, and memory-efficient handling.
What you need
- Python 3.12 or later
- anndata package, installed with uv
- Optional dask and lazy extras for lazy I/O
- Network access for installation and remote data
Try asking
- Create an AnnData object from my count matrix and sample metadata
- Open a large h5ad file in backed mode and subset the first 1000 cells
- Concatenate three h5ad batches into one AnnData with a batch label
Good to know
- AnnLoader and Loom reading and writing are deprecated
- Backed sparse item assignment is unsupported in AnnData 0.13
- AnnCollection and other experimental APIs carry caveats
- AnnData.concatenate() was removed in 0.13; use ad.concat
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/anndata/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
Allowed tools: Read Write Edit Bash
-
SKILL.md15 KB -
references/best_practices.md15 KB -
references/concatenation.md12 KB -
references/data_structure.md10 KB -
references/io_operations.md15 KB
Show all 6 files
-
references/manipulation.md14 KB
Alternatives to anndata
All alternatives →Searches arXiv for scientific papers and preprints, extracts their metadata and abstracts, and downloads PDF or HTML full text. Suited to users who need research papers, literature or specific arXiv IDs.
Downloads AlphaFold predicted structures and PAE matrices for a UniProt ID, then reports pLDDT confidence, domain boundaries and disorder. Built for users who already have a UniProt accession.
Queries the QuickGO and Evidence & Conclusion Ontology REST API to map genes to Gene Ontology terms. Built for researchers doing functional annotation and GO hierarchy exploration.
Connects an AI assistant to Peloton to browse fitness classes, check live and archived schedules, and manage workouts. Built for Peloton users who want to plan rides from their assistant.
Queries NCBI Gene through the E-utilities and Datasets API. It helps researchers search genes by symbol or ID, retrieve gene details, and run batch lookups for annotation and functional analysis.
Prepares and launches nf-core/pacsomatic runs for matched tumor-normal PacBio HiFi data starting from unaligned BAM files. It generates samplesheets and pinned launch artifacts, then runs locally or submits to a scheduler.
Compare with literature-search-arxiv, alphafold-database-fetch-and-analyze or quickgo-database
anndata: common questions
Does this skill run single-cell analysis workflows?
No. The skill is for the data format layer. The source says to use scanpy for analysis workflows, scvi-tools for probabilistic models, and cellxgene-census for population-scale queries.
Which AnnData version does the skill target?
The skill targets AnnData 0.13.4 and requires Python 3.12 or later. It was reviewed on 2026-09-30.
Can it read 10X Genomics data?
The source says 10X data should be read with scanpy, not anndata. It shows sc.read_10x_h5 and sc.read_10x_mtx for this.
How do I install anndata?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is anndata free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is anndata safe to use?
It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to anndata?
Similar skills: literature-search-arxiv, alphafold-database-fetch-and-analyze, quickgo-database, peloton.
