ktplotspy.plot.plot_cpdb_chord
- ktplotspy.plot.plot_cpdb_chord(adata, means, pvals, deconvoluted, celltype_key, interaction=None, cell_type1=None, cell_type2=None, keep_celltypes=None, remove_self=True, layer=None, sector_colors=None, sector_text_kwargs={'adjust_rotation': True, 'color': 'black', 'r': 105, 'size': 8}, sector_radius_limit=(95, 100), equal_sector_size=False, same_producer_colors=False, link_colors=None, link_offset=0, link_kwargs={'allow_twist': True, 'direction': 1, 'r1': 95, 'r2': 90}, legend_width=2, legend_kwargs={'bbox_to_anchor': (1, 1), 'fontsize': 8, 'loc': 'center'}, **plot_cpdb_kwargs)[source]
Plotting cellphonedb results as a chord diagram.
- Parameters:
adata (AnnData) – AnnData object with the .obs storing the celltype_key with or without splitby_key. The .obs_names must match the first column of the input meta.txt used for cellphonedb.
means (pd.DataFrame) – Dataframe corresponding to means.txt from cellphonedb.
pvals (pd.DataFrame) – Dataframe corresponding to pvalues.txt or relevant_interactions.txt from cellphonedb.
deconvoluted (pd.DataFrame) – Dataframe corresponding to deconvoluted.txt from cellphonedb.
celltype_key (str) – Column name in adata.obs storing the celltype annotations. Values in this column should match the second column of the input meta.txt used for cellphonedb.
interaction (str | list[str] | None, optional) – Interaction(s) to plot. If None, all interactions will be plotted. If provided as a ‘-’ separated string between L-R pair, only the specific interaction(s) will be plotted (more than 1 pair is accepted). If provided as a list of strings without ‘-’ separator, all relevant interactions in the list will be plotted.
cell_type1 (str | None, optional) – Name of cell type 1. Accepts regex pattern. None defaults to “.” i.e. all cell types. If both cell_type1 and cell_type2 are provided, only interactions contained in these cell types will be plotted.
cell_type2 (str | None, optional) – Name of cell type 2. Accepts regex pattern. None defaults to “.” i.e. all cell types. If both cell_type1 and cell_type2 are provided, only interactions contained in these cell types will be plotted.
keep_celltypes (list[str] | None, optional) – If provided, only interactions to/from these celltypes will be plotted.
remove_self (bool, optional) – whether to remove self edges.
layer (str | None, optional) – slot in AnnData.layers to access. If None, uses .X.
sector_colors (dict[str, str] | None, optional) – dictionary of celltype (sector) colours. If not provided, will try and use .uns from adata if correct slot is present.
sector_text_kwargs (dict, optional) – additional arguments for track.text. See https://moshi4.github.io/pyCirclize/api-docs/sector/#pycirclize.sector.Sector.text
sector_radius_limit (tuple[float, float], optional) – radius limits for the sectors.
equal_sector_size (bool, optional) – whether to use equal sector sizes.
same_producer_colors (bool, optional) – whether to use the same colours for sector and links for outgoing interactions.
link_colors (dict[str, str] | None, optional) – String or dictionary of L-R interaction colours. If not provided, will use a default colour, will use a random colour for each unique interaction.
link_offset (float, optional) – offset to add to each interaction value.
link_kwargs (dict, optional) – additional arguments for circos.link. See https://moshi4.github.io/pyCirclize/api-docs/circos/#pycirclize.circos.Circos.link
legend_width (float, optional) – width of the legend line.
legend_kwargs (dict, optional) – additional arguments for Axes.Legend. See https://matplotlib.org/stable/tutorials/intermediate/legend_guide.html
**plot_cpdb_kwargs – passed to plot_cpdb.
- Returns:
a Gcircle object from pycircos.
- Return type:
Gcircle