code: def manhattan(
      pvals: "Float64Expression",
      locus: "Optional[LocusExpression]" = None,
      title: "Optional[str]" = None,
      size: int = 4,
      hover_fields: "Optional[Dict[str, Expression]]" = None,
      collect_all: "Optional[bool]" = None,
      n_divisions: "Optional[int]" = 500,
      significance_line: "Optional[Union[int, float]]" = 5e-8,
  ) -> Plot:
      """Create a Manhattan plot. (https://en.wikipedia.org/wiki/Manhattan_plot)
  
      Parameters
      ----------
      pvals : :class:`.Float64Expression`
          P-values to be plotted.
      locus : :class:`.LocusExpression`, optional
          Locus values to be plotted.
      title : str, optional
          Title of the plot.
      size : int
          Size of markers in screen space units.
      hover_fields : Dict[str, :class:`.Expression`], optional
          Dictionary of field names and values to be shown in the HoverTool of the plot.
      collect_all : bool, optional
          Deprecated - use `n_divisions` instead.
      n_divisions : int, optional.
          Factor by which to downsample (default value = 500).
          A lower input results in fewer output datapoints.
          Use `None` to collect all points.
      significance_line : float, optional
          p-value at which to add a horizontal, dotted red line indicating
          genome-wide significance.  If ``None``, no line is added.
  
      Returns
      -------
      :class:`bokeh.models.Plot`
      """
      if locus is None:
          locus = pvals._indices.source.locus
  
      ref = locus.dtype.reference_genome
  
      if hover_fields is None:
          hover_fields = {}
  
      hover_fields["locus"] = hail.str(locus)
  
      pvals = -hail.log10(pvals)
  
      source_pd = _collect_scatter_plot_data(
          ("_global_locus", locus.global_position()),
          ("_pval", pvals),
          fields=hover_fields,
          n_divisions=_downsampling_factor(
              "manhattan", n_divisions, collect_all
          ),
      )
      source_pd["p_value"] = [10 ** (-p) for p in source_pd["_pval"]]
      source_pd["_contig"] = [
          locus.split(":")[0] for locus in source_pd["locus"]
      ]
  
      observed_contigs = [
          contig
          for contig in ref.contigs.copy()
          if contig in set(source_pd["_contig"])
      ]
  
      contig_ticks = [
          ref._contig_global_position(contig)
          + ref.contig_length(contig) // 2
          for contig in observed_contigs
      ]
      color_mapper = CategoricalColorMapper(
          factors=ref.contigs,
          palette=palette[:2] * int((len(ref.contigs) + 1) / 2),
      )
  
      p = figure(
          title=title,
          x_axis_label="Chromosome",
          y_axis_label="P-value (-log10 scale)",
          width=1000,
      )
      p, _, legend, _, _, _ = _get_scatter_plot_elements(
          p,
          source_pd,
          x_col="_global_locus",
          y_col="_pval",
          label_cols=["_contig"],
          colors={"_contig": color_mapper},
          size=size,
          hover_cols={"locus", "p_value"} | set(hover_fields),
      )
      assert legend is not None
      legend.visible = False
      p.xaxis.ticker = contig_ticks
      p.xaxis.major_label_overrides = dict(
          zip(
              contig_ticks,
              [
                  contig.replace("chr", "")
                  for contig in observed_contigs
              ],
          )
      )
  
      if significance_line is not None:
          p.renderers.append(
              Span(
                  location=-math.log10(significance_line),
                  dimension="width",
                  line_color="red",
                  line_dash="dashed",
                  line_width=1.5,
              )
          )
  
      return p
  
imports: import math
  import collections
  import numpy
  import pandas
  import bokeh
  import bokeh.io
  import bokeh.models
  import warnings
  from bokeh.models import HoverTool, ColorBar, LogTicker, LogColorMapper, LinearColorMapper, CategoricalColorMapper, ColumnDataSource, BasicTicker, Plot, CDSView, GroupFilter, IntersectionFilter, Legend, LegendItem, Renderer, CustomJS, Select, Column, Span, DataRange1d, Slope, Label, ColorMapper, GridPlot
  import bokeh.plotting
  import bokeh.palettes
  from bokeh.plotting import figure
  from bokeh.transform import transform
  from bokeh.layouts import gridplot
  from hail.expr import aggregators
  from hail.expr.expressions import Expression, NumericExpression, StringExpression, LocusExpression, Int32Expression, Int64Expression, Float32Expression, Float64Expression, expr_numeric, expr_float64, expr_any, expr_locus, expr_str, raise_unless_row_indexed
  from hail.expr.functions import _error_from_cdf_python
  from hail.typecheck import typecheck, oneof, nullable, sized_tupleof, numeric, sequenceof, dictof
  from hail import Table, MatrixTable
  from hail.utils.struct import Struct
  from hail.utils.java import warning
  from typing import List, Tuple, Dict, Union, Callable, Optional, Sequence, Any, Set
  import hail
label_desc: Use image node_id 19 for calling a global function with example usage: manhattan(pvals, locus, title, size, hover_fields, collect_all, n_divisions, significance_line) and returns: p