Skip to main content
Glama

pl_rank_genes_groups_dotplot

Visualize differentially expressed genes across cell groups using dot plots to identify expression patterns and statistical significance.

Instructions

Plot ranking of genes(DEGs) using dotplot visualization. Defualt plot DEGs for rank_genes_groups tool

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
figsizeNoFigure size. Format is (width, height).
color_mapNoColor map to use for continuous variables.
paletteNoColors to use for plotting categorical annotation groups.
vmaxNoThe value representing the upper limit of the color scale.
vminNoThe value representing the lower limit of the color scale.
vcenterNoThe value representing the center of the color scale.
legend_fontsizeNoNumeric size in pt or string describing the size.
legend_fontweightNoLegend font weight. A numeric value in range 0-1000 or a string.bold
legend_locNoLocation of legend, either 'on data', 'right margin' or a valid keyword for the loc parameter.right margin
legend_fontoutlineNoLine width of the legend font outline in pt.
var_namesNoGenes to plot. Sometimes is useful to pass a specific list of var names (e.g. genes) to check their fold changes or p-values
groupbyYesThe key of the observation grouping to consider.
use_rawNoUse raw attribute of adata if present.
logNoPlot on logarithmic axis.
dendrogramNoIf True or a valid dendrogram key, a dendrogram based on the hierarchical clustering between the groupby categories is added.
gene_symbolsNoColumn name in .var DataFrame that stores gene symbols.
var_group_positionsNoUse this parameter to highlight groups of var_names with brackets or color blocks between the given start and end positions.
var_group_labelsNoLabels for each of the var_group_positions that want to be highlighted.
layerNoName of the AnnData object layer that wants to be plotted.
groupsNoThe groups for which to show the gene ranking.
n_genesNoNumber of genes to show. This can be a negative number to show down regulated genes. Ignored if var_names is passed.
values_to_plotNoInstead of the mean gene value, plot the values computed by sc.rank_genes_groups.
min_logfoldchangeNoValue to filter genes in groups if their logfoldchange is less than the min_logfoldchange.
keyNoKey used to store the ranking results in adata.uns.

Implementation Reference

  • Pydantic model (RankGenesGroupsDotplotModel) defining the input schema, fields, and validation for the pl_rank_genes_groups_dotplot tool.
    class RankGenesGroupsDotplotModel(BaseMatrixModel):
        """Input schema for the rank_genes_groups_dotplot plotting tool."""
        
        groups: Optional[Union[str, List[str]]] = Field(
            default=None,
            description="The groups for which to show the gene ranking."
        )    
        n_genes: Optional[int] = Field(
            default=None,
            description="Number of genes to show. This can be a negative number to show down regulated genes. Ignored if var_names is passed."
        )
        values_to_plot: Optional[Literal['scores', 'logfoldchanges', 'pvals', 'pvals_adj', 'log10_pvals', 'log10_pvals_adj']] = Field(
            default=None,
            description="Instead of the mean gene value, plot the values computed by sc.rank_genes_groups."
        )
        min_logfoldchange: Optional[float] = Field(
            default=None,
            description="Value to filter genes in groups if their logfoldchange is less than the min_logfoldchange."
        )
        key: Optional[str] = Field(
            default=None,
            description="Key used to store the ranking results in adata.uns."
        )
        var_names: Union[List[str], Mapping[str, List[str]]] = Field(
            default=None,
            description="Genes to plot. Sometimes is useful to pass a specific list of var names (e.g. genes) to check their fold changes or p-values"
        )        
        @field_validator('n_genes')
        def validate_n_genes(cls, v: Optional[int]) -> Optional[int]:
            """Validate n_genes"""
            # n_genes can be positive or negative, so no validation needed
            return v
  • Definition and registration of the pl_rank_genes_groups_dotplot Tool object with name, description, and input schema.
    pl_rank_genes_groups_dotplot = types.Tool(
        name="pl_rank_genes_groups_dotplot",
        description="Plot ranking of genes(DEGs) using dotplot visualization. Defualt plot DEGs for rank_genes_groups tool",
        inputSchema=RankGenesGroupsDotplotModel.model_json_schema(),
    )
  • Mapping (pl_func dict) of tool name 'pl_rank_genes_groups_dotplot' to the underlying Scanpy function sc.pl.rank_genes_groups_dotplot.
    pl_func = {
        "pl_pca": sc.pl.pca,
        "pl_embedding": sc.pl.embedding,  # Add the new embedding function
        "diffmap": sc.pl.diffmap,
        "pl_violin": sc.pl.violin,
        "pl_stacked_violin": sc.pl.stacked_violin,
        "pl_heatmap": sc.pl.heatmap,
        "pl_dotplot": sc.pl.dotplot,
        "pl_matrixplot": sc.pl.matrixplot,
        "pl_tracksplot": sc.pl.tracksplot,
        "pl_scatter": sc.pl.scatter,
        "embedding_density": sc.pl.embedding_density,
        "rank_genes_groups": sc.pl.rank_genes_groups,
        "pl_rank_genes_groups_dotplot": sc.pl.rank_genes_groups_dotplot,  # Add function mapping
        "pl_clustermap": sc.pl.clustermap,
        "pl_highly_variable_genes": sc.pl.highly_variable_genes,
        "pl_pca_variance_ratio": sc.pl.pca_variance_ratio,
    }
  • Addition of the tool object to pl_tools dict, which is exposed via server.list_tools() for MCP tool listing.
    pl_tools = {
        "pl_pca": pl_pca_tool,
        "pl_embedding": pl_embedding,  # Add the new embedding tool
        # "diffmap": diffmap,
        "pl_violin": pl_violin,
        "pl_stacked_violin": pl_stacked_violin,
        "pl_heatmap": pl_heatmap,
        "pl_dotplot": pl_dotplot,
        "pl_matrixplot": pl_matrixplot,
        "pl_tracksplot": pl_tracksplot,
        "pl_scatter": pl_scatter,
        # "embedding_density": embedding_density,
        # "spatial": spatial,
        # "rank_genes_groups": rank_genes_groups,
        "pl_rank_genes_groups_dotplot": pl_rank_genes_groups_dotplot,  # Add tool mapping
        # "pl_clustermap": pl_clustermap,
        "pl_highly_variable_genes": pl_highly_variable_genes,
        "pl_pca_variance_ratio": pl_pca_variance_ratio,
    }
  • Core handler function for all pl_ tools, including pl_rank_genes_groups_dotplot: dispatches to mapped Scanpy function, prepares arguments, executes plot, saves figure via set_fig_path, logs operation.
    def run_pl_func(ads, func, arguments):
        """
        Execute a Scanpy plotting function with the given arguments.
        
        Parameters
        ----------
        adata : AnnData
            Annotated data matrix.
        func : str
            Name of the plotting function to execute.
        arguments : dict
            Arguments to pass to the plotting function.
            
        Returns
        -------
        The result of the plotting function.
        """
        adata = ads.adata_dic[ads.active]
        if func not in pl_func:
            raise ValueError(f"Unsupported function: {func}")
    
        run_func = pl_func[func]
        parameters = inspect.signature(run_func).parameters
        kwargs = {k: arguments.get(k) for k in parameters if k in arguments}    
    
        if "title" not in parameters:
            kwargs.pop("title", False)    
        kwargs.pop("return_fig", True)
        kwargs["show"] = False
        kwargs["save"] = ".png"
        try:
            fig = run_func(adata, **kwargs)
            fig_path = set_fig_path(func, **kwargs)
            add_op_log(adata, run_func, kwargs)
            return fig_path 
        except Exception as e:
            raise e
        return fig_path
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states what the tool does (plotting), but doesn't mention whether it creates a file, displays an image, requires specific data preprocessing, has side effects, or any performance considerations. For a complex tool with 24 parameters, this is a significant gap in transparency.

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

Conciseness3/5

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

The description is brief (two sentences) but not particularly well-structured. The first sentence states the purpose, while the second adds a vague note about defaults. However, the second sentence doesn't provide clear value and contains a typo ('Defualt'), reducing its effectiveness. It's concise but could be more polished and informative.

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?

Given the tool's complexity (24 parameters, no output schema, no annotations), the description is inadequate. It doesn't explain what the tool returns (e.g., a plot object, file path, or visualization), how to interpret results, or any prerequisites. For a visualization tool with many configuration options, more context is needed to help an agent use it effectively.

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%, meaning all parameters are documented in the input schema itself. The description adds no parameter-specific information beyond what's already in the schema. According to the rules, when schema coverage is high (>80%), the baseline score is 3 even with no param info in the description.

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

Purpose3/5

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

The description states the tool 'Plot ranking of genes(DEGs) using dotplot visualization', which provides a clear verb ('Plot') and resource ('ranking of genes'). However, it doesn't differentiate from sibling tools like 'pl_dotplot' or 'pl_matrixplot' that might also create dot plots, and the mention of 'rank_genes_groups tool' is vague without explaining what that tool does.

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. It mentions 'Default plot DEGs for rank_genes_groups tool', but this is unclear without context on what that tool does or when this visualization is preferred over other plotting tools like 'pl_heatmap' or 'pl_violin' in the sibling list.

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