Start here
  • InstallationAdd Nelumbo to a shadcn project
  • ThemingBrand accent, neutrals, dynamic color
  • Biology componentsSequences, maps, plates and trees
  • katalyx.bio

    Sequence Logo

    A motif as stacks of letters: each position as tall as the information it carries, each letter as tall as its share. The letters take the same hues as Nucleotide and Amino Acid, so a logo reads with the sequences around it.

    Install

    npx shadcn@latest add @nelumbo/sequence-logo

    A motif

    Where p53 binds DNA, from 17,412 sites in JASPAR (MA0106.3): two half-sites, each with the CATG core at full height. A position matrix of counts goes straight in; hover a stack for every base's share.

    Bits or probability

    "bits" sizes each stack by its information, so the positions that matter stand out. "probability" fills every stack, for reading the mix at a loose position. A background composition turns bits into relative entropy, for genomes far from a quarter of each base.

    Protein

    The C2H2 zinc finger, from Pfam's seed alignment of 151 sequences (PF00096). The two cysteines and two histidines that hold the zinc tower over the rest; the hydrophobic F and L that pack the core sit in between.

    Strands

    CTCF's motif (JASPAR MA0139.1) on either strand: reverseComplement flips the matrix and swaps each base for its partner.

    Small samples

    With few sequences, chance alone makes a position look conserved. The small-sample correction takes that expected information off every stack. Eight zinc fingers, with and without it.

    25.9 bits in all

    Selection

    selectable makes the logo one keyboard stop, like a chart: arrows move a position, Shift extends, Home and End jump, Escape clears. Drag with the pointer. The selected stretch reads out its consensus and total bits.

    CXXC, Positions 3 to 6
    9.4 bits across 4 positions

    Props

    PropTypeDefaultNotes
    sequencesstring[]Aligned sequences of one length; - or . for gaps.
    matrixRecord<string, number>[]Or a position matrix, counts or frequencies per position (JASPAR, MEME, TRANSFAC).
    type"dna" | "rna" | "protein"detectedThe alphabet: 2 bits a position for DNA, 4.32 for protein.
    schemeNucleotide or AminoAcid scheme"nelumbo"The letter hues.
    mode"bits" | "probability""bits"Stacks sized by information, or all full height.
    correctionbooleantrueSmall-sample correction, (s − 1) / (2 ln 2 n). Skipped for frequencies.
    backgroundRecord<string, number>Letter composition to measure against (relative entropy).
    reverseComplementbooleanfalseThe other strand, read 5′ to 3′.
    columnStartnumber1The number of the first position.
    height / maxColumnWidthnumber160, 40Plot height; the widest a stack gets. Below 12 px a stack, the logo scrolls.
    yAxis / rulerboolean, boolean | numbertrue, trueThe bits axis; position numbers, every one that fits or every n.
    consensusbooleanfalseA row of tiles under the stacks: IUPAC codes for DNA (Cavener's rules), X for a loose protein position.
    highlight{ start, end, label? }[]Stretches marked behind the stacks.
    tooltipbooleantrueThe hover card with each letter's share.
    selectable / selectionboolean, { start, end } | nullfalseKeyboard and pointer selection. Controlled or not (defaultSelection).
    onActiveChange(column | null) => voidThe position under the pointer or cursor: bits, gaps, letters.
    HelperslogoCounts, logoColumns, logoConsensus, reverseComplementMatrix, detectLogoTypeCounts from sequences; stacks from counts; a column's consensus; the other strand.