This version of DNA FFT Matcher uses a hybrid optimization model:
Used for sequences < 200,000 characters.
Fast & zero startup delay.
Auto-enabled for large or heavy datasets.
Gives native-like performance.
Project automatically decides the best engine based on:
- DNA text size
- Pattern size
- Mismatch tolerance
- Device capability
- ⚡ Auto-selects JS FFT or WASM FFT
- 🔬 Fast convolution-based pattern matching
- 💡 Mutation tolerance (0–5 mismatches)
- 🎨 Pink-blue heatmap with match strength
- 📊 Reports:
- Match positions
- Similarity %
- Mutation detection
- Variant similarity
- Virus marker probability
if (text_length < 200k)
use JS_FFT();
else
use WASM_FFT();
JS FFT → zero-latency, better for small data
WASM FFT → optimized for large inputs via native math libraries
Text DNA Pattern DNA
| |
Encode A/C/G/T to 4 binary arrays
| |
Reverse Pattern array
|
Hybrid FFT Engine
(JS FFT for small, WASM FFT for large)
|
Complex Multiplication (Convolution)
|
Inverse FFT
|
match_score = A_matches + C_matches + G_matches + T_matches
|
Mismatch detection
|
Heatmap + Output Stats
npm install
Rust:
wasm-pack build --target web
C++ (Emscripten):
emcc hybrid_fft.cpp -O3 -s WASM=1 -o hybrid_fft.js
npm run dev
import { jsFFTConvolve } from "./fft.js";
import init, { wasmFFTConvolve } from "./wasm_fft/wasm_fft.js";
async function convolve(a, b) {
if (a.length < 200000) {
return jsFFTConvolve(a, b);
} else {
await init();
return wasmFFTConvolve(a, b);
}
}| Input Size | JS FFT | WASM FFT | Hybrid |
|---|---|---|---|
| 50k | 12 ms | 18 ms | 12 ms |
| 500k | 200 ms | 60 ms | 60 ms |
| 2M | 800 ms | 140 ms | 140 ms |
| 10M | ❌ Too slow | 700 ms | 700 ms |
Hybrid = always picks best path.
- Genomic research
- Mutation detection
- Virus tracking
- Bioinformatics dashboards
- Fast sequence alignment
MIT License
Pankaj Kumar
Competitive Programmer | FFT Specialist | MERN + Web3 Developer