For the complete documentation index, see llms.txt. This page is also available as Markdown.

Molecular & cell biology kernels

Sequence-level bioinformatics, genome-scale statistics, mass-spectrometry protein and metabolite quantification, allele-frequency population genetics, and plant secondary-metabolite assay formulas acr

Six modules for the arithmetic that sits behind a wet-lab assay or a sequencing pipeline's summary statistics, at six different scales: a single sequence read (bioinformatics), a whole assembled genome (genomics), a digested protein run through a mass spectrometer (proteomics), a pool of small-molecule metabolites profiled the same way (metabolomics), an allele's frequency across generations of a population (population_genetics), and a plant extract characterized by spectrophotometric assay (phytochemistry). Every function here is a closed-form formula lifted from a named, citable method — Wallace-rule melting temperature, Pace's 1995 extinction-coefficient model, Ishihama's emPAI, Lichtenthaler's 1987 chlorophyll equations, Wright's fixation index — not a sequence aligner, a peak picker, or a statistical solver. Given the summary numbers an upstream tool already produced, these modules turn them into the percentage, ratio, or score a paper would report.

from algenta import MojoRuntime

runtime = MojoRuntime(mode="local")

# 200M reads x 150bp over a 3 Gbp genome
runtime.execute("genomics", "coverage_depth", [200_000_000.0, 150.0, 3_000_000_000.0])["result"]
# 10.0 -- mean depth, computed from raw read count and length, not a pre-summed base total

runtime.execute("bioinformatics", "phred_quality_to_error", [30.0])["result"]
# 0.001 -- Phred Q30 is the base-caller's own "1 error in 1000 bases" convention

The modules

Module
What it does

bioinformatics

Single-sequence and single-read formulas: GC%, Wallace-rule and salt-adjusted melting temperature, ssDNA molecular weight, pairwise sequence identity, E-value significance, coverage from pre-summed base totals, a pipeline pass-through for N50, Phred quality | error-probability conversion in both directions, and codon/amino-acid counting from a raw sequence length.

genomics

Genome-scale annotation statistics: GC content from separate G and C counts, genome size from Cot½ reassociation kinetics, coverage from read count and length, N50 estimated from an assumed-uniform contig size distribution, SNP density, indel rate, repeat fraction, gene density per Mb, read-mapping efficiency, and sequencing error rate from Phred quality.

proteomics

Protein-scale mass-spectrometry formulas: molecular weight from residue count, a simplified isoelectric-point estimate, the Pace (1995) ε₂₈₀ extinction coefficient, Beer-Lambert protein concentration, sequence coverage, monoisotopic peptide m/z, label-free peak-area quantification, protein abundance index, exponentially-modified PAI (emPAI), and target-decoy FDR.

metabolomics

Metabolite-scale profiling and pathway statistics: log2 fold change, hypergeometric-style pathway enrichment, the Tanimoto chemical-similarity coefficient, metabolic flux-branch ratio, ¹³C/²H isotope-label fraction, first-order metabolite half-life, z-score normalization, PCA variance-explained, PLS-DA VIP score, and Euclidean feature-space distance.

population_genetics

Allele-frequency dynamics across generations: Hardy-Weinberg heterozygote frequency, drift's standard deviation of Δp, a linearized selection-coefficient Δp, Wright's effective population size from sex ratio, nucleotide diversity π, a simplified Tajima's D, Wright's FST, an inbreeding coefficient, a simplified mutation-load estimate, and linkage disequilibrium D.

phytochemistry

Plant secondary-metabolite assay formulas: Folin-Ciocalteu total phenolics, AlCl₃ total flavonoids, pH-differential anthocyanin concentration, tannin content by difference, hydrodistillation essential-oil yield, gravimetric alkaloid content, Lichtenthaler (1987) chlorophyll a/b and total carotenoids, and DPPH radical-scavenging activity.

bioinformatics and genomics: overlapping names, genuinely different scale

The hint that motivated this page frames bioinformatics as "general (sequence analysis)" and genomics as "DNA/genome-scale analysis," and reading both sources confirms that split rather than finding it collapsed into one thing — but the two modules are close enough in vocabulary that the distinction is worth spelling out function by function, because three names appear in both and mean different things each time:

  • gc_content — bioinformatics.gc_content(gc_count, total_bases) takes a single pre-summed G+C count over two arguments. genomics.gc_content(g_count, c_count, total_bp) takes G and C as separate counts over three arguments, only summing them inside the function. Same formula ((GC / total) * 100), different calling shape — passing a combined count where genomics expects two separate ones silently double-counts nothing but shifts every other positional argument by one.

  • coverage_depth — bioinformatics.coverage_depth(total_bases_sequenced, genome_size) expects the caller to have already multiplied read count by read length. genomics.coverage_depth( read_count, read_length, genome_size_bp) does that multiplication itself from the two raw sequencing-run numbers. Both return the same "×" fold-coverage figure; they just start from a different upstream state.

  • N50 — bioinformatics.n50_from_values(total_assembly, half_total) is a documented pass-through: it accepts a pre-computed N50 (half_total) and returns it unchanged, taking total_assembly only "for context/validation" that this function's own body never uses. genomics.n50_approximation(total_assembly_bp, contig_count) instead computes an estimate, assuming every contig is the same size: total_bp / (2 * n_contigs). Calling the bioinformatics version expecting it to derive N50 from a contig count gets nothing — it has no contig-count argument to derive from.

Everything else in genomics — Cot½ genome-size estimation, SNP density per kb, indel rate, repeat fraction, gene density per Mb, read-mapping efficiency — has no bioinformatics counterpart at all; those are genuinely genome-assembly-scale statistics with nothing to compare against upstream. sequencing_error_rate (genomics) and phred_quality_to_error (bioinformatics) are the same 10^(-Q/10) formula under two different names in two different modules, with no cross-import between them — a caller who only reads one module's docstring will not discover the other has the identical function.

A worked assembly-QC chain

These are not arbitrary inputs: gene_density's ratio and repeat_fraction's 0.5 both land close to figures widely reported for the human genome, which is what the docstrings' own scale (bp, Mb) implies these functions are sized for.

proteomics: mass-spectrometry identification and quantification

isoelectric_point_approx is the one formula in this module that is not a named published method — its own docstring calls it a "Simplified model: pI ≈ (pK_pos + pK_neg) / 2," implemented as 7.0 + 1.5 * ln(positive / (negative + 1)) rather than a real pKa-lookup Henderson-Hasselbalch titration curve. molecular_weight_da's + 18.0 is the standard peptide-bond-condensation water correction (n_residues * avg_mass + water), the same convention used by real protein-MW calculators — not a made-up constant.

metabolomics: profiling and pathway statistics, with one dead parameter

metabolic_distance's n_features argument never reaches the return value. The docstring frames the function as d = sqrt(Σ(xi - yi)²) over n_features dimensions, and the contract lists n_features as the function's first parameter — but the body is exactly sqrt(sum_sq_diff), with n_features unused anywhere in it. metabolic_distance(999.0, 25.0) and metabolic_distance(3.0, 25.0) both return 5.0; the caller is expected to have already summed the squared per-feature differences into sum_sq_diff before calling, and the feature count carried alongside it for documentation purposes is simply never consulted. This was verified by reading the function body directly, not inferred from behavior — mojo/engine/metabolomics.mojo's metabolic_distance has no reference to n_features past its own signature.

population_genetics: allele-frequency dynamics across generations

tajimas_d_simplified is explicitly named and documented as an approximation — its own comment reads "ignores variance correction factors" — and hand-tracing it confirms that: for n=10, seg_sites=20, avg_pairwise_diff=5.0, Watterson's a1 is the harmonic sum Σ 1/i for i=1..9 ≈ 2.828968, giving theta_w = 20 / 2.828968 ≈ 7.0697, and the function divides (5.0 - 7.0697) by sqrt(seg_sites * 0.05 + 0.001) ≈ 1.0005 to return ≈ -2.0687. A real Tajima's D normalizes by a full sampling-variance formula built from a1, a2, and the sample size; this one substitutes a single ad hoc sqrt(0.05*S + 0.001) term, which is why its own name carries "simplified."

mutation_load's formula runs opposite to the population-genetics result it is named for. Classical mutation-selection balance (Haldane's principle) says the equilibrium genetic load from a recurrent deleterious mutation is independent of both the selection coefficient and the dominance coefficient once the allele has any dominance at all (L ≈ 2μ for h > 0, L ≈ μ for a fully recessive h = 0) — that is the textbook result the docstring itself invokes by name ("Haldane's principle"). The function's own "Simplified" formula, L = μ / (2h) for h > 0, instead makes the returned load shrink as dominance increases (mutation_load(1e-5, 0.1) = 5e-05, mutation_load(1e-5, 0.5) = 1e-05) — the opposite direction from the constant-in-h result the docstring names. This is a real, verified property of the shipped formula, not a transcription error on this page's part: the h = 0.0 branch returns mutation_rate unmodified (matching the recessive case, L ≈ μ), but every h > 0 branch diverges further from 2μ the larger h gets, rather than converging toward it. Treat this function's output as the named "simplified" proxy it documents itself as, not as a literal reproduction of Haldane's load formula.

phytochemistry: plant secondary-metabolite assay formulas

phenolic_content_folin and flavonoid_content share one calibration-curve shape — (absorbance - intercept) / slope * dilution — differing only in which standard (gallic acid vs. quercetin equivalents) and which absorbance wavelength (765 nm vs. 510 nm) the calibration was built from; the function itself is agnostic to which assay it is being used for; that information lives entirely in the slope/intercept the caller supplies. anthocyanin_concentration is the one function in this module built from six arguments instead of two to four, because the pH-differential method it implements (ΔA × MW / (ε × l) × dilution) genuinely needs a molar mass, an extinction coefficient, a path length, and both pH-1.0 and pH-4.5 absorbances to produce a concentration in mg/L, unlike the single-wavelength assays around it.

Verification

Only bioinformatics has a real, hand-pinned numeric test suite: tests/mojo/test_wave88.mojo (shared with refrigeration and cartography) checks 30 assertions against worked values — gc_content(40.0, 100.0) == 40.0, tm_salt_adjusted(60.0, 50.0) between 38.0 and 39.0, phred_quality_to_error(30.0) within 1e-3 of 0.001, codon_count(90) == 30, amino_acid_count(30) == 29, and more — every one independently reproducible from the formulas in mojo/engine/bioinformatics.mojo.

The other five modules — genomics, proteomics, metabolomics, population_genetics, phytochemistry — have only auto-generated coverage smoke tests (mojo/tests/libs/test_<module>.mojo, plus a shared pass in mojo/tests/test_all_libraries.mojo): each calls every function once with a literal 0.5 (or 10.0 in the all-libraries pass) per argument and asserts only that the result is finite, never pinning a specific numeric output. Every worked number on this page for those five modules was hand-traced against the real formula bodies in mojo/engine/genomics.mojo, proteomics.mojo, metabolomics.mojo, population_genetics.mojo, and phytochemistry.mojo, and cross-checked independently in plain Python (log, sqrt, exp, no library) rather than assumed from the docstrings alone — the metabolic_distance dead parameter and the mutation_load direction were both found this way, by reading the function bodies rather than trusting their comments.

Next: see Immunology, hematology, and virology kernels for the adjacent clinical and cell-biology lab-science formulas, or browse the Runtime library catalog for every module and function.

Last updated

Was this helpful?