dandelion.base.plotting.clone_overlap

dandelion.base.plotting.clone_overlap(adata, group_by, color_by=None, weighted_overlap=False, clone_key=None, color_mapping=None, node_labels=True, return_graph=False, save=None, legend_kwargs={'bbox_to_anchor': (1, 0.5), 'frameon': False, 'loc': 'center left', 'ncol': 2}, node_label_size=10, as_heatmap=False, return_heatmap_data=False, scale_edge_lambda=None, **kwargs)[source]

A plot function to visualise clonal overlap as a circos-style plot.

Originally written with nxviz < 0.7.3. Ported from https://github.com/zktuong/nxviz/tree/custom_color_mapping_circos_nodes_and_edges

Parameters:
  • adata (AnnData) – AnnData object.

  • group_by (str) – column name in obs for collapsing to nodes in circos plot.

  • color_by (str | None, optional) – column name in obs for grouping and color of nodes in plot. Must be a same or subcategory of the group_by categories e.g. group_by=”group_tissue”, color_by=”tissue”.

  • weighted_overlap (bool, optional) – if True, instead of collapsing to overlap to binary, edge thickness will reflect the number of cells found in the overlap. In the future, there will be the option to use something like a jaccard index instead.

  • clone_key (str | None, optional) – column name for clones. None defaults to ‘clone_id’.

  • color_mapping (list | dict | None, optional) – custom color mapping provided as a sequence (correpsonding to order of categories or alpha-numeric order ifdtype is not category), or dictionary containing custom {category:color} mapping.

  • node_labels (bool, optional) – whether to use node objects as labels or not

  • return_graph (bool, optional) – whether or not to return the graph for fine tuning.

  • save (str | None, optional) – file path for saving plot

  • legend_kwargs (dict, optional) – options for adjusting legend placement

  • node_label_size (int, optional) – size of labels if node_labels = True

  • as_heatmap (bool, optional) – whether to return plot as heatmap.

  • return_heatmap_data (bool, optional) – whether to return heatmap data as a pandas dataframe.

  • scale_edge_lambda (Callable | None, optional) – a lambda function to scale the edge thickness. If None, will not scale.

  • **kwargs – passed to matplotlib.pyplot.savefig.

Returns:

a nxviz.CircosPlot object.

Return type:

CircosPlot

Raises:
  • KeyError – if clone_overlap not found in adata.uns.

  • ValueError – if input is not AnnData.