danieltslz's picture
Refine embedding READMEs and optional metadata
b012c9b verified
|
Raw History Blame Contribute Delete
7.22 kB
# Embedding name: RNA-FM-full-transcript
- Modality: RNA/mRNA sequence / full mature transcript language-model embedding
- Algorithm: Transformer RNA language model
- Embedding source URL: Local generation from Ensembl release 114 GRCh38 mature RNA transcript sequences and master_gene_table.csv
- Original model/code URL: https://github.com/ml4bio/RNA-FM
## Public files
- `embeddings.npz`: compressed NumPy archive containing the embedding matrix under key `embeddings`.
- `genes.tsv`: row metadata table. Row order matches the embedding matrix.
- `metadata.json`: machine-readable provenance and processing metadata.
## Matrix
- Shape: `19976 genes × 640 dimensions`
- Dtype: `float32`
## Detailed processing notes
### Source and interpretation
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.
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.
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.
### Provenance fields
source_name: RNA-FM full mature transcript
original_model_or_method: RNA-FM / rna_fm_t12 RNA language model
input_sequence_type: mature RNA full transcript
input_sequence_source: Ensembl release 114 GRCh38 cDNA-derived mature RNA sequences and master_gene_table.csv canonical transcript IDs
genome_build: GRCh38
sequence_reference: Ensembl release 114
model_checkpoint: RNA-FM_pretrained.pth
model_checkpoint_sha256: 5b5d7d87b37c291ef42c140ef9edf7aea29f255fa2a4fd435f776c52e93d5e99
model_code_url: https://github.com/ml4bio/RNA-FM
model_interface: fm.pretrained.rna_fm_t12()
model_output_dimension: 640
final_layer_used: 12
chunk_len: 900
min_chunk_len: 0
batch_size: 1
pooling_strategy: mean pooling over final layer 12 token embeddings, excluding BOS/EOS tokens, with sequence-length weighted mean across chunks
training_or_finetuning: none
### Sequence and transcript decisions
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.
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.
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.
### Processing workflow
For each gene in the mature RNA transcript table:
1. Read the canonical transcript ID from master_gene_table.csv.
2. Reuse the mature transcript sequence table prepared from Ensembl release 114 GRCh38 cDNA.
3. Convert mature cDNA-derived sequence to raw RNA sequence.
4. Use the raw RNA sequence without Helix E markers.
5. Load RNA-FM / rna_fm_t12 from the local checkpoint cache.
6. Split long transcript sequences into 900 nt chunks.
7. Run RNA-FM with batch_size=1.
8. Extract final layer 12 token representations.
9. Exclude BOS/EOS tokens from pooling.
10. Mean-pool token embeddings within each chunk.
11. Combine chunk vectors with sequence-length weighted mean pooling.
12. Save the final matrix as float32.
### Important implementation decisions
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.
No model training or fine-tuning was performed. The final matrix was generated only by local inference from the official pretrained checkpoint.
### Summary of final mapping:
Source identifiers / mature transcript sequences: 19,976
Dimensions: 640
Rows generated before duplicate collapse: 19,976
Missing/failed sequence genes: 121
Unmapped source rows: 0
Ambiguous source rows: 0
Final mapped genes: 19,976
Master table rows: 20,097
Master coverage: 99.398%
Duplicate final mappings averaged: 0
<!-- BEGIN CATALOG NORMALIZATION: LEGACY METADATA -->
## Processing and provenance metadata
This section preserves information moved out of `metadata.json` during catalog normalization. The loading-facing metadata is intentionally compact; detailed source, mapping, processing, quality-control, and reproducibility records remain here.
Source catalog commit: `ab37742040d20b523aebd188d3079871a0c2b534`.
### Canonicalized field names
| Previous field | Compact metadata field |
| --- | --- |
| `embedding_name` | `display_name` |
| `num_genes` | `n_genes` |
| `embedding_dimension` | `n_dimensions` |
| `matrix_shape[0]` | `n_genes` |
| `matrix_shape[1]` | `n_dimensions` |
### Derived standardized fields
- `species` was set to `Homo sapiens` from the validated human Ensembl `ENSG` identifier namespace.
- `master_coverage_fraction` was computed as `n_genes / 20097`.
### Legacy processing and provenance record
```json
{
"all_zero_rows": {
"count": 0,
"documented": true,
"expected": false,
"reason": "No exact all-zero rows were detected in embeddings.npz.",
"report_file": null
},
"batch_size": 1,
"chunk_len": 900,
"created_at": "2026-07-08T10:59:52",
"former_processing_embedding_id": "rnafm_full_transcript_v1_1",
"input_sequence_source": "Derived from Helix mature mRNA preparation based on Ensembl release 114 GRCh38 cDNA/canonical transcript mapping",
"input_sequence_type": "mature mRNA full transcript",
"min_chunk_len": 0,
"model": "RNA-FM / rna_fm_t12",
"model_checkpoint_sha256": "5b5d7d87b37c291ef42c140ef9edf7aea29f255fa2a4fd435f776c52e93d5e99",
"public_file_structure": {
"embeddings": "embeddings.npz",
"genes": "genes.tsv",
"metadata": "metadata.json",
"readme": "README.md"
},
"runtime_seconds": 3351.46,
"sequence_processing": "Helix E codon-start markers removed; T converted to U; sequences restricted to A/C/G/U/N",
"software": {
"python": "3.10",
"torch": "2.2.2+cu118"
},
"status": "processed_qc_passed"
}
```
<!-- END CATALOG NORMALIZATION: LEGACY METADATA -->