Represent
Choose features that preserve useful biological signal.
BIOINFORMATICS · FEATURE ENGINEERING · COMPUTE ECONOMICS
This lab follows DNA, RNA and protein sequences through composition, k-mers, alignment, structure and learned embeddings. Students calculate both algorithmic complexity and operational cost, then design a feature store that reuses evidence without losing provenance.
Choose features that preserve useful biological signal.
Connect sequence length and dataset size to runtime.
Avoid recomputing deterministic evidence for every model.
Version tools, databases, parameters and sequence identity.
01 · COMMON FEATURE LANDSCAPE
No feature family is universally best. Composition is cheap but coarse; alignment and structure add biological context; learned embeddings may capture richer patterns but require model inference and careful versioning.
GC%, AT/GC ratio, nucleotide frequency, sequence length, ambiguity rate
O(n)single scanCounts or normalized frequencies of substrings of length k.
O(n + |Σ|k)time plus dense outputAAC, dipeptide, molecular weight, charge, hydrophobicity, entropy
O(n)after lookup tablesidentity, coverage, score, conserved position, profile/PSSM-like evidence
O(mn)exact pairwise DP; searches often heuristicMFE, paired fraction, stem/loop counts, ensemble-derived measures
O(n³) time · O(n²) memoryclassical DP baselineper-token or pooled representation from a versioned pretrained model
Attention ≈ O(n²)standard self-attention; architecture-dependentgene distance, exon/intron overlap, conservation, regulatory annotation
O(log R + h)typical indexed interval query; implementation-dependentdegree, centrality, neighborhood aggregation, interaction embeddings
O(V + E) → higherdepends on graph algorithm and layers02 · SEE THE CALCULATION
The illustration uses one RNA sequence. Cheap scans share the same input, while alignment, folding and embedding invoke separate engines and reference versions.
AUGGCUAUGC…GGAUACsha256: 91b…e42[0.57, 300,
0.021, …,
-84.2, 0.61,
e₁ … e₇₆₈]03 · COMPLEXITY IS NOT WALL-CLOCK TIME
Runtime also depends on implementation, hardware, batching, I/O, reference database size, model size and sequence-length distribution. The table separates asymptotic shape from a measurement plan.
O(n)O(1) or fixed vectorsequences/s per CPU coreO(n)Sparse O(min(n,|Σ|ᵏ)); dense O(|Σ|ᵏ)k · sparsity · serializationO(mn)Classic matrix O(mn); optimized variants differcell updates/s · tracebackheuristic / data-dependentindex + hitsDB version · size · sensitivity parametersO(n³)O(n²)length bins · mode · constraintsattention O(Ln²d), broadlyattention activations grow quadraticallyGPU · batch · precision · pooling04 · INTERACTIVE COST SCENARIO
This is an illustrative capacity model—not a hardware benchmark. Replace the baseline seconds with measurements from your own tool, sequence-length bin and machine.
The calculator assumes every experiment recomputes every sequence, workers scale perfectly and there is no queue, I/O or failure. Real systems scale less cleanly. Its purpose is to expose multiplication: sequence count × per-sequence cost × experiment count.
05 · WITHOUT A FEATURE STORE
Each student or model rebuilds features with slightly different tools and parameters. Waiting grows, results diverge and no one can tell whether two columns are truly comparable.
Deterministic folding or embeddings are regenerated for every experiment.
BLAST/database-derived features silently change after a database update.
Library, model weights or folding parameters differ across notebooks.
Forty students submit identical GPU jobs instead of sharing one approved build.
A failed 80% run may restart because intermediate features were not persisted.
A model artifact survives, but the exact feature-generating environment does not.
06 · BIOINFORMATICS FEATURE STORE ARCHITECTURE
Sequence identity alone is not a valid key. A feature also depends on algorithm, parameters, tool/container, model weights and reference database version.
SHA256(sequence) + feature_name + feature_version + parameters_hash
+ tool_container_digest + reference_database_version + model_weights_digest07 · LAB: DEFINE AND STORE CHEAP FEATURES
This Python example emits fixed-schema DNA/RNA composition and sparse k-mer counts. It is intentionally small enough to inspect before using a workflow engine.
from collections import Counter
from hashlib import sha256
def sequence_features(sequence: str, k: int = 3) -> dict:
seq = sequence.upper().replace("U", "T")
counts = Counter(seq)
valid = sum(counts[b] for b in "ACGT")
kmers = Counter(seq[i:i+k] for i in range(len(seq)-k+1)
if set(seq[i:i+k]) <= set("ACGT"))
return {
"sequence_sha256": sha256(seq.encode()).hexdigest(),
"length": len(seq),
"gc_fraction": (counts["G"] + counts["C"]) / valid if valid else None,
"ambiguous_fraction": 1 - valid / len(seq) if seq else None,
"k": k,
"kmer_counts": dict(kmers),
"feature_version": "sequence_basic_v1"
}08 · MATERIALIZATION POLICY
The store has its own storage and governance cost. Decide by compute-to-read ratio, reuse count, determinism, size, privacy and invalidation frequency.
09 · STUDENT CHALLENGES
Benchmark GC, 3-mer and 6-mer features across length bins; separate CPU from serialization time.
Measure RNA folding at four lengths and test whether observed growth resembles n³ on your machine.
Design a feature key for a BLAST-derived feature, including database and parameter versions.
Calculate CPU/GPU-hours for 50 experiments with and without reuse; include queue and failure assumptions.
Create a parity test showing a stored embedding equals a freshly computed embedding within a stated tolerance.
Write a retirement policy for unused 768-dimensional embeddings while preserving model reproducibility.
THE CENTRAL IDEA