danieltslz commited on
Commit
27f01bd
·
verified ·
1 Parent(s): 39a2087

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

Browse files
data/embeddings/nt_v2_500m_multispecies_cds/README.md CHANGED
@@ -1,40 +1,22 @@
1
- # nt_v2_500m_multispecies_cds_v1_1
2
 
3
- Embedding ID: `nt_v2_500m_multispecies_cds`
4
-
5
- Former processing ID: `nt_v2_500m_multispecies_cds_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: `20085 genes × 1024 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
 
@@ -50,32 +32,77 @@ assert X.shape[0] == len(genes)
50
  | `source_transcript_id_used` | 20085 | 20085 | ENST00000373020.9<br>ENST00000373031.5<br>ENST00000371588.10<br>ENST00000367771.11 | Original transcript identifier selected as model input. |
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
- | `nt_v2_token_count_used_for_mean_pooling` | 20085 | 1337 | 123<br>159<br>133<br>347 | TODO: define this source-specific column during manual curation. |
54
- | `effective_chunk_nt` | 20085 | 1 | 6000 | TODO: define this source-specific column during manual curation. |
55
-
56
- ## Basic metadata
57
-
58
- | Field | Value |
59
- |---|---|
60
- | `status` | processed_qc_passed |
61
- | `modality` | DNA language model / CDS sequence |
62
- | `embedding_name` | nt_v2_500m_multispecies_cds_v1_1 |
63
- | `download_source` | official HuggingFace model repository |
64
- | `original_model_or_method` | Nucleotide Transformer v2 |
65
- | `embedding_generated_by` | Daniel locally by model inference |
66
- | `model_checkpoint` | InstaDeepAI/nucleotide-transformer-v2-500m-multi-species |
67
- | `pooling_strategy` | final hidden layer mean pooling over non-special, non-padding tokens; chunk-weighted by token count for long CDS |
68
 
69
  ## Detailed processing notes
70
 
71
- TODO: manually paste and curate the processing explanation for this embedding from the central project README.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
 
73
- Please include, when relevant:
74
 
75
- - original source/model/checkpoint;
76
- - whether the embedding was downloaded or generated locally;
77
- - input data used;
78
- - identifier mapping and filtering decisions;
79
- - pooling, aggregation, PCA, or normalization method;
80
- - coverage and important caveats;
81
- - license or redistribution notes.
 
 
 
 
1
+ # Embedding name: Nucleotide-Transformer-v2-500M-multispecies-CDS
2
 
3
+ - Modality: DNA sequence / canonical CDS nucleotide language-model embedding
4
+ - Algorithm: Transformer nucleotide language model
5
+ - Embedding source URL: Local generation from Ensembl release 114 GRCh38 canonical CDS sequences and master_gene_table.csv
6
+ - Original model/code URL: https://huggingface.co/InstaDeepAI/nucleotide-transformer-v2-500m-multi-species
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 × 1024 dimensions`
17
  - Dtype: `float32`
 
 
 
 
 
 
 
18
 
 
19
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  ## genes.tsv columns
22
 
 
32
  | `source_transcript_id_used` | 20085 | 20085 | ENST00000373020.9<br>ENST00000373031.5<br>ENST00000371588.10<br>ENST00000367771.11 | Original transcript identifier selected as model input. |
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
+ | `nt_v2_token_count_used_for_mean_pooling` | 20085 | 1337 | 123<br>159<br>133<br>347 | Number of valid Nucleotide Transformer tokens included in the final mean-pooling step for this gene, after excluding special and padding tokens. For chunked CDS sequences, this reflects the effective token count used across chunks. |
36
+ | `effective_chunk_nt` | 20085 | 1 | 6000 | Nucleotide chunk size used during inference. Long CDS sequences were split into 6,000 nt chunks before model inference and combined by chunk-aware weighted mean pooling. |
37
+
38
+
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  ## Detailed processing notes
41
 
42
+ ### Source and interpretation
43
+
44
+ This embedding is a gene-level canonical CDS representation derived from the Nucleotide Transformer v2 500M multi-species model. It was generated locally from Ensembl release 114 GRCh38 CDS sequences matched to the canonical transcript IDs in master_gene_table.csv.
45
+
46
+ The model used was the official HuggingFace checkpoint `InstaDeepAI/nucleotide-transformer-v2-500m-multi-species`. For each matched gene, the canonical coding DNA sequence was tokenized with the official Nucleotide Transformer tokenizer, embedded with the model, and summarized into one vector per gene by mean pooling final hidden-layer token embeddings. Long CDS sequences were split into chunks and then combined with a chunk-aware weighted mean.
47
+
48
+ This embedding should therefore be interpreted as a coding-DNA sequence language-model representation. It represents canonical CDS sequence content, not promoter sequence, regulatory context, mature full transcript sequence, protein sequence, expression, or single-cell context.
49
+
50
+ ### Provenance fields
51
+
52
+ source_name: Nucleotide Transformer v2 500M multi-species canonical CDS
53
+ original_model_or_method: Nucleotide Transformer v2 nucleotide language model
54
+ input_sequence_type: canonical coding DNA sequence
55
+ input_sequence_source: Ensembl release 114 GRCh38 CDS FASTA and master_gene_table.csv canonical transcript IDs
56
+ genome_build: GRCh38
57
+ sequence_reference: Ensembl release 114
58
+ model_checkpoint: InstaDeepAI/nucleotide-transformer-v2-500m-multi-species
59
+ model_url: https://huggingface.co/InstaDeepAI/nucleotide-transformer-v2-500m-multi-species
60
+ tokenizer: official HuggingFace tokenizer, 6-mer nucleotide tokenization
61
+ model_output_dimension: 1,024
62
+ model_precision_used: float32
63
+ pooling_strategy: final hidden-layer mean pooling over valid non-special and non-padding tokens
64
+ long_sequence_handling: 6,000 nt chunks with chunk-aware weighted mean
65
+ training_or_finetuning: none
66
+
67
+ ### Sequence and transcript decisions
68
+
69
+ The source gene set came from master_gene_table.csv. Canonical transcript IDs from the master table were used to select one CDS sequence per gene from the Ensembl release 114 GRCh38 CDS FASTA.
70
+
71
+ Versioned canonical transcript IDs were matched first. If an exact versioned transcript match was not available, unversioned transcript matching and version-rescued matching were used. Genes without a matched canonical CDS sequence were excluded from this embedding.
72
+
73
+ The same canonical CDS sequence set was later reused for HyenaDNA and DNABERT-2 so that those DNA/CDS language-model embeddings are directly comparable at the input-sequence level.
74
+
75
+ ### Processing workflow
76
+
77
+ For each gene in the master table:
78
+
79
+ 1. Read canonical transcript IDs from master_gene_table.csv.
80
+ 2. Index the Ensembl release 114 GRCh38 CDS FASTA by versioned and unversioned transcript IDs.
81
+ 3. Match each gene to its canonical CDS sequence using exact versioned matching first, then unversioned/version-rescued matching.
82
+ 4. Exclude genes without a matched canonical CDS sequence.
83
+ 5. Tokenize each CDS with the official Nucleotide Transformer tokenizer.
84
+ 6. Run the official Nucleotide Transformer v2 500M multi-species model in float32.
85
+ 7. Mean-pool the final hidden layer across valid non-special and non-padding tokens.
86
+ 8. For long CDS sequences, split into 6,000 nt chunks and compute a chunk-aware weighted mean.
87
+ 9. Save the final matrix as float32.
88
+
89
+ ### Important implementation decisions
90
+
91
+ The final run used float32 inference. An fp16 smoke test produced a dtype mismatch in this environment, so float32 was kept for the validated run.
92
+
93
+ 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.
94
+
95
+ No model training or fine-tuning was performed. The final matrix was generated only by local inference from the official pretrained checkpoint.
96
 
97
+ ### Summary of final mapping:
98
 
99
+ Source identifiers / canonical CDS sequences: 20,085
100
+ Dimensions: 1,024
101
+ Rows generated before duplicate collapse: 20,085
102
+ Missing CDS genes: 12
103
+ Unmapped source rows: 0
104
+ Ambiguous source rows: 0
105
+ Final mapped genes: 20,085
106
+ Master table rows: 20,097
107
+ Master coverage: 99.940%
108
+ Duplicate final mappings averaged: 0