Standardiser les données single-cell en h5ad

VérifiéPrudence

Convertit des ensembles de données transcriptomiques single-cell hétérogènes en fichiers h5ad canoniques prêts pour l'analyse avec suivi complet de la provenance.

Spar Skills Guide Bot
Data & IAIntermédiaire
26/07/2026
Claude Code
#single-cell#h5ad#data-conversion#anndata#bioinformatics

Recommandé pour

Synthèse automatique

Convertit des jeux de données single-cell de formats hétérogènes (RDS Seurat ou SingleCellExperiment, MTX/10x, CSV/TSV, HDF5, loom, archives) en fichiers .h5ad AnnData canoniques, avec rapport et journal d'audit.

Points forts

  • Prend en charge une large gamme de formats d'entrée, y compris les objets R via un sous-processus R
  • Produit systématiquement trois sorties : le .h5ad, un rapport JSON et un journal d'audit lisible
  • Applique un schéma canonique documenté (X, layers['counts'], obs/var normalisés, provenance dans uns)
  • Gère les cas ambigus par un protocole de décision explicite (exit code 10) avec recommandations

Limites

  • Nécessite un chemin de sortie fourni explicitement par l'utilisateur avant de lancer la conversion
  • La conversion des RDS Seurat/SingleCellExperiment dépend d'un environnement R fonctionnel
  • Ne réalise aucune analyse biologique (PCA, clustering) ni relecture des h5ad existants
Quand l'utiliser

À utiliser lorsqu'il faut harmoniser un fichier single-cell brut ou provenant de R vers un .h5ad prêt pour l'analyse.

Quand l'éviter

À ne pas utiliser pour inspecter un h5ad existant, convertir des identifiants de gènes ou effectuer des analyses downstream.

Analyse de sécurité

Prudence
Score qualité86/100

The skill uses Bash for legitimate local file conversion and shows no destructive commands, network calls, credential access, or obfuscated payloads. However, because it delegates significant behavior to bundled Python/R code and handles archives, a cautious rating is appropriate rather than fully safe.

Points d'attention
  • •Invokes a bundled Python script via Bash (`~/.claude/skills/stanobj/scripts/stanobj.py`); the script contents are not included in SKILL.md and cannot be audited from this listing.
  • •Supports archive extraction and optional R subprocesses, increasing execution surface when processing untrusted single-cell datasets.
Comment cette analyse est faite

Exemples

Seurat RDS to h5ad
Convert my Seurat object data/seurat_final.rds to h5ad at out/dataset.h5ad using stanobj.
10x MTX directory
Standardize the 10x matrix directory data/filtered_feature_bc_matrix/ into a canonical h5ad saved as out/sample01.h5ad
CSV expression matrix
Convert the expression matrix counts.csv (genes as columns) into out/expr.h5ad and tell me what matrix type it detected.

name: stanobj description: > Use when the user asks to "standardize single-cell data", "convert to h5ad", "convert Seurat to h5ad", "convert RDS to h5ad", "standardize scRNA-seq", "convert 10x to h5ad", "convert CSV/TSV expression matrix", "convert MTX files", "read Seurat object", "convert SingleCellExperiment", "harmonize single-cell metadata", or mentions converting any single-cell format (rds, mtx, csv, tsv, h5, hdf5, loom) into canonical h5ad. Do NOT use for reading/inspecting existing h5ad files (that is scrna-reader), gene ID conversion (that is stangene), or biological analysis (PCA, clustering, etc). version: 1.0.0 allowed-tools: [Bash, Read, Glob, Grep]

stanobj — Standardize Single-Cell Data to Canonical h5ad

Convert heterogeneous single-cell transcriptomics datasets into canonical, analysis-ready .h5ad files with full provenance tracking.

Supported Formats

| Format | Extension | Reader | |--------|-----------|--------| | Matrix Market / 10x triplet | .mtx, directory | mtx_reader | | CSV expression matrix | .csv, .csv.gz | csv_reader | | TSV expression matrix | .tsv, .tsv.gz | csv_reader | | 10x Genomics HDF5 | .h5 | h5_reader | | Generic HDF5 | .h5, .hdf5 | h5_reader | | Existing h5ad | .h5ad | h5ad_reader | | Loom | .loom | loom_reader | | Seurat RDS | .rds | seurat_reader (R subprocess) | | SingleCellExperiment RDS | .rds | sce_reader (R subprocess) |

Archives supported: .tar.gz, .tgz, .tar.bz2, .tar, .zip Compression: .gz, .bz2 (transparent for most formats)

Workflow

  1. Identify the input file/directory from the user's request
  2. Ask the user for an output path (required: -o <path.h5ad>)
  3. Run the orchestrator:
python ~/.claude/skills/stanobj/scripts/stanobj.py <input> -o <output.h5ad>
  1. Check the exit code:

    • Exit 0: Success. Read the audit log and present a summary to the user.
    • Exit 10: Decision needed. Parse the JSON from stdout, present options to the user (or decide if obvious), then re-invoke with --decision <type>=<choice>.
    • Exit 1: Fatal error. Read stderr and report to user.
  2. After success, optionally suggest running scrna-reader to verify the output.

Decision Protocol

When the orchestrator cannot proceed autonomously, it exits with code 10 and prints a JSON decision request to stdout:

{
  "status": "decision_needed",
  "decision_type": "assay_selection",
  "context": "Seurat object has 3 assays: RNA, SCT, ADT",
  "options": ["RNA", "SCT", "ADT"],
  "recommendation": "RNA",
  "reason": "RNA has the most features and contains raw counts"
}

Re-invoke with: --decision assay_selection=RNA

Multiple decisions can be supplied: --decision assay_selection=RNA --decision matrix_type=counts

Known Decision Points

| Type | Trigger | Options | |------|---------|---------| | format_detection | Unrecognized file format | format names | | assay_selection | Multiple assays in Seurat/SCE | assay names | | matrix_orientation | Ambiguous CSV/TSV layout | cells_x_genes, genes_x_cells | | matrix_type | Low-confidence classification | counts, normalized, log1p, scaled, unknown | | layer_selection | Multiple candidate layers | layer names | | modality_filter | Mixed RNA + non-RNA features | rna_only, keep_all |

Outputs

Three files per conversion:

<output>.h5ad               # Canonical AnnData
<output_stem>_report.json   # Machine-readable report
<output_stem>_audit.log     # Human-readable audit log

Canonical Schema

See references/canonical-schema.md for the full target schema.

Key conventions:

  • adata.X = main analysis matrix
  • adata.layers["counts"] = raw counts when available
  • adata.obs["cell_id"] = original cell barcode
  • adata.obs["dataset"] = dataset name
  • adata.var["gene_symbol"] = gene symbols
  • adata.var["gene_id"] = Ensembl IDs if available
  • adata.uns["stanobj"] = conversion provenance

Scope Boundaries

  • This skill does NOT convert gene IDs — that is stangene
  • This skill does NOT inspect/compare/merge existing h5ad — that is scrna-reader
  • This skill does NOT perform biological analysis

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/standardize-single-cell-data-to-h5ad-ms1aw3t9/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/standardize-single-cell-data-to-h5ad-ms1aw3t9' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/standardize-single-cell-data-to-h5ad-ms1aw3t9/download' --output '.skill-downloads/standardize-single-cell-data-to-h5ad-ms1aw3t9/SKILL.md.part' && mv '.skill-downloads/standardize-single-cell-data-to-h5ad-ms1aw3t9/SKILL.md.part' '.skill-downloads/standardize-single-cell-data-to-h5ad-ms1aw3t9/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/standardize-single-cell-data-to-h5ad-ms1aw3t9/SKILL.md' && test -s '.skill-downloads/standardize-single-cell-data-to-h5ad-ms1aw3t9/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/stanobj' && cp -R '.skill-downloads/standardize-single-cell-data-to-h5ad-ms1aw3t9' '.claude/skills/stanobj'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/standardize-single-cell-data-to-h5ad-ms1aw3t9'

openskills read 'standardize-single-cell-data-to-h5ad-ms1aw3t9'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/standardize-single-cell-data-to-h5ad-ms1aw3t9/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires