Skip to main content
Alpha Cyanea is in public alpha. We're building in the open — expect rough edges and rapid iteration. See what's live

cyanea-meta

v0.1.2 Analysis

From reads to community structure — taxonomy, diversity, and composition.

Analysis layer Apache-2.0 8 functions

Metagenomics — k-mer LCA taxonomy, community profiling, alpha/beta diversity, compositional analysis, binning, and assembly QC.

Overview

cyanea-meta turns sequencing reads and assemblies into community-level insight. It covers the metagenomics pipeline end to end: taxonomic assignment, community profiling, diversity analysis, compositional statistics, contig binning, and assembly quality control.

Microbiome data is compositional — abundances sum to a constant, so raw counts are misleading. The crate treats this as a first-class concern, providing log-ratio transforms and compositional differential-abundance tests rather than naive count comparisons.

Key Concepts

Taxonomy and LCA

Reads are classified by matching k-mers against a reference and resolving conflicts with a lowest-common-ancestor rule: when a k-mer maps to several taxa, the assignment climbs to the most specific shared ancestor. This trades resolution for robustness against ambiguous or contaminated references.

Diversity

Alpha diversity summarizes a single sample (Shannon, Simpson, observed richness). Beta diversity compares samples pairwise (Bray-Curtis, Jaccard, UniFrac), producing the distance matrices that feed ordination and clustering.

Compositional Analysis

CLR and ILR transforms move counts into an unconstrained space where standard statistics behave. ALDEx2 and ANCOM build on this to test differential abundance while respecting the compositional structure of the data.

Binning and Assembly QC

Contigs are grouped into putative genomes using tetranucleotide frequency and coverage signals. Assembly quality is summarized with N50, auN, and length distributions.

Code Examples

Rust

use cyanea_meta::{profile_community, alpha_diversity, DiversityMetric};

let profile = profile_community(&assignments);
let shannon = alpha_diversity(&counts, DiversityMetric::Shannon);

JavaScript (WASM)

import { alpha_diversity, beta_diversity } from '/wasm/cyanea_wasm.js';

const shannon = alpha_diversity(JSON.stringify(counts), "shannon");
const dist = JSON.parse(beta_diversity(JSON.stringify(samples), "bray_curtis"));

Use Cases

  • Microbiome surveys — Profile communities and compare diversity across conditions.
  • Differential abundance — Identify taxa that shift between groups without compositional artifacts.
  • Metagenome-assembled genomes — Bin contigs and assess assembly completeness.

API Surface

lca_assign (kmer_hits: &str) -> JSON Lowest-common-ancestor taxonomy assignment from k-mer hits
profile_community (assignments: &str) -> JSON Relative-abundance community profile
alpha_diversity (counts, metric) -> f64 Shannon, Simpson, and richness estimators
beta_diversity (samples: &str, metric) -> JSON Bray-Curtis, Jaccard, and UniFrac distances
clr_transform (counts: &str) -> JSON Centered log-ratio transform for compositional data
aldex2 (counts, groups) -> JSON ALDEx2 differential abundance testing
bin_contigs (tnf, coverage) -> JSON Metagenomic binning from tetranucleotide frequency and coverage
assembly_qc (contigs: &str) -> JSON N50, auN, and length distribution metrics

Depended on by

Tags

Metagenomics Taxonomy Diversity Compositional Binning