Marker Gene Analysis with LLM Agents in AI4S Biocomputing
This article explains how LLM agents can support marker gene analysis in single-cell biological computing. It covers the standard single-cell analysis workflow, marker gene scoring and threshold selection, filtering of ribosomal protein genes, biological plausibility checks, and the design of an agent workflow with verification steps and human review points. It also discusses efficiency gains, risks such as hallucination and parameter sensitivity, and how a team can introduce such workflows.
1. Background: Why Computational Acceleration Needs Reliable Workflows
Drug discovery and life science research are generating increasingly high-dimensional data. A single run of an experiment such as single-cell sequencing or spatial transcriptomics can produce an expression matrix covering tens of thousands of cells and over ten thousand genes. As data volumes grow, the bottleneck in analysis has moved from the experiment to computation and interpretation.
A typical single-cell analysis includes the following steps:
- Quality control: filtering out low-quality cells and abnormal genes
- Normalization and dimensionality reduction: removing differences in sequencing depth and compressing the data into fewer dimensions
- Clustering: grouping cells with similar expression patterns into clusters
- Cell type annotation: using marker genes to determine the identity of each cluster
- Differential expression analysis: identifying genes whose expression differs significantly across clusters
Each step depends on parameter choices and expert judgment. A skilled researcher often needs several hours to complete one full analysis, and longer when data problems arise.
The value of LLM agents lies in handling repetitive work. An agent can break down tasks, call computational tools, read intermediate results, generate explanations, and hand off to a human for confirmation at key checkpoints. Accelerating computation is only the starting point of the research pipeline. Every conclusion, from candidate targets to clinical trials, requires independent experimental validation and ethical review.
2. Basic Logic of Marker Gene Computation
A marker gene is a gene whose expression is clearly higher in a given cell population than in other populations. Marker genes are the main basis for identifying cell types and states.
A common approach is to compare each cluster against all other clusters and then rank the genes by statistical metrics. The key metrics include:
- Average expression: the expression level of a gene in the target cluster
- Percentage expressed (pct): the proportion of cells in the target cluster where the gene is detected
- Log fold change (log FC): the magnitude of the expression difference
- Adjusted p-value: the control of false positives caused by multiple testing
In practice, several thresholds are usually applied together rather than relying on the p-value alone. A statistically significant gene is not necessarily biologically meaningful. With large cell numbers in particular, even small differences can reach statistical significance.
The following shows a generic filtering workflow:
function find_marker_genes(expr_matrix, cluster_labels, min_pct, min_logfc, alpha):markers = {}for cluster in unique(cluster_labels):in_group = expr_matrix[:, cluster_labels == cluster]out_group = expr_matrix[:, cluster_labels != cluster]stats = differential_test(in_group, out_group) // The specific test method depends on the chosen computational librarykeep = (stats.pct_in >= min_pct)AND (stats.log_fc >= min_logfc)AND (stats.adj_p <= alpha)markers[cluster] = sort_by(stats[keep], "log_fc", descending=true)return markers
No universal optimal threshold exists. It is recommended to first calibrate thresholds on data with known cell types, then apply them to new data.
3. Filtering Ribosomal Protein Genes
Ribosomal protein genes, commonly named with an RPL or RPS prefix, are highly expressed in most cells. Their high expression can mask the signals that define cell types. These genes are also strongly affected by batch effects and library preparation methods. Without treatment, they often rank near the top of marker gene lists.
When handling these genes, the key is to define the analysis goal instead of removing them across the board:
- If the goal is to distinguish cell types, remove these genes from marker gene candidates so that unrelated signals do not rank highly.
- If the study focuses on translation activity or ribosome-related physiological states, keep these genes and analyze them separately.
- Regardless of the approach, save the list of filtered genes and the reason for filtering to support auditing and reproducibility.
The following shows a filtering approach based on gene name patterns:
RIBO_PATTERN = "^RP[LS][0-9]+"flagged = [g for g in gene_names if regex_match(RIBO_PATTERN, g)]filtered_markers = markers WHERE gene NOT IN flaggedwrite_log(removed=flagged, reason="ribosomal protein genes, excluded for cell-type specificity")
Gene name matching can miss genes with non-standard names and can wrongly exclude a few special genes. After filtering, check a sample of the results to confirm they meet expectations.
4. Biological Plausibility Assessment
Statistical significance shows only that a difference exists in the data. It does not show that the difference is biologically meaningful. A plausibility assessment usually covers five dimensions:
- Consistency with known markers: compare the results with classic marker genes from the literature or public databases. Consistent results provide support, and inconsistent results need an explanation.
- Tissue context: the function of a marker gene should match the tissue the sample came from. For example, if immune cell markers appear in epithelial tissue, the cause must be investigated.
- Specificity: an ideal marker is highly expressed in the target cluster and expressed at low levels in unrelated clusters. If the same gene is highly expressed in several clusters with very different functions, its specificity is questionable.
- Technical artifacts: check the proportion of mitochondrial genes, stress response genes, and batch-specific genes. These signals often come from sample processing rather than from true biological states.
- Reproducibility: determine whether the results hold in independent samples or datasets. A conclusion drawn from a single dataset provides limited evidence.
Agents are well suited to organizing this evidence, for example by generating comparison tables or summarizing the literature and database entries for each gene. Deciding whether to accept a conclusion still requires researchers with domain expertise.
5. Designing the Agent Workflow
A reliable analysis agent should split the task into steps that can be verified independently:
- Data loading and format checks
- Quality control and identification of abnormal samples
- Clustering, with parameters recorded
- Marker gene computation
- Filtering of known interfering genes, such as ribosomal protein genes
- Biological plausibility assessment and evidence summarization
- Report generation
Each step needs clearly defined inputs, outputs, and validation criteria. For example, after marker gene computation, check the number of results, confirm that the thresholds were applied, and check for empty results.
Human review should be placed at the following points:
- Key parameter choices, such as clustering resolution and threshold settings
- Annotation results with low confidence
- Findings that conflict with known conclusions
- Conclusions that will enter downstream experiments or external publication
Engineering requirements are equally important:
- Logging and traceability: record the parameters, software versions, and intermediate files used at each step to ensure reproducibility.
- Least privilege: the agent should access only the data and compute resources needed for the current task.
- Data security: de-identify sensitive data, and inject credentials through environment variables or a key management service. Never write credentials into code or logs.
- Output constraints: cited literature and database entries must be verifiable. Citations that cannot be traced to a source are not allowed.
6. Balancing Efficiency and Risk
Efficiency gains come mainly from automating repetitive work, including batch computation, format conversion, result organization, and draft reports. These steps take considerable time and follow clear rules, which makes them suitable for agents.
There are three main risks:
- Hallucination: a model may produce biological explanations that sound plausible but lack evidence, or it may fabricate literature sources.
- Parameter masking: conclusions can change noticeably under different thresholds. Reporting only one set of results can lead to a one-sided conclusion.
- Overconfidence: results generated quickly can be treated as final answers, and validation gets skipped.
To manage these risks:
- Attach the location of the raw data and the computation steps to each key conclusion.
- Verify each cited literature source individually.
- Report results under multiple threshold settings to check whether the conclusions hold.
- Run regression tests on datasets with known results to confirm the workflow has not degraded.
Computational results should not be used directly as the basis for clinical or drug decisions. They help narrow the range of hypotheses and plan follow-up experiments, but they do not replace experimental validation.
7. Rollout Recommendations
When introducing such a workflow into a team, proceed in the following order:
- Select published datasets with clearly defined marker genes, and verify whether the workflow reproduces the known cell type conclusions.
- Establish evaluation metrics, such as marker gene recall, agreement with manual results, and the time required per analysis. Measure timing in your own team’s environment rather than relying on external figures.
- Start with low-risk tasks, such as exploratory analysis, and expand to tasks that require formal conclusions.
- When deploying, use the team’s existing infrastructure and organize resources by general category, including compute clusters, object storage, job scheduling, logging services, and monitoring and alerting.
Agents can take on analysis work reliably only after validation data, evaluation metrics, and manual review mechanisms are all in place.
