danieltslz commited on
Commit
294d629
·
verified ·
1 Parent(s): 243b3e1

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

Browse files
data/embeddings/mahi_all_contexts_mean/README.md CHANGED
@@ -1,40 +1,22 @@
1
- # mahi_all_contexts_mean_v1_1
2
 
3
- Embedding ID: `mahi_all_contexts_mean`
4
-
5
- Former processing ID: `mahi_all_contexts_mean_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,83 @@ 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 | 289 | 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_all_contexts_mean_v1_1 |
54
- | `pooling_strategy` | mean across all non-global tissue/cell contexts per Entrez gene |
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-all-contexts-mean
2
 
3
+ - Modality: Tissue/context-aware gene embedding / mean across non-global contexts
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 | 289 | Number of non-global Mahi contexts averaged into this final vector for the gene. For this embedding it is always 289, because all non-global tissue/cell contexts were averaged and the `global` context was excluded. |
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 all-contexts-mean output, where the 289 non-global tissue/cell context vectors were averaged for each mapped gene. The `global` context was intentionally excluded from this mean.
39
+
40
+ This embedding should therefore be interpreted as a compact summary of Mahi's tissue/cell-context-specific gene representations. It is complementary to Mahi-global, which keeps only the `global` context vector.
41
+
42
+ ### Provenance fields
43
+
44
+ source_name: Mahi gene embeddings / all non-global contexts mean
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_contexts: 289 non-global tissue/cell contexts
57
+ excluded_context: global
58
+ final_embedding_dtype: float32
59
+
60
+ ### Mapping and context decisions
61
+
62
+ 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.
63
+
64
+ Entrez IDs that mapped to more than one master-table gene were excluded. This avoids assigning one source Mahi vector to multiple Ensembl genes.
65
+
66
+ For this output, all non-global tissue/cell context vectors were averaged per mapped gene. The `global` context was excluded from the average because it represents a separate Mahi output mode rather than a tissue/cell context.
67
+
68
+ ### Processing workflow
69
+
70
+ For the Mahi all-contexts-mean embedding:
71
+
72
+ 1. Stream the official Mahi parquet file locally.
73
+ 2. Read source Entrez IDs, context labels, and 3,666-dimensional vectors.
74
+ 3. Build an unambiguous Entrez-to-master mapping from master_gene_table.csv.
75
+ 4. Exclude Entrez IDs mapping ambiguously to multiple master genes.
76
+ 5. Exclude the Mahi `global` context from the mean calculation.
77
+ 6. Average all remaining non-global tissue/cell context vectors per mapped gene.
78
+ 7. Map source Entrez IDs to final Ensembl gene IDs.
79
+ 8. Save one averaged non-global Mahi vector per mapped master-table gene.
80
+ 9. Save the final matrix as float32.
81
+
82
+ ### Important implementation decisions
83
+
84
+ The full 36.87 GB source parquet was processed locally by streaming rather than loading everything into memory at once.
85
+
86
+ The `global` context was not included in the mean. This keeps the all-contexts-mean output biologically and computationally distinct from Mahi-global.
87
+
88
+ The maximum non-global context count per final gene was 289, matching the number of non-global Mahi contexts in the source parquet.
89
+
90
+ The same source parquet and Entrez mapping were also used for Mahi-global.
91
 
92
+ ### Summary of final mapping:
93
 
94
+ Source identifiers / unique Mahi Entrez IDs: 19,073
95
+ Source parquet rows: 5,531,170
96
+ Source contexts: 290
97
+ Non-global contexts averaged: 289
98
+ Excluded context: global
99
+ Dimensions: 3,666
100
+ Rows generated before duplicate collapse: 18,918
101
+ Unmapped or non-unique source Entrez IDs excluded: 155
102
+ Ambiguous Entrez IDs excluded from master mapping: 272
103
+ Final mapped genes: 18,918
104
+ Master table rows: 20,097
105
+ Master coverage: 94.134%
106
+ Duplicate final mappings averaged: 0