> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cosmosid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Compare Samples (Comparative Analysis)

> How to create a new comparative analysis

# What is Comparative Analysis?

Use comparative analysis to compare samples to one another using metadata-based cohorts. The analysis creates a matrix showing which organisms appear in each sample with useful visualizations and diversity figures.

<Note>
  You must upload metadata or add tags before creating a comparative analysis.
</Note>

## To start, select your samples and click "Create CA"

<img src="https://mintcdn.com/cmbio/307fZUV6b5qVmpzn/images/Screenshot2025-11-06at5.29.57PM.png?fit=max&auto=format&n=307fZUV6b5qVmpzn&q=85&s=4961e1581660de48f3dfe8b6b50ec1aa" alt="Screenshot2025 11 06at5 29 57PM Pn" title="Screenshot2025 11 06at5 29 57PM Pn" className="mx-auto" style={{ width:"61%" }} width="1328" height="892" data-path="images/Screenshot2025-11-06at5.29.57PM.png" />

## Group samples into cohorts based on metadata or tags

### 1. Using uploaded metadata

Give a descriptive name to your analysis file, and select the dropdown "Split cohorts by metadata" to view input metadata fields. For example, selecting the *Antimicrobial Treatment* variable, it will group samples into "Yes" and "No". These variables can be any data you wish to input into the Hub.

[You can read how to upload metadata here](https://docs.cosmosid.com/docs/metadata-and-cohorts)

<img src="https://mintcdn.com/cmbio/307fZUV6b5qVmpzn/images/Screenshot2025-11-06at5.26.08PM.png?fit=max&auto=format&n=307fZUV6b5qVmpzn&q=85&s=ab165d9678d6c09a4042b54c4baa4b2b" alt="Screenshot2025 11 06at5 26 08PM Pn" title="Screenshot2025 11 06at5 26 08PM Pn" style={{ width:"82%" }} width="1898" height="1218" data-path="images/Screenshot2025-11-06at5.26.08PM.png" />

### 2. Using quick tags (#)

You can also define cohorts by adding custom tags to samples in the Samples menu, then use those tags to group samples.

<iframe src="https://www.youtube.com/embed/rWfF4-i9rPg" title="YouTube video player" frameborder="0" className="w-full aspect-video rounded-xl" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen />

<Warning>
  The \*\*names \*\*of comparative analysis only allow <u>letters</u>, <u>numbers</u>, and these special characters: `'`, `&`, `(`, `)`, `[`, `]`, `+`, `!`, `.`, `-`, `_`
</Warning>

## If you are still having trouble:

Watch the comprehensive tutorial here:

<iframe src="https://www.youtube.com/embed/f_OIvfVKxX4" title="YouTube video player" frameborder="0" className="w-full aspect-video rounded-xl" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen />

## Rename or delete analyses

1. Click the comparative analysis icon in the left panel
2. Select one or more analyses

**To delete:**

* Click the Delete icon (you can delete multiple at once)
* Confirm deletion when prompted
* Note: Deleted analyses are permanently removed but can be recreated from original files

**To rename:**

* Select only one analysis
* Click the Rename icon
* Enter a new name using allowed characters: letters, numbers, `'`, `&`, `(`, `)`, `[`, `]`, `+`, `!`, `.`, `-`, `_`
