commot.pl.plot_cluster_communication_network

commot.pl.plot_cluster_communication_network(adata, uns_names=None, clustering=None, quantile_cutoff=0.99, p_value_cutoff=0.05, self_communication_off=False, filename=None, nx_node_size=0.2, nx_node_cmap='Plotly', nx_node_cluster_cmap=None, nx_pos_idx=array([0, 1]), nx_node_pos='cluster', nx_edge_width_lb_quantile=0.05, nx_edge_width_ub_quantile=0.95, nx_edge_width_min=1, nx_edge_width_max=4, nx_edge_color='node', nx_edge_colors=['#636EFA', '#EF553B', '#00CC96', '#AB63FA', '#FFA15A', '#19D3F3', '#FF6692', '#B6E880', '#FF97FF', '#FECB52'], nx_edge_colormap=<matplotlib.colors.LinearSegmentedColormap object>, nx_bg_pos=True, nx_bg_color='lavender', nx_bg_ndsize=0.05)

Plot cluster-cluster communication as network.

../_images/cluster_communication.png
Parameters
  • adata (AnnData) – The data matrix of shape n_obs × n_var. Rows correspond to cells or positions and columns to genes.

  • pathway_name – Name of the signaling pathway.

  • clustering (Optional[str]) – Name of the clustering.

  • lr_pair – If method=’single-pair’, lr_pair is a tuple of a pair of ligand-receptor or the total commucation of the pathway when set to None.

  • keys – A list of keys for cluster communication as tuples (pathway_name, ligand, receptor). If given, pathway_name and lr_pair will be ignored. If more than one is given, the average will be plotted.

  • quantile_cutoff (float) – The quantile cutoff for including an edge. Set to 1 to disable this criterion. The quantile_cutoff and p_value_cutoff works in the “or” logic to avoid missing significant signaling connections.

  • p_value_cutoff (float) – The cutoff of p-value to plot an edge.

  • self_communication_off (bool) – Whether to exclude self communications in the visualization.

  • filename (Optional[str]) – Filename for saving the figure. Set the name to end with ‘.pdf’ or ‘png’ to specify format.

  • nx_node_size (float) – Size of node representing clusters.

  • nx_node_cmap (str) – The discrete color map to use for clusters. Choices: ‘Plotly’, ‘Alphabet’, ‘Light24’, ‘Dark24’. Recommend to use ‘Plotly’ for ten clusters or fewer and ‘Alphabet’ for 10-24 clusters.

  • nx_pos_idx (ndarray) – Coordinates to use for the 2D plot.

  • nx_node_pos (str) – ‘cluster’, the predicted spatial location of clusters will be used. If None, the ‘dot’ layout from Graphviz package will be used.

  • nx_edge_width_lb_quantile (float) – The quantile of communication connections to set for the lower bound of edge width.

  • nx_edge_width_ub_quantile (float) – The quantile of communication connections to set for the upper bound of edge width.

  • nx_edge_width_min (float) – Minimum width for plotted edges.

  • nx_edge_width_max (float) – Maximum width for plotted edges.

  • nx_edge_color (Union[str, ndarray]) – If ‘node’, the color of an edge will be the same as the source node. If an array of numbers between [0,1], the nx_edge_colormap will be used to determine the edge colors.

  • nx_edge_colors (list) – A list of color strings when method=’multi-pair’.

  • nx_edge_colormap – The color map to use when nx_edge_color is an array of weights.

  • nx_bg_pos (bool) – Whether to plot the cells/positions as spatial background. Set to False when not using the spatial layout of clusters.

  • nx_bg_color (str) – Color of the spatial background.

  • nx_bg_ndsize (float) – Node size of the spatial background.