Update curated CDS README documentation: data/embeddings/hyenadna_medium_160k_cds/README.md
Browse files
data/embeddings/hyenadna_medium_160k_cds/README.md
CHANGED
|
@@ -1,40 +1,22 @@
|
|
| 1 |
-
#
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
|
|
|
| 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: `20085 genes × 256 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 |
|
|
@@ -51,31 +33,79 @@ assert X.shape[0] == len(genes)
|
|
| 51 |
| `cds_length_nt` | 20085 | 2255 | 738<br>954<br>783<br>2067 | Coding sequence length in nucleotides. |
|
| 52 |
| `mapping_method` | 20085 | 2 | canonical_transcript_id_versioned_exact<br>canonical_transcript_id_unversioned_exact | Mapping method used to connect the source record to the master gene table. |
|
| 53 |
| `status` | 20085 | 1 | mapped | Processing or QC status for this row. |
|
| 54 |
-
| `hyenadna_token_count_used_for_mean_pooling` | 20085 | 2255 | 738<br>954<br>783<br>2067 |
|
| 55 |
-
| `hyenadna_chunk_count` | 20085 | 5 | 1<br>2<br>3<br>9 |
|
| 56 |
|
| 57 |
-
## Basic metadata
|
| 58 |
|
| 59 |
-
| Field | Value |
|
| 60 |
-
|---|---|
|
| 61 |
-
| `status` | processed_qc_passed |
|
| 62 |
-
| `modality` | DNA language model / canonical CDS sequence |
|
| 63 |
-
| `embedding_name` | hyenadna_medium_160k_cds_v1_1 |
|
| 64 |
-
| `download_source` | official HuggingFace repository LongSafari/hyenadna-medium-160k-seqlen-hf |
|
| 65 |
-
| `original_model_or_method` | HyenaDNA medium 160k sequence-length checkpoint |
|
| 66 |
-
| `embedding_generated_by` | Daniel locally by model inference |
|
| 67 |
-
| `pooling_strategy` | final hidden-state mean pooling over non-special nucleotide tokens; long CDS split into chunks and token-count weighted |
|
| 68 |
|
| 69 |
## Detailed processing notes
|
| 70 |
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
-
|
| 74 |
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Embedding name: HyenaDNA-medium-160k-CDS
|
| 2 |
|
| 3 |
+
- Modality: DNA sequence / canonical CDS nucleotide language-model embedding
|
| 4 |
+
- Algorithm: Hyena long-sequence nucleotide language model
|
| 5 |
+
- Embedding source URL: Local generation from the canonical CDS sequence table prepared for NT-v2
|
| 6 |
+
- Original model/code URL: https://huggingface.co/LongSafari/hyenadna-medium-160k-seqlen-hf
|
| 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: `20085 genes × 256 dimensions`
|
| 17 |
- Dtype: `float32`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
|
|
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
## genes.tsv columns
|
| 22 |
|
|
|
|
| 33 |
| `cds_length_nt` | 20085 | 2255 | 738<br>954<br>783<br>2067 | Coding sequence length in nucleotides. |
|
| 34 |
| `mapping_method` | 20085 | 2 | canonical_transcript_id_versioned_exact<br>canonical_transcript_id_unversioned_exact | Mapping method used to connect the source record to the master gene table. |
|
| 35 |
| `status` | 20085 | 1 | mapped | Processing or QC status for this row. |
|
| 36 |
+
| `hyenadna_token_count_used_for_mean_pooling` | 20085 | 2255 | 738<br>954<br>783<br>2067 | Number of valid HyenaDNA nucleotide tokens included in the final mean-pooling step for this gene, after excluding special tokens. For chunked CDS sequences, this reflects the effective token count used across chunks. |
|
| 37 |
+
| `hyenadna_chunk_count` | 20085 | 5 | 1<br>2<br>3<br>9 | Number of CDS sequence chunks used during HyenaDNA inference for this gene. Most genes fit in one chunk; longer CDS sequences were split into multiple 12,000 nt chunks and combined by token-count weighted mean pooling. |
|
| 38 |
|
|
|
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
## Detailed processing notes
|
| 42 |
|
| 43 |
+
### Source and interpretation
|
| 44 |
+
|
| 45 |
+
This embedding is a gene-level canonical CDS representation derived from the HyenaDNA medium 160k model. It was generated locally from the same canonical CDS sequence table used for NT-v2, which was prepared from Ensembl release 114 GRCh38 CDS sequences and the canonical transcript IDs in master_gene_table.csv.
|
| 46 |
+
|
| 47 |
+
The model used was the official HuggingFace checkpoint `LongSafari/hyenadna-medium-160k-seqlen-hf`. For each matched gene, the canonical coding DNA sequence was tokenized with the HyenaDNA tokenizer, embedded with the model, and summarized into one vector per gene by mean pooling final hidden-state nucleotide-token embeddings. Long CDS sequences were split into 12,000 nt chunks and then combined with a token-count weighted mean.
|
| 48 |
+
|
| 49 |
+
This embedding should therefore be interpreted as a coding-DNA sequence language-model representation. It uses the same gene-level CDS input sequences as NT-v2, so differences between the NT-v2 and HyenaDNA embeddings mainly reflect model architecture, tokenizer, training objective, and pooling behaviour rather than differences in sequence selection.
|
| 50 |
+
|
| 51 |
+
### Provenance fields
|
| 52 |
+
|
| 53 |
+
source_name: HyenaDNA medium 160k canonical CDS
|
| 54 |
+
original_model_or_method: HyenaDNA long-sequence nucleotide language model
|
| 55 |
+
input_sequence_type: canonical coding DNA sequence
|
| 56 |
+
input_sequence_source: canonical CDS FASTA reused from the NT-v2 sequence-preparation workflow
|
| 57 |
+
genome_build: GRCh38
|
| 58 |
+
sequence_reference: Ensembl release 114 canonical CDS sequences prepared for NT-v2
|
| 59 |
+
model_checkpoint: LongSafari/hyenadna-medium-160k-seqlen-hf
|
| 60 |
+
model_url: https://huggingface.co/LongSafari/hyenadna-medium-160k-seqlen-hf
|
| 61 |
+
model_file_sha256: 16685b36caf5d144da391f1b540ed47e89d79b3efd38899325492f174b8e852a
|
| 62 |
+
tokenizer_vocab_size: 12
|
| 63 |
+
special_token_ids_excluded_from_pooling: [0, 1, 2, 3, 4]
|
| 64 |
+
model_output_dimension: 256
|
| 65 |
+
pooling_strategy: final hidden-state mean pooling over non-special nucleotide tokens
|
| 66 |
+
long_sequence_handling: 12,000 nt chunks with token-count weighted mean across chunks
|
| 67 |
+
training_or_finetuning: none
|
| 68 |
+
|
| 69 |
+
### Sequence and transcript decisions
|
| 70 |
+
|
| 71 |
+
The source gene set came from master_gene_table.csv. Canonical transcript IDs from the master table were already mapped to Ensembl release 114 GRCh38 CDS records during the NT-v2 sequence-preparation workflow. HyenaDNA reused that exact CDS FASTA instead of preparing a separate sequence set.
|
| 72 |
+
|
| 73 |
+
This decision keeps HyenaDNA and NT-v2 directly comparable. Both embeddings use the same canonical CDS sequence per gene, generated from the same master-table canonical transcript IDs and Ensembl release 114 GRCh38 CDS FASTA.
|
| 74 |
+
|
| 75 |
+
Genes without a matched canonical CDS sequence in the reused CDS table were excluded from this embedding.
|
| 76 |
+
|
| 77 |
+
### Processing workflow
|
| 78 |
+
|
| 79 |
+
For each gene in the reused canonical CDS table:
|
| 80 |
+
|
| 81 |
+
1. Read the canonical CDS sequence prepared by the NT-v2 sequence workflow.
|
| 82 |
+
2. Tokenize the CDS sequence with the HyenaDNA tokenizer.
|
| 83 |
+
3. Split long CDS sequences into 12,000 nt chunks.
|
| 84 |
+
4. Run the official HyenaDNA medium 160k HuggingFace checkpoint locally.
|
| 85 |
+
5. Remove special token IDs [0, 1, 2, 3, 4] from the pooling mask.
|
| 86 |
+
6. Mean-pool final hidden states over valid non-special nucleotide tokens.
|
| 87 |
+
7. For chunked sequences, combine chunk vectors by token-count weighted mean.
|
| 88 |
+
8. Save the final matrix as float32.
|
| 89 |
+
|
| 90 |
+
### Important implementation decisions
|
| 91 |
+
|
| 92 |
+
The NT-v2 canonical CDS FASTA was reused intentionally. This avoids introducing a second CDS-selection procedure and makes the NT-v2, HyenaDNA, and later CDS language-model embeddings easier to compare.
|
| 93 |
+
|
| 94 |
+
Long CDS sequences were chunked instead of truncated. This preserves information from the full canonical CDS sequence while staying within memory and model input constraints.
|
| 95 |
+
|
| 96 |
+
The processing script included CUDA out-of-memory backoff logic that could recursively split chunks if needed. The final successful run used 12,000 nt chunks and passed QC.
|
| 97 |
+
|
| 98 |
+
No model training or fine-tuning was performed. The final matrix was generated only by local inference from the official pretrained checkpoint.
|
| 99 |
|
| 100 |
+
### Summary of final mapping:
|
| 101 |
|
| 102 |
+
Source identifiers / canonical CDS sequences: 20,085
|
| 103 |
+
Dimensions: 256
|
| 104 |
+
Rows generated before duplicate collapse: 20,085
|
| 105 |
+
Missing CDS genes: 12
|
| 106 |
+
Unmapped source rows: 0
|
| 107 |
+
Ambiguous source rows: 0
|
| 108 |
+
Final mapped genes: 20,085
|
| 109 |
+
Master table rows: 20,097
|
| 110 |
+
Master coverage: 99.940%
|
| 111 |
+
Duplicate final mappings averaged: 0
|