> For the complete documentation index, see [llms.txt](https://docs.biodock.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.biodock.ai/analysis-and-results/filters-like-flow-cytometry.md).

# Populations (gating)

*What you'll get: how to pick out a subset of objects on the results page, by drawing on the scatter plot or by a threshold, much like gating in flow cytometry, and how to show it in colour.*

A **population** is a subset of the objects in a result. Making one is called **gating**: you draw a gate around objects on a plot, or set a rule such as "Area more than 1 std. dev. above the mean". Populations help answer questions like:

* How many large and round organoids do I have, and what percentage are they? How does their average intensity compare with the rest?
* What is the average size and count of cells that are positive for both CD8 and CD4?

Populations form a tree. Each one narrows the population above it, and the top of the tree holds every object.

Populations also narrow the rest of the dashboard and the **Raw object data** export (**Only some populations**). The **Aggregate report** export always covers every object.

## Create a population

Click **Create population** in the filter bar at the top of the result's **Dashboard** tab. You need edit access to the result.

![The Create population menu](https://3806122466-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk3DfNQKoMy1JXdaDLvpG%2Fuploads%2Fgit-blob-807694ab3cec62f8651d68331bb6bb1c25b825d6%2Fv2-create-population-menu.png?alt=media)

The menu offers:

* **Draw rectangle** and **Draw freeform**: draw a gate on the scatter plot.
* **By threshold**: keep objects above or below a value.
* **By std dev**: keep objects a number of standard deviations from the mean.
* **Inside a parent object**: keep objects that sit inside a parent object. Only offered when the results have parent objects.

### Draw a gate on the scatter plot

<figure><img src="https://3806122466-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk3DfNQKoMy1JXdaDLvpG%2Fuploads%2Fgit-blob-586a2f40c1dd5209511fadc6db2309b098ced7ab%2Fdocs-results-draw-population.gif?alt=media" alt="Click Create population, click Draw rectangle, drag a box around the dots on the far right of an Area scatter plot, type Large nuclei as the name, keep All objects as the parent population, and click Save"><figcaption><p><strong>Create population</strong> → <strong>Draw rectangle</strong> → drag on the scatter plot → name it → <strong>Save</strong>.</p></figcaption></figure>

1. Set the scatter plot's **X** and **Y** axes to the measurements you want to gate on.
2. Click **Create population**, then **Draw rectangle** or **Draw freeform**.
3. Drag around the objects you want on the scatter plot. Click **Cancel** to stop drawing.
4. The **Create new population** window opens. Name your population, select a parent population, and click **Save**.

The population is added to the population tree.

### Gate by a threshold or by standard deviations

1. Click **Create population**, then **By threshold** or **By std dev**. The **Create new population** window opens.
2. Name your population and select a parent population.
3. Under **Select a filter method**, choose:
   * **Threshold**: choose **Above** or **Below** and enter the threshold.
   * **Std. deviation**: choose less than (**<**) or more than (**>**), enter the number of standard deviations, and choose **Above** or **Below** the mean.
4. Choose the measurement to gate on, such as an intensity or the area.
5. Click **Save**.

### Inside a parent object

If your model detects objects inside other objects (for example, nuclei inside cells), **Inside a parent object** keeps only the objects that sit inside a parent of the class you pick. The parent objects themselves are not in the population.

This needs a class hierarchy with **Parent ID** turned on; see [Class hierarchy](https://docs.biodock.ai/projects-and-models/configuring-your-model.md#class-hierarchy).

### Gating on images

There is no separate gate for images. To look at particular images, use **View** in the filter bar. To gate on images, put **Image origin** on an axis of the scatter plot and draw around the rows you want.

## Show a population in colour

1. In the filter bar, click the populations button (for example **All populations selected**) to open the population tree.
2. Click the **⋯** on the right of the population and choose **Overlay**.
3. In the **Overlay population** window, pick a colour under **Pick color** and click **Overlay**.

The population's objects now appear in that colour on the scatter plot, and its outlines appear in that colour in the image viewer while the population is selected in the tree. The overlay lasts for this visit only. To take it off, choose **Remove overlay** from the same menu.

{% hint style="info" %}
On results with more than 250,000 objects, the plots show a random sample of 250,000 objects while an overlay is on.
{% endhint %}

## Delete a population

In the population tree, click the **⋯** on the population and choose **Delete**. Deleting a population also deletes the populations under it.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.biodock.ai/analysis-and-results/filters-like-flow-cytometry.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
