> For the complete documentation index, see [llms.txt](https://docs.mithrl.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mithrl.com/deprecated/inference-algorithms/biological-effects-analysis.md). Agents can also search and read this documentation through its [MCP server](https://docs.mithrl.com/~gitbook/mcp).

# Biological Effects Analysis

{% hint style="info" %}
**Which pathways, biological processes and diseases are over-represented in my selected genes?** Biological Effects Analysis (BEA) tests one signature against three bodies of annotated knowledge at once, judges each against its own family of terms, and reports every hit with the genes and knowledge sources behind it.
{% endhint %}

### How it works

1. **Provide the signal.** Upload the genes of interest and, optionally, the background your assay could have detected. If the upload includes significance values, choose the cutoff for this run; a table carrying significance values is refused until a cutoff is declared. An upload without them is treated as already narrowed.
2. **Test three classes of term.** The inference reads the build's annotated membership for pathways, Gene Ontology biological processes and disease terms, and compares the signature overlap with each term's member set inside your background.
3. **Test each direction on its own.** When the upload names an effect column, the features with a positive effect and the features with a negative effect are each tested as their own query against the same background, beside the pooled test. A program in one direction is otherwise hidden by a larger program in the other: on a statin signature the sterol-synthesis genes are all up and a bigger translation program is down, and cholesterol biosynthesis reaches #1 among processes only on the up-regulated query.
4. **Explore the result.** Review each class as its own ranking, with statistical values, overlapping genes, evidence and a network view.

### The three classes are three separate results

Every term is corrected against the other terms of its own class and against no others. A pathway q-value is computed over the pathways, a process q-value over the processes, and a disease q-value over the diseases. The false-discovery guarantee holds **within** each class.

That has two consequences worth stating plainly.

* The three ranked tables must not be merged and read as one list. A combined ranking would carry no guarantee, because the three were never corrected together.
* Reporting fewer classes changes nothing. `scope` selects which classes appear in the result, and a run reporting only pathways delivers exactly the pathway rows a run reporting all three delivers, q-values included.

The direction split multiplies this by three. Every row carries `direction`: `all` for the pooled query, `up` and `down` for the two halves. Each (class, direction) pair is corrected and ranked as its own family, so a term can appear once per direction with a different q-value each time, and `rank_in_class` restarts at 1 inside each pair. Read a direction's rows as their own list; do not compare a q-value across directions. An upload without an effect column delivers `all` rows only.

### Example input and output

**Feature table**

```csv
entity,effect,adj_p_value
PCNA,1.20,0.004
MCM2,1.08,0.006
MCM4,0.93,0.011
CDK1,1.31,0.003
CCNB1,1.15,0.005
```

**Background and run settings**

```
Assayed background: 17,980 genes
Significance column: adj_p_value
Significance cutoff: <= 0.05
Scope: pathways, processes, diseases
```

**Result**

| Class   | Term                       | Overlapping genes | Term size | q-value |
| ------- | -------------------------- | ----------------- | --------- | ------- |
| pathway | DNA Replication            | PCNA, MCM2, MCM4  | 73 genes  | 0.002   |
| process | DNA replication initiation | MCM2, MCM4        | 41 genes  | 0.011   |
| disease | Fanconi anaemia            | PCNA, CDK1        | 96 genes  | 0.031   |

> The first row means three selected genes occur together in one annotated pathway more often than the assayed background would predict. The q-value beside it was corrected over the pathways and over nothing else, so it is not comparable with the disease row below it.

{% hint style="warning" %}
Illustrative only — names and values above are simplified and fabricated to demonstrate the input and output shape. They are not a biological result.
{% endhint %}

### What the result contains

* **One ranked table per class**, each complete to its own cut, plus a combined table that interleaves them. Narrowing `scope` to a single class delivers that one combined table only, since with one class there is nothing to split apart. Within each table the pooled rows come first, then the up-regulated query's rows, then the down-regulated query's, and `direction` says which is which.
* **Which queries were tested**, under `run_metadata.direction_split`: whether effect values were present, the size of the pooled, up and down queries, and the two columns (`term_class`, `direction`) that identify a correction family.
* **The overlapping genes** for every hit, named as your upload named them.
* **The knowledge sources** that assert each membership, and the publications where the source cited any. Pathway and process membership is an annotation with no publication by construction, and those rows are marked as sourced but uncited rather than left looking unsupported.
* **The background this run tested against**, its size, and a digest of the annotated gene universe it was drawn from.

### How statistical validity is protected

* **The query is not the background.** The test uses the selected signature as the query and the measured universe as the comparison population.
* **The universe does not move with what you asked to see.** The background is the genes carrying at least one annotation anywhere in the build, intersected with what your assay measured. It is the same set whichever classes the run reports, so a pathway p-value cannot depend on whether you also asked for diseases.
* **Duplicate hypotheses count once.** Two terms with exactly the same members inside your background have the same contingency table, so one is tested and names the other rather than both taking a slot in the correction.
* **The family is read from a build asset, not assembled per run.** Membership derived live over the query API cannot be shown complete, and a correction over a family nobody can enumerate is not a correction. A build that does not carry the asset refuses the run instead of returning numbers it cannot defend.

### Reading the result responsibly

* Enrichment indicates that the signature is consistent with an annotated term; it does not prove that the term describes a cause of the observed state.
* `direction` names the query a row was tested on, not how the term is regulated. The knowledge graph carries no signed layer connecting these terms to a gene-level measurement, so BEA reports over-representation and says nothing about activation. A term over-represented among your up-regulated genes is a term those genes annotate to; whether it is activated is a separate claim BEA does not make.
* p-values and q-values are specific to the run's signature, measured background, knowledge-graph build and term family. Avoid direct comparisons across unlike experiments.
* Disease terms carry no curated-evidence floor. A disease hit reflects the associations the build ingested, at the strength those sources asserted them.
* Narrowing `sources` does change the pathway result. It removes pathway membership asserted only by sources the run did not name, so the pathway family shrinks and every pathway q-value is corrected over what is left. The result says so when it happens.

{% hint style="success" %}
**In short:** BEA gives an evidence-linked view of a signature across pathways, processes and diseases, with one correction per class, a background that does not move with the question, and a refusal rather than an undefended number when the build cannot supply a complete family.
{% endhint %}

Next: [Upstream Regulator Analysis](https://docs.mithrl.com/deprecated/inference-algorithms/upstream-regulator-analysis.md).
