Bioinformática · katucharts.js/bio

Manhattan

type: 'manhattan'

Visualización GWAS — puntos a lo largo de posiciones cromosómicas con colores alternos por cromosoma y una línea de significación genómica completa. Canvas-renderizado por encima de ~20k puntos.

Edita el JSON a la derecha y presiona Ejecutar (o ⌘/Ctrl + Intro) — los datos, títulos, categorías y colores se actualizan en vivo.

En Vivo
Manhattan
Editar · JSON

Formato de datos

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

Estructura de datos

El JSON que pasas dentro del gráfico — colócalo directamente en tu 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' } }
]

Ejemplo

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

Opciones específicas del tipo

OpciónDescripción
significanceThreshold / suggestiveLineLíneas de umbral (p. ej. 5e-8, 1e-5).
chromosomeColorsColores alternos por cromosoma.

Variaciones

Línea sugestiva

Añade una segunda línea de umbral por debajo de la de significancia genómica.

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.
Las opciones comunes (color, visible, marker, dataLabels, animation, events, zones…) se aplican a todos los tipos — véase Configuración → series. Míralo renderizado en la galería.