danieltslz commited on
Commit
243b3e1
·
verified ·
1 Parent(s): 9b96a1c

Update curated README documentation: data/embeddings/mahi_global/README.md

Browse files
Files changed (1) hide show
  1. data/embeddings/mahi_global/README.md +70 -39
data/embeddings/mahi_global/README.md CHANGED
@@ -1,40 +1,22 @@
1
- # mahi_global_v1_1
2
 
3
- Embedding ID: `mahi_global`
4
-
5
- Former processing ID: `mahi_global_v1_1`
 
6
 
7
  ## Public files
8
 
9
  - `embeddings.npz`: compressed NumPy archive containing the embedding matrix under key `embeddings`.
10
  - `genes.tsv`: row metadata table. Row order matches the embedding matrix.
11
  - `metadata.json`: machine-readable provenance and processing metadata.
12
- - `README.md`: this per-embedding documentation file.
13
 
14
  ## Matrix
15
 
16
  - Shape: `18918 genes × 3666 dimensions`
17
  - Dtype: `float32`
18
- - NPZ array key: `embeddings`
19
-
20
- The row order is authoritative:
21
-
22
- ```text
23
- embeddings.npz['embeddings'][i, :] corresponds to genes.tsv row i
24
- ```
25
-
26
- ## Loading example
27
-
28
- ```python
29
- import numpy as np
30
- import pandas as pd
31
 
32
- with np.load('embeddings.npz') as z:
33
- X = z['embeddings']
34
 
35
- genes = pd.read_csv('genes.tsv', sep='\t')
36
- assert X.shape[0] == len(genes)
37
- ```
38
 
39
  ## genes.tsv columns
40
 
@@ -42,27 +24,76 @@ assert X.shape[0] == len(genes)
42
  |---|---:|---:|---|---|
43
  | `ensembl_gene_id` | 18918 | 18918 | ENSG00000000003<br>ENSG00000000005<br>ENSG00000000419<br>ENSG00000000457 | Ensembl gene identifier; main stable identifier used to align genes across embeddings. |
44
  | `entrez_id` | 18918 | 18918 | 7105<br>64102<br>8813<br>57147 | NCBI Entrez Gene identifier, when available. |
45
- | `mahi_context_count` | 18918 | 1 | 1 | TODO: define this source-specific column during manual curation. |
46
  | `hgnc_symbol` | 18918 | 18918 | TSPAN6<br>TNMD<br>DPM1<br>SCYL3 | HGNC-associated gene symbol. |
47
 
48
- ## Basic metadata
49
 
50
- | Field | Value |
51
- |---|---|
52
- | `status` | processed_qc_passed |
53
- | `embedding_name` | mahi_global_v1_1 |
54
- | `pooling_strategy` | global context only |
55
 
56
  ## Detailed processing notes
57
 
58
- TODO: manually paste and curate the processing explanation for this embedding from the central project README.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
- Please include, when relevant:
61
 
62
- - original source/model/checkpoint;
63
- - whether the embedding was downloaded or generated locally;
64
- - input data used;
65
- - identifier mapping and filtering decisions;
66
- - pooling, aggregation, PCA, or normalization method;
67
- - coverage and important caveats;
68
- - license or redistribution notes.
 
 
 
 
 
 
1
+ # Embedding name: Mahi-global
2
 
3
+ - Modality: Tissue/context-aware gene embedding / global context
4
+ - Algorithm: Context-aware multimodal gene embedding model
5
+ - Embedding source URL: https://huggingface.co/datasets/anushaggs/Mahi_gene_embeddings
6
+ - Original model/code URL: https://huggingface.co/datasets/anushaggs/Mahi_gene_embeddings
7
 
8
  ## Public files
9
 
10
  - `embeddings.npz`: compressed NumPy archive containing the embedding matrix under key `embeddings`.
11
  - `genes.tsv`: row metadata table. Row order matches the embedding matrix.
12
  - `metadata.json`: machine-readable provenance and processing metadata.
 
13
 
14
  ## Matrix
15
 
16
  - Shape: `18918 genes × 3666 dimensions`
17
  - Dtype: `float32`
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
 
 
19
 
 
 
 
20
 
21
  ## genes.tsv columns
22
 
 
24
  |---|---:|---:|---|---|
25
  | `ensembl_gene_id` | 18918 | 18918 | ENSG00000000003<br>ENSG00000000005<br>ENSG00000000419<br>ENSG00000000457 | Ensembl gene identifier; main stable identifier used to align genes across embeddings. |
26
  | `entrez_id` | 18918 | 18918 | 7105<br>64102<br>8813<br>57147 | NCBI Entrez Gene identifier, when available. |
27
+ | `mahi_context_count` | 18918 | 1 | 1 | Number of Mahi contexts represented in this final vector for the gene. For Mahi-global this is always 1, because only the `global` context row was retained. |
28
  | `hgnc_symbol` | 18918 | 18918 | TSPAN6<br>TNMD<br>DPM1<br>SCYL3 | HGNC-associated gene symbol. |
29
 
 
30
 
 
 
 
 
 
31
 
32
  ## Detailed processing notes
33
 
34
+ ### Source and interpretation
35
+
36
+ This embedding is a gene-level context-aware representation derived from the official precomputed Mahi gene-embedding parquet. It was not generated locally by rerunning the original Mahi model. Instead, the official parquet was streamed locally, mapped to master_gene_table.csv, and standardized into the common gene-embedding format.
37
+
38
+ The source parquet contains one embedding per Entrez gene and Mahi context. In total, it contains 290 contexts, including one `global` context and 289 non-global tissue/cell contexts. This README describes the `global` output, where only the Mahi `global` context row was retained for each mapped gene.
39
+
40
+ This embedding should therefore be interpreted as the global Mahi gene representation. It is complementary to Mahi-all-contexts-mean, which summarizes the non-global context-specific representations.
41
+
42
+ ### Provenance fields
43
+
44
+ source_name: Mahi gene embeddings / global context
45
+ original_model_or_method: Mahi context-aware gene embedding model
46
+ input_data_type: precomputed gene-context embedding parquet
47
+ input_source: official Mahi HuggingFace parquet
48
+ source_parquet_file: mahi_embeddings_float16.parquet
49
+ source_parquet_sha256: 4437fd21ea1813390d7edf9761f4d1042c939660acd610485675416dc6bd69e6
50
+ source_parquet_size: 36.87 GB
51
+ source_parquet_rows: 5,531,170
52
+ source_embedding_dtype: float16 in source parquet
53
+ source_embedding_dimension: 3,666
54
+ source_contexts: 290
55
+ unique_source_entrez_ids: 19,073
56
+ retained_context: global
57
+ final_embedding_dtype: float32
58
+
59
+ ### Mapping and context decisions
60
+
61
+ The source gene identifier was Entrez ID. Entrez IDs were mapped to master_gene_table.csv using an unambiguous Entrez-to-master map built from all available Entrez columns in the enriched master table.
62
+
63
+ Entrez IDs that mapped to more than one master-table gene were excluded. This avoids assigning one source Mahi vector to multiple Ensembl genes. The global output retained only the `global` context row for each final mapped gene.
64
+
65
+ ### Processing workflow
66
+
67
+ For the Mahi global embedding:
68
+
69
+ 1. Stream the official Mahi parquet file locally.
70
+ 2. Read source Entrez IDs, context labels, and 3,666-dimensional vectors.
71
+ 3. Build an unambiguous Entrez-to-master mapping from master_gene_table.csv.
72
+ 4. Exclude Entrez IDs mapping ambiguously to multiple master genes.
73
+ 5. Select only rows where the Mahi context is `global`.
74
+ 6. Map source Entrez IDs to final Ensembl gene IDs.
75
+ 7. Save one global Mahi vector per mapped master-table gene.
76
+ 8. Save the final matrix as float32.
77
+
78
+ ### Important implementation decisions
79
+
80
+ The full 36.87 GB source parquet was processed locally by streaming rather than loading everything into memory at once.
81
+
82
+ The `global` context was kept as its own output instead of averaging it with tissue/cell contexts. This preserves the distinction between Mahi's model-level global gene representation and its context-specific representations.
83
+
84
+ The same source parquet and Entrez mapping were also used for Mahi-all-contexts-mean.
85
 
86
+ ### Summary of final mapping:
87
 
88
+ Source identifiers / unique Mahi Entrez IDs: 19,073
89
+ Source parquet rows: 5,531,170
90
+ Source contexts: 290
91
+ Retained context: global
92
+ Dimensions: 3,666
93
+ Rows generated before duplicate collapse: 18,918
94
+ Unmapped or non-unique source Entrez IDs excluded: 155
95
+ Ambiguous Entrez IDs excluded from master mapping: 272
96
+ Final mapped genes: 18,918
97
+ Master table rows: 20,097
98
+ Master coverage: 94.134%
99
+ Duplicate final mappings averaged: 0