> For the complete documentation index, see [llms.txt](https://academy.dnanexus.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://academy.dnanexus.com/cohortbrowser/how-to-create-cohorts/cohort-combine.md).

# Cohort Combine

*Please note: in order to use Cohort Browser on the Platform, an Apollo License is needed.*

## Cohort Combine Logic

Cohort combine logic allows you to combine existing cohorts with Boolean Logic operations

### **Overview**

Here is a summary of the functions for Cohort Combine

<figure><img src="https://1979569080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPtCOm9rXoRi4P9rh1ET8%2Fuploads%2FVDCRdj7lsGgzaaUpBrRF%2Funknown.jpeg?alt=media&amp;token=782774b5-8ad0-4c2f-b1e0-c8c3abf8d7e7" alt=""><figcaption></figcaption></figure>

## **Rules and Boundaries**

* All cohorts must be from the same dataset.
* All cohorts must be saved before being combined.
* A cohort that is a result of combine cannot be combined a second time.
* Cohorts from different projects can be combined if they use the same underlying database.
* Cohort combine are very complex queries
* Beware of performance delays and timeouts as query gets more complex.
* Use extra caution when:
* Combining cohorts with genomic filters
* Combining cohorts with complicated filters
* Combining cohorts based on very large datasets

## **How To:**

1. Add your cohorts into the cohort browser by selecting “Load Saved Cohort” if the cohort has already been created and saved into the project, or “New Cohort” if a new cohort needs to be created. You can select up to 10 cohorts to load into the side menu.

<figure><img src="https://1979569080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPtCOm9rXoRi4P9rh1ET8%2Fuploads%2Fgit-blob-8ed6a4652418617cf6fca34d23b48b60de476895%2Funknown.png?alt=media" alt=""><figcaption></figcaption></figure>

2. Pick your cohort and add it to the browser. It will look like this.

<figure><img src="https://1979569080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPtCOm9rXoRi4P9rh1ET8%2Fuploads%2FzWQQdcAxoDjCIA050bvh%2Funknown.png?alt=media&amp;token=5c810505-feee-44d4-b1c2-a4864af30b31" alt=""><figcaption></figcaption></figure>

3. At the bottom of the cohort tab, select "Combine Cohorts"

<figure><img src="https://1979569080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPtCOm9rXoRi4P9rh1ET8%2Fuploads%2Fgit-blob-fb00a9c9c114a85ad5f6d923f66de597bc3d6735%2Funknown.png?alt=media" alt=""><figcaption></figcaption></figure>

4. You will then have the following screen to combine. Pick your cohort combine logic, then select combine

<figure><img src="https://1979569080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPtCOm9rXoRi4P9rh1ET8%2Fuploads%2Fgit-blob-7e9948178920e7521c0f628378881b75f25d95bb%2Funknown.png?alt=media" alt=""><figcaption></figcaption></figure>

## Examples of Cohort Combine Functions

### Intersection

#### **Overview:**

<figure><img src="https://1979569080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPtCOm9rXoRi4P9rh1ET8%2Fuploads%2FdN6M7fiYKd3BzXLRhN5f%2Funknown.jpeg?alt=media&amp;token=e73560e4-a313-41f4-9da1-8c74becef1c3" alt=""><figcaption></figcaption></figure>

#### **Example:**

<figure><img src="https://1979569080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPtCOm9rXoRi4P9rh1ET8%2Fuploads%2Fgit-blob-e21a1884a4ed5a953f0f62bcaabb17483d89c49c%2Funknown.jpeg?alt=media" alt=""><figcaption></figcaption></figure>

### Union

#### **Overview:**

<figure><img src="https://1979569080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPtCOm9rXoRi4P9rh1ET8%2Fuploads%2F0l0m6nZF9a3otB1xNI7V%2Funknown.jpeg?alt=media&amp;token=96f0eef9-97f9-4733-bd82-f1c8eb09fdf0" alt=""><figcaption></figcaption></figure>

#### **Example:**

<figure><img src="https://1979569080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPtCOm9rXoRi4P9rh1ET8%2Fuploads%2Fgit-blob-3b9b0db1909ed37721a7b554353760de7db98223%2Funknown.jpeg?alt=media" alt=""><figcaption></figcaption></figure>

### Subtraction

Important note: the order of the cohorts matters in this.

#### **Overview:**

<figure><img src="https://1979569080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPtCOm9rXoRi4P9rh1ET8%2Fuploads%2F5ad88hNA7jkxbDlfCo12%2Funknown.jpeg?alt=media&amp;token=2795a19d-ab05-4b33-ad57-b764d0ac5364" alt=""><figcaption></figcaption></figure>

#### **Example 1:**

<figure><img src="https://1979569080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPtCOm9rXoRi4P9rh1ET8%2Fuploads%2Fgit-blob-0fa7686a5cb4419295d6f9c311adc82f9a8d322e%2Funknown.jpeg?alt=media" alt=""><figcaption></figcaption></figure>

#### **Example 2:**

<figure><img src="https://1979569080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPtCOm9rXoRi4P9rh1ET8%2Fuploads%2Fgit-blob-04397c77b0a54b562785e57bb18c32782291eb20%2Funknown.jpeg?alt=media" alt=""><figcaption></figcaption></figure>

### Unique

#### **Overview:**

<figure><img src="https://1979569080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPtCOm9rXoRi4P9rh1ET8%2Fuploads%2F2fwuMXn4PUkdIC2VhTNv%2Funknown.jpeg?alt=media&amp;token=e8df2234-9846-4205-87d1-8cdd25515336" alt=""><figcaption></figcaption></figure>

#### **Example:**

<figure><img src="https://1979569080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPtCOm9rXoRi4P9rh1ET8%2Fuploads%2Fgit-blob-4df2ef0233cf17ce14a93cf0f60990db835ef7c1%2Funknown.jpeg?alt=media" alt=""><figcaption></figcaption></figure>

### Complement

Important notes:

* Cohort must be saved before creating its complement (same rule as previous)
* A combined cohort (Intersection, Union, Subtraction, Unique) can be used to create a complement.
* A cohort created as a complement cannot be further used for combine / complement.

#### **Overview:**

<figure><img src="https://1979569080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPtCOm9rXoRi4P9rh1ET8%2Fuploads%2FPXzaTaYVH0R9OInRlxdi%2Funknown.jpeg?alt=media&amp;token=ee2de0ea-9305-49fb-b1e0-183399c87804" alt=""><figcaption></figcaption></figure>

#### **Example:**

<figure><img src="https://1979569080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPtCOm9rXoRi4P9rh1ET8%2Fuploads%2Fgit-blob-d4cbf1e0b768adc7a50328c3bf0082dafe16699d%2Funknown.jpeg?alt=media" alt=""><figcaption></figcaption></figure>
