From gene lists to mechanisms

Track: Bulk RNA-seq

Introduction to agentic AI

About this lecture

A list of changed genes is not yet a result. The next questions are always the same: what is known about the top genes, and what could explain them all? An agent can search the literature for every gene, infer which regulators were active, and draft a mechanism. It can also write a convincing story that is not true.

  • “Top genes” is a choice. Write the ranking rule yourself, and include the down genes.
  • Search each gene with your experiment’s context, aliases included; verify every PMID.
  • Regulators leave footprints. TF and pathway activity is inferred from many targets at once.
  • Every arrow in a mechanism gets a label: measured, cited, inferred or speculation.
  • A mechanism is worth something when it says what would refute it.

The second deck of the RNA-seq track. It uses the DESeq2 results from the first deck and the verified-table method from Literature review.

Your list has 4 000 genes; the question is why they changed

Part 1 is a literature table for the top genes. Part 2 turns the list into a mechanism and predictions.

“Top genes” is a choice, and the choice changes the list

A fair top list combines certainty, size and expression, and includes the down genes

  • Certainty: padj below a threshold, say 0.01.
  • Size: a fold-change cut-off, or DESeq2’s shrunken fold changes (lfcShrink), which tame low-count genes.
  • Expression: a minimum mean count, so the gene can be measured again by qPCR.
  • Both directions: in airway, 2 196 genes go up and 1 797 down. Ranking by padj alone gives 16 up genes in the top 20.
  • Write the rule in the README before you look at the list, and keep the full ranked table.

The rule is yours. The agent applies it, reports how many genes pass each filter, and saves the list.

Prompt: you state the ranking rule, the agent applies it

From results/tables/deseq2_all_genes.csv, make results/tables/top_genes.csv
with the top 15 UP and top 15 DOWN genes, using this rule:
padj < 0.01, mean count (baseMean) > 100, ranked by the absolute
shrunken log2 fold change (DESeq2 lfcShrink, type "apeglm" or
"ashr"; tell me which you used and why).
Report how many genes pass each filter, in order. Then show me how the
list would change if I ranked by padj instead: which genes enter and
which leave. Write the rule into README.md under "Top genes".

What you check: the filter counts are plausible, both directions are present, and the rule in the README is the one you gave.

Search each gene with the experiment’s context, not the gene alone

Aliases can hide most of the literature

Ask the agent to look up aliases in NCBI Gene or HGNC, by script, not from memory.

The table: one row per gene and claim, with a verified PMID

Reuse the verification from Literature review, and add one check

  • Script: every PMID resolves, titles match, quotes are found in the abstract.
  • Planted errors: the verifier must catch a fake PMID, swapped titles and an edited quote.
  • You: five random rows read against the abstract.
  • New: the context check. Does the paper describe the same direction, a similar cell type and a similar treatment? “FKBP5 is induced by glucocorticoids” from blood cells supports “known elsewhere”, not “known in airway smooth muscle”.

Sort every gene into known here, known elsewhere, or nothing found

Little literature can mean new biology, or a name problem

Before you call a gene “novel”, rule out the boring explanations:

  • An alias you did not search (the official symbol is often the newest name).
  • An ID mapping error: the Ensembl ID maps to another symbol, or to none (LOC..., LINC...).
  • Too few reads: a large fold change on a mean count of 6 is weak evidence.
  • A gene family: papers about the paralog, or about “SPARC-like” proteins in general.
  • Only abstracts searched: try Europe PMC full text, which finds mentions in tables and results.

SPARCL1 survives these checks in airway: mean normalised count about 1 000, up 24-fold, alias hevin added, no paper with glucocorticoids in PubMed.

Enrichment names the themes; a mechanism says what caused them

Regulators leave footprints: their targets move together

decoupler with CollecTRI and PROGENy does this in R and Python

R (Bioconductor) Python
Package decoupleR decoupler (version 2)
TF regulons (CollecTRI) get_collectri(organism = "human") dc.op.collectri(organism="human")
Pathways (PROGENy) get_progeny(organism = "human", top = 500) dc.op.progeny(organism="human", top=500)
Activity per regulator run_ulm(mat, net, .mor = "mor") dc.mt.ulm(data, net)

Input: one statistic per gene, such as the DESeq2 stat column. CollecTRI: signed regulons for about 1 200 TFs (PMID 37843125). PROGENy: footprints of 14 pathways (PMID 29295995).

Prompt: infer regulator activity from the DE statistics

Using results/tables/deseq2_all_genes.csv, infer transcription factor
activities with decoupleR (R) and the CollecTRI network, method ulm,
on the DESeq2 stat column (gene symbols; drop duplicates and NAs).
Check the current decoupleR documentation first and tell me the
package version. Save the full table to results/tables/tf_activity.csv.
Show me the top 15 TFs by p-value, with score, number of targets
measured, and the 5 targets that contribute most to each score.
Then do the same for PROGENy pathways (top 500 genes, method mlm).
Do not interpret anything yet.

What you check: the version, the number of targets per TF, and the driver genes behind each top hit.

Synthetic data: the planted regulators come out on top

A decoy can look significant because it shares targets

  • RegD’s network entry includes 20 genes from RegA’s program, 16 of them also listed under RegA.
  • Those 16 drive RegD’s score. Without them: score 1.9, p = 0.06.
  • In real networks, regulators that bind similar DNA or work together share many targets.
  • Ask for the driver genes of every top hit, and whether they are shared with a stronger hit.
  • A multivariate method (mlm) fitted on all regulators at once shrinks RegD’s score from 10.8 to 4.8, but does not remove it.

airway: GR comes second, after a receptor the cells barely express

Check every top hit against what the cells express and what was done

  • Is the regulator expressed? PGR: mean count 6. NR3C1: 2 811. AR: 1 330, unchanged.
  • Was it stimulated? Dexamethasone is a glucocorticoid, not a progestin or an androgen.
  • Which genes drive the score? For PGR, largely targets it shares with NR3C1.
  • Activity is not expression. NR3C1 mRNA goes down 2-fold while its activity goes up; glucocorticoids lower the receptor’s own mRNA (PMID 3216865, rat liver and hepatoma cells).

The tool ranks; you decide which hit is biology. Here the known pharmacology picks NR3C1.

A pathway tool finds only the pathways it contains

Prompt: the agent drafts the chain, with a label and a source on every arrow

Draft a mechanism for the dexamethasone response in results/mechanism.md:
a chain from stimulus to phenotype, as a Mermaid diagram plus a table
with one row per arrow: from, to, evidence type (measured / cited /
inferred / speculation), the source (a file and number from this
project, or a PMID from results/literature_table.csv), and a one-line
reason. Only cite PMIDs that are already in the verified table; if an
arrow needs a paper we do not have, label it speculation and list it
under "to search". Use dashed arrows for inferred and speculation.

What you check: every “cited” PMID is in your verified table, and every “measured” arrow points to a number you can find.

airway: the chain the agent should arrive at

One cited arrow does not hold in this dataset

  • The paper: KLF15 is directly induced by glucocorticoids in airway smooth muscle and regulates PLCD1 (PMID 28375666).
  • Our data: KLF15 up 22-fold; PLCD1 log2 fold change 0.19, padj 0.33.
  • Possible reasons: timing (18 h may be too early for a secondary target), the paper’s link came from KLF15 overexpression, or a different context.
  • That is not a contradiction to hide. It is the first prediction: a later time point, or KLF15 overexpression in these cells, should move PLCD1.

A mechanism becomes science when it says what would prove it wrong

Three predictions for airway, each with a refutation

Prediction Expected Refuted if
GR is needed: siRNA NR3C1, then dexamethasone FKBP5, TSC22D3, PER1, DUSP1, KLF15 induction much smaller GR protein down, induction unchanged
Primary targets are early: 0, 1, 2, 4, 8, 18 h the five targets up by 2 h, also with cycloheximide they rise only after 4 h, or not with cycloheximide
KLF15 acts later: same time course PLCD1 up after 18 h, not before KLF15 PLCD1 flat at all times, despite KLF15 protein up

Precedent for the second row: FKBP51 mRNA rose within 2 h, and tests with a GR antagonist and cycloheximide pointed to direct induction by GR (PMID 12519866, lymphoblastoid cells).

A small model turns “early” and “late” into numbers

Optional: an ODE per gene. See Track B: Simulation for building and checking models with an agent.

Ask for rival mechanisms and what would tell them apart

Prompt: make the agent argue against its own mechanism

Read results/mechanism.md. Now argue against it.
1. Give three alternative mechanisms that could produce the same
   gene changes, including at least one that does not involve the
   regulator ranked first.
2. For each, the evidence in this project that supports or weakens it.
3. A table of experiments with the expected outcome under each
   mechanism, marking which experiments give different outcomes.
Do not tell me which mechanism you prefer.

What you check: at least one alternative you had not thought of, and that each claimed piece of evidence points to a file or a verified PMID.

Correlation in, hypothesis out: the data cannot prove the arrows

  • RNA-seq measures correlation. A gene going up with treatment does not show which gene caused which.
  • Activity inference is indirect. It depends on a curated network that favours well-studied factors and cancer cell lines.
  • Shared targets confuse regulators of the same family; only an experiment separates them.
  • Missing pathways are invisible. A tool without a glucocorticoid pathway reports the nearest one.
  • Literature is context-bound. A cited arrow from another cell type is a hypothesis here.

Everything after “measured” is a hypothesis until an experiment tests it.

An LLM’s mechanism story is plausible, not true

  • Likely, not new (How LLMs work): the model writes the mechanism most often described for genes like these.
  • Hallucination: a fluent paragraph with an arrow nobody has shown, or a PMID that is real but about something else.
  • Confirmation bias: it adopts your favourite hypothesis and finds support for it. Ask for rivals.
  • Rounding up: “associated” becomes “regulates”, “in mice” disappears, “cited” becomes “known”.
  • Defences: labels on every arrow, PMIDs only from the verified table, the context check, and a prediction that can fail.

Mechanisms of pathogens and toxins can hit guardrails

  • Most mechanism work, like this one, never meets a guardrail.
  • Questions about how a pathogen or toxin causes harm, and how to make that worse, sit close to the topics providers restrict.
  • A legitimate host-response study may get a refusal, a vaguer answer, or a stopped session.
  • What to do: give honest context, keep the analysis on your own data, and talk to your biosafety officer if it keeps happening.

See Limits of AI for biological research for the forms a block takes and the access programmes.

Where this goes wrong

  • The agent picks “top” by its own default; low-count genes and one direction dominate.
  • Gene-only searches without context; aliases missed, so known genes look novel.
  • Context rounded up: a paper on blood cells cited as “known in airway”.
  • The top TF taken at face value: not expressed, not stimulated, driven by shared targets.
  • A pathway tool interpreted beyond its menu (“androgen signalling”).
  • Arrows without labels, PMIDs from memory, a story that cannot fail.
  • Only your hypothesis tested: no rivals, no refutation criteria.

Summary

Concept Key fact
Top genes your rule: padj, size (shrunken), expression; up and down
Literature query gene and aliases AND treatment (AND tissue); counts kept
Verification as in Literature review, plus same direction and context
Known / elsewhere / none “none” is a candidate, or an alias or ID problem
TF and pathway activity decoupler + CollecTRI / PROGENy on the DESeq2 statistic

Summary (continued)

Concept Key fact
Top hits check expression, stimulus and driver genes; shared targets mislead
Hypothesis chain every arrow: measured, cited, inferred or speculation
Predictions intervention, genes, direction, control, refutation
Rivals ask for alternatives and the experiment that separates them
Known answer the synthetic pilot: RegA up, RegB down, RegC up; RegD is a decoy

Next (Track C: Image analysis in Python, or any other track): the same habits on another kind of data. Or apply this deck to your own gene list.