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, 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)#

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.

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.