danieltslz commited on
Commit
dea3088
·
verified ·
1 Parent(s): 202e6cd

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

Browse files
data/embeddings/rnafm_full_transcript/README.md CHANGED
@@ -1,69 +1,106 @@
1
- # rnafm_full_transcript_v1_1
2
 
3
- Embedding ID: `rnafm_full_transcript`
4
-
5
- Former processing ID: `rnafm_full_transcript_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: `19976 genes × 640 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
 
41
  | Column | Non-empty values | Unique values | Example values | Meaning |
42
  |---|---:|---:|---|---|
43
  | `ensembl_gene_id` | 19976 | 19976 | ENSG00000000003<br>ENSG00000000005<br>ENSG00000000419<br>ENSG00000000457 | Ensembl gene identifier; main stable identifier used to align genes across embeddings. |
44
- | `rnafm_sequence_length` | 19976 | 7597 | 3768<br>1205<br>1054<br>6308 | TODO: define this source-specific column during manual curation. |
45
  | `num_chunks` | 19976 | 37 | 5<br>2<br>8<br>3 | Number of chunks/windows used when the input was too long. |
46
  | `transcript_id` | 19976 | 19976 | ENST00000373020<br>ENST00000373031<br>ENST00000371588<br>ENST00000367771 | Transcript identifier used for sequence-based processing. |
47
 
48
- ## Basic metadata
49
 
50
- | Field | Value |
51
- |---|---|
52
- | `status` | processed_qc_passed |
53
- | `embedding_name` | rnafm_full_transcript_v1_1 |
54
- | `model_checkpoint` | /local/home/dtabares/data/raw_embeddings/rnafm_full_transcript_v1_1/hf_model/RNA-FM_pretrained.pth |
55
- | `pooling_strategy` | Final layer 12 mean token pooling over real RNA tokens only; BOS/EOS excluded; long transcripts split into chunks and chunk means length-weighted |
56
 
57
  ## Detailed processing notes
58
 
59
- TODO: manually paste and curate the processing explanation for this embedding from the central project README.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
- Please include, when relevant:
62
 
63
- - original source/model/checkpoint;
64
- - whether the embedding was downloaded or generated locally;
65
- - input data used;
66
- - identifier mapping and filtering decisions;
67
- - pooling, aggregation, PCA, or normalization method;
68
- - coverage and important caveats;
69
- - license or redistribution notes.
 
 
 
 
1
+ # Embedding name: RNA-FM-full-transcript
2
 
3
+ - Modality: RNA/mRNA sequence / full mature transcript language-model embedding
4
+ - Algorithm: Transformer RNA language model
5
+ - Embedding source URL: Local generation from Ensembl release 114 GRCh38 mature RNA transcript sequences and master_gene_table.csv
6
+ - Original model/code URL: https://github.com/ml4bio/RNA-FM
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: `19976 genes × 640 dimensions`
17
  - Dtype: `float32`
 
 
 
 
 
 
 
18
 
 
19
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  ## genes.tsv columns
22
 
23
  | Column | Non-empty values | Unique values | Example values | Meaning |
24
  |---|---:|---:|---|---|
25
  | `ensembl_gene_id` | 19976 | 19976 | ENSG00000000003<br>ENSG00000000005<br>ENSG00000000419<br>ENSG00000000457 | Ensembl gene identifier; main stable identifier used to align genes across embeddings. |
26
+ | `rnafm_sequence_length` | 19976 | 7597 | 3768<br>1205<br>1054<br>6308 | Length in nucleotides of the mature raw RNA transcript sequence used as RNA-FM input for this gene. |
27
  | `num_chunks` | 19976 | 37 | 5<br>2<br>8<br>3 | Number of chunks/windows used when the input was too long. |
28
  | `transcript_id` | 19976 | 19976 | ENST00000373020<br>ENST00000373031<br>ENST00000371588<br>ENST00000367771 | Transcript identifier used for sequence-based processing. |
29
 
 
30
 
 
 
 
 
 
 
31
 
32
  ## Detailed processing notes
33
 
34
+ ### Source and interpretation
35
+
36
+ This embedding is a gene-level mature RNA transcript representation derived from RNA-FM. It was generated locally from the mature transcript sequence universe prepared from Ensembl release 114 GRCh38 cDNA sequences and the canonical transcript IDs in master_gene_table.csv.
37
+
38
+ The model used was RNA-FM / `rna_fm_t12` with the official pretrained checkpoint `RNA-FM_pretrained.pth`. For each matched gene, the mature transcript sequence was represented as raw RNA sequence. No Helix-specific `E` codon-start markers were inserted. RNA-FM final layer 12 token representations were extracted, BOS/EOS tokens were excluded, token embeddings were mean-pooled within each chunk, and long transcripts were combined by sequence-length weighted mean pooling across chunks.
39
+
40
+ This embedding should therefore be interpreted as a full mature transcript RNA language-model representation. It differs from Helix-mRNA because it uses raw RNA sequence without CDS-aware `E` markers, and it differs from CDS-only DNA embeddings because it includes UTR sequence from the mature transcript.
41
+
42
+ ### Provenance fields
43
+
44
+ source_name: RNA-FM full mature transcript
45
+ original_model_or_method: RNA-FM / rna_fm_t12 RNA language model
46
+ input_sequence_type: mature RNA full transcript
47
+ input_sequence_source: Ensembl release 114 GRCh38 cDNA-derived mature RNA sequences and master_gene_table.csv canonical transcript IDs
48
+ genome_build: GRCh38
49
+ sequence_reference: Ensembl release 114
50
+ model_checkpoint: RNA-FM_pretrained.pth
51
+ model_checkpoint_sha256: 5b5d7d87b37c291ef42c140ef9edf7aea29f255fa2a4fd435f776c52e93d5e99
52
+ model_code_url: https://github.com/ml4bio/RNA-FM
53
+ model_interface: fm.pretrained.rna_fm_t12()
54
+ model_output_dimension: 640
55
+ final_layer_used: 12
56
+ chunk_len: 900
57
+ min_chunk_len: 0
58
+ batch_size: 1
59
+ pooling_strategy: mean pooling over final layer 12 token embeddings, excluding BOS/EOS tokens, with sequence-length weighted mean across chunks
60
+ training_or_finetuning: none
61
+
62
+ ### Sequence and transcript decisions
63
+
64
+ The source gene set came from master_gene_table.csv. Canonical transcript IDs from the master table were used to select one mature transcript sequence per gene from the Ensembl release 114 GRCh38 cDNA FASTA.
65
+
66
+ RNA-FM reused the raw mature RNA sequence universe prepared during the Helix-mRNA workflow. However, it used the raw RNA FASTA without Helix `E` codon-start markers. This decision prevents Helix-specific input formatting from contaminating the RNA-FM representation.
67
+
68
+ Genes without a matched mature transcript sequence, without a matched CDS sequence from the shared preparation workflow, or where sequence preparation failed were excluded from this embedding.
69
+
70
+ ### Processing workflow
71
+
72
+ For each gene in the mature RNA transcript table:
73
+
74
+ 1. Read the canonical transcript ID from master_gene_table.csv.
75
+ 2. Reuse the mature transcript sequence table prepared from Ensembl release 114 GRCh38 cDNA.
76
+ 3. Convert mature cDNA-derived sequence to raw RNA sequence.
77
+ 4. Use the raw RNA sequence without Helix E markers.
78
+ 5. Load RNA-FM / rna_fm_t12 from the local checkpoint cache.
79
+ 6. Split long transcript sequences into 900 nt chunks.
80
+ 7. Run RNA-FM with batch_size=1.
81
+ 8. Extract final layer 12 token representations.
82
+ 9. Exclude BOS/EOS tokens from pooling.
83
+ 10. Mean-pool token embeddings within each chunk.
84
+ 11. Combine chunk vectors with sequence-length weighted mean pooling.
85
+ 12. Save the final matrix as float32.
86
+
87
+ ### Important implementation decisions
88
+
89
+ The standard RNA-FM loader attempted to use an external CUHK checkpoint URL that could return 403. The final workflow copied the HuggingFace snapshot checkpoint into the torch hub checkpoint cache so `fm.pretrained.rna_fm_t12()` could load the official checkpoint locally and reproducibly.
90
+
91
+ The final run used `chunk_len=900` and `min_chunk_len=0`. An earlier test with `min_chunk_len=200` could merge a short final chunk into the previous chunk and exceed RNA-FM's effective position limit. Setting `min_chunk_len=0` kept every chunk safely within the tested token length.
92
+
93
+ No model training or fine-tuning was performed. The final matrix was generated only by local inference from the official pretrained checkpoint.
94
 
95
+ ### Summary of final mapping:
96
 
97
+ Source identifiers / mature transcript sequences: 19,976
98
+ Dimensions: 640
99
+ Rows generated before duplicate collapse: 19,976
100
+ Missing/failed sequence genes: 121
101
+ Unmapped source rows: 0
102
+ Ambiguous source rows: 0
103
+ Final mapped genes: 19,976
104
+ Master table rows: 20,097
105
+ Master coverage: 99.398%
106
+ Duplicate final mappings averaged: 0