# Liver_References · View-Only List **Date**: 2026-05-25 **目的**: 标记本目录下**已 ingest 但 X/X.raw 都不是 integer raw counts** 的 .h5ad 文件——这些文件可以做 UMAP / clustering / 看 marker 表达 / cell-type 注释验证,但**不能直接用于**: - DESeq2-style 差异表达(需 raw integer counts) - 重新 normalize / batch correction(已经被作者 scale 过) - 整合到 scVI / Scanorama / Harmony 的 raw-counts pipeline(数值范围不对) 下游 census 整合时**这些文件应该被 skip**,或者从原始 GEO mtx 重 ingest 后替换。 --- ## ⚠️ 当前 View-Only 文件清单 | 文件 | X 状态 | .raw.X 状态 | 真 raw counts 来源 | |---|---|---|---| | `sc__hcc-tumor-normal__sharma2020-58pts__73589cx2608g__GSE156625-HCC.h5ad` | scaled HVG (2,608 genes, neg values −2.1~10) | log-normalized full (19,852 genes, max 7.0) | `_staging/wave2_geo/GSE156625/HCCmatrix.mtx.gz` (562 MB) + HCCbarcodes + HCCgenes | | `sc__hcc-fetal__sharma2020-62pts__109238cx2384g__GSE156625-HCCF.h5ad` | scaled HVG (2,384 genes, neg values −1.3~10) | log-normalized full (20,417 genes, max 6.3) | `_staging/wave2_geo/GSE156625/HCCFmatrix.mtx.gz` (687 MB) + HCCFbarcodes + HCCFgenes | --- ## 怎么"反悔" — 拿回真 raw counts 两个文件源自 GEO GSE156625 (Sharma 2020 Onco-fetal Cell paper)。raw 10x matrix 在 staging 里已经下好: ```bash ls /Users/zhongjunfu/Desktop/项目/AIVIN/database_unified/_staging/wave2_geo/GSE156625/ # GSE156625_HCCbarcodes.tsv.gz 129M cell barcodes # GSE156625_HCCgenes.tsv.gz 259K gene symbols # GSE156625_HCCmatrix.mtx.gz 562M integer counts # GSE156625_HCCFbarcodes.tsv.gz 138M # GSE156625_HCCFgenes.tsv.gz 259K # GSE156625_HCCFmatrix.mtx.gz 687M ``` 重 ingest 用 `scripts/ingest_wave2_remaining.py` 的 `_read_10x_triplet()` 函数即可——已经有现成代码。重 ingest 之前先备份现 .h5ad(含 louvain / UMAP / cell type annotations)到 `derived_views/sharma2020_processed_view/` 保留作者的预处理产物。 --- ## 防御性使用规则(团队约定) 任何下游脚本读取 Liver_References 时,应先检查 `uns.x_state`: ```python import anndata as ad a = ad.read_h5ad(fp, backed='r') if a.uns.get("x_state") in ("scaled_HVG", "scaled"): # 这是 view-only file if "raw_state" in a.uns and a.uns["raw_state"].startswith("log_normalized"): # 可以用 .raw 做 score_genes 但不能做 DE ... else: # 不应用作 DE / re-normalize 输入 raise ValueError(f"{fp.name} has scaled X, no raw counts — re-ingest from _staging/") ``` 或者读取本目录的 `_view_only_list.md`(本文档)跑前过滤。 --- ## 未来加入此清单的判定规则 新 ingest 的 .h5ad 应该自动跑 `scripts/verify_h5ad.py --report`,若发现: - `.X` 含负值 → scaled,自动加入 view-only - `.X` 全为整数 + sparsity ≥ 90% → raw counts,正常 - `.X` 全为浮点 [0, 10] + sparsity ≥ 80% → log-normalized,**borderline**(看具体场景) - `.X` 列数远小于 `.raw.X` 列数 → HVG subset 而非全基因,view-only 详见 `scripts/verify_h5ad.py` 自动判定逻辑。