Bio Plots
21 specialized biological visualization functions. All return SVG and share the common plot options (width, height, title, palette, theme).
Visual catalogue
See every BioLang biological plot
These are generated by the current BioLang renderer from the small examples shown in each preview. Select a figure to inspect it at full size, copy its code, or download SVG and high-resolution PNG.
Genomics
manhattan
Manhattan plot for genome-wide association studies. Alternating chromosome colors with significance threshold line.
manhattan(tbl, opts?) -> svg
| Option | Type | Description |
|---|---|---|
| chrom | string | Chromosome column name |
| pos | string | Position column name |
| pvalue | string | P-value column name |
| threshold | float | Significance threshold (default: 5e-8) |
| suggestive | float | Suggestive threshold (default: 1e-5) |
| label_top | int | Label top N hits |
let gwas = read_csv("data/expression.csv")
manhattan(gwas, {
chrom: "CHR", pos: "BP", pvalue: "P",
label_top: 5,
title: "GWAS Manhattan Plot"
}) |> save_svg("manhattan.svg")
qq_plot
Quantile-quantile plot for p-value distribution assessment. Includes genomic inflation factor (lambda).
qq_plot(pvalues, opts?) -> svg
let pvals = gwas |> select("P") |> to_records |> map(|r| r.P)
qq_plot(pvals, {title: "QQ Plot", show_lambda: true})
ideogram
Chromosome ideogram with banding patterns and highlighted regions.
ideogram(chromosome_bands, opts?) -> svg
ideogram("hg38", [
{chrom: "chr17", start: 43044295, end: 43170245, label: "BRCA1", color: "red"},
{chrom: "chr13", start: 32315474, end: 32400266, label: "BRCA2", color: "blue"}
])
circos
Circular genome plot with multiple data tracks (links, scatter, histogram, heatmap).
circos(tracks, opts?) -> svg
circos([
{type: "ideogram", genome: "hg38"},
{type: "scatter", data: gwas_hits, r_inner: 0.7, r_outer: 0.9},
{type: "links", data: translocations, color: "red"}
], {title: "Structural Variants"})
hic_map
Hi-C contact map visualization. Renders chromatin interaction frequencies as a triangular or square heatmap.
hic_map(data, opts?) -> svg
hic_map(contact_matrix, {resolution: "10kb", title: "Hi-C chr1"})
Cancer Genomics
oncoprint
Mutation landscape visualization (genes x samples).
oncoprint(mutations, opts?) -> svg
let muts = table({
gene: ["TP53", "TP53", "BRCA1", "EGFR"],
sample: ["S01", "S02", "S01", "S03"],
type: ["missense", "nonsense", "frameshift", "missense"]
})
oncoprint(muts, {
gene: "gene",
sample: "sample"
})
Variant & Mutation Plots
rainfall
Mutation rainfall plot showing inter-mutation distances along the genome. Useful for identifying localized hypermutation (kataegis).
rainfall(data, opts?) -> svg
rainfall(variants, {chrom: "chr", pos: "position", title: "Mutation Rainfall"})
cnv_plot
Copy number variation plot across the genome. Displays log2 ratios with gain/loss coloring and segmentation lines.
cnv_plot(data, opts?) -> svg
cnv_plot(cnv_data, {chrom: "chr", start: "start", end: "end", ratio: "log2ratio", title: "CNV Profile"})
lollipop
Protein mutation lollipop plot. Shows mutations along a protein domain diagram with frequency stems.
lollipop(data, opts?) -> svg
lollipop(mutations, {position: "aa_pos", label: "mutation", height: "count", length: 393, title: "TP53 Mutations"})
Statistical Plots
violin
Violin plot showing distribution shape. Data is a record of {group_name: [values]} or a table.
violin(data, opts?) -> svg
violin({"WT": [30,32,28,35], "KO": [22,25,20,18]}, {title: "Expression"})
density
Kernel density estimation plot. Smooths a distribution of values into a continuous curve.
density(data, opts?) -> svg
density(quality_scores, {title: "Quality Distribution", bandwidth: 0.5})
kaplan_meier
Survival analysis plot with step function curves and optional confidence intervals. Supports group comparison.
kaplan_meier(data, opts?) -> svg
kaplan_meier(survival_data, {time: "months", event: "status", group: "treatment", title: "Overall Survival"})
forest_plot
Meta-analysis forest plot with effect sizes and confidence intervals. Shows individual study estimates and pooled summary.
forest_plot(data, opts?) -> svg
forest_plot(studies, {effect: "OR", ci_low: "lower", ci_high: "upper", title: "Meta-Analysis"})
roc_curve
ROC curve with AUC annotation. Visualizes classifier performance with true/false positive rate tradeoff.
roc_curve(data, opts?) -> svg
roc_curve(predictions, {fpr: "fpr", tpr: "tpr", auc: 0.85, title: "Classifier Performance"})
pca_plot
PCA scatter plot with group coloring and variance explained annotations on each axis.
pca_plot(data, opts?) -> svg
pca_plot(pca_result, {group: "cell_type", title: "PCA of Samples"})
RNA & Splicing
sashimi
Render splice junction counts, optionally with a coverage table.
sashimi(junctions, opts?) -> svg
sashimi({coverage: coverage_table, junctions: junction_table}, opts?) -> svg
let junctions = table([
{start: 43045600, end: 43049100, count: 42},
{start: 43045600, end: 43051000, count: 17}
])
sashimi(junctions, {
title: "BRCA1 Splicing"
})
clustered_heatmap
Heatmap with hierarchical clustering on rows, columns, or both. Adds dendrograms and reorders axes by similarity. Works with any numeric matrix — especially useful for expression data.
clustered_heatmap(matrix, opts?) -> svg
clustered_heatmap(expr_matrix, {cluster_rows: true, cluster_cols: true, title: "Clustered Expression"})
Sequence & Structure
Sequence Visualization
| Function | Signature | Description |
|---|---|---|
| sequence_logo | sequence_logo(sequences, opts?) -> svg | Sequence logo (motif) |
| phylo_tree | phylo_tree(newick, opts?) -> svg | Phylogenetic tree (rectangular/circular) |
# Sequence logo from binding sites
let motif_seqs = ["ATCGATCG", "ATCGTTCG", "ATCGATGG", "ATCGATCG"]
sequence_logo(motif_seqs, {title: "Binding Motif"}) |> save_svg("motif.svg")
# Phylogenetic tree
let tree = read_text("species.nwk")
phylo_tree(tree, {layout: "circular", title: "Species Tree"})
Set & Comparison Plots
venn
Venn diagram for 2-4 sets. Shows overlapping and unique counts with labeled regions.
venn(data, opts?) -> svg
venn({A: genes_a, B: genes_b, C: genes_c}, {title: "Gene Set Overlap"})
upset
UpSet plot for complex set intersections. Scales better than Venn diagrams for 4+ sets, showing intersection sizes as a bar chart with a dot matrix indicating set membership.
upset(data, opts?) -> svg
upset({ChIP: chip_genes, RNA: rna_genes, ATAC: atac_genes}, {title: "Multi-Omics Intersection"})