malariagen_data.ag3.Ag3.plot_haplotype_network#

Ag3.plot_haplotype_network(region: str | Region | Mapping | List[str | Region | Mapping] | Tuple[str | Region | Mapping, ...], analysis: str = 'default', sample_sets: Sequence[str] | str | None = None, sample_query: str | None = None, sample_query_options: dict | None = None, max_dist: int = 2, color: str | Mapping | None = None, color_discrete_sequence: List | None = None, color_discrete_map: Mapping | None = None, category_orders: List | Mapping | None = None, node_size_factor: int = 50, layout: str = 'cose', layout_params: Mapping | None = None, server_port: int | None = None, server_mode: Literal['inline', 'external', 'jupyterlab', 'tab'] | None = 'inline', height: int = 600, width: int | str | None = '100%', serve_scripts_locally: bool = True, chunks: int | str | Tuple[int | str, ...] | Callable[[Tuple[int, ...]], int | str | Tuple[int | str, ...]] = 'native', inline_array: bool = True)#

Construct a median-joining haplotype network and display it using Cytoscape.

A haplotype network provides a visualisation of the genetic distance between haplotypes. Each node in the network represents a unique haplotype. The size (area) of the node is scaled by the number of times that unique haplotype was observed within the selected samples. A connection between two nodes represents a single SNP difference between the corresponding haplotypes.

Parameters#

regionstr or Region or Mapping or list of str or Region or Mapping or tuple of str or Region or Mapping

Region of the reference genome. Can be a contig name, region string (formatted like “{contig}:{start}-{end}”), or identifier of a genome feature such as a gene or transcript. Can also be a sequence (e.g., list) of regions.

analysisstr, optional, default: ‘default’

Which haplotype phasing analysis to use. See the phasing_analysis_ids property for available values.

sample_setssequence of str or str or None, optional

List of sample sets and/or releases. Can also be a single sample set or release.

sample_querystr or None, optional

A pandas query string to be evaluated against the sample metadata, to select samples to be included in the returned data.

sample_query_optionsdict or None, optional

A dictionary of arguments that will be passed through to pandas query() or eval(), e.g. parser, engine, local_dict, global_dict, resolvers.

max_distint, optional, default: 2

Join network components up to a maximum distance of 2 SNP differences.

colorstr or Mapping or None, optional

Name of variable to use to color the markers.

color_discrete_sequenceList or None, optional

Provide a list of colours to use.

color_discrete_mapMapping or None, optional

Provide an explicit mapping from values to colours.

category_ordersList or Mapping or None, optional

Control the order in which values appear in the legend.

node_size_factorint, optional, default: 50

Control the sizing of nodes.

layoutstr, optional, default: ‘cose’

Name of the network layout to use to position nodes.

layout_paramsMapping or None, optional

Additional parameters to the layout algorithm.

server_portint or None, optional

Manually override the port on which the Dash app will run.

server_mode{‘inline’, ‘external’, ‘jupyterlab’, ‘tab’} or None, optional, default: ‘inline’

Controls how the Jupyter Dash app will be launched. See https://dash.plotly.com/dash-in-jupyter#display-modes for more information.

heightint, optional, default: 600

Height of the Dash app in pixels (px).

widthint or str or None, optional, default: ‘100%’

Width of the Dash app.

serve_scripts_locallybool, optional, default: True

If True, serve scripts locally, otherwise use CDN.

chunksint or str or tuple of int or str or Callable[[typing.Tuple[int, …]], int or str or tuple of int or str], optional, default: ‘native’

Define how input data being read from zarr should be divided into chunks for a dask computation. If ‘native’, use underlying zarr chunks. If a string specifying a target memory size, e.g., ‘300 MiB’, resize chunks in arrays with more than one dimension to match this size. If ‘auto’, let dask decide chunk size. If ‘ndauto’, let dask decide chunk size but only for arrays with more than one dimension. If ‘ndauto0’, as ‘ndauto’ but only vary the first chunk dimension. If ‘ndauto1’, as ‘ndauto’ but only vary the second chunk dimension. If ‘ndauto01’, as ‘ndauto’ but only vary the first and second chunk dimensions. Also, can be a tuple of integers, or a callable which accepts the native chunks as a single argument and returns a valid dask chunks value.

inline_arraybool, optional, default: True

Passed through to dask from_array().