File size: 6,661 Bytes
581717a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6f6ea9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
581717a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6f6ea9d
581717a
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
---
license: cc-by-4.0
task_categories:
  - feature-extraction
  - text-classification
tags:
  - biology
  - genomics
  - dna
  - cancer
  - bioinformatics
  - binary-encoding
  - knot-theory
pretty_name: Bitwise Genome Datasets
size_categories:
  - 10K<n<100K
---

# Bitwise Genome Datasets

DNA sequences encoded as 2-bit binary with topological annotations.
**4x smaller than FASTA. Searchable at 32 bases per CPU cycle.**

## Format

```
A = 00, C = 01, G = 10, T = 11
4 bases per byte. The DNA IS the binary.
```

Each `.bw` file contains:
- Magic header `0x4257` ("BW")
- Sequence length (4 bytes, big-endian)
- Header string (variable length)
- Packed 2-bit bases

## Tools

### `bw` -- DNA ripgrep

Install the [Bitwise](https://github.com/forkjoin-ai/bitwise) CLI to search these datasets:

```bash
cargo install --path .  # from the bitwise repo

# Search for a pattern across a gene
bw grep GGTGGCGTAGGC cancer-genes/fasta/KRAS.fasta

# Count mutations between reference and tumor
bw count reference.fasta tumor.fasta

# Compression stats
bw stats cancer-genes/fasta/BRCA1.fasta
```

Search speed: **90 million bases per second** on a single CPU core.

### Aeon FlowFrame Protocol

These datasets stream natively as [Aeon FlowFrames](https://github.com/forkjoin-ai/aeon-flux):

```
stream_id = chromosome (1-25)
sequence  = genomic position
flags     = FORK | FOLD | VENT (structure type)
payload   = 2-bit packed bases
```

Wire = storage = memory. No serialization boundary.

### helix.repair

Search these datasets live at **[helix.repair](https://helix.repair)** -- a DNA topology search engine powered by Bitwise encoding and 402 Lean theorems.

## Datasets

### cancer-genes/

20 clinically important cancer genes from NCBI RefSeq:

| Gene | Accession | Bases | Bitwise Size | Function |
|------|-----------|-------|-------------|----------|
| TP53 | NM_000546.6 | 2,512 | 628 B | Tumor suppressor ("guardian of the genome") |
| BRCA1 | NM_007294.4 | 7,088 | 1,772 B | DNA repair (breast/ovarian cancer) |
| BRCA2 | NM_000059.4 | 11,954 | 2,989 B | DNA repair (breast/ovarian/prostate) |
| KRAS | NM_004985.5 | 5,306 | 1,327 B | GTPase (pancreatic/lung/colorectal) |
| EGFR | NM_005228.5 | 9,905 | 2,477 B | Growth factor receptor (lung cancer) |
| BRAF | NM_004333.6 | 6,459 | 1,615 B | Kinase (melanoma/colorectal) |
| PIK3CA | NM_006218.4 | 9,259 | 2,315 B | PI3K catalytic (breast/endometrial) |
| PTEN | NM_000314.8 | 8,515 | 2,129 B | Phosphatase (glioblastoma/prostate) |
| APC | NM_000038.6 | 10,704 | 2,676 B | Wnt regulator (colorectal) |
| RB1 | NM_000321.3 | 4,768 | 1,192 B | Retinoblastoma protein |
| MYC | NM_002467.6 | 3,721 | 931 B | Transcription factor (many cancers) |
| IDH1 | NM_005896.4 | 2,318 | 580 B | Isocitrate dehydrogenase (glioma) |
| VHL | NM_000551.4 | 4,414 | 1,104 B | Von Hippel-Lindau (renal cancer) |
| ALK | NM_004304.5 | 6,240 | 1,560 B | Receptor tyrosine kinase (lung/lymphoma) |
| HER2 | NM_004448.4 | 4,557 | 1,140 B | ERBB2 (breast cancer) |
| ATM | NM_000051.4 | 12,915 | 3,229 B | DNA damage response kinase |
| MGMT | NM_002412.5 | 4,678 | 1,170 B | DNA methyltransferase (glioblastoma) |
| TERT | NM_198253.3 | 4,039 | 1,010 B | Telomerase (many cancers) |
| JAK2 | NM_004972.4 | 7,023 | 1,756 B | Janus kinase (myeloproliferative) |
| FLT3 | NM_004119.3 | 3,826 | 957 B | FMS-like tyrosine kinase (AML) |

## Usage

### With `bw` CLI

```bash
# Install
cargo install --path .

# Search for a mutation hotspot
bw grep GGTGGCGTAGGC datasets/cancer-genes/fasta/KRAS.fasta

# Pack FASTA to Bitwise binary
bw pack datasets/cancer-genes/fasta/TP53.fasta > TP53.bw

# Count mutations between sequences
bw count ref.fasta tumor.fasta

# Compression stats
bw stats datasets/cancer-genes/fasta/BRCA1.fasta
```

### With WASM (JavaScript/TypeScript)

```typescript
import { pack_bases, search_packed, mutation_count } from 'bitwise';

const packed = pack_bases(new TextEncoder().encode('ATGCTAGCATGC'));
const needle = pack_bases(new TextEncoder().encode('TAGC'));
const matches = search_packed(packed, 12, needle, 4);
// matches = [4]  -- found TAGC at position 4
```

## Theory

Every dataset is backed by mechanized Lean 4 theorems (zero sorry):

- `dna_is_folded_knot`: DNA IS a folded knot (PsycheGrindExtended Pass 17)
- `two_bit_four_per_byte`: 4 bases per byte by construction (Pass 39)
- `word_parallel_speedup`: 32x search speedup (Pass 39)
- `xor_detects_mutations`: XOR = mutation detection (Pass 39)
- `noncoding_is_void`: non-coding DNA IS the void boundary (Pass 43)
- `junk_not_junk`: "junk" DNA carries MORE information (Pass 43)
- `sigma_monotone_with_age`: σ IS a molecular clock (GenomicVoidArchaeology)
- `unwinding_theorem`: history reconstructible from void (GenomicVoidArchaeology)

402 theorems total. The math proves the encoding. The encoding enables the search. The search reveals the biology.

## Source

All sequences from NCBI RefSeq (public domain). Fetched via E-utilities API.
Reproducible via `scripts/fetch-and-convert.sh`.

## Related

- [helix.repair](https://helix.repair) -- DNA topology search engine
- [Aunt Sandy](https://github.com/forkjoin-ai/aunt-sandy) -- Cancer genomics via Buleyean probability
- [Gnosis](https://github.com/forkjoin-ai/gnosis) -- Formal verification engine (402 Lean theorems)

## License

Data: CC-BY-4.0 (sequences are public domain from NCBI)
Code: MPL-2.0

## hg38 -- Full Human Reference Genome

**2.9GB FASTA → 736MB Bitwise binary. 25 chromosomes.**

| Chromosome | Bases | Bitwise Size |
|------------|-------|-------------|
| chr1 | 248,956,422 | 59 MB |
| chr2 | 242,193,529 | 58 MB |
| chr3 | 198,295,559 | 47 MB |
| chr4 | 190,214,555 | 45 MB |
| chr5 | 181,538,259 | 43 MB |
| chr6 | 170,805,979 | 41 MB |
| chr7 | 159,345,973 | 38 MB |
| chr8 | 145,138,636 | 35 MB |
| chr9 | 138,394,717 | 33 MB |
| chr10 | 133,797,422 | 32 MB |
| chr11 | 135,086,622 | 32 MB |
| chr12 | 133,275,309 | 32 MB |
| chr13 | 114,364,328 | 27 MB |
| chr14 | 107,043,718 | 26 MB |
| chr15 | 101,991,189 | 24 MB |
| chr16 | 90,338,345 | 22 MB |
| chr17 | 83,257,441 | 20 MB |
| chr18 | 80,373,285 | 19 MB |
| chr19 | 58,617,616 | 14 MB |
| chr20 | 64,444,167 | 15 MB |
| chr21 | 46,709,983 | 11 MB |
| chr22 | 50,818,468 | 12 MB |
| chrX | 156,040,895 | 37 MB |
| chrY | 57,227,415 | 14 MB |
| chrM | 16,569 | 4.1 KB |

**Too large for GitHub.** Reproduce locally:

```bash
# Download and convert (requires ~4GB disk)
bash scripts/fetch-and-convert-hg38.sh

# Or use Cloud Build
gcloud builds submit --config=cloudbuild-whole-genome.yaml --substitutions=_ASSEMBLY=hg38 .
```

Search speed: **90 million bases per second** on a single CPU core.