Bioinformática · katucharts.js/bio
Manhattan
type: 'manhattan'Visualização GWAS — pontos ao longo de posições cromossômicas com cores alternadas por cromossomo e uma linha de significância em nível de genoma. Renderizado em tela acima de ~20k pontos.
Edite o JSON à direita e pressione Executar (ou ⌘/Ctrl + Enter) — dados, títulos, categorias e cores se atualizam ao vivo.
Ao Vivo
Manhattan
Editar · JSON
Formato de dados
{ x: position, y: -log10pval, custom: { chromosome } }
Estrutura de dados
O JSON que você passa dentro do gráfico — coloque direto na sua 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' } }
]Exemplo
KatuCharts.chart('container', {
series: [{ type: 'manhattan',
data: [{ x: 0, y: 7.5, custom: { chromosome: 'chr1' } }],
significanceLine: -5 }]
});Opções específicas do tipo
| Opção | Descrição |
|---|---|
significanceThreshold / suggestiveLine | Linhas de limite (ex. 5e-8, 1e-5). |
chromosomeColors | Cores alternadas por cromossomo. |
Variações
Linha sugestiva
Adicione uma segunda linha de limiar abaixo da de significância 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.
Opções comuns (color, visible, marker, dataLabels, animation, events, zones…) se aplicam a cada tipo — veja Configuração → series. Veja renderizado na galeria.