Skip to main content
Glama

ccc_rank_aggregate

Aggregates ligand-receptor interaction scores from multiple cell-cell communication methods to identify significant signaling pathways between cell groups in single-cell RNA sequencing data.

Instructions

Get an aggregate of ligand-receptor scores from multiple Cell-cell communication methods.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
groupbyYesKey to be used for grouping or clustering cells (e.g., cell type annotations).
resource_nameNoName of the resource to be used for ligand-receptor inference. See `li.rs.show_resources()` for available resources.consensus
expr_propNoMinimum expression proportion for the ligands and receptors in the corresponding cell identities. Set to 0 to return unfiltered results.
min_cellsNoMinimum cells per cell identity to be considered for downstream analysis.
baseNoExponent base used to reverse the log-transformation of the matrix. Relevant only for the `logfc` method.
aggregate_methodNoMethod aggregation approach: 'mean' for mean rank, 'rra' for RobustRankAggregate.rra
return_all_lrsNoWhether to return all ligand-receptor pairs, or only those that surpass the expr_prop threshold.
key_addedNoKey under which the results will be stored in adata.uns.liana_res
use_rawNoUse raw attribute of adata if present.
layerNoLayer in AnnData.layers to use. If None, use AnnData.X.
de_methodNoDifferential expression method used to rank genes according to 1vsRest.t-test
n_permsNoNumber of permutations for permutation-based methods. If None, no permutation testing is performed.
n_jobsNoNumber of jobs to run in parallel.

Implementation Reference

  • Handler function run_ccc_func that executes ccc_rank_aggregate by dispatching to li.mt.rank_aggregate(adata, **filtered_kwargs) in the 'else' branch.
    def run_ccc_func(ads, func, arguments):
        
        if func not in ccc_func:
            raise ValueError(f"不支持的函数: {func}")
        run_func = ccc_func[func]
        adata = ads.adata_dic[ads.active]
        try:
            logger.info(f"Running function {func} with arguments {arguments}")
            
            if func == "ls_ccc_method":
                res = run_func()
            elif func == "ccc":
                # Extract method from arguments and pass remaining args
                method = arguments.get("method", "cellphonedb")
                method_args = {k: v for k, v in arguments.items() if k != "method"}
                res = run_func(adata, method, **method_args)
                
            elif "plot" in func:
                from ..util import savefig
                ax = run_func(adata, **arguments)
                fig_path = Path(os.getcwd()) / f"figures/{func}.png"
                res = savefig(ax, fig_path, format="png")
                add_op_log(adata, run_func, arguments)  # 
            else:   
                parameters = inspect.signature(run_func).parameters
                kwargs = {k: arguments.get(k) for k in parameters if k in arguments}
                res = run_func(adata, **kwargs)
                add_op_log(adata, run_func, kwargs)
            return res
        except Exception as e:
            logger.error(f"Error running function {func}: {e}")
            raise e
  • Pydantic model defining the input schema for the ccc_rank_aggregate tool, used via model_json_schema().
    class RankAggregateModel(JSONParsingModel):
        """Input schema for LIANA's rank_aggregate method for cell-cell communication analysis."""
        
        groupby: str = Field(
            ...,  # Required field
            description="Key to be used for grouping or clustering 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."
        )
        
        aggregate_method: Literal["rra", "mean"] = Field(
            default="rra",
            description="Method aggregation approach: 'mean' for mean rank, 'rra' for RobustRankAggregate."
        )
        
        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 permutation-based methods. If None, no permutation testing is performed."
        )
  • Creates the MCP Tool object for ccc_rank_aggregate with name, description, and input schema.
    rank_aggregate_tool = types.Tool(
        name="ccc_rank_aggregate",
        description="Get an aggregate of ligand-receptor scores from multiple  Cell-cell communication methods. ",
        inputSchema=RankAggregateModel.model_json_schema(),
    )
  • Maps tool name 'ccc_rank_aggregate' to the actual function li.mt.rank_aggregate for execution.
    ccc_func = {
        "ls_ccc_method": ls_ccc_method,
        "ccc_rank_aggregate": li.mt.rank_aggregate,
        "ccc_circle_plot": plot_circleplot,
        "ccc_dot_plot": plot_dotplot,
        "ccc": run_ccc,
    }
  • Registers the rank_aggregate_tool in the ccc_tools dictionary, which is used by server.list_tools() and call_tool() dispatch.
    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,
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It mentions aggregation but doesn't explain what the tool actually does with the data (e.g., computational method, output format, whether it modifies input data, performance characteristics, or error conditions). For a tool with 13 parameters and complex functionality, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core purpose without unnecessary words. It's appropriately sized for what it communicates, though it could be more informative. There's no wasted verbiage or redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex tool with 13 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what the aggregation produces, how results are returned or stored, what computational methods are involved, or what the user should expect. The description leaves too many questions unanswered for effective tool selection and use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the schema already fully documents all 13 parameters. The description adds no additional parameter information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline score is 3 even with no parameter information in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get an aggregate') and the target ('ligand-receptor scores from multiple Cell-cell communication methods'), making the purpose understandable. However, it doesn't differentiate this tool from its sibling 'ccc' tool, which appears to be a related cell-cell communication method, leaving some ambiguity about when to use one versus the other.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'ccc' available, there's no indication of whether this is for aggregation of existing results, a different analysis approach, or specific use cases. The user must infer usage from the name and parameters alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/huang-sh/scmcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server