jo-mengr commited on
Commit
147d51d
·
verified ·
1 Parent(s): 27a4122

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +110 -21
README.md CHANGED
@@ -1,23 +1,112 @@
1
  ---
2
- dataset_info:
3
- features:
4
- - name: sample_idx
5
- dtype: string
6
- - name: cell_sentence_1
7
- dtype: string
8
- - name: cell_sentence_2
9
- dtype: string
10
- - name: adata_link
11
- dtype: string
12
- splits:
13
- - name: test
14
- num_bytes: 2663909161
15
- num_examples: 94836
16
- download_size: 1431179464
17
- dataset_size: 2663909161
18
- configs:
19
- - config_name: default
20
- data_files:
21
- - split: test
22
- path: data/test-*
23
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - code
4
+ pretty_name: "Transcriptome with text annotations - paired dataset"
5
+ tags:
6
+ - multimodal
7
+ - omics
8
+ - sentence-transformers
9
+ - anndata
10
+ license: "mit"
11
+ task_categories:
12
+ - zero-shot-classification
 
 
 
 
 
 
 
 
 
 
13
  ---
14
+
15
+ ## Description
16
+
17
+ This dataset contains a representation of **RNA sequencing data** and text descriptions.
18
+ Dataset type: single (suitable for relevant contrastive-learning or inference tasks).
19
+
20
+ **Cell Sentence Length**: The cell sentences in this dataset have a length of $cs_length genes.
21
+
22
+ The **RNA sequencing data** used for training was originally gathered and annotated in the **CellWhisperer** project. It is derived from
23
+ **CellxGene** and **GEO**. Detailed information on the gathering and annotation of the data can be read in the CellWhisperer Manuscript.
24
+
25
+ ## Example Data Row
26
+
27
+ The dataset contains the following column structure (example from the first row):
28
+
29
+ ```
30
+ sample_idx: AGACCATTCAAACCTG_TSP2_Trachea_NA_10X_1_1
31
+ cell_sentence_1: AGACCATTCAAACCTG_TSP2_Trachea_NA_10X_1_1
32
+ cell_sentence_2: MALAT1 MT-RNR2 MT-RNR1 NEAT1 S100A2 KRT19 MT-CO2 S100A9 S100A6 KRT5 KRT17 KRT6A SFN FABP5 AQP3 MT-ND1 PERP MT-ND2 WFDC2 HSP90AA1 SERPINB3 SAT1 B2M TAC...
33
+ adata_link: https://zenodo.org/api/records/17721879/draft/files/all_chunk_0.zarr.zip/content
34
+ ```
35
+
36
+ The processed .h5ad files used to create this dataset are stored remotely. An example file can be accessed here: https://zenodo.org/api/records/17721879/draft/files/all_chunk_0.zarr.zip/content
37
+
38
+ The AnnData Objects were processed and converted into a Hugging Face dataset using the [adata_hf_datasets](https://github.com/mengerj/adata_hf_datasets) Python package.
39
+ The dataset can be used to train a multimodal model, aligning transcriptome and text modalities with the **sentence-transformers** framework.
40
+ See [mmcontext](https://github.com/mengerj/mmcontext) for examples on how to train such a model.
41
+
42
+ The anndata objects are stored on nextcloud and a sharelink is provided as part of the dataset to download them. These anndata objects contain
43
+ intial embeddings generated like this: Each AnnData contained the following embedding keys: ['X_pca', 'X_scvi_fm', 'X_geneformer', 'X_gs10k', 'X_geneformer-v1', 'X_cw-geneformer'].
44
+ These initial embeddings are used as inputs for downstream model training / inference.
45
+
46
+ ## Source
47
+
48
+ - **Original Data:**
49
+ CZ CELLxGENE Discover: **A single-cell data platform for scalable exploration, analysis and modeling of aggregated data CZI Single-Cell Biology, et al. bioRxiv 2023.10.30**
50
+ [Publication](https://doi.org/10.1101/2023.10.30.563174)
51
+
52
+ GEO Database: Edgar R, Domrachev M, Lash AE.
53
+ Gene Expression Omnibus: NCBI gene expression and hybridization array data repository
54
+ Nucleic Acids Res. 2002 Jan 1;30(1):207-10
55
+
56
+ - **Annotated Data:**
57
+ Cell Whisperer: _Multimodal learning of transcriptomes and text enables interactive single-cell RNA-seq data exploration with natural-language chats_
58
+ _Moritz Schaefer, Peter Peneder, Daniel Malzl, Mihaela Peycheva, Jake Burton, Anna Hakobyan, Varun Sharma, Thomas Krausgruber, Jörg Menche, Eleni M. Tomazou, Christoph Bock_
59
+ [Publication](https://doi.org/10.1101/2024.10.15.618501)
60
+ Annotated Data: [CellWhisperer website](https://cellwhisperer.bocklab.org/)
61
+ - **Embedding Methods:**
62
+ scVI: _Lopez, R., Regier, J., Cole, M.B. et al. Deep generative modeling for single-cell transcriptomics. Nat Methods 15, 1053–1058 (2018). https://doi.org/10.1038/s41592-018-0229-2_
63
+ geneformer: _Theodoris, C.V., Xiao, L., Chopra, A. et al. Transfer learning enables predictions in network biology. Nature 618, 616–624 (2023)._ [Publication](https://doi.org/10.1038/s41586-023-06139-9)
64
+ - **Further important packages**
65
+ anndata: _Isaac Virshup, Sergei Rybakov, Fabian J. Theis, Philipp Angerer, F. Alexander Wolf. anndata: Annotated data. bioRxiv 2021.12.16.473007_
66
+ [Publication](https://doi.org/10.1101/2021.12.16.473007)
67
+ scnapy: _Wolf, F., Angerer, P. & Theis, F. SCANPY: large-scale single-cell gene expression data analysis. Genome Biol 19, 15 (2018)._
68
+ [Publication](https://doi.org/10.1186/s13059-017-1382-0)
69
+
70
+ ## Usage
71
+
72
+ To use this dataset in Python:
73
+
74
+ ```python
75
+ from datasets import load_dataset
76
+
77
+ # Load the dataset
78
+ dataset = load_dataset("jo-mengr/tabula_sapiens_schafer_single_no_caption_v2")
79
+ ```
80
+
81
+ ### Understanding the Data Structure
82
+
83
+ - **sample_idx**: This column maps to the `adata.obs.index` of the original AnnData objects
84
+ - **Chunking**: Larger datasets were chunked, so each AnnData object contains only a subset of the indices from the complete dataset
85
+ - **Share Links**: Each row contains a `share_link` that can be used with requests to download the corresponding AnnData object
86
+
87
+ ### Loading AnnData Objects
88
+
89
+ The share links in the dataset can be used to download the corresponding AnnData objects:
90
+
91
+ ```python
92
+ import requests
93
+ import anndata as ad
94
+
95
+ # Get the share link from a dataset row
96
+ row = dataset["train"][0] # First row as example
97
+ share_link = row["share_link"]
98
+ sample_idx = row["sample_idx"]
99
+
100
+ # Download and load the AnnData object
101
+ response = requests.get(share_link)
102
+ if response.status_code == 200:
103
+ with open("adata.h5ad", "wb") as f:
104
+ f.write(response.content)
105
+ adata = ad.read_h5ad("adata.h5ad")
106
+
107
+ # The sample_idx corresponds to adata.obs.index
108
+ sample_data = adata[adata.obs.index == sample_idx]
109
+ print(f"Found sample: {sample_data.shape}")
110
+ else:
111
+ print("Failed to download AnnData object")
112
+ ```