Update curated README documentation: data/embeddings/rnafm_full_transcript/README.md
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869# rnafm_full_transcript_v1_1Embedding ID: `rnafm_full_transcript`Former processing ID: `rnafm_full_transcript_v1_1`## 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.- `README.md`: this per-embedding documentation file.## Matrix- Shape: `19976 genes × 640 dimensions`- Dtype: `float32`- NPZ array key: `embeddings`The row order is authoritative:```textembeddings.npz['embeddings'][i, :] corresponds to genes.tsv row i```## Loading example```pythonimport numpy as npimport pandas as pdwith np.load('embeddings.npz') as z:X = z['embeddings']genes = pd.read_csv('genes.tsv', sep='\t')assert X.shape[0] == len(genes)```## genes.tsv columns| Column | Non-empty values | Unique values | Example values | Meaning ||---|---:|---:|---|---|| `ensembl_gene_id` | 19976 | 19976 | ENSG00000000003<br>ENSG00000000005<br>ENSG00000000419<br>ENSG00000000457 | Ensembl gene identifier; main stable identifier used to align genes across embeddings. || `rnafm_sequence_length` | 19976 | 7597 | 3768<br>1205<br>1054<br>6308 | TODO: define this source-specific column during manual curation. || `num_chunks` | 19976 | 37 | 5<br>2<br>8<br>3 | Number of chunks/windows used when the input was too long. || `transcript_id` | 19976 | 19976 | ENST00000373020<br>ENST00000373031<br>ENST00000371588<br>ENST00000367771 | Transcript identifier used for sequence-based processing. |## Basic metadata| Field | Value ||---|---|| `status` | processed_qc_passed || `embedding_name` | rnafm_full_transcript_v1_1 || `model_checkpoint` | /local/home/dtabares/data/raw_embeddings/rnafm_full_transcript_v1_1/hf_model/RNA-FM_pretrained.pth || `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 |## Detailed processing notesTODO: manually paste and curate the processing explanation for this embedding from the central project README.Please include, when relevant:- original source/model/checkpoint;- whether the embedding was downloaded or generated locally;- input data used;- identifier mapping and filtering decisions;- pooling, aggregation, PCA, or normalization method;- coverage and important caveats;- license or redistribution notes.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106# 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`## genes.tsv columns| Column | Non-empty values | Unique values | Example values | Meaning ||---|---:|---:|---|---|| `ensembl_gene_id` | 19976 | 19976 | ENSG00000000003<br>ENSG00000000005<br>ENSG00000000419<br>ENSG00000000457 | Ensembl gene identifier; main stable identifier used to align genes across embeddings. || `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. || `num_chunks` | 19976 | 37 | 5<br>2<br>8<br>3 | Number of chunks/windows used when the input was too long. || `transcript_id` | 19976 | 19976 | ENST00000373020<br>ENST00000373031<br>ENST00000371588<br>ENST00000367771 | Transcript identifier used for sequence-based processing. |## Detailed processing notes### Source and interpretationThis 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 fieldssource_name: RNA-FM full mature transcriptoriginal_model_or_method: RNA-FM / rna_fm_t12 RNA language modelinput_sequence_type: mature RNA full transcriptinput_sequence_source: Ensembl release 114 GRCh38 cDNA-derived mature RNA sequences and master_gene_table.csv canonical transcript IDsgenome_build: GRCh38sequence_reference: Ensembl release 114model_checkpoint: RNA-FM_pretrained.pthmodel_checkpoint_sha256: 5b5d7d87b37c291ef42c140ef9edf7aea29f255fa2a4fd435f776c52e93d5e99model_code_url: https://github.com/ml4bio/RNA-FMmodel_interface: fm.pretrained.rna_fm_t12()model_output_dimension: 640final_layer_used: 12chunk_len: 900min_chunk_len: 0batch_size: 1pooling_strategy: mean pooling over final layer 12 token embeddings, excluding BOS/EOS tokens, with sequence-length weighted mean across chunkstraining_or_finetuning: none### Sequence and transcript decisionsThe 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 workflowFor 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 decisionsThe 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.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.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,976Dimensions: 640Rows generated before duplicate collapse: 19,976Missing/failed sequence genes: 121Unmapped source rows: 0Ambiguous source rows: 0Final mapped genes: 19,976Master table rows: 20,097Master coverage: 99.398%Duplicate final mappings averaged: 0
data/embeddings/rnafm_full_transcript/README.md+77-40