> ## 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.

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

![Screenshot2025 11 06at5 29 57PM Pn](https://mintcdn.com/cmbio/307fZUV6b5qVmpzn/images/Screenshot2025-11-06at5.29.57PM.png?fit=max\&auto=format\&n=307fZUV6b5qVmpzn\&q=85\&s=4961e1581660de48f3dfe8b6b50ec1aa)

## 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.md)

![Screenshot2025 11 06at5 26 08PM Pn](https://mintcdn.com/cmbio/307fZUV6b5qVmpzn/images/Screenshot2025-11-06at5.26.08PM.png?fit=max\&auto=format\&n=307fZUV6b5qVmpzn\&q=85\&s=ab165d9678d6c09a4042b54c4baa4b2b)

### 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.

[YouTube video player](https://www.youtube.com/embed/rWfF4-i9rPg)

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

## If you are still having trouble:

Watch the comprehensive tutorial here:

[YouTube video player](https://www.youtube.com/embed/f_OIvfVKxX4)

## 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, `'`, `&`, `(`, `)`, `[`, `]`, `+`, `!`, `.`, `-`, `_`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.