Run omicverse's CellPhoneDB v5 wrapper on annotated single-cell data to infer ligand-receptor networks and produce CellChat-style visualisations.
Apply this skill when a user wants to quantify ligand–receptor communication between annotated single-cell populations and display the networks with CellChatViz. It distils the workflow from t_cellphonedb.ipynb, which analyses EVT trophoblast data.
omicverse>=0.2, scanpy, anndata, pandas, matplotlib, and cellphonedb resources. The tutorial assumes the pre-built CellPhoneDB v5 SQLite bundle downloaded as cellphonedb.zip in the working directory.ov.plot_set() so that downstream figures follow the project palette.adata = ov.read('data/cpdb/normalised_log_counts.h5ad').adata.obs['cell_labels'] (e.g., EVT, dNK, VCT). Ensure adata.obs['cell_labels'] is categorical and free of missing values so CellPhoneDB groups cells correctly.adata.X.max() should be <10 and non-integer); raw counts inflate CellPhoneDB permutations.ov.single.run_cellphonedb_v5 with the curated AnnData and metadata column:
cpdb_results, adata_cpdb = ov.single.run_cellphonedb_v5(
adata,
cpdb_file_path='./cellphonedb.zip',
celltype_key='cell_labels',
min_cell_fraction=0.005,
min_genes=200,
min_cells=3,
iterations=1000,
threshold=0.1,
pvalue=0.05,
threads=10,
output_dir='./cpdb_results',
cleanup_temp=True,
)
ov.utils.save(cpdb_results, ...), adata_cpdb.write(...)). Saving avoids recomputing permutations.cell_labels categories to adata.uns['cell_labels_colors'] from previous plots.viz = ov.pl.CellChatViz(adata_cpdb, palette=color_dict). Inspect adata_cpdb to ensure communication slots (uns/obsm) were populated.viz.compute_aggregated_network(pvalue_threshold=0.05, use_means=True).viz.netVisual_circle(...) with matching figure sizes and colormaps.viz.netVisual_individual_circle and viz.netVisual_individual_circle_incoming to highlight senders versus receivers.pathway_comm = viz.compute_pathway_communication(method='mean', min_lr_pairs=2, min_expression=0.1).viz.get_significant_pathways_v2(...), then plot selected pathways using viz.netVisual_aggregate(..., layout='circle'), viz.netVisual_chord_cell(...), or viz.netVisual_heatmap_marsilea(...).viz.netVisual_chord_LR(...) or viz.netAnalysis_contribution(pathway) to surface dominant pairs.viz.netVisual_bubble_marsilea(...), optionally restricting sources_use/targets_use.viz.netVisual_chord_gene(...) to inspect signalling directionality.viz.netAnalysis_computeCentrality(), viz.netAnalysis_signalingRole_network_marsilea(...), viz.netAnalysis_signalingRole_scatter(...), and viz.netAnalysis_signalingRole_heatmap(...) for incoming/outgoing programmes.celltype_key. If the column contains spaces, mixed casing, or NaN, clean it (adata.obs['cell_labels'] = adata.obs['cell_labels'].astype('category').cat.remove_unused_categories()).cpdb_file_path must point to a full CellPhoneDB v5 SQLite zip. If omicverse raises FileNotFoundError or missing receptor tables, re-download the bundle from the official release and ensure the zip is not corrupted.min_cells) cause early termination. Increase min_cell_fraction thresholds or merge sparse clusters before rerunning.color_dict from adata.uns['cell_labels_colors'] after sorting categories to keep nodes and legends consistent.t_cellphonedb.ipynbomicverse_guide/docs/Tutorials-single/data/cpdb/reference.md