Bioinformatics · katucharts.js/bio

Manhattan

type: 'manhattan'

GWAS visualization — points along chromosomal positions with alternating colors per chromosome and a genome-wide significance line. Canvas-rendered above ~20k points.

Edit the JSON on the right and press Run (or ⌘/Ctrl + Enter) — data, titles, categories and colors all update live.

Live
Manhattan
Edit · JSON

Data format

{ x: position, y: -log10pval, custom: { chromosome } }

Data shape

The JSON you pass inside the chart — drop it straight into your series.

data: [
  { x: 0, y: 7.5, custom: { chromosome: 'chr1' } },
  { x: 100, y: 5.2, custom: { chromosome: 'chr1' } },
  { x: 500, y: 8.1, custom: { chromosome: 'chr2' } }
]

Example

KatuCharts.chart('container', {
  series: [{ type: 'manhattan',
    data: [{ x: 0, y: 7.5, custom: { chromosome: 'chr1' } }],
    significanceLine: -5 }]
});

Type-specific options

OptionDescription
significanceThreshold / suggestiveLineThreshold lines (e.g. 5e-8, 1e-5).
chromosomeColorsAlternating per-chromosome colors.

Variations

Suggestive line

Add a second threshold line below the genome-wide significance line.

KatuCharts.chart('container', {
  series: [{
    type: 'manhattan',
    data: snps,
    significanceLine: -5,
    suggestiveLine: -3
  }]
});

Common errors

Why does my manhattan chart render as a line chart?
The chart type was not registered. KatuCharts logs "KatuCharts: unknown series type "<type>", falling back to line" and draws a line chart rather than throwing. Import the module the type belongs to — for example `import 'katucharts.js/bio';` — before creating the chart.
Why do I get "Cannot read properties of null (reading 'appendChild')"?
The container element does not exist when the chart is created. Create the chart after the element is in the DOM: in React that means inside useEffect, not during render.
Why is the chart rendering with zero height?
The container has no height. A div with no content collapses to zero. Give it a height in CSS, or pass `chart: { height: 400 }` in the options.

FAQ

How do I create a manhattan chart in JavaScript?
Install with `npm install katucharts.js`, import the module with `import 'katucharts.js/bio';`, then call KatuCharts.chart(container, { chart: { type: 'manhattan' }, series: [...] }).
What data does the Manhattan plot expect?
One point per SNP: { x: position, y: −log10(p), custom: { chromosome } }. Convert PLINK or regenie output to that shape first; the series does not parse those formats itself. Chromosomes alternate colours from chromosomeColors.
How many SNPs can a Manhattan plot draw?
Above canvasThreshold points (20,000 by default) the series switches from SVG to canvas rendering, so large GWAS results stay responsive.
Where is the genome-wide significance line?
Drawn at p = 5e-8 by default, with a suggestive line at p = 1e-5. Override them with significanceLine and suggestiveLine on the series; both take p-values.
Why does my manhattan chart render as a line chart?
The chart type was not registered. KatuCharts logs "KatuCharts: unknown series type "<type>", falling back to line" and draws a line chart rather than throwing. Import the module the type belongs to — for example `import 'katucharts.js/bio';` — before creating the chart.
Why do I get "Cannot read properties of null (reading 'appendChild')"?
The container element does not exist when the chart is created. Create the chart after the element is in the DOM: in React that means inside useEffect, not during render.
Common options (color, visible, marker, dataLabels, animation, events, zones…) apply to every type — see Configuration → series. See it rendered in the gallery.