--- pretty_name: OmniCellTOSG dataset_name: omnicelltosg dataset_summary: | OmniCellTOSG is a large-scale Text–Omic Signaling Graph (TOSG) dataset for single-cell learning. It integrates sharded expression matrices, graph topology (full/internal/PPI edges), and textual entity metadata (names, descriptions, sequences) with optional precomputed embeddings. It supports graph-aware pretraining and downstream tasks such as cell-type annotation, disease status, and gender classification. # 🏷️ Taxonomy (use standard HF enums where possible) annotations_creators: [no-annotation] language_creators: [found] language: [en] multilinguality: [monolingual] source_datasets: [original, external] size_categories: [">1M"] # change if needed: n<1K | 1K1M # πŸ“š Tasks (use β€œother” if your task isn’t in HF’s standard list) task_categories: [other] task_ids: - multi-label-classification - explanation-generation # πŸ”– Tags (free-form keywords) tags: - single-cell - transcriptomics - foundation-models # πŸ“„ Licensing & attribution license: other license_url: - https://cellxgene.cziscience.com/tos - https://doi.org/10.1038/s41591-024-03150-z - https://www.ncbi.nlm.nih.gov/geo/info/citations.html#third-party # πŸ”— Project links (optional but recommended) homepage: https://github.com/FuhaiLiAiLab/OmniCellTOSG repository: https://github.com/FuhaiLiAiLab/OmniCellTOSG paper: "https://arxiv.org/pdf/2504.02148" point_of_contact: "Heming Zhang" # 🧩 Dataset structure hints (optional) dataset_type: multimodal-graph configs: - config_name: default data_files: cell_metadata_with_mappings.csv # βœ… Maintenance pretty_format: true --- # OmniCellTOSG
OmniCellTOSG Logo
GitHub Hugging Face Paper
--- ## 🧭 Overview **OmniCellTOSG** is a large-scale **Text–Omic Signaling Graph (TOSG)** resource for **single-cell foundation model pretraining** and **omics analysis**. It combines: - **Expression matrices** (sharded `.npy` for scalable IO) - **Graph topology** (full, internal, and PPI edges) - **Textual metadata** (entity names, descriptions, sequences) with **precomputed embeddings** Supported tasks include **graph–language foundation model pretraining**, **cell-type annotation**, **disease status** and **gender** classification, plus **core signaling inference**.
Dataset Overview
--- ## πŸ“ Dataset Structure ```text OmniCellTOSG_Dataset/ β”œβ”€β”€ expression_matrix/ β”‚ β”œβ”€β”€ braincellatlas_brain_part_0.npy β”‚ β”œβ”€β”€ braincellatlas_brain_part_1.npy β”‚ β”œβ”€β”€ cellxgene_blood_part_0.npy β”‚ β”œβ”€β”€ cellxgene_blood_part_1.npy β”‚ β”œβ”€β”€ cellxgene_lung_part_0.npy β”‚ β”œβ”€β”€ cellxgene_small_intestine_part_0.npy β”‚ └── ... (additional *.npy shards) β”œβ”€β”€ cell_metadata_with_mappings.csv β”œβ”€β”€ cell_metadata_with_mappings.parquet β”œβ”€β”€ edge_index.npy β”œβ”€β”€ internal_edge_index.npy β”œβ”€β”€ ppi_edge_index.npy β”œβ”€β”€ s_bio.csv β”œβ”€β”€ s_desc.csv β”œβ”€β”€ s_name.csv β”œβ”€β”€ x_bio_emb.npy β”œβ”€β”€ x_desc_emb.npy └── x_name_emb.csv ``` > **Notes:** > - Files in `expression_matrix/*.npy` are **sharded partitions** of single-cell expression matrices; merge shards (concatenate/stack) to reconstruct the full matrix for a given source/organ. > - `cell_metadata_with_mappings.csv` contains **standardized per-cell annotations** (e.g., tissue, disease, sex, cell type, ontology mappings). > - `edge_index.npy`, `s_bio.csv`, `s_name.csv`, and `s_desc.csv` provide the **graph topology** (COO `[2, E]`) and **entity metadata** (biological sequences, names, descriptions). > - `x_bio_emb.npy`, `x_desc_emb.npy`, and `x_name_emb.csv` are **precomputed entity embeddings** (`[#entities Γ— D]`, encoder-dependent) aligned to the CSVsβ€”use these to **skip on-the-fly embedding**. --- ## βš™οΈ Installation If you only need dataset loading/extraction, download the standalone loader package from the [Releases](https://github.com/FuhaiLiAiLab/OmniCellTOSG/releases/tag/v2.1.0) page. --- ## πŸš€ Quick Start ```python from CellTOSG_Loader import CellTOSGDataLoader conditions = {"tissue_general": "brain", "disease_name": "Alzheimer's Disease"} ddataset = CellTOSGDataLoader( root=args.dataset_root, conditions=conditions, task=args.task, # "disease" | "gender" | "cell_type" label_column=args.label_column, # "disease" | "gender" | "cell_type" sample_ratio=args.sample_ratio, # mutually exclusive with sample_size sample_size=args.sample_size, shuffle=args.shuffle, stratified_balancing=args.stratified_balancing, extract_mode=args.extract_mode, # "inference" | "train" random_state=args.random_state, train_text=args.train_text, train_bio=args.train_bio, correction_method=args.correction_method, # None | "combat_seq" output_dir=args.output_dir, ) # --- Access outputs --- if args.extract_mode == "inference": X = dataset.data # pandas.DataFrame (expression/features) y = dataset.labels # pandas.DataFrame metadata = dataset.metadata # pandas.DataFrame (row-aligned metadata) else: X = dataset.data # dict: {"train": X_train, "test": X_test} y = dataset.labels # dict: {"train": y_train, "test": y_test} metadata = dataset.metadata # dict: {"train": meta_train, "test": meta_test} all_edge_index = dataset.edge_index # full graph (COO [2, E]) internal_edge_index = dataset.internal_edge_index # optional transcript–protein edges ppi_edge_index = dataset.ppi_edge_index # optional PPI edges x_name_emb, x_desc_emb, x_bio_emb = pre_embed_text(args, dataset, pretrain_model, device) # Prepare text and seq embeddings ``` ### Parameters (`CellTOSGDataLoader`) - **root** *(str, required)* β€” Filesystem path to the dataset root (e.g., `../OmniCellTOSG/CellTOSG_dataset_v2`). - **conditions** *(dict, required)* β€” Metadata filters used to subset rows (e.g., `{"tissue_general": "brain", "disease": "Alzheimer's disease"}`). - **task** *(str, required)* β€” Downstream task type: `"disease"` | `"gender"` | `"cell_type"`. - **label_column** *(str, required)* β€” Target label column (e.g., `"disease"`, `"gender"`, `"cell_type"`). - **extract_mode** *(str, required)* β€” Extraction mode: - `"inference"`: extract a single dataset for inference/analysis (no train/test split) - `"train"`: extract a training-ready dataset and generate splits (e.g., train/test) - **sample_ratio** *(float, optional)* β€” Fraction of rows to sample (0–1). Mutually exclusive with `sample_size`. - **sample_size** *(int, optional)* β€” Absolute number of rows to sample. Mutually exclusive with `sample_ratio`. - **shuffle** *(bool, default: `False`)* β€” Shuffle rows during sampling/composition. - **stratified_balancing** *(bool, default: `False`)* β€” Enable stratified sampling / class balancing based on `label_column`. - **random_state** *(int, default: `2025`)* β€” Random seed for reproducibility (sampling, shuffling, splitting). - **train_text** *(bool, default: `False`)* β€” Controls text feature output: - `False`: return precomputed text embeddings (if available) - `True`: return raw text fields for custom embedding - **train_bio** *(bool, default: `False`)* β€” Controls biological sequence feature output: - `False`: return precomputed sequence embeddings (if available) - `True`: return raw sequences for custom embedding - **correction_method** *(str or None, default: `None`)* β€” Correction method: - `None`: no correction - `"combat_seq"`: apply ComBat-Seq - **output_dir** *(str, optional)* β€” Directory for loader outputs (extracted expression matrix, label,splits). > **Returns:** > - `extract_mode="inference"`: > - `dataset.data`: `pandas.DataFrame` > - `dataset.labels`: `pandas.DataFrame` > - `dataset.metadata`: `pandas.DataFrame` > - `extract_mode="train"`: > - `dataset.data`: `dict` (`{"train": X_train, "test": X_test}`) > - `dataset.labels`: `dict` (`{"train": y_train, "test": y_test}`) > - `dataset.metadata`: `dict` (`{"train": meta_train, "test": meta_test}`) > - `edge_index`, `internal_edge_index`, `ppi_edge_index`: graph topological information > - Either raw text/sequence fields (`s_name`, `s_desc`, `s_bio`) **or** their precomputed embeddings (`x_name_emb`, `x_desc_emb`, `x_bio_emb`), returned according to the `train_text`/`train_bio` flags. --- ## πŸ§ͺ Pretraining ```bash python pretrain.py ``` --- ## πŸ‹οΈ Training Examples (CLI) **Disease status (AD, brain)** ```bash # Alzheimer's Disease (Take AD as an example) python train.py \ --downstream_task disease \ --label_column disease \ --tissue_general brain \ --disease_name "Alzheimer's Disease" \ --sample_ratio 0.1 \ --train_base_layer gat \ --train_lr 0.0005 \ --train_batch_size 3 \ --random_state 42 \ --dataset_output_dir ./Data/train_ad_disease_0.1_42 ``` **Gender (AD, brain)** ```bash # Alzheimer's Disease (Take AD as an example) python train.py \ --downstream_task gender \ --label_column gender \ --tissue_general brain \ --disease_name "Alzheimer's Disease" \ --sample_ratio 0.1 \ --train_base_layer gat \ --train_lr 0.0005 \ --train_batch_size 2 \ --random_state 42 \ --dataset_output_dir ./Data/train_ad_gender_0.1_42 ``` **Cell type annotation (LUAD, lung)** ```bash # Lung (LUAD) (Take LUAD as an example) python train.py \ --downstream_task cell_type \ --label_column cell_type \ --tissue_general "lung" \ --disease_name "Lung Adenocarcinoma" \ --sample_ratio 0.2 \ --train_base_layer gat \ --train_lr 0.0001 \ --train_batch_size 3 \ --random_state 42 \ --dataset_output_dir ./Data/train_luad_celltype_0.2_42 ``` **Signaling inference** ```bash python analysis.py ``` --- ## βš–οΈ Licensing & Attribution This dataset aggregates data from **CellxGENE**, the **Brain Cell Atlas**, **GEO** and **HCA**. Use of these resources is governed by their respective terms and citation policies: - **CellxGENE Terms of Service** β€” Follow the platform’s ToS for data access, reuse, and sharing. πŸ”— https://cellxgene.cziscience.com/tos - **Brain Cell Atlas (citation required)** *Cite:* Xinyue Chen#, Yin Huang#, Liangfeng Huang#, Ziliang Huang#, Zhao-Zhe Hao#, Lahong Xu, Nana Xu, Zhi Li, Yonggao Mou, Mingli Ye, Renke You, Xuegong Zhang, Sheng Liu*, Zhichao Miao*. **A brain cell atlas integrating single-cell transcriptomes across human brain regions.** *Nat Med* (2024). https://doi.org/10.1038/s41591-024-03150-z - **GEO Citation Policy** β€” Follow NCBI GEO guidelines for citing datasets and third-party analyses. πŸ”— https://www.ncbi.nlm.nih.gov/geo/info/citations.html#third-party - **HCA Data Use Agreement** πŸ”— https://data.humancellatlas.org/about/data-use-agreement > **Note:** You are responsible for ensuring compliance with the licenses/terms and for providing appropriate attribution to each source in any publications or derived works. --- ## πŸ“š Citation If you use **OmniCellTOSG**, please cite: ```bibtex @misc{omnicelltosg2025, title = {OmniCellTOSG: A Text–Omic Signaling Graph Dataset for Single-Cell Learning}, author = {Zhang, Heming and Li, Fuhai and collaborators}, year = {2025}, note = {Dataset on Hugging Face}, url = {https://huggingface.co/FuhaiLiAiLab} } ```