ccc
Analyze cell-cell communication in single-cell RNA sequencing data using multiple methods to identify ligand-receptor interactions between cell types.
Instructions
Cell-cell communication analysis with one method (cellphonedb, cellchat,connectome, natmi, etc.)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | cell-cell communication method | cellphonedb |
| groupby | Yes | Key to be used for grouping cells (e.g., cell type annotations). | |
| resource_name | No | Name of the resource to be used for ligand-receptor inference. See `li.rs.show_resources()` for available resources. | consensus |
| expr_prop | No | Minimum expression proportion for the ligands and receptors in the corresponding cell identities. Set to 0 to return unfiltered results. | |
| min_cells | No | Minimum cells per cell identity to be considered for downstream analysis. | |
| base | No | Exponent base used to reverse the log-transformation of the matrix. Relevant only for the `logfc` method. | |
| return_all_lrs | No | Whether to return all ligand-receptor pairs, or only those that surpass the expr_prop threshold. | |
| key_added | No | Key under which the results will be stored in adata.uns. | liana_res |
| use_raw | No | Use raw attribute of adata if present. | |
| layer | No | Layer in AnnData.layers to use. If None, use AnnData.X. | |
| de_method | No | Differential expression method used to rank genes according to 1vsRest. | t-test |
| n_perms | No | Number of permutations for the permutation test. Relevant for CellPhoneDB method. | |
| seed | No | Random seed for reproducibility. | |
| n_jobs | No | Number of jobs to run in parallel. | |
| verbose | No | Whether to print verbose output. | |
| inplace | No | Whether to store results in place, or return them. | |
| supp_columns | No | Additional columns to be added from methods in liana, or columns from scanpy.tl.rank_genes_groups. |
Implementation Reference
- src/scmcp/tool/ccc.py:53-62 (handler)Core handler function `run_ccc` that performs the cell-cell communication analysis by dynamically calling the specified LIANA method function.def run_ccc(adata, method, **kwargs): """Run cell-cell communication analysis with the specified method.""" method_func = getattr(li.mt, method) parameters = inspect.signature(method_func).parameters filtered_kwargs = {k: kwargs.get(k) for k in parameters if k in kwargs} # filtered_kwargs["key_added"] = f"{method}_res" method_func(adata, **filtered_kwargs) add_op_log(adata, method_func, filtered_kwargs) return adata
- src/scmcp/schema/ccc.py:81-180 (schema)Pydantic model defining the input schema for the 'ccc' tool, used in inputSchema=CCCModel.model_json_schema().class CCCModel(JSONParsingModel): """Input schema for LIANA's cell-cell communication analysis.""" method: Literal[ "singlecellsignalr", "connectome", "cellphonedb", "natmi", "logfc", "cellchat", "geometric_mean", "scseqcomm" ] = Field( default="cellphonedb", description="cell-cell communication method" ) groupby: str = Field( ..., # Required field description="Key to be used for grouping cells (e.g., cell type annotations)." ) resource_name: str = Field( default="consensus", description="Name of the resource to be used for ligand-receptor inference. See `li.rs.show_resources()` for available resources." ) expr_prop: float = Field( default=0.1, description="Minimum expression proportion for the ligands and receptors in the corresponding cell identities. Set to 0 to return unfiltered results." ) min_cells: int = Field( default=5, description="Minimum cells per cell identity to be considered for downstream analysis." ) base: float = Field( default=2.718281828459045, # e description="Exponent base used to reverse the log-transformation of the matrix. Relevant only for the `logfc` method." ) return_all_lrs: bool = Field( default=False, description="Whether to return all ligand-receptor pairs, or only those that surpass the expr_prop threshold." ) key_added: str = Field( default="liana_res", description="Key under which the results will be stored in adata.uns." ) use_raw: Optional[bool] = Field( default=True, description="Use raw attribute of adata if present." ) layer: Optional[str] = Field( default=None, description="Layer in AnnData.layers to use. If None, use AnnData.X." ) de_method: str = Field( default="t-test", description="Differential expression method used to rank genes according to 1vsRest." ) n_perms: int = Field( default=1000, description="Number of permutations for the permutation test. Relevant for CellPhoneDB method." ) seed: int = Field( default=1337, description="Random seed for reproducibility." ) n_jobs: int = Field( default=1, description="Number of jobs to run in parallel." ) verbose: Optional[bool] = Field( default=False, description="Whether to print verbose output." ) inplace: bool = Field( default=True, description="Whether to store results in place, or return them." ) supp_columns: Optional[List[str]] = Field( default=None, description="Additional columns to be added from methods in liana, or columns from scanpy.tl.rank_genes_groups." )
- src/scmcp/tool/ccc.py:42-47 (registration)Tool object registration for the 'ccc' tool.# Add general CCC tool ccc_tool = types.Tool( name="ccc", description="Cell-cell communication analysis with one method (cellphonedb, cellchat,connectome, natmi, etc.)", inputSchema=CCCModel.model_json_schema(), )
- src/scmcp/tool/ccc.py:100-106 (registration)Mapping of 'ccc' tool to ccc_tools dictionary, which is used for registration in server.list_tools().ccc_tools = { "ls_ccc_method": ls_ccc_method_tool, "ccc_rank_aggregate": rank_aggregate_tool, "ccc_circle_plot": circle_plot_tool, "ccc_dot_plot": dot_plot_tool, "ccc": ccc_tool, }
- src/scmcp/server.py:35-56 (registration)Server tool listing function that includes ccc_tools.values(), registering the 'ccc' tool.@server.list_tools() async def list_tools() -> list[types.Tool]: if MODULE == "io": tools = io_tools.values() elif MODULE == "pp": tools = pp_tools.values() elif MODULE == "tl": tools = tl_tools.values() elif MODULE == "pl": tools = pl_tools.values() elif MODULE == "util": tools = util_tools.values() else: tools = [ *io_tools.values(), *pp_tools.values(), *tl_tools.values(), *pl_tools.values(), *util_tools.values(), *ccc_tools.values(), ] return tools