원클릭으로
hvantk-resource-ucsc-cellbrowser
Onboard, build, or update a UCSC Cell Browser single-cell expression resource for hvantk
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Onboard, build, or update a UCSC Cell Browser single-cell expression resource for hvantk
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | hvantk:resource-ucsc-cellbrowser |
| description | Onboard, build, or update a UCSC Cell Browser single-cell expression resource for hvantk |
| status | provisional |
| backend | anndata |
| domain | expression |
This skill covers BUILD and UPDATE of a UCSC Cell Browser single-cell AnnData (.h5ad) from raw expression + metadata TSVs. It does NOT cover download (see hvantk/skills/ucsc_cellbrowser/cli.py), scanpy-based downstream analysis, or atlas-level merging across multiple UCSC collections.
Provider metadata (URLs, collections, organisms, per-collection sample counts) lives in hvantk/skills/ucsc_cellbrowser/catalog/datasets.json (per-collection key is accession, e.g., cortex-dev, ad-multi-region). Browse via hvantk catalog list --data-source UCSC or hvantk catalog show cortex-dev. Read those files; do not restate.
Stable note (not in catalog): UCSC Cell Browser publishes per-collection (one accession at a time), not on a global monthly cadence like ClinVar. Each collection is curated independently and may be updated without warning. There is no global "release version" string — versioning is implicit in the collection's last-modified timestamp captured in the registry.
AnnData (.h5ad). Single-cell expression is sparse cells × genes; AnnData's CSR storage and the surrounding scanpy ecosystem are the natural fit. A Hail MatrixTable would force materialization of zeros and lose access to scanpy / cell-level QC tooling. Conventions § 3 ("expression sparse, single-cell → anndata h5ad") applies directly.
UCSC publishes two TSVs per collection:
<symbol>|<id> pipe-encoded). The header's first column name is collection-dependent (commonly gene or geneId) — the builder default is gene_column="gene". Tab-delimited. May be plain .tsv or gzipped (.gz/.bgz); the loader auto-detects via extension.celltype, cluster, donor). Tab-delimited. Cell IDs must match the expression matrix's column header.Gotchas:
<symbol>|<ensembl_id>. The builder's default split_gene_field=True keeps only the part before the |. If a collection ships fully-qualified IDs, set split_gene_field=False to retain the full string.obs is constructed; the builder does not silently re-key.build_ucsc_cellbrowser(backed=None, ...) chooses based on input size compared with the threshold defined at hvantk/skills/ucsc_cellbrowser/builder.py:BACKED_BUILDER_THRESHOLD_BYTES (default: 1 GiB). Backed mode requires backed_output_path (passed via --plugin-arg backed_output_path=<path>, same path as --output). Backed-mode obs writes are guarded by coerce_obs_for_h5ad() because anndata's vlen-string HDF5 writer chokes on object-dtype columns mixing strings and NaN; the in-memory path applies the same coercion before saving.annotate_column_summary_ad is only called in the in-memory branch — for atlas-scale inputs it would force a full X scan. When auditing a backed build, do not assume the per-column summary fields exist on the returned handle._iter_ucsc_rows (in hvantk/skills/ucsc_cellbrowser/shared/ucsc.py) wraps a file handle that closes on generator exhaustion. Partial iteration leaks the handle until GC; full iteration is the contract.The builder returns an ExpressionMatrix wrapping an AnnData; the platform persists it to the --output .h5ad path via artifact.save(). Schema is defined by hvantk/skills/ucsc_cellbrowser/tests/snapshots/ucsc-cellbrowser/schema.json (canonical). Human summary: AnnData with obs indexed by cell ID and carrying cell metadata (rows = cells), var indexed by gene ID (rows = genes), X a float32 sparse matrix (CSR for the in-memory path; CSC for the backed path). Provenance is stamped on the returned ExpressionMatrix via ctx.provenance(schema_id=...) and persisted by the platform as a sidecar .provenance.json.
build_ucsc_cellbrowser in hvantk/skills/ucsc_cellbrowser/builder.py. Signature is build_ucsc_cellbrowser(parsed_input, ctx, *, gene_column, delimiter, split_gene_field, chunk_size, backed, column_batch, backed_output_path, **params) -> ExpressionMatrix; parsed_input carries the expression_matrix and metadata paths. One function serves all three datasets (default, adult-ctx, dev-ctx); the per-dataset schema_id is resolved from ctx.dataset.create_anndata_from_ucsc_matrix in hvantk/skills/ucsc_cellbrowser/shared/ucsc.py.build_ucsc_atlas_backed in hvantk/skills/ucsc_cellbrowser/shared/ucsc.py.load_ucsc_metadata in hvantk/skills/ucsc_cellbrowser/shared/ucsc.py.ctx.provenance(...) (see hvantk/core/plugin/run_builder.py). Save / summary helpers: save_anndata in hvantk/core/io/anndata_io.py, annotate_column_summary_ad in hvantk/core/models/anndata_utils.py.hvantk reprocess ucsc-cellbrowser:<dataset> --raw-dir <dir> --output <path>.h5ad (dataset is one of default, adult-ctx, dev-ctx). Builder kwargs flow through --plugin-arg key=value.hvantk/core/plugin/loader.py) auto-resolves each dataset from the plugin manifest at hvantk/skills/ucsc_cellbrowser/plugin.yaml via get_registry().get_dataset("ucsc-cellbrowser:<dataset>") (one of default, adult-ctx, dev-ctx). Top-level builds run through run_builder_for_spec in hvantk/core/plugin/run_builder.py. There is no MATRIX_BUILDERS registry or registry.py.hvantk/skills/ucsc_cellbrowser/tests/test_builder.py.Read the existing files at these paths as ground truth for shape. This skill does not restate code.
When invoked to build or update:
anndata, scanpy, and scipy are importable. The current SessionStart hook (hvantk/skills/_hooks/check-hail.sh) only checks Hail + Java — anndata/scanpy availability is a known gap; verify manually with python -c "import anndata, scanpy, scipy" until the hook is extended.gene/geneId/Symbol), not a cell ID. The remaining header fields should be cell IDs that match the metadata TSV's cell-ID column.UCSC_CELL_ID_COLUMN resolves to (see hvantk/skills/ucsc_cellbrowser/shared/constants.py); other columns become obs fields.hvantk reprocess ucsc-cellbrowser:<dataset> --raw-dir <dir> --output <path>.h5ad, passing builder kwargs through --plugin-arg key=value (e.g. --plugin-arg gene_column=geneId --plugin-arg split_gene_field=false). The platform calls build_ucsc_cellbrowser(parsed_input, ctx, ...); it auto-selects backed mode based on file size; pass --plugin-arg backed=true to force.--plugin-arg backed_output_path=<path> is required (use the same path as --output). Division of responsibility: build_ucsc_atlas_backed writes CSC columns directly to disk (no return value of interest); build_ucsc_cellbrowser re-opens the written file via anndata.read_h5ad(backed_output_path, backed='r') and returns that read-backed handle wrapped in an ExpressionMatrix. Per § 4, do not rely on annotate_column_summary_ad-derived fields in this branch — the backed path skips that pass.obs via coerce_obs_for_h5ad → pre-flight via _probe_write_elem (catches obs-serialization failures BEFORE streaming any X columns) → stream X column-batches via write_elem + sparse_dataset(...).append(...) → finalize by writing /obs, /var, /uns. Reordering risks committing a partial atlas to disk before discovering an obs failure.pytest hvantk/skills/ucsc_cellbrowser/tests/test_builder.py (this test is NOT marked @pytest.mark.hail — it does not require a Hail session).UCSC datasets are per-collection. To refresh a collection's build:
hvantk/skills/ucsc_cellbrowser/cli.py (or replace the fixture by hand if regenerating from a stored slice).hvantk/skills/ucsc_cellbrowser/tests/testdata/raw/ucsc-cellbrowser/expression_matrix.tsv and metadata.tsv. The current pilot fixture is a 12 cells × 250 genes slice from asp_2019_celltype_summary.h5ad; keep slices small but representative (mix of cell types, sparse rows, at least one gene with pipe-encoded ID if relevant).pytest hvantk/skills/ucsc_cellbrowser/tests/test_builder.py --regenerate-snapshots. (No -m hail; this builder is not Hail-backed.)obs_columns (added metadata field), changed n_obs / n_vars (different fixture shape), new layers if a downstream caller starts populating one. Commit the regenerated snapshots with explanation.X_dtype shifts away from float32 (likely a cast regression), X_format changes between csr_matrix / csc_matrix for the same code path, missing or renamed obs_columns (data loss). STOP and investigate before committing.fixture: hvantk/skills/ucsc_cellbrowser/tests/testdata/raw/ucsc-cellbrowser/expression_matrix.tsv (primary) and hvantk/skills/ucsc_cellbrowser/tests/testdata/raw/ucsc-cellbrowser/metadata.tsv (secondary).schema_snapshot: hvantk/skills/ucsc_cellbrowser/tests/snapshots/ucsc-cellbrowser/schema.jsonrow_snapshot: hvantk/skills/ucsc_cellbrowser/tests/snapshots/ucsc-cellbrowser/sample_rows.jsontest_command: pytest hvantk/skills/ucsc_cellbrowser/tests/test_builder.pyWhen a new collection appears, follow this triage before deciding what to add:
gene, geneId, geneSymbol, etc.). Note pipe-encoded gene names if present.hvantk/skills/ucsc_cellbrowser/catalog/datasets.json (and a datasets: entry in hvantk/skills/ucsc_cellbrowser/plugin.yaml if it is a new compound dataset) with:
accession, data_source: "UCSC", url, last_updatedgene_column, split_gene_field, pre_normalized, expected_obs_columns (for drift detection)Onboard, build, or update the ClinGen Gene-Disease Validity resource for hvantk
Onboard, build, or update the ClinVar resource for hvantk
Build a Hail Table from GTEx cis-eQTL summary statistics (per-tissue significant variant-gene pairs) for qtlcascade and variant annotation.
Build a Hail Table from the EBI GWAS Catalog v1.0 full-associations TSV for variant-annotation joins.
Build a Hail Table from the Interactome Insider genomic BED (protein-protein interface residues projected to GRCh38) for interval-based variant annotation.
Build a Hail Table from an MSigDB GMT gene-set file (e.g., C2 Canonical Pathways) for enrichment / burden / overlap analyses.