YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Supplementary: tokenizer characterization benchmark
Code, data, and results behind Supplementary Figure 2:
- (a) motif preservation β perfect match rate and motif fragmentation
- (b) JensenβShannon distance between functional-region token distributions and a matched random genomic background
Tokenizers compared: DNABERT-2 BPE, Grover BPE, cCRE-guided BPE, motif-guided BPE, DNAMotifTokenizer.
Layout
Shared
tokenizers/β all five tokenizers used in both panelsDNAbert2_tokenizer.json,Grover_tokenizer.jsonβ original DNABERT-2 / Grover tokenizerscCRE_region_BPE_tokenizer.json,motif_region_BPE_tokenizer.jsonDNAMotifTokenizer/β trie, motif list, vocab (loaded viacode/dna_motif_tokenizer.py, seed = 42)
code/dna_motif_tokenizer.pyβ wrapper exposing DNAMotifTokenizer through atokenizers-like interface
Panel a β motif preservation
data/motifs.txtβ 904 unique motifs; wildcard (*) motifs are expanded to all A/C/G/T variants (β€5 wildcards), giving 3,737 test sequences of length 5β12code/motif_coverage_eval.pyβ tokenizes each variant (no special tokens) and computes per-tokenizer metricsresults/summary_by_tokenizer.csvβ per-tokenizer metrics plotted in the figureresults/motif_variant_results.csv,results/consistency_by_motif.csvβ per-variant and per-motif detailcode/plot_supp_fig2a_motif.pyβfigures/supp_fig2a_motif.{pdf,png}
Metrics:
- Perfect match rate β % of motif variants encoded as exactly one token
- Avg. tokens per motif β mean number of tokens per motif variant (lower = less fragmentation)
Panel b β region vs random-background JS distance
data/regions/β promoter (2 kb), enhancer, and exon interval sets (merged BED)data/background/βchrom.sizes(canonical hg38 chromosomes),region_union.bed(union of the three region sets, used as exclusion),random.bed(exon intervals shuffled into the non-region genome withbedtools shuffle -seed 42, so total bp matches exon)data/fastas/β hg38 sequences for promoter, enhancer, exon, and random (bedtools getfasta)code/js_vs_random_heatmap.pyβ builds the background, tokenizes each FASTA, and computes the JensenβShannon distance (base 2) between each region's token-frequency distribution and the random backgroundresults/js_vs_random_matrix.csvβ 5 tokenizers Γ 3 regions matrix plotted in the figureresults/js_vs_random.logβ run log with token counts per region and tokenizerfigures/js_vs_random_heatmap.{pdf,png}β heatmap fromjs_vs_random_heatmap.pycode/plot_combined_panel_a_b.pyβfigures/combined_panel_a_b.{pdf,png}β combined draft of panels a and b
Reproduce
# Panel a
python code/motif_coverage_eval.py --motif-file data/motifs.txt --output-dir results
python code/plot_supp_fig2a_motif.py
# Panel b (requires bedtools and hg38.fa from UCSC)
python code/js_vs_random_heatmap.py # full run
python code/js_vs_random_heatmap.py --plot-only # redraw from results/js_vs_random_matrix.csv
motif_coverage_eval.py, js_vs_random_heatmap.py, and plot_combined_panel_a_b.py are uploaded as run and resolve paths relative to the original project layout (DEFAULT_TOKENIZER_PATHS, ROOT, REGION_BEDS, etc.); point them at tokenizers/ and data/ before running. The hg38 reference genome is not included (public, ~3 GB); the extracted FASTAs in data/fastas/ are what the analysis tokenized.
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support