# What is Cosmos-Hub 2.0
Source: https://docs.cosmosid.com/DAP_docs/About

One platform, from raw sequence to scientific decision.
Cosmos-Hub 2.0 is a centralized omics operating system. It gives scientists, bioinformaticians, and R\&D teams one governed platform for turning omics data into scientific insight. Instead of scattering the building blocks of omics research across separate tools, it keeps them in one shared environment: data and metadata, pipelines, analysis, AI tools, a collaboration workspace, and exports. The result is a workflow that is easier to manage, reproduce, and share.
> [card] [Take the Quickstart](https://docs.cosmosid.com/DAP_docs/quickstart)
>
> Go from sign-in to exported results in a few steps.
> [card] [Get access](mailto:info@cosmos-hub.com)
>
> See Cosmos-Hub 2.0 running on your own data.
## The challenge of microbiome multi-omics
Microbiome multi-omics resources tend to be spread across many tools. You store sequencing data in one place, run pipelines in another, write separate scripts for statistics, and reach for yet more tools to create figures and share results. Along the way, data ends up in silos, file versions drift, and projects stall in the handoffs between bench and bioinformatics teams. Often the coordination becomes harder than the science itself. Cosmos-Hub 2.0 brings these steps into one platform, so your data, analyses, and results stay connected from start to finish.
## Why Cosmos-Hub 2.0
Cosmos-Hub 2.0 rests on three layers that build on each other: a **unified data foundation**, **no-code analysis at expert depth** that runs on top of it, and **governance** that turns every result into shared, reusable knowledge.
> [card] Raw sequence to decision, in one platform
>
> One governed platform. All your microbiome data, profiling workflows, a queryable database for all your profiles, advanced statistical models, AI tools, and collaboration — in one place. Your tools, data, assets, and people work together on a single platform.
> [card] No-code science at expert depth
>
> Turn your raw microbial 'omics data into ready-to-use profiles with our award-winning Cosmos-Hub Workflows. Then unlock publication-ready insights in Analysis Studio — an interactive toolbox for microbiome analyses, statistical tests, and machine learning. No coding required. No compromise on scientific rigor.
> [card] Every study becomes institutional knowledge
>
> Each analysis becomes a governed, shareable study. One-off results turn into a lasting asset that stays reproducible, can be benchmarked against the Cmbio Atlas and its 150,000+ datasets, and retains traceability and therefore value even when people or projects move on.
## Key features and capabilities
* **Organize omics projects in one governed workspace.** Keep data, metadata, analyses, results, collaborators, and exports connected inside structured workspaces and studies.
* **Process raw sequencing data with validated pipelines.** Run Cosmos-Hub profiling workflows directly in the platform, including CHAMP, Kepler, DADA2 short-read amplicon profiling, and EMU long-read profiling.
* **Perform analyses on multiple omics data types under one system.** Work with shotgun metagenomics, 16S/ITS amplicon data, metatranscriptomics, metabolomics, proteomics, and custom feature tables.
* **Find and assemble the right data faster.** Use AI-supported data access to turn scientific questions into queries that select the relevant samples, tables, and metadata.
* **Analyze data without writing code.** Explore patterns, compare groups, test hypotheses, run statistical workflows, build models, and generate figures in a flexible no-code Analysis Studio.
* **Benchmark studies against reference data.** Use the Cmbio Atlas to place your results in a broader biological context and to compare your studies against a large, harmonized reference dataset.
* **Create reproducible, shareable results.** Save snapshots, track versions, preserve provenance, and export analysis outputs, so results can be revisited, audited, shared, and trusted.
* **Collaborate securely across teams.** Manage access with roles, permissions, SSO/MFA, and GDPR-aligned infrastructure, so data and results stay governed as projects grow.
### The Analysis Studio
The Analysis Studio is a single no-code studio that covers the whole microbiome analytical workflow. You can run statistics, train machine-learning models, and build figures in the same interface, with customizable parameters and interactive visualizations throughout.
> [card] No-code interface
>
> Point-and-click analyses with customizable parameters that put full control in the hands of non-programmers.
> [card] Microbiome statistics
>
> Alpha and beta diversity, PCA and PERMANOVA, rarefaction, and differential abundance and prevalence testing, with multiple-testing correction.
> [card] Machine-learning toolbox
>
> Predict and classify from microbiome profiles, with feature importance to highlight the taxa or functions that distinguish a group. Methods include Random Forest, Logistic Regression, SVM, and Gradient Boosting.
> [card] Publication-ready visualizations
>
> Diversity and ordination plots, heatmaps, stacked bar charts, and volcano and forest plots.
## How it works
Cosmos-Hub 2.0 is organized as a simple hierarchy that mirrors how microbiome R\&D teams work:
* **Workspace.** The home for a team, such as a department or research unit. Workspaces make collaboration between team members easier.
* **Study.** One project's data in one place: feature tables, microbial profiles, metadata, analyses, and any assets relevant to your project.
* **AI Query Builder.** A lot of time in microbiome research is spent building the right cohort of data to analyze — metadata wrangling, SQL queries, filtering, sample matching. The AI Query Builder facilitates all of this, helping you select a targeted subset of a study, including samples, tables, groups, and metadata, that an analysis should run on.
* **Analysis modules.** Turn a cohort into results, using the Analysis Studio and its modules for diversity, ordination, differential abundance, and machine learning to quickly translate data into scientific insights.
* **Snapshots and export.** Save the parameters and results of each step and keep a record of all your team's work. Collaborating on analyses and making every step reproducible has never been easier. Once you get to the figure you need, export it and it's ready to be used in your reports or a slide deck.
> [card] [Take the Quickstart](https://docs.cosmosid.com/DAP_docs/quickstart)
>
> Go from sign-in to exported results in a few steps.
# Alpha diversity on Cosmos-Hub 2.0
Source: https://docs.cosmosid.com/DAP_docs/alpha-diversity
Run alpha-diversity analysis on Cosmos-Hub 2.0: the outputs it produces, how to read them, and the parameters that shape them.
The **Alpha diversity** module measures microbial taxonomic and functional diversity within a single sample. Alpha-diversity metrics calculated across cohort samples are then compared across groups of interest through panels of boxplots. The module also handles the statistics behind each comparison and produces exportable tables of statistical values for every comparison. For more on what alpha diversity is and how to interpret it, see the [Alpha diversity overview](https://docs.cosmosid.com/DAP_docs/alpha-diversity-overview).
# Module output and customization
* **Alpha-diversity boxplot panels:** one panel per metric and statistical test, comparing alpha diversity across your groups of interest.
* **Alpha-diversity table (1):** a table of per-sample alpha diversity values for all samples in the analysis.
* **Statistical testing tables (3):** tables of statistical test results for every pairwise group comparison.
## Alpha-diversity boxplot panels
Each panel compares alpha-diversity distributions between the groups of interest, with pairwise brackets and q-values marking which group pairs differ significantly for the statistical test used.

Boxplot of alpha diversity (richness) across skin samples grouped by body site. Each box shows the interquartile range with the median line; whiskers extend to 1.5× IQR, and points beyond them are outliers. Individual samples are overlaid as a jitter plot. Brackets above the boxes display FDR-corrected q-values from pairwise Mann–Whitney U tests between body sites.
Each panel reports:
* **Title**: the statistical test, the metric shown, and the grouping variable (for example, *Mann-Whitney test: richness by hiv\_riskgroup\_text*).
* **Axes**: the selected metric on the y-axis; the grouping variable on the x-axis, one boxplot per group.
* **Brackets between boxplots**: every significant pairwise comparison, labelled with its FDR-adjusted q-value.
The module produces one panel for each combination of selected **Alpha-diversity metric** and **Statistical Test Type**.
The [**Alpha-diversity metric**](#alpha-diversity-metric) sets which measure(s) of diversity are plotted. You can select more than one, and each produces its own set of panels.
| Metric | What it captures | Choose it when |
| :- | :- | :- |
| **Observed richness** | How many different taxa/features are present | You want to compare the raw count of taxa or features detected in your samples. |
| **Shannon** | Richness and evenness; sensitive to rare taxa | You want a balanced measure, and changes in rare or moderately abundant taxa matter |
| **Simpson** | Weighted toward dominant taxa; stable when rare features are noisy | You care about the main community members and want to downweight noisy low-abundance features |
The [**Grouping Variable**](#grouping-variable) parameter sets how samples are split into groups along the x-axis: pick the metadata variable whose effect you want to study, such as disease status, treatment, or body site.
The [**Statistical Test Type**](#statistical-test-type) sets which test is run between groups. Each selected test runs **pairwise** on every pair of groups, and a bracket is drawn for a pair when its FDR-adjusted q-value falls below the [FDR threshold](#fdr-threshold). You must select at least one, and each selected test produces its own panel.
> [!TIP]
>
> P-values below a certain value (typically 0.05) indicate a statistically significant difference between those groups, meaning they have distinct alpha diversity distributions.
| Test | When to use? |
| :- | :- |
| **Mann-Whitney** | Independent groups with non-normal data; the safest default for most microbiome studies (for example, cases versus controls) |
| **Wilcoxon** | Paired or matched samples (for example, the same subjects before and after treatment) |
| **T-test** | Independent groups whose alpha-diversity distributions are approximately normal with comparable variance |
> [!NOTE]
>
> #### **Which test fits my design?**
>
> \
> First ask: *are the same subjects measured in more than one group, or are all subjects different?*
>
> * **Use `Mann–Whitney U` for independent groups.**\
> Example: You compare alpha diversity between 10 treated mice and 10 untreated mice. Each mouse appears in only one group, so values cannot be paired across groups. The groups are independent → `Mann–Whitney U` is appropriate.
> * **Use `Wilcoxon` for paired or matched samples.**\
> Example: You compare alpha diversity in the same 10 mice before and after treatment. Each mouse contributes one “before” and one “after” value, so every value has a natural partner from the same animal. The samples are paired → `Wilcoxon` tests the within-subject change.
>
> **Reminder:** Equal group sizes do **not** make a design paired. Two groups of 10 different mice are still independent, and `Mann–Whitney U` is the correct nonparametric test.
> [!NOTE]
>
> **How Statistical testing works on this module:**\
> \
> Each test you choose from the **Statistical Test Type** parameter is applied pairwise: it runs on every pair of groups that can possibly be composed from your groups, comparing their alpha diversity distributions two at a time. With three groups, for example, this means three comparisons (A versus B, A versus C, B versus C), whereas four groups means 6 comparisons, and 8 groups means 28.
>
> More comparisons means more hypotheses tested, something that inflates the chance of false positives, results that by chance fall below the significance threshold even when the two groups are truly equal.
>
> This is the multiple comparisons problem. For this reason, the list of p-values for all the comparisons must be corrected for multiple testing using FDR (Benjamini-Hochberg), which raises each p-value according to how many comparisons were made, so a difference is called significant only if it would still stand out among that many tests.
>
> If a pairwise comparison is still significant after correction (below the [FDR threshold](#fdr-threshold)), the corrected value, the q-value, is what appears on the bracket.
>
> We recommend treating a comparison as statistically significant only when its FDR-adjusted q-value falls below your chosen FDR threshold.
### A special statistical test: Kruskal-Wallis and Dunn's test
Alongside the pairwise tests you select, the module always runs a **Kruskal-Wallis** test followed by **Dunn's post-hoc test**. These answer a different question from your chosen tests, which is why it helps to read them together.
* **Kruskal-Wallis** is a single non-parametric test (it does not assume normal data) that asks one global question: does at least one group differ from the rest? Because it is one test rather than many, its false-positive rate does not grow with the number of groups the way a set of separate pairwise tests does, so it is a useful first check of whether there is any group effect at all. It does not say which groups differ.
* **Dunn's post-hoc test** identifies which pairs drive a significant Kruskal-Wallis result. It ranks all samples together and compares each pair using the whole dataset, so its pairwise results stay consistent with the global test and with each other. The false-positive rate across Dunn's pairs is then held in check by the FDR correction described above, not by Kruskal-Wallis itself.
You can explore full statistical output of KW + Dunn's test in files `df_kruskal.csv` and `df_dunn.csv`, included in the output export of the module.
### Why is this plot useful?
* **Assess the impact of biological factors on within-sample diversity:** boxplots sitting at clearly different heights, with a significant bracket, suggest that the biological factor (disease, treatment, diet) might be a driver of community composition and richness.
* **Spot outliers within single groups:** single dots far from the main distribution might flag a contaminated sample (usually richer, depending on how rich the contamination source is), a mislabelled sample, or a genuine outlier pointing to a distinct responder.
* **Which part of the community changed:** comparing the richness, Shannon, and Simpson panels shows where the change sits. A difference in richness but not Simpson means rare taxa shifted while the dominant members held steady, pointing to a different mechanism than a change among the dominant community.
* **Dose-response trend:** when the grouping variable has a natural order, such as disease stage or time after treatment, a stepwise rise or fall across the boxes suggests a monotonic relationship between alpha-diversity and the variable.
## Statistical output tables
Export the per-sample alpha-diversity values and the full statistical results of the pairwise comparisons by scrolling to the end of the output page and clicking **Download Tables and Images**:
| Table | What it contains |
| :- | :- |
| **`df_alpha.csv`** | Sample-level alpha-diversity values: one row per sample, with a column for each calculated metric (`richness`, `shannon`, `simpson`). Useful for inspecting, exporting, or reusing the diversity values directly. |
| **`df_kruskal.csv`** | The overall Kruskal-Wallis result for each metric (`feature`, `H_stat`, `p_value`, `fdr`), testing whether that metric differs across the groups of the grouping variable. A significant `fdr` means at least one group differs, but not which pair. |
| **`df_dunn.csv`** | Dunn's post-hoc pairwise comparisons following Kruskal-Wallis (`feature`, `group_value1`, `group_value2`, `q_value`), showing which specific group pairs differ for each metric. |
| **`df_diff_abundance_pairwise.csv`** | Pairwise comparisons of alpha-diversity values between groups for the tests you selected (Mann-Whitney, Wilcoxon, t-test): group names, sample sizes, group medians, effect size, test statistics, p-values, FDR-adjusted values, and significance flags. |
## Recommended parameters
Select your workflow to see the recommended values. Note that pre-processing parameters vary per data type.
> [tab] Kepler - Host-Agnostic Taxonomic Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method |
- `raw` if samples have comparable read depths
- `filter` if a few samples have notably lower read depth than the rest of the cohort
- `rarefaction` to standardize the whole cohort to a common read depth
Observed Richness depends strongly on read depth: deeper samples yield more detected taxa. Check how much read depth varies across your cohort in the [rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction-on-the-dap), and if variability is high, apply `rarefaction` before concluding that richness differs between groups. |
> | Read Depth | - With `rarefaction`, use the [Rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction-on-the-dap) to choose the optimal depth. Any sample below the chosen depth is discarded, so the depth sets a trade-off between depth and sample size.
- With `filter`, choose a threshold that removes only the samples with notably lower depth than the rest of the cohort. Use the [Rarefaction module](DAP_docs/rarefaction-on-the-dap) retention plot helps identify them.
|
> | Feature Relative Abundance Threshold | `0` |
> | Feature Prevalence Threshold | `0` |
> | Grouping Variable | Categorical metadata of interest |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Alpha-diversity metric | See [Alpha-diversity](#alpha-diversity-boxplot-panels) metrics |
> | Statistical Test Type | - `Mann-Whitney` independent groups, each subject in one group only (for example case versus control)
- `Wilcoxon` paired samples, each subject in both groups (for example pre versus post treatment)
- `t-test` independent groups, roughly normal values, at least 20 samples per group
[Which test fits my design?](#which-test-fits-my-design) |
> | P-value threshold | `0.05` |
> | FDR threshold | - Exploratory analyses: `0.2`
- Confirmatory analyses: `0.05`
|
> [tab] CHAMP - Human Taxonomic Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `raw` if samples have comparable read depths
- `filter` if a few samples have notably lower read depth than the rest of the cohort
- `rarefaction` to standardize the whole cohort to a common read depth
Observed Richness depends strongly on read depth: deeper samples yield more detected taxa. Check how much read depth varies across your cohort in the [rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction-on-the-dap), and if variability is high, apply `rarefaction` before concluding that richness differs between groups. |
> | Read Depth | - With `rarefaction`, use the [Rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction-on-the-dap) to choose the optimal depth. Any sample below the chosen depth is discarded, so the depth sets a trade-off between depth and sample size.
- With `filter`, choose a threshold that removes only the samples with notably lower depth than the rest of the cohort. Use the [Rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction-on-the-dap) retention plot helps identify them.
|
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
> | Grouping Variable | Categorical metadata of interest |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Alpha-diversity metric | See [Alpha-diversity](#alpha-diversity-boxplot-panels) metrics |
> | Statistical Test Type | - `Mann-Whitney` independent groups, each subject in one group only (for example case versus control)
- `Wilcoxon` paired samples, each subject in both groups (for example pre versus post treatment)
- `t-test` independent groups, roughly normal values, at least 20 samples per group
[Which test fits my design?](#which-test-fits-my-design) |
> | P-value threshold | `0.05` |
> | FDR threshold | - Exploratory analyses: `0.2`
- Confirmatory analyses: `0.05`
|
> [tab] 16S SR Amplicon Classification - Taxonomic
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `genus` |
> | Data Table Pre-processing Method | - `raw` if samples have comparable read depths
- `filter` if a few samples have notably lower read depth than the rest of the cohort
- `rarefaction` to standardize the whole cohort to a common read depth
Observed Richness depends strongly on read depth: deeper samples yield more detected taxa. Check how much read depth varies across your cohort in the [rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction-on-the-dap), and if variability is high, apply `rarefaction` before concluding that richness differs between groups. |
> | Read Depth | - With `rarefaction`, use the [Rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction-on-the-dap) to choose the optimal depth. Any sample below the chosen depth is discarded, so the depth sets a trade-off between depth and sample size.
- With `filter`, choose a threshold that removes only the samples with notably lower depth than the rest of the cohort. Use the [Rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction-on-the-dap) retention plot helps identify them.
|
> | Feature Relative Abundance Threshold | `0.001` |
> | Feature Prevalence Threshold | `0` |
> | Grouping Variable | Categorical metadata of interest |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Alpha-diversity metric | See [Alpha-diversity](#alpha-diversity-boxplot-panels) metrics |
> | Statistical Test Type | - `Mann-Whitney` independent groups, each subject in one group only (for example case versus control)
- `Wilcoxon` paired samples, each subject in both groups (for example pre versus post treatment)
- `t-test` independent groups, roughly normal values, at least 20 samples per group
[Which test fits my design?](#which-test-fits-my-design) |
> | P-value threshold | `0.05` |
> | FDR threshold | - Exploratory analyses: `0.2`
- Confirmatory analyses: `0.05`
|
> [tab] 16S LR Amplicon profiling - Taxonomic
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `raw` if samples have comparable read depths
- `filter` if a few samples have notably lower read depth than the rest of the cohort
- `rarefaction` to standardize the whole cohort to a common read depth
Observed Richness depends strongly on read depth: deeper samples yield more detected taxa. Check how much read depth varies across your cohort in the [rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction-on-the-dap), and if variability is high, apply `rarefaction` before concluding that richness differs between groups. |
> | Read Depth | - With `rarefaction`, use the [Rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction-on-the-dap) to choose the optimal depth. Any sample below the chosen depth is discarded, so the depth sets a trade-off between depth and sample size.
- With `filter`, choose a threshold that removes only the samples with notably lower depth than the rest of the cohort. Use the [Rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction-on-the-dap) retention plot helps identify them.
|
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
> | Grouping Variable | Categorical metadata of interest |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Alpha-diversity metric | See [Alpha-diversity](#alpha-diversity-boxplot-panels) metrics |
> | Statistical Test Type | - `Mann-Whitney` independent groups, each subject in one group only (for example case versus control)
- `Wilcoxon` paired samples, each subject in both groups (for example pre versus post treatment)
- `t-test` independent groups, roughly normal values, at least 20 samples per group
[Which test fits my design?](#which-test-fits-my-design) |
> | P-value threshold | `0.05` |
> | FDR threshold | - Exploratory analyses: `0.2`
- Confirmatory analyses: `0.05`
|
> [tab] Host-Agnostic Functional Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative abundance` |
> | Data Table Pre-processing Method | - `raw`
- `filter` if a few samples have notably lower read depth than the rest of the cohort
|
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
> | Grouping Variable | Categorical metadata of interest |
> | Alpha-diversity metric | See [Alpha-diversity](#alpha-diversity-boxplot-panels) metrics |
> | Statistical Test Type | - `Mann-Whitney` independent groups, each subject in one group only (for example case versus control)
- `Wilcoxon` paired samples, each subject in both groups (for example pre versus post treatment)
- `t-test` independent groups, roughly normal values, at least 20 samples per group
[Which test fits my design?](#which-test-fits-my-design) |
> | P-value threshold | `0.05` |
> | FDR threshold | - Exploratory analyses: `0.2`
- Confirmatory analyses: `0.05`
|
> [tab] CHAMP - Human Functional Profiling (GBM, GMM, KEGG)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `cellular abundance` |
> | Data Table Pre-processing Method | - `raw`
- `filter` if a few samples have notably lower read depth than the rest of the cohort
|
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
> | Grouping Variable | Categorical metadata of interest |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Alpha-diversity metric | See [Alpha-diversity](#alpha-diversity-boxplot-panels) metrics |
> | Statistical Test Type | - `Mann-Whitney` independent groups, each subject in one group only (for example case versus control)
- `Wilcoxon` paired samples, each subject in both groups (for example pre versus post treatment)
- `t-test` independent groups, roughly normal values, at least 20 samples per group
[Which test fits my design?](#which-test-fits-my-design) |
> | P-value threshold | `0.05` |
> | FDR threshold | - Confirmatory analyses: `0.05`
|
> [tab] Kepler (WGS) -AMR/VF
>
> | Parameter | Recommended value | |
> | :- | :- | - |
> | Analysis Metric | `relative abundance` | |
> | Data Table Pre-processing Method | - `raw`
- `filter` if a few samples have notably lower read depth than the rest of the cohort
| |
> | Feature Relative Abundance Threshold | `0.0001` | |
> | Feature Prevalence Threshold | `0` | |
> | Grouping Variable | Categorical metadata of interest | |
> | Alpha-diversity metric | See [Alpha-diversity](#alpha-diversity-boxplot-panels) metrics | |
> | Statistical Test Type | - `Mann-Whitney` independent groups, each subject in one group only (for example case versus control)
- `Wilcoxon` paired samples, each subject in both groups (for example pre versus post treatment)
- `t-test` independent groups, roughly normal values, at least 20 samples per group
[Which test fits my design?](#which-test-fits-my-design) | |
> | P-value threshold | `0.05` | |
> | FDR threshold | - Exploratory analyses: `0.2`
- Confirmatory analyses: `0.05`
| |
## Analysis parameter reference
> [accordion] Grouping Variable
>
> The metadata column used to define the groups compared in the analysis. It should reflect the biological question or study hypothesis you want to test.
>
> **Options** · Categorical variables from the metadata table associated with the query used to create the analysis
>
> **Default** · `None`
>
> **Suggested** · A categorical variable relevant to your study design, such as `treatment`, `disease status`, `condition`, `body site`, `cohort`, or `time point`.
>
> > [!NOTE]
> >
> > When no grouping variable is selected, alpha-diversity values are shown for the whole cohort, with no group-based comparison.
> [accordion] Alpha-diversity metric
>
> The diversity metric(s) calculated per sample and plotted on the y-axis. You can select more than one; each produces its own set of panels.
>
> **Options** · `richness`, `shannon`, `simpson`
>
> > [!TIP]
> >
> > **What's the difference between Shannon and Simpson?**
> >
> > Shannon diversity is calculated from each taxon's relative abundance multiplied by its logarithm, so it reflects both richness and evenness and is more sensitive to rare taxa. Simpson diversity is based on squared relative abundances, so it gives more weight to dominant taxa and is less affected by rare ones.
> >
> > **In practice:** Shannon is usually more informative when changes in rare or moderately abundant taxa matter. Simpson is more stable when low-abundance features are noisy, but it may hide differences that occur mainly among rare taxa.
> [accordion] Statistical Test Type
>
> The statistical test used to compare alpha-diversity values between groups. Available when a **Grouping Variable** is selected. The right test depends on your study design, in particular whether samples are independent or paired/matched. In addition to the test(s) you choose here, **Kruskal-Wallis (followed by Dunn's post-hoc) is always run and reported**.
>
> **Options** · `Wilcoxon`, `Mann-Whitney`, `T-test`
>
> > [!NOTE]
> >
> > **Which test fits my design?**\
> > First ask: *are the same subjects measured in more than one group, or are all subjects different?*
> >
> > * **Use** `Mann–Whitney U `**for independent groups.**\
> > Example: You compare alpha diversity between 10 treated mice and 10 untreated mice. Each mouse appears in only one group, so values cannot be paired across groups. The groups are independent → `Mann–Whitney U` is appropriate.
> > * **Use** `Wilcoxon `**for paired or matched samples.**\
> > Example: You compare alpha diversity in the same 10 mice before and after treatment. Each mouse contributes one “before” and one “after” value, so every value has a natural partner from the same animal. The samples are paired → `Wilcoxon` tests the within-subject change.
> >
> > **Reminder:** Equal group sizes do **not** make a design paired. Two groups of 10 different mice are still independent, and `Mann–Whitney U` is the correct nonparametric test.
>
> > [!WARNING]
> >
> > Using the wrong test can be misleading. Don't use `Wilcoxon` for independent groups; it's meant for paired or matched comparisons. Don't use `Mann-Whitney` for paired samples, since it ignores the pairing structure and can reduce statistical power.
> [accordion] P-value threshold
>
> The p-value cutoff that controls which pairwise comparisons get a significance bracket on the boxplots. It's applied to the raw p-value of **every pairwise test you selected**, in each panel (one panel per alpha-diversity metric), so it governs the significance brackets shown between groups, not which features or metrics are analyzed.
>
> **Options** · Numeric value between `0` and `1`
>
> **Default** · `0.05`
>
> **Suggested** · Use `0.05` as the standard threshold. A more stringent value such as `0.01` reduces the chance of reporting false positives.
>
> > [!NOTE]
> >
> > This threshold is applied to the **original** (unadjusted) test p-value. Use the **FDR threshold** below to gate significance on the multiple-testing-corrected value instead.
> [accordion] FDR threshold
>
> The threshold used to report significance **after** multiple-testing correction (Benjamini-Hochberg). This matters most when the grouping variable has **many categories**: more groups means more pairwise comparisons, and FDR adjustment keeps the overall rate of false positives across all of them in check.
>
> **Options** · Numeric value between `0` and `1`
>
> **Default** · `0.05`
>
> **Suggested** · Use `0.05` as standard. A more stringent value such as `0.01` gives stronger control over false positives when many comparisons are performed.
### References
**Shannon-Weaver Index** (Shannon, C. E. (1948). “A mathematical theory of communication.” Bell System Technical Journal, 27, 379–423 & 623–656.)
**Simpson Index** (Simpson, E. H. (1949). “Measurement of diversity.” Nature, 163(4148), 688.)
# Alpha diversity Overview
Source: https://docs.cosmosid.com/DAP_docs/alpha-diversity-overview
# What is Alpha Diversity?
Alpha diversity describes how diverse the microbial community within a single sample is. It is often the first measure examined in a microbiome study, because changes in community diversity are frequently associated with health status, disease or treatment. To express diversity as a single number, the full profile of the sample (taxa, genes, pathways or functions) is condensed into one value. This requires a decision on what “diversity” means, and it can be defined in more than one way.
* **Richness** counts how many different features (e.g: microbial species) are present in the sample.
* **Evenness** describes how equally the features share the total abundance.
* **Combined definitions** consider richness and evenness together.
Each definition leads to a different alpha diversity metric. For this reason, several metrics are available, and each one describes a different aspect of the same community.
# Why is Alpha Diversity useful?
Alpha diversity is one of the most widely used analyses in a microbiome study, because it gives a compact overview of the community structure within each sample. Many biological and environmental factors influence microbial communities, for example disease, antibiotics, diet, age, treatment, host genetics and body site, and their effects are often reflected in alpha diversity.
When groups of samples that differ in a variable of interest, such as health status or treatment, also show different alpha diversity distributions, this suggests that the variable is associated with differences in the overall microbiome.
Alpha diversity is not a universal health score, and its interpretation depends strongly on the ecosystem and the biological system under study.
In many ecosystems, higher diversity indicates a more complex and potentially more stable community with greater functional redundancy, that is, several taxa able to perform the same function. In a soil or gut microbiome, for example, other taxa can compensate for the loss of an individual species.
In other ecosystems, low diversity is characteristic of a healthy, specialised community. The healthy vaginal microbiome is usually dominated by *Lactobacillus*, and an increase in diversity often signals dysbiosis, that is, an imbalance in the microbial community.
Changes in alpha diversity, whether increases or decreases, therefore need to be interpreted relative to the specific habitat, host and perturbation, and should not be assumed to be good or bad on their own.
# How does alpha diversity work?

**1. **Start with a input feature table****
The input to alpha diversity analysis is a table of microbial features that describes the taxonomic or functional composition of each sample in your cohort.
The value of a feature in a sample may be the number of sequencing reads assigned to a given taxon or function (counts), or a relative abundance.
Each sample's profile is therefore a vector of numbers, and alpha diversity indexes allow to reduce that profile to a single value.
**2. **Choose the question you want to answer****
Alpha diversity measures fall mainly into two categories, depending on what they quantify:
* **Feature richness** is the number of different features, for example microbial species or genera, present in a sample. It does not take into account how abundant these features are or how evenly their abundances are distributed.
* **Feature evenness** describes how the relative abundances are distributed across the features present in a sample. High evenness means that the features are present in similar proportions, and low evenness means that a few features dominate the community. For example, two samples can both contain four species. If each species makes up 25% of the community, evenness is high. If one species makes up 85% and the other three 5% each, evenness is low, although richness is the same in both samples.
Before choosing a metric, ask what you care about most:
* How many microbial taxa or functions are present or detected in my community?
* Is my community dominated by a few abundant organisms, or are they spread evenly across many?
**3. **Pick an alpha diversity metric****
Choose an alpha diversity metric based on your research question and on the aspect of diversity you want to measure. Cosmos-Hub 2.0 currently supports three alpha diversity metrics.
| Metric | What it captures | Best used when | Keep in mind |
| :- | :- | :- | :- |
| **Observed richness** | The number of detected features in a sample. | You want the simplest answer to "How many taxa or features are present?" | It is strongly influenced by sequencing depth, because deeper sequencing tends to recover more rare features. |
| **Shannon** | A combination of richness and evenness; values increase when a sample contains more taxa and when abundances are more balanced. | You want one summary value that reflects both community size and balance. | It is widely used and more interpretable than many advanced indices, though still less intuitive than a percentage or a direct count. |
| **Simpson** | The contribution of dominant taxa; it is more influenced by abundant organisms and less sensitive to rare ones. | You care most about whether a few organisms dominate the community. | It can miss subtle shifts that happen mainly among low-abundance organisms. |
**4. **Calculate alpha-diversity for each sample in your cohort****
The chosen metric is calculated separately for each sample, so the output is a table with one alpha diversity value per sample.
For example, calculating Shannon diversity for 80 gut samples gives 80 Shannon values, one per sample.
**5. **Compare alpha-diversity across different groups****
Once each sample has a diversity value, you can compare those values across groups defined by **metadata**, meaning descriptive variables such as treatment, disease status, body site, time point, cohort, sex, or age group.
For example, in a treated-versus-control study, you might group samples by **Treatment** and ask whether one group tends to have higher or lower within-sample diversity than the other.
**6. **Visualize and test alpha-diversity patterns acrosss groups****
Alpha diversity is usually displayed as a boxplot, with one point for each sample. This lets you see at a glance whether the groups differ in their typical value, in their spread or in the presence of outliers.
When you read the plot, look at three aspects.
* Whether one group shows consistently higher or lower diversity than the others.
* Whether one group is much more variable than the others.
* Whether some samples are outliers, and whether they reflect a biological effect or a technical issue such as low sequencing depth.
For example, in a treated-versus-control study, the treated group might show a lower median Shannon value and a wider spread than the control group. A statistical test then tells you whether this difference is larger than expected by chance alone.
> [!NOTE]
>
> A statistically significant difference in alpha diversity tells you that groups differ for the selected metric, but it does **not** tell you which taxa caused the difference. To identify the organisms or features might be driving a shift in alpha-diversity across groups, follow up with methods to identify differentially abundant features (such as the Univariate Comparison or ML Classification analysis modules)
## References
**Wurm, J., et al.** (2024). "The effect of antibiotics on the intestinal microbiota in children." - antibiotic-associated decrease in gut alpha diversity
**Gong, D., et al.** (2016). "Involvement of Reduced Microbial Diversity in Inflammatory Bowel Disease." - lower Shannon diversity in IBD
**Han, Y., et al.** (2021). "Role of Vaginal Microbiota Dysbiosis in Gynecological Diseases." - Vaginal dysbiosis and loss of Lactobacillus dominance
# Analysis Projects (AP)
Source: https://docs.cosmosid.com/DAP_docs/analysis-project-AP
An Analysis Project holds a cohort and every analysis run on it, with each saved result kept as a snapshot.
## What is an Analysis Project?
Modern microbiome research often requires exploring and analyzing multiple types of 'omics data from a defined cohort, using different analytical approaches, algorithms, and visualizations to address specific biological questions. Within a single research project, the same cohort is typically analyzed in several distinct ways.
In Cosmos-Hub 2.0, an **Analysis Project (AP)** is the gateway to running Analysis Modules through the Analysis Studio on the [Cohorts](https://docs.cosmosid.com/DAP_docs/query-builder#what-is-a-cohort) you assembled with the Query Builder.
## Navigating and managing Analysis Projects in a Study
Enter a study to display which Analysis Projects are available. Analyses Projects are listed and can be managed from the '**Analysis Projects**' section of the Study Dashboard.

#### Creating Analysis Project(s)
Creation of a new Analysis Project is tied to creation of a cohort through the Query builder. Click on '+ New Analysis' to start creating a cohort and an Analysis Project. For more details, visit [Create a cohort with the Query Builder](https://docs.cosmosid.com/DAP_docs/query-builder).
#### Deleting Analysis Project(s)
Select one or more Analysis Projects and click on the 'Delete' button appearing on the upper right of the interface.
> [!CAUTION]
>
> Deleting an Analysis Project is permanent and cannot be undone. The cohort defined for that Analysis Project is deleted, along with every analysis and snapshot it contains. The source data in the Workspace used to build the AP cohort is NOT affected.
#### Renaming an Analysis Project
Select a single Analysis Project and click on the 'Rename' button appearing on the upper right of the interface. Duplicated AP names within the same study are not allowed.
## Searching and filtering Analysis Projects
Use the search bar in the Analysis Projects section of the Study Dashboard to find Analysis Projects and change how they are displayed.

1. **Select all** selects every Analysis Project in the list. Available in card view only.
2. **Show Filters** displays filters below the column names. Enter text or numbers to search within a specific metadata column.
3. **Card View** displays Analysis Projects as cards.
4. **List View** displays Analysis Projects as rows in a table.
5. **Manage Columns** sets which metadata columns appear in list view.
6. **Full Screen** expands the list to fill the window.
## Next step: analyse your cohort through [the Analysis Studio](https://docs.cosmosid.com/DAP_docs/analysis-studio)
> [card] [The Analysis Studio](https://docs.cosmosid.com/DAP_docs/analysis-studio)
>
> Run diversity, differential abundance, ordination and machine learning modules on your cohort.
# Analysis Snapshots
Source: https://docs.cosmosid.com/DAP_docs/analysis-snapshots
A snapshot records the state of an Analysis Project at a point in time, including the module, its parameters and the output produced.
## What is an Analysis Snapshot?
On Cosmos-Hub 2.0, an **Analysis Snapshot** is a saved state of an analysis within an Analysis Project. It records the Analysis Module, the parameter values used, and the output produced, together with the name and description provided when the snapshot is saved.
Snapshots allow a specific analysis configuration to be preserved and reopened later. They also provide a record of how an analysis has changed over time and make it possible for other Workspace members to review or continue from a saved state.
## Navigating AP's Snapshot History
Clicking an **Analysis Project** opens the **Analysis Project Dashboard**. The **Analysis Snapshots** section lists all snapshots saved for that project. Each **Analysis Snapshot** acts as an entry point to the **Analysis Studio**, opening the Analysis Module used for that analysis together with the saved parameter configuration.

* Click **Open Current Analysis** (**Default**) to open the latest state of the Analysis Studio.
* Click **Open Snapshot** to open a saved Analysis Snapshot in the Analysis Studio, with the corresponding Analysis Module and parameter configuration restored.
#### Searching and filtering Analysis Snapshots within an AP
Use the search bar in the Analysis snapshots of the Study Dashboard to find Analysis Projects and change how they are displayed.

1. **Select all** selects every Analysis Snapshot in the list. Available in card view only.
2. **Show Filters** displays filters below the column names. Enter text or numbers to search within a specific metadata column.
3. **Card View** displays Analysis Snapshots as cards.
4. **List View** displays Analysis Snapshots as rows in a table.
5. **Manage Columns** sets which metadata columns appear in list view.
6. **Full Screen** expands the list to fill the window.
#### Rename and delete Snapshots
Switch the view to list mode (4) and select a snapshot to rename or delete it.
> [!WARNING]
>
> Deleting a snapshot is permanent. The parameter configuration and the output it recorded are removed. The Analysis Project, its cohort and its other snapshots are unaffected.
## Navigating snapshot from the Analysis Studio
#### Inside an Analysis Snapshot
Entering an Analysis Snapshot will open a saved Analysis Snapshot in the Analysis Studio, with the corresponding Analysis Module and parameter configuration restored.

To generate the Analysis Module output that was supposed to be saved with the Snapshot, simply click on 'Run and Apply' to regenerate the output.
> [!TIP]
>
> Snapshots are designed to be shared and further explored with other members of the Workspace. You can change any number of parameters after opening a snapshot. To return to the parameter values stored in that snapshot, click **Reset Snapshot**.
>
> Cosmos-Hub does not allow a new snapshot to be saved if its parameter configuration is identical to that of an existing snapshot in the same Analysis Project.
#### Taking Snapshots from the Analysis Studio
Inside the Analysis Studio, click **Save** in the control bar at the top right of the Analysis Studio and give the snapshot a name and description.

#### Show AP Snapshot History
Clicking on '**History**' inside the Analysis Studio will display the list of all Snapshots available for the current Analysis Projects. This list is equivalent to that shown in Analysis Snapshots section of the Analysis Project Dashboard.

* Clicking on **Restore** for a snapshot will change the current Analysis Studio view to that Snapshot analysis module and parameters
> [!NOTE]
>
> **Reset Snapshot** and **Restore** do different things. **Reset Snapshot** undoes unsaved parameter changes in the snapshot you are working on. **Restore**, in the Snapshot History panel, switches to a different saved snapshot.
# The Analysis Studio
Source: https://docs.cosmosid.com/DAP_docs/analysis-studio
## What is the Analysis Studio?
The **Analysis Studio** is the Cosmos-Hub 2.0 suite of **Analysis Modules**, designed to help you explore and analyse the Cohort defined in an Analysis Project. It brings together a broad range of popular microbiome bioinformatics analyses as nine different Analysis Modules, including exploratory visualisations, alpha- and beta-diversity analysis, differential abundance testing, machine learning, and much more.
Each Analysis module can be fine tuned interactively, to produce publication-ready figures and statistical testing using dedicated parameters interactively and see results update as parameters change.
## Accessing the Analysis Studio
1. To access the Analysis Studio, navigate the 'Analysis Projects' section of the Study Dashboard and enter an Analysis Project by clicking on the 'Open' of the corresponding card. This will open the **Analysis Project Dashboard,** listing all instances (Analysis Snapshots) of the Analysis Studio currently available for Analysis Project. Visit [**Analysis Snapshots**](https://docs.cosmosid.com/DAP_docs/analysis-snapshots) for more details on what Analysis Snapshots are and how to use them.

1. Click on '**Open Current Analysis'** to enter the Analysis Studio for the current Analysis Project\
## A tour of the Analysis Studio

1. **The Analysis Modules panel:** Choose an Analysis Module among those available to load the Analysis Module Parameter Panel. \
\
Cosmos-Hub 2.0 includes nine analysis modules, each exploring your data in a different way. Select the one that fits your research question from the Module panel; each module's overview is linked below.
2. **The Analysis Module Parameter Panel**: the panel the parameters Each Analysis Module is customisable, and require to set Pre-processing and Analysis parameters.
3. **Analysis Output Viewer:** an embedded viewer (iFrame) that inetractively renders the figures, statistics, and tables the module produces for the set of parameters chose.
4. **Analysis Snapshots and Export control:** allows to download the current Analysis Studio output, save the current instance of the Analysis Studio, and control Analysis Snapshots.
## Running Analysis Modules
**1. Select a module from the Analysis Modules Panel**
> [!NOTE]
>
> If you any module is not available for your Analysis Project, you might not have selected it during Cohort and Analysis Project creation. Visit [Create a Cohort with Query Builder](https://docs.cosmosid.com/DAP_docs/query-builder) to learn more.
Choose a module from the module panel. You can learn more about each Analysis Module, read the module overviews available for each Analysis Module currently implemented on Cosmos-Hub 2.0.
> [card] [Stacked Bar Chart](/DAP_docs/stacked-bar-chart-overview)
> [card] [Heatmap](/DAP_docs/heatmap-overview)
> [card] [PCA Explorer](/DAP_docs/pca-explorer-overview)
> [card] [Rarefaction](/DAP_docs/rarefaction-analysis-overview)
> [card] [Alpha Diversity](/DAP_docs/alpha-diversity-overview)
> [card] [Beta Diversity](/DAP_docs/beta-diversity-overview)
> [card] [Univariate Comparison](/DAP_docs/univariate-comparison-overview)
> [card] [ML Classification](/DAP_docs/ml-classification-overview)
> [card] [ML Regression](/DAP_docs/ml-regression-overview)
**2. Adjust Pre-processing and Module parameters**
Each Analysis module requires to set the parameters for the module. The Analysis Module Parameter Panel is divided into two sections:
* **PREPROC**: this section includes parameters controlling data table pre-processing, i.e filtering samples or features from the data table before downstream analyis. Depending on the type of data currently available for the AP cohort, available parameter options might change. Learn more about Data table Pre-processing at [Pre-processing Overview](https://docs.cosmosid.com/DAP_docs/preprocessing-overview).
* **Analysis**: this section includes all Analysis Module-specific parameters. Analysis parameters control how that particular analysis is run and displayed. To learn more on how to tune Analysis Modules and how to read their outputs, visit the guides available in the documentation (e.g: [Heatmap on Cosmos-Hub 2.0](https://docs.cosmosid.com/DAP_docs/heatmaps))

**3. Run the Analysis Module**

Click '**Run and Apply**' button to start the Analysis Module using the current set of parameters.
Use the **Reset** button to return all parameters to their default values.
> [!TIP]
>
> You can re-run a module as many times as you like. Changing parameters and clicking **Run and Apply** will recomputes the output.
**4. Read the Analysis Module output**
Once the Analysis module finishes running, figures and tables will appear on the **Analysis Output Viewer.**
## Download the output of an Analysis Module
Click the **Export** button in the **Analysis Snapshots and Export control menu** to download all the figures and table generated by the current Analysis Module:
* Figures in high-resolution .png format
* Tables with statistical outputs
* A record of the analysis parameter used
* The raw and pre-processed input data table
* The raw and pre-processed metadata
## Saving a Snapshot of your Analysis
**Analysis Modules** can include several parameters, which can make it difficult to reproduce a specific output from memory alone. In **Cosmos-Hub 2.0**, you can save an **Analysis Snapshot** of the current Analysis Studio state, preserving the configuration that generated a given figure.
Anyone with access to the current workspace can open the snapshot, review the same output and parameter settings, and continue the analysis from that point by adjusting the configuration further.
To save a Snapshot of your Analysis:
1. Click on the 'Save' button, in the **Analysis Snapshots and Export control menu.**
2. Choose a name and a description (optional) for the Analysis Snapshot

To learn more about Snapshots and how to navigate them, visit [Analysis Snapshots](untitled-page-8).
## FAQ
> [accordion] How do I download the feature table used in my analysis?
>
> You can download both the original feature table (taxonomic or functional profiles) and the pre-processed version used by the current Analysis Module, together with the matching metadata.
>
> **1. Run any Analysis Module**
>
> Select any module from the Analysis Modules Panel (e.g. **Stacked Bar Chart**).
>
> **2. Set the pre-processing parameters**
>
> In the **PREPROC** section of the Analysis Module Parameter Panel, set the pre-processing parameters you want to apply to the feature table (e.g. analysis metric, taxonomic rank, abundance and prevalence thresholds).
>
> **3. Click Run and Apply**
>
> Click **Run and Apply** so the pre-processing is applied to the feature table.
>
> **4. Click Export**
>
> Click the **Export** button in the **Analysis Snapshots and Export control** menu. This downloads a folder that includes:
>
> * the \*\*raw feature table \*\*, before pre-processing - `input_features.csv`
>
> * the **pre-processed feature table**, as used by the module (e.g. relative abundances aggregated at genus level) - `transformed_features.csv`
>
> * the \*\*raw and pre-processed metadata - \*\*`input_metadata.csv` and `transformed_metadata.csv`
>
> > [!TIP]
> >
> > The pre-processed feature table reflects the parameters used in the last **Run and Apply**. If you change the pre-processing parameters, click **Run and Apply** again before exporting.
# Beta diversity on Cosmos-Hub 2.0
Source: https://docs.cosmosid.com/DAP_docs/beta-diversity-on-the-dap
Run beta-diversity analysis in Cosmos-Hub 2.0: the plots and tables it produces, how to read them, and the parameters that shape them.
This page covers how beta-diversity analysis works on Cosmos-Hub 2.0: the outputs it produces, how to read them, and the parameters you can tune. For the theory behind beta diversity and the ordination methods, see the [Beta diversity overview](https://docs.cosmosid.com/DAP_docs/beta-diversity-overview).
# Module output and customization
* **Beta-diversity ordination plot(s):** one ordination plot for each method currently available on Cosmos-Hub 2.0 (PCoA, MDS, t-SNE, and UMAP).
* **PCoA scree plot:** a PCoA-specific plot showing the proportion of distance variation captured by each PCoA axis.
* **Beta-diversity Statistical testing (Permanova and Anosim):** a heatmap showing statistical support for differences between the groups defined by the grouping variable, one cell per pairwise comparison.
* **Statistical output tables (5):** the data behind the PCoA ordination and scree plot, plus the PERMANOVA and ANOSIM results for the overall and pairwise group comparisons.
## Beta-diversity ordination plot(s)

Beta-diversity ordination. Each point is one sample, colored by sex\_text (male/female) and shaped by hiv\_serostatus\_text (positive/negative). Ellipses summarize the spread of the sex groups, showing whether they separate or overlap.
The ordination plot maps how microbial communities relate to one another across samples, based on how similar or different their compositions are.
* Each point represents one sample: the **distance separating two points** in the ordination plot is proportional to how different their microbial feature profiles are. When working with taxonomic profiles, distance tells you how similar their microbial communities are. When looking at functional profiles, it tells you how similar their functional profiles are.
### **1. Choose how to measure sample distances.**
Choose the method used to calculate the sample-to-sample pairwise distance matrix from the [**Beta-diversity metric**](#beta-diversity-metric) dropdown. This choice is important, as it actively changes how [the distance matrix](/DAP_docs/betadiversity-overview) used by the ordination methods for plotting is generated. Different beta-diversity metrics can lead to profoundly different ordination plots.\
\
A few of the most popular metrics include:
* **Bray-Curtis**: for relative-abundance data, when you want differences in composition to be weighted by how abundant each taxon is. It is a popular, intuitive default.
* **Jaccard**: specific for presence/absence data. Useful when you care about which taxa are shared or not shared, regardless of their abundance.
* **Aitchison**: when you want to keep into account the compositional nature of sequencing data. Because sequencing measures relative, not absolute, abundances, an apparent rise in one taxon can just reflect a drop in another, which can create spurious patterns.
> [!NOTE]
>
> **How Aitchison works?** The Aitchison metric addresses compositionality by comparing samples using log-ratios between features. It first applies a CLR (centered log-ratio) transformation, where each feature in a sample is divided by a per-sample reference value and then log-transformed. When Aitchison is selected as distance metric from the parameter, the [**Centroid Method**](https://docs.cosmosid.com/DAP_docs/beta-diversity-on-the-dap#:~:text=preprocessing%20and%20scaling-,Centroid,-Method) lets you set this per-sample reference value. You can choose between:
>
> * `Mean`: the geometric mean of the sample (the standard CLR choice). Best when the data is fairly clean.
> * `Median`: more robust to outliers and noisy low-abundance taxa, often useful for sparse data.
### 2. Customize the ordination plot
Once distances are computed, these parameters control how the plot is built and annotated:
* From your categorical metadata variables, choose one of interest from the [**Grouping Variable**](#grouping-variable) parameter dropdown. Data points in the ordination plots are assigned different colors depending on which group of that variable they belong to. This is the main way to visually inspect whether the variable you chose (treatment, body site, and so on) displays any pattern in the community structure.\
> [!NOTE]
>
> Choice of the Grouping Variable governs between which groups PERMANOVA/ANOSIM testing is done.
* Overlay a second categorical variable as point shape using the [**Shape Variable**](#shape-variable) parameter. This is useful to keep track of another categorical variable (for example, Treatment encoded as the Grouping variable + Timepoint encoded as the Shape variable).
* Choose to display the ordination plot in 2D or 3D: change the [**Number of Components**](#number-of-components) parameter. A 2D ordination plot is usually the best choice to maintain readability of the plot, but a 3D plot can be useful when the first two components do not capture enough of the variation, so an important separation between groups stays hidden in 2D but becomes visible once a third axis is added.
* The [**Max ellipses**](#max-ellipses) and [**Confidence level**](#confidence-level) parameters control the group ellipses drawn on the plot, which summarize where each group of samples sits and how spread out it is.
* [**Drop samples with missing grouping metadata**](#drop-samples-with-missing-grouping-metadata) removes samples that have no value for the grouping variable, keeping the plot and the comparison clean.
> [!TIP]
>
> Keeping them can instead be useful to get a sense of where an unlabeled sample falls, for example whether it sits near a known group.
#### **Why it's useful**
* **Explore overall similarity:** close samples have similar communities; distant samples differ.
* **Assess whether your metadata explains community structure:** color samples by a variable (treatment, disease status, body site, and so on) and check whether it lines up with visible patterns. If the groups are **mixed**, that variable may not explain much of the variation; if they **cluster or separate**, it may be associated with community differences, but first rule out study-design or technical variables (batch, cohort, sampling site).
* **Spot batch or technical effects:** if samples cluster by sequencing batch, study site, run, extraction method, processing date, or cohort, consider this before reading the pattern as biology.
* **Detect outlier or suspicious samples:** samples expected to be similar (replicates, or longitudinal samples from one subject) should sit close together. If one clusters with an unrelated subject, it may be a true biological shift, or a sample swap, label mismatch, contamination, or processing issue worth checking.
### 3. Statistical testing
The ordination plot shows whether your groups appear to separate. Statistical testing checks whether that separation is real or could be due to chance.
The module runs two permutation tests, **PERMANOVA** and **ANOSIM**, for every pair of groups in your grouping variable. Both use the same distance matrix as the ordination plot, so the test and the plot describe the same differences between samples.
> [!NOTE]
>
> **What is a permutation test?** Common tests such as the t-test compare one measured value per sample, for example the abundance of a single species, and calculate the p-value from a known distribution such as the bell curve. Beta diversity gives a different kind of data. The result is a distance between every pair of samples, so each sample contributes to many values at once, and these distances do not follow a known distribution. A permutation test solves this by building its reference distribution directly from your own data.
>
> Take gut samples from 10 antibiotic-treated mice and 10 control mice. If the antibiotic had no effect on the gut community, the labels "treated" and "control" would carry no information, and swapping them between mice would make no difference. The test measures how well the real labels separate the samples, then shuffles the labels at random and measures the separation again. After 999 shuffles, it counts how many random labellings separate the samples as well as the real one. If only 4 of the 999 shuffles do as well, the p-value is about 0.005, and the separation between treated and control mice is unlikely to be due to chance. The number of shuffles is set by the [**Number of permutations**](#number-of-permutations) parameter.
Two parameters control the testing:
* The [**Grouping Variable**](#grouping-variable) defines the groups being compared. It is the same variable you used to colour the plot, so the visual pattern and the statistical result refer to the same groups.
* The [**Number of permutations**](#number-of-permutations) controls the precision of the p-value. With 999 permutations, the smallest p-value the test can return is 0.001. More permutations give a more precise p-value and take longer to run.
The results are summarised in the PERMANOVA/ANOSIM heatmap.

Pairwise PERMANOVA and ANOSIM results for dermotypes in skin samples, with 999 permutations. The lower triangle shows PERMANOVA results. The upper triangle shows ANOSIM results. Each cell shows the FDR adjusted q-value for one pair of dermotypes. An asterisk marks a significant comparison. Darker cells indicate lower q-values on a log scale. Numbers in parentheses on the y-axis show the sample size of each dermotype.
The heatmap is split along the diagonal. Cells **below the diagonal** show PERMANOVA results and cells **above the diagonal** show ANOSIM results. Each pair of groups therefore appears twice, once in each triangle, in mirrored positions. For example, if group A is listed above group B on the y-axis, the PERMANOVA result for the pair sits in row B, column A, and the ANOSIM result sits in row A, column B.
Each cell shows the **FDR adjusted q-value** for one pairwise comparison. A q-value is a p-value adjusted for multiple testing. Every additional pairwise comparison adds a chance of a false positive, and the false discovery rate (FDR) correction keeps the expected proportion of false positives among the significant cells low. Lower q-values mean stronger evidence that the two groups differ in composition. A q-value shows how unlikely a difference is to be due to chance, and it gives no information about the size of the difference. Use the ordination plot to judge how large the separation is.
> [!NOTE]
>
> **PERMANOVA and ANOSIM in brief.** Both tests ask whether samples from the same group are more similar to each other than to samples from other groups, that is, whether your grouping variable separates the data better than random chance would.
>
> * **PERMANOVA** tests whether the centroids of the groups differ. A centroid is the average position of a group's samples in the space defined by the distances. The test statistic, pseudo-F, compares distances between groups with distances within groups, in a similar way to ANOVA. PERMANOVA works on the actual distance values.
> * **ANOSIM** ranks all distances from smallest to largest and compares the average rank between groups with the average rank within groups. Its statistic **R** ranges from about −1 to 1. Values near 0 indicate no separation and values near 1 indicate strong separation.
> [!TIP]
>
> **Choosing between PERMANOVA and ANOSIM.** Read the PERMANOVA result first. It uses the actual distance values, it generally has more statistical power (the ability to detect a difference that really exists), and it is the test most microbiome studies report. Use ANOSIM as a second check on the same pair of groups.
>
> Both tests are sensitive to **dispersion**, that is, how widely the samples of a group are spread around their centroid. Two groups with the same average composition can still give a significant result if one group is much more variable than the other. ANOSIM is more affected by differences in dispersion than PERMANOVA. PERMANOVA becomes more affected when the groups have very different sample sizes.
>
> When the two tests disagree, compare the result with the ordination plot.
>
> | PERMANOVA | ANOSIM | What it usually means | What to check |
> | - | - | - | - |
> | Significant | Significant | Strong evidence that the two groups differ in composition. | Confirm in the ordination plot that the groups are shifted relative to each other, and that one group is not only more spread out. |
> | Significant | Not significant | The groups differ, but the difference is modest. A few very different samples can drive PERMANOVA, because it uses the distance values, while ANOSIM gives them less weight because it uses ranks. With small groups, the lower power of ANOSIM can also explain the result. | Look for outlier samples in the ordination plot. If one group is much wider than the other and the group sizes are unequal, interpret the PERMANOVA result with caution. |
> | Not significant | Significant | Less common. This pattern usually reflects a difference in spread between the groups rather than in their average composition. | Check whether one group forms a tight cluster and the other is widely scattered. Describe the result as a difference in variability between the groups. |
> | Not significant | Not significant | No evidence of a difference in composition between the two groups. | Check the sample sizes in parentheses. With few samples per group, both tests may lack the power to detect a real difference. |
## PCoA scree plot

PCoA scree plot. The top panel shows the proportion of variation explained by each axis; the bottom panel shows the corresponding eigenvalues. Axes explaining more variation capture stronger patterns.
The scree plot displays the amount of variability in the data that is explained by each PCoA axis. This allows you to understand how well the two-dimensional plot represents the overall differences in community composition across all the samples. Axes that explain more of the variability are more important for understanding the main factors that cause the samples to be different from each other.
**Why it's useful**
* **Judge how well the 2D plot summarizes the data:** if PCoA1 and PCoA2 explain a large share of variation, the ordination is a strong summary; if they explain only a small share, the plot still helps but represents only part of the full differences.
* **See whether differences come from one strong pattern or many:** if PCoA1 explains far more than the others, one dominant source separates the samples; if variation is spread across many axes, the differences are more complex and distributed, rather than driven by a single gradient.\
## Ordination and statistical test tables
Scroll past the of the output page to download intermediate files and statistical summaries of the Beta-diversity Analysis module
| Table | What it contains |
| :- | :- |
| **PCoA: proportion explained and eigenvalues** | The numerical form of the scree plot: the proportion of variation explained by each PCoA axis and its eigenvalue. |
| **PCoA: sample coordinates** | The PCoA coordinates of every sample across 150 axes. The first two columns are the coordinates used to place the dots on the ordination plot. |
| **PERMANOVA summary** | Sample size, number of groups, pseudo-F statistic, p-value, and permutation count for the overall test. |
| **ANOSIM summary** | Sample size, number of groups, R statistic, p-value, and permutation count for the overall test. |
| **Pairwise PERMANOVA / ANOSIM results** | Each pairwise group comparison: group names, sample sizes, test statistics, p-values, FDR-adjusted q-values, and permutation counts. |
## Recommended parameters
> [tab] Kepler - Host-Agnostic Taxonomic Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `raw` if samples have comparable read depths
- `filter` if a few samples have notably lower read depth than the rest of the cohort
- `rarefaction` to standardize the whole cohort to a common read depth
Sequencing depth heavily affects output with presence-absence Beta-diversity metric (e.g:`Jaccard`). Compositional-aware distances (e.g: `Braycurtis`or `Aitchison` ) are robust to variability in sequencing depth. |
> | Read Depth | - When using `rarefaction`, use the [Rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction) to detect an optimal read depth to avoid discarding too many samples. Samples below it are discarded, so depth trades against sample size.
- With `filter`, set a threshold that removes only the samples with notably lower depth. The retention plot helps spot them.
|
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | - `0` with `Jaccard`
- `0.01` to `0.05` with `Bray Curtis`
- `0.05` to `0.1 ` with `Aitchison`
Use minimal but nonzero filtering for Jaccard, since each detected taxon contributes equally regardless of abundance and rare detections can be noise-sensitive. Apply modest filtering for Bray–Curtis and stronger filtering before conventional Aitchison analysis, where high sparsity makes results sensitive to zero replacement rather than measured relative abundances. |
> | Beta Diversity Metric | - `Aitchison` or `Bray-Curtis` : you care about differences in *relative community structure*
- `Jaccard : `your question is whether samples differ in *which taxa are detected*
|
> | Centroid Method (if available) | `median` |
> | Number of Components | - `2` when the first two axes capture most of the variation
- `3` if the third PCoA axis explains nearly as much as the second (use the PCoA scree plot). Note: A static 3D plot gets easily crowded with many samples.
|
> | Grouping Variable | Categorical metadata of interest. Grouping defines the groups compared by PERMANOVA and ANOSIM. Avoid variables with very few samples per category. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Number of Permutations | - Exploring: `999`
- For more confidence in the p-value, especially near your threshold: `9999`
With `999` permutations the smallest p-value obtainable is `0.001`. |
> | Max Ellipses | Number of groups in your grouping variable (up to about `5`) |
> | Shape Variable | Optional second categorical variable. For example, color by `treatment` and shape by `timepoint` to see whether groups separate only at later timepoints. |
> | Confidence Level | - `0.95` as standard.
- `0.70` for tighter ellipses on crowded plots.
|
> [tab] CHAMP - Human Taxonomic Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `raw` if samples have comparable read depths
- `filter` if a few samples have notably lower read depth than the rest of the cohort
- `rarefaction` to standardize the whole cohort to a common read depth
Sequencing depth heavily affects output with presence-absence Beta-diversity metric (e.g:`Jaccard`). Compositional-aware distances (e.g: `Braycurtis`or `Aitchison` ) are robust to variability in sequencing depth. |
> | Read Depth | - When using `rarefaction`, use the [Rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction) to detect an optimal read depth to avoid discarding too many samples. Samples below it are discarded, so depth trades against sample size.
- With `filter`, set a threshold that removes only the samples with notably lower depth. The retention plot helps spot them.
|
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | - `0` with `Jaccard`
- `0.01` to `0.05` with `Bray Curtis`
- `0.05` to `0.1 ` with `Aitchison`
Use minimal but nonzero filtering for Jaccard, since each detected taxon contributes equally regardless of abundance and rare detections can be noise-sensitive. Apply modest filtering for Bray–Curtis and stronger filtering before conventional Aitchison analysis, where high sparsity makes results sensitive to zero replacement rather than measured relative abundances. |
> | Beta Diversity Metric | - `Aitchison` or `Bray-Curtis` : you care about differences in *relative community structure*
- `Jaccard : `your question is whether samples differ in *which taxa are detected*
|
> | Centroid Method (if available) | `median` |
> | Number of Components | - `2` when the first two axes capture most of the variation
- `3` if the third PCoA axis explains nearly as much as the second (use the PCoA scree plot). Note: A static 3D plot gets easily crowded with many samples.
|
> | Grouping Variable | Categorical metadata of interest. Grouping defines the groups compared by PERMANOVA and ANOSIM. Avoid variables with very few samples per category. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Number of Permutations | - Exploring: `999`
- For more confidence in the p-value, especially near your threshold: `9999`
With `999` permutations the smallest p-value obtainable is `0.001`. |
> | Max Ellipses | Number of groups in your grouping variable (up to about `5`) |
> | Shape Variable | Optional second categorical variable. For example, color by `treatment` and shape by `timepoint` to see whether groups separate only at later timepoints. |
> | Confidence Level | - `0.95` as standard.
- `0.70` for tighter ellipses on crowded plots.
|
> [tab] 16S SR Amplicon Classification - Taxonomic
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `genus` |
> | Data Table Pre-processing Method | - `raw` if samples have comparable read depths
- `filter` if a few samples have notably lower read depth than the rest of the cohort
- `rarefaction` to standardize the whole cohort to a common read depth
Sequencing depth heavily affects output with presence-absence Beta-diversity metric (e.g:`Jaccard`). Compositional-aware distances (e.g: `Braycurtis`or `Aitchison` ) are robust to variability in sequencing depth. |
> | Read Depth | - When using `rarefaction`, use the [Rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction) to detect an optimal read depth to avoid discarding too many samples. Samples below it are discarded, so depth trades against sample size.
- With `filter`, set a threshold that removes only the samples with notably lower depth. The retention plot helps spot them.
|
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | - `0` with `Jaccard`
- `0.01` to `0.05` with `Bray Curtis`
- `0.05` to `0.1 ` with `Aitchison`
Use minimal but nonzero filtering for Jaccard, since each detected taxon contributes equally regardless of abundance and rare detections can be noise-sensitive. Apply modest filtering for Bray–Curtis and stronger filtering before conventional Aitchison analysis, where high sparsity makes results sensitive to zero replacement rather than measured relative abundances. |
> | Beta Diversity Metric | - `Aitchison` or `Bray-Curtis` : you care about differences in *relative community structure*
- `Jaccard : `your question is whether samples differ in *which taxa are detected*
|
> | Centroid Method (if available) | `median` |
> | Number of Components | - `2` when the first two axes capture most of the variation
- `3` if the third PCoA axis explains nearly as much as the second (use the PCoA scree plot). Note: A static 3D plot gets easily crowded with many samples.
|
> | Grouping Variable | Categorical metadata of interest. Grouping defines the groups compared by PERMANOVA and ANOSIM. Avoid variables with very few samples per category. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Number of Permutations | - Exploring: `999`
- For more confidence in the p-value, especially near your threshold: `9999`
With `999` permutations the smallest p-value obtainable is `0.001`. |
> | Max Ellipses | Number of groups in your grouping variable (up to about `5`) |
> | Shape Variable | Optional second categorical variable. For example, color by `treatment` and shape by `timepoint` to see whether groups separate only at later timepoints. |
> | Confidence Level | - `0.95` as standard.
- `0.70` for tighter ellipses on crowded plots.
|
> [tab] 16S LR Amplicon profiling - Taxonomic
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `raw` if samples have comparable read depths
- `filter` if a few samples have notably lower read depth than the rest of the cohort
- `rarefaction` to standardize the whole cohort to a common read depth.
Sequencing depth heavily affects output with presence-absence Beta-diversity metric (e.g:`Jaccard`). Compositional-aware distances (e.g: `Braycurtis`or `Aitchison` ) are robust to variability in sequencing depth. |
> | Read Depth | - When using `rarefaction`, use the [Rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction) to detect an optimal read depth to avoid discarding too many samples. Samples below it are discarded, so depth trades against sample size.
- With `filter`, set a threshold that removes only the samples with notably lower depth. The retention plot helps spot them.
|
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | - `0` with `Jaccard`
- `0.01` to `0.05` with `Bray Curtis`
- `0.05` to `0.1 ` with `Aitchison`
Use minimal but nonzero filtering for Jaccard, since each detected taxon contributes equally regardless of abundance and rare detections can be noise-sensitive. Apply modest filtering for Bray–Curtis and stronger filtering before conventional Aitchison analysis, where high sparsity makes results sensitive to zero replacement rather than measured relative abundances. |
> | Beta Diversity Metric | - `Aitchison` or `Bray-Curtis` : you care about differences in *relative community structure*
- `Jaccard : `your question is whether samples differ in *which taxa are detected*
|
> | Centroid Method (if available) | `median` |
> | Number of Components | - `2` when the first two axes capture most of the variation
- `3` if the third PCoA axis explains nearly as much as the second (use the PCoA scree plot). Note: A static 3D plot gets easily crowded with many samples.
|
> | Grouping Variable | Categorical metadata of interest. Grouping defines the groups compared by PERMANOVA and ANOSIM. Avoid variables with very few samples per category. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Number of Permutations | - Exploring: `999`
- For more confidence in the p-value, especially near your threshold: `9999`
With `999` permutations the smallest p-value obtainable is `0.001`. |
> | Max Ellipses | Number of groups in your grouping variable (up to about `5`) |
> | Shape Variable | Optional second categorical variable. For example, color by `treatment` and shape by `timepoint` to see whether groups separate only at later timepoints. |
> | Confidence Level | - `0.95` as standard.
- `0.70` for tighter ellipses on crowded plots.
|
> [tab] Host-Agnostic Functional Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Data Table Pre-processing Method | `raw` |
> | Read Depth | - With `filter`, set a threshold that removes only the samples with notably lower depth.
|
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | - `0` with `Jaccard`
- `0.01` to `0.05` with `Bray Curtis`
- `0.05` to `0.1 ` with `Aitchison`
|
> | Beta Diversity Metric | - `Aitchison` or `Bray-Curtis` : you care about differences in *relative functional composition*
- `Jaccard : `your question is whether samples differ in *which functions are detected*
|
> | Number of Components | - `2` when the first two axes capture most of the variation
- `3` if the third PCoA axis explains nearly as much as the second (use the PCoA scree plot). Note: A static 3D plot gets easily crowded with many samples.
|
> | Grouping Variable | Categorical metadata of interest. Grouping defines the groups compared by PERMANOVA and ANOSIM. Avoid variables with very few samples per category. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Number of Permutations | - Exploring: `999`
- For more confidence in the p-value, especially near your threshold: `9999`
With `999` permutations the smallest p-value obtainable is `0.001`. |
> | Max Ellipses | Number of groups in your grouping variable (up to about `5`) |
> | Shape Variable | Optional second categorical variable. For example, color by `treatment` and shape by `timepoint` to see whether groups separate only at later timepoints. |
> | Confidence Level | - `0.95` as standard.
- `0.70` for tighter ellipses on crowded plots.
|
> [tab] CHAMP - Human Functional Profiling (GBM, GMM, KEGG)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `cellular_abundance` |
> | Data Table Pre-processing Method | `raw` |
> | Read Depth | - When using `rarefaction`, use the [Rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction) to detect an optimal read depth to avoid discarding too many samples. Samples below it are discarded, so depth trades against sample size.
- With `filter`, set a threshold that removes only the samples with notably lower depth. The retention plot helps spot them.
|
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | - `0` with `Jaccard`
- `0.01` to `0.05` with `Bray Curtis`
- `0.05` to `0.1 ` with `Aitchison`
|
> | Beta Diversity Metric | - `Bray-Curtis` or `Aitchison`: you care about differences in *relative functional module composition*
- `Jaccard : `your question is whether samples differ in *which functional modules or pathways are detected*
|
> | Number of Components | - `2` when the first two axes capture most of the variation
- `3` if the third PCoA axis explains nearly as much as the second (use the PCoA scree plot). Note: A static 3D plot gets easily crowded with many samples.
|
> | Grouping Variable | Categorical metadata of interest. Grouping defines the groups compared by PERMANOVA and ANOSIM. Avoid variables with very few samples per category. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Number of Permutations | - Exploring: `999`
- For more confidence in the p-value, especially near your threshold: `9999`
With `999` permutations the smallest p-value obtainable is `0.001`. |
> | Max Ellipses | Number of groups in your grouping variable (up to about `5`) |
> | Shape Variable | Optional second categorical variable. For example, color by `treatment` and shape by `timepoint` to see whether groups separate only at later timepoints. |
> | Confidence Level | - `0.95` as standard.
- `0.70` for tighter ellipses on crowded plots.
|
> [tab] AMR/VF - Functional
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Data Table Pre-processing Method | `raw` |
> | Read Depth | - When using `rarefaction`, use the [Rarefaction module](https://docs.cosmosid.com/DAP_docs/rarefaction) to detect an optimal read depth to avoid discarding too many samples. Samples below it are discarded, so depth trades against sample size.
- With `filter`, set a threshold that removes only the samples with notably lower depth. The retention plot helps spot them.
|
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | - `0` with `Jaccard`
- `0.01` to `0.05` with `Bray Curtis`
- `0.05` to `0.1 ` with `Aitchison`
|
> | Beta Diversity Metric | - `Aitchison` or `Bray-Curtis` : you care about differences in *relative resistance/virulence gene composition*
- `Jaccard : `your question is whether samples differ in *which resistance or virulence genes are detected*
|
> | Number of Components | - `2` when the first two axes capture most of the variation
- `3` if the third PCoA axis explains nearly as much as the second (use the PCoA scree plot). Note: A static 3D plot gets easily crowded with many samples.
|
> | Grouping Variable | Categorical metadata of interest. Grouping defines the groups compared by PERMANOVA and ANOSIM. Avoid variables with very few samples per category. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Number of Permutations | - Exploring: `999`
- For more confidence in the p-value, especially near your threshold: `9999`
With `999` permutations the smallest p-value obtainable is `0.001`. |
> | Max Ellipses | Number of groups in your grouping variable (up to about `5`) |
> | Shape Variable | Optional second categorical variable. For example, color by `treatment` and shape by `timepoint` to see whether groups separate only at later timepoints. |
> | Confidence Level | - `0.95` as standard.
- `0.70` for tighter ellipses on crowded plots.
|
## Parameter reference
> [accordion] Grouping Variable
>
> The categorical metadata column that defines the groups you want to compare. It plays two roles at once: it sets the **color** of the points in the ordination plot (one color per category), and it defines the groups that the **PERMANOVA / ANOSIM** tests use to ask whether community composition actually differs between them. Choose the variable that encodes your biological question, the factor you expect to separate the microbial communities (for example, case versus control, or body site).
>
> * **Options** · Categorical variables from the metadata table associated with the query used to create the analysis
> * **Default** · `None`: no grouping is applied, all samples share one color and the plot shows their overall spread without group comparisons. Choose a grouping variable to color samples by metadata and compare groups.
> * **Suggested** · A categorical variable relevant to your study design, such as `treatment`, `disease status`, `condition`, `body site`, `cohort`, or `time point`. Avoid variables with too many categories or categories represented by very few samples, these clutter the plot and reduce the reliability of statistical testing.
> [accordion] Beta-diversity metric
>
> The rule used to turn any two microbial profiles into a single **distance**, a number summarizing how different two samples are. Computing it for every pair of samples produces the **distance matrix** that everything downstream is built on: the ordination plot and the PERMANOVA / ANOSIM tests. The choice matters because each metric weighs the data differently: some respond to differences in **abundance**, some only to which features are **present or absent**, and some are designed for **compositional** data (where sequencing measures relative, not absolute, abundances).
>
> * **Options** · 23 metrics
> * **Default** · `Euclidean`
> * **Suggested** · Match the metric to your question and feature type:
>
> | Goal | Feature type | Metric | Why | Note |
> | :- | :- | :- | :- | :- |
> | Differ in overall composition based on abundance? | Relative abundance | **Bray-Curtis** | Popular, intuitive abundance-based distance; a safe default | Sensitive to abundance differences; doesn't address compositionality |
> | Contain different taxa, regardless of abundance? | Presence/absence | **Jaccard** or **Dice** | Focuses on shared versus non-shared features | Ignores abundance, so rare and abundant taxa count equally |
> | Differ as compositional profiles? | Relative abundance / compositional | **Aitchison** | Built for compositional data; compares log-ratios between features | Needs appropriate zero handling before the log-ratio transformation |
> | Are low-abundance features important? | Counts or relative abundance | **Canberra** | Gives more weight to proportional differences in low-abundance features | Sensitive to zeros, noise, and very rare features |
> | Have similar functional profile shapes? | Functional profiles | **Cosine** or **Correlation** | Compares overall profile shape rather than direct abundance | More exploratory; depends heavily on preprocessing and scaling |
> [accordion] Centroid Method
>
> *Available only when the Beta-diversity Metric is* `Aitchison`
>
> * The Aitchison metric first applies a **CLR (centered log-ratio) transformation**: within each sample, every feature's abundance is divided by a single per-sample reference value and then log-transformed, which removes the compositional constraint and makes samples comparable. This parameter chooses which summary statistic is used as that reference value, so it controls how each sample is centered before distances are computed.
> * **Options** · `mean`, `median`
> * **Default** · `mean`
> * **Suggested**
> * `mean`: the geometric mean of abundances (the standard CLR choice). Best when the data is fairly clean and most taxa carry meaningful signal.
> * `median`: more robust to outliers and noisy low-abundance taxa, often useful for sparse microbiome data.
> [accordion] Number of Components
>
> The number of ordination axes shown in the plot. An ordination method compresses the full distance matrix into a handful of axes, ordered by how much sample-to-sample variation each one captures; this sets how many of those leading axes are displayed.
>
> * **Options** · `2` (2D) or `3` (3D)
>
> * **Default** · `2`
>
> * **Suggested**:
> * `2`: a standard 2D scatter plot: easier to read, annotate, and export, and usually enough when the first two components capture most variation.
> * `3`: when the first two components don't capture enough structure, or an extra axis reveals separation hidden in 2D. Shown as a static 3D plot.
> [accordion] Drop samples with missing grouping metadata
>
> Controls what happens to samples that have **no value** for the grouping variable (missing metadata).
>
> * **Default** · `TRUE` (samples with missing values are dropped)
>
> * **Options:**
> * **Enabled**: samples with missing metadata are removed before the analysis runs. The distance matrix, ordination, and tests are computed only on samples with a valid group, keeping comparisons clean.
> * **Disabled**: samples with missing values are kept and assigned to a separate `NaN_group`, appearing as their own group and included in calculations.
>
> * **Suggested** ·
>
> * **Enable** to compare well-defined groups, run PERMANOVA, or produce a clean publication plot (missing values can otherwise distort group centroids, within-group spread, and test results).
>
> * **Disable** when it's useful to see where unlabelled samples fall in the ordination, for example to check whether they cluster with any known group.
> [accordion] Max ellipses
>
> The maximum number of group **confidence ellipses** drawn on the 2D plot. Each ellipse summarizes one group's center and spread in the ordination space, making it easy to see at a glance whether groups overlap or pull apart. Ellipses are drawn only for groups present in the plotted data with an assigned color; if more groups are eligible than this maximum, only the first ones in plotting order get an ellipse.
>
> * **Options** · `0` to `10`
> * **Default** · `0`
> * **Suggested** · With few, well-separated groups (≤5), showing all is fine. For more complex datasets, limiting the number improves readability.
> [accordion] Confidence level
>
> How much of each group its ellipse covers: the percentage of that group's samples expected to fall inside it. Higher values draw wider ellipses; lower values draw tighter ones.
>
> * **Options** · `50` to `99%`
>
> * **Default** · `95%`
>
> > [!WARNING]
> >
> > This parameter only affects the **visualization** of group ellipses. It does not change the beta-diversity calculation, sample positions, or statistical results. Ellipses are visual aids: don't read them as strict statistical boundaries or as proof of group separation.
> [accordion] Number of permutations
>
> The number of random permutations used to calculate significance for **PERMANOVA** or **ANOSIM**. The group labels are shuffled this many times (with the distances held fixed) to build a **null distribution**, the range of group separation you'd expect to see if the labels were random. The separation actually observed is then compared against it to produce the p-value.
>
> * **Options** · `99` to `10000`
>
> * **Default** · `999`
>
> * **Suggested** · Use `999` for standard exploratory analysis. Use `4999` or `9999` when results will be reported formally, or when the p-value is close to the significance threshold. Higher values give more precise p-values but take longer.
>
> > [!NOTE]
> >
> > This parameter affects only the significance testing, it does not change the distances, the ordination, or sample positions.
> [accordion] Shape Variable
>
> An optional categorical metadata column mapped to different point **shapes**, letting you overlay a second factor on top of the color-coded grouping variable. It's purely visual, it doesn't change the distance matrix, the ordination, or the statistics.
>
> **Options** · Metadata variables from the metadata table associated with the query used to create the analysis
>
> **Default** · `None` (all samples share the same shape)
>
> **Suggested** · A categorical variable that adds context, such as `sex`, `cohort`, `sample type`, `time point`, or `body site`. For example, with samples colored by `treatment`, the shape could show which cohort or collection site each came from.
## References
* Anderson, M. (2014). "Permutational Multivariate Analysis of Variance (PERMANOVA)." Wiley StatsRef: Statistics Reference Online. [https://doi.org/10.1002/9781118445112.stat07841](https://doi.org/10.1002/9781118445112.stat07841)
* **Jaccard Index.** Jaccard, P. (1901). "Étude comparative de la distribution florale dans une portion des Alpes et des Jura." Bulletin de la Société vaudoise des sciences naturelles, 37(142), 547-579. Jaccard, P. (1912). "The Distribution of the Flora in the Alpine Zone. 1." New Phytologist, 11(2), 37-50. doi:10.1111/j.1469-8137.1912.tb05611.x
* **Bray-Curtis Dissimilarity.** Bray, J. R. & Curtis, J. T. (1957). "An ordination of the upland forest communities of southern Wisconsin." Ecological Monographs, 27, 325-349.
# Beta diversity Overview
Source: https://docs.cosmosid.com/DAP_docs/beta-diversity-overview
What beta diversity is, why it's useful, and how the analysis turns microbial profiles into distances and ordination plots you can read.
## What is Beta Diversity?
In ecology, beta diversity is classically defined as the ratio between regional and local species diversity.
Put simply, beta diversity captures how much microbial community composition varies across samples or cohorts, for example between gut samples from different people or body sites. It shows how the microbiome shifts across environments or conditions.
Beta-diversity analysis measures this shift using distance metrics. Each metric takes two microbiome feature profiles (for example, the relative abundance profiles of two patient samples) and computes a single value whose magnitude reflects how far apart they are. Applied to every pair of samples in a cohort, the metric produces a matrix holding the distance between all possible pairs of profiles.
In microbiome publications, beta-diversity results are most often presented as ordination plots. An ordination plot takes the matrix of pairwise distances and turns it into a map, where each sample is a point and the spacing between points reflects how different the samples are. Several ordination methods exist, each converting the distance matrix into coordinates in a slightly different way.
Points in an ordination plot can then be annotated with colors and shapes. This makes it easy to see whether a variable, such as treatment, disease status, or body site, is associated with the differences between microbial communities.
> [!NOTE]
>
> What's the difference between alpha and beta diversity?
>
> **Alpha diversity** measures the diversity within a single sample, a quantitative way to describe how rich and varied the microbial community in that sample is. Each sample gets its own value, so you can compare communities the way you would compare any other measurement, for example pH or cell count.
>
> **Beta diversity**, by contrast, measures how different two microbial communities are, offering a way to compare complex microbial profiles. Imagine trying to compare two profiles, each with hundreds of taxa at different abundances, by reading down two columns of numbers. Beta diversity does that comparison for you and returns a single distance for every pair of samples. It calculates this difference using a range of metrics (e.g: Bray-Curtis, Jaccard, Aitchison), and the metric you choose determines which features carry the most weight in the comparison.
## Why is it useful?
Beta-diversity analysis lets you see how different samples are from one another, and once the points are annotated with colors or shapes, whether those differences line up with a variable you are visualizing, such as treatment, disease status, body site, or time point.
For biological discovery, it can separate conditions that look clinically similar but differ in community structure, track how far a community is pushed from baseline after a perturbation such as antibiotics and whether it recovers, judge intervention success such as a recipient community moving closer to its donor after a fecal transplant, or check whether samples from treatment responders and non-responders group apart.
Beta diversity is also useful for quality control: it can flag outlier samples that may signal low sequencing depth or contamination, expose mislabeled samples when known-similar ones fail to group together, and reveal batch effects when samples cluster by sequencing run rather than by biology.
## How does it work?

Beta-diversity analysis moves from your raw data table to a plot in five steps. Each step feeds the next, following the figure from left to right.
**Step 1. Feature table.** The input is a **Data Table**: a grid where each column is a sample (S1, S2, ... Sn) and each row is a feature, such as a taxon or gene (F1, F2, ... Fm). Each cell holds how abundant that feature is in that sample. This table is the numerical profile of every sample in your cohort.
**Step 2. Beta-diversity metric.** A **beta-diversity metric** compares two samples at a time and returns a single number: the **distance** between them. A small value means the two communities are similar, a large value means they are different. For example, in the figure above, the Bray-Curtis metric gives a distance of 0.62 between S1 and S2, and 0.91 between S1 and Sn. Cosmos-Hub 2.0 supports 23 metrics, and your choice decides which features carry the most weight in the comparison (see [how to choose a metric](/beta-diversity-on-the-dap)).
**Step 3. Distance matrix.** The metric is applied to every possible pair of samples, and all of those values are collected into a **distance matrix**. Each cell is the distance between one pair of samples, and the diagonal is 0 because a sample compared to itself has no difference. This matrix holds the full result, but it is hard to read by eye, especially with many samples.
**Step 4. Ordination method.** An **ordination method** takes the distance matrix and converts it into coordinates in 2D or 3D space, placing similar samples close together and different samples far apart. Several methods exist, and Cosmos-Hub 2.0 offers four of them (see the table below).
| Method | What it shows | When to use it | How to read it |
| :- | :- | :- | :- |
| **PCoA** | The main differences in community composition between samples. | The standard starting point for beta-diversity analysis, especially when you want a clear view of whether groups separate. | Closer samples are more similar; samples far apart are more different. The axes indicate how much variation the plot captures. |
| **MDS** | Whether the distances between samples in the plot match the original beta-diversity distances. | When you want another direct view of sample-to-sample differences, or to confirm patterns seen with PCoA. | Similar to PCoA, but samples are placed so plotted distances reflect the original distance matrix as closely as possible. |
| **t-SNE** | Small clusters or subgroups of samples. | When you suspect the dataset contains distinct community types that aren't obvious in PCoA. | Good for exploring clusters, but don't over-interpret the distance between far-apart groups, since it is mainly a visualization tool. |
| **UMAP** | Clusters, gradients, and non-linear patterns in microbial communities. | Larger or more complex datasets where samples may form subgroups or gradual transitions. | Useful for exploration, but confirm apparent clusters with metadata, biological context, and statistical testing. |
**Step 5. Ordination plot.** The final output is an **ordination plot**, where each sample becomes one dot. Dots that sit close together have similar communities, and dots far apart are more different. The axes tell you how much of the variation the plot captures. You can then color or shape the dots by metadata, such as treatment or body site, to see whether a variable is associated with the differences between samples.
To run beta diversity in Cosmos-Hub 2.0, including the plots and tables it produces, how to read them, and the parameters you can tune, see [Beta diversity on Cosmos-Hub 2.0](https://docs.cosmosid.com/DAP_docs/beta-diversity-on-the-dap).
# Build ML Classification and Regression models on Cosmos-Hub 2.0
Source: https://docs.cosmosid.com/DAP_docs/configuring-a-ml-analysis
Build Regression or Classification ML models with Cosmos-Hub 2.0
Machine learning models, whether regression or classification, predict unknown information about a sample from data we can collect and observe about it. The foundation of ML is that variables of interest (e.g. health status, age, treatment efficacy) leave a trace in the known data (e.g. the microbial profile of a stool sample). Building an ML model means using source data to discover whether those patterns are present and, if so, using them to infer the outcome of a *target variable* on new samples. ML models are also a valuable way to identify which features are linked to the outcome variable, which helps generate biological hypotheses and guide further research.
## Choose between ML Regression or Classification
From the module panel, choose either the ML Regression or the ML Classification module, depending on the type of output your model will predict. The question to ask is: "Is the outcome I want to predict categorical or numerical?"
> [card] [ML Regression](/analysis/ml-regression)
>
> Predicts a **numerical value**: *how much?*
>
> For example, a metabolite concentration, an inflammation marker, a clinical score, or the age of a patient.
> [card] [ML Classification](/analysis/ml-classification)
>
> Predicts a **category**: *which group?*
>
> For example, patient vs healthy control, responder vs non-responder, or one of several body sites.
## Choose *what your model should predict*
Select the variable your model should predict through the **Target Variable** parameter in the Analysis section. It lists the metadata columns available for your dataset: categorical for classification, numerical for regression
# Training an ML model
Building a model requires a set of samples for which both parts are available: the **Input data** (microbial, metabolomic, or functional profiles) and the target Variable we want to predict (a label for classification, or a value for regression).
The phase where complete data is used to 'teach' a model what are the data patterns that allow to link input data to make a prediction of a target variable is called **model training**. During model training, the model learns the input-to-output relationship between your data and the output. For this reason, training requires a dataset where, for each sample, both the data used for prediction and the outcome to predict are available (Training dataset).
> [!WARNING]
>
> Model performance is bounded by the data, not only by the algorithm. It depends on whether a real relationship between input and output exists, how strong that relationship is, how many samples are available, and the quality of the input data. Good input data starts before training, at study design, sampling, and sequencing.
## Pre-processing the Data Table
As in any other analysis module on Cosmos-Hub 2.0, the input to the ML model is the Cohort Data Table that was assembled at creation of the Analysis Project through the Query Builder.
[Pre-processing](https://docs.cosmosid.com/DAP_docs/preprocessing-overview) parameters directly affect the microbial features table used for the analyses modules. In ML, particular care is needed when choosing pre-processing parameters, since this will decide many aspects of the input table used for training.
> [!NOTE]
>
> Overfitting, noise, and the imbalance between the number of features and samples strongly affect how well an ML model trains and generalizes, and pre-processing is where you most influence them. Filtering too aggressively removes real low-abundance or condition-specific signal, so reduce features and samples only as far as the noise and overfitting warrant.
Pre-processing impacts mainly on 4 aspects of the Data Table that is used for training and CV-validation: **feature values** of the Data Table , the **number of features**, the **number of samples**, and whether sample profiles are adjusted for sequencing depth through rarefaction. Each parameter acts on them as follows:
| Parameter | Affects | Effect on the training data |
| :- | :- | :- |
| **Analysis Metric** | Feature values | Expresses each feature as raw `counts` or `relative abundance`. Relative abundance rescales every sample to the same total, changing the values so the model compares composition rather than sequencing depth. |
| **Taxonomic Rank** | Number of features | A coarser rank (`genus`) merges related taxa into fewer, less sparse features, lowering overfitting risk at the cost of resolution. |
| **Data Table Preprocessing Method** (`Filter`) | Number of samples, and features | Removes samples below a read-depth cutoff, improving data quality but reducing sample size. It also drops any feature found only in the removed samples. |
| **Data Table Preprocessing Method** (`Rarefaction`) | Sequencing depth, and features | Subsamples all samples to a common depth, removing depth as a signal the model could exploit, at the cost of discarding reads and dropping some low-abundance features. |
| **Feature Relative Abundance Threshold** | Number of features | A higher value counts fewer low-abundance features as detected, reducing noise but risking loss of real low-abundance signal. |
| **Feature Prevalence Threshold** | Number of features | A higher value discards features present in few samples, reducing dimensionality but risking loss of rare, condition-specific signal. |
## Choose the ML algorithm
The ML algorithm is the method the model uses to find the patterns that link the input data to the target. Different algorithms learn different kinds of relationships between microbiome features and the target variable.
Choose it from the **ML Algorithm** parameter dropdown.
| Algorithm | Task | Best for |
| :- | :- | :- |
| `Random Forest` | Regression · Classification | A reliable general-purpose default |
| `Support Vector Machine` | Regression · Classification | Flexible, non-linear relationships |
| `Linear Regression` | Regression | Simplicity and interpretability |
| `Gradient Boosting Regressor` | Regression | Strong performance on complex, non-linear patterns |
| `ElasticNet Regression` | Regression | Interpretability with feature selection (many correlated features) |
| `Logistic Regression` | Classification | Simplicity and interpretability |
| `ElasticNet Logistic Regression` | Classification | Interpretability with feature selection |
| `Gradient Boosting` | Classification | Maximum prediction accuracy |
More flexible algorithms, like Support Vector Machines, can capture more complex patterns but at cost of harder interpretability; simpler ones, like linear and logistic regression, are less powerful but output offer easier to interpret, which makes them ideal to understand which features and how much are associated with the target variable.
> [!TIP]
>
> `Random Forest` is a good default for exploratory work because it handles non-linear patterns and usually works well without extensive tuning. For biological interpretation, it can be useful to compare it with a simpler model such as linear or logistic regression.
## Correct for confounding variables (Covariates)
A confounding variable, or confounder, is a factor associated with both the input and the target, which can create or mask an apparent link between them. The microbiome is shaped by many such factors, including age, sex, BMI, diet, and health conditions. When one of these factors differs systematically between your groups, the model can pick up its effect and mistake it for a microbiome-target relationship. **Covariates** are the factors you adjust for to prevent this: variables you expect to influence the microbiome but that are not the biological signal you want to study.
Use the **Covariates** parameter dropdown in the Analysis section to select the categorical or numerical metadata variables to correct for.
> [!NOTE]
>
> **Confounders in microbiome studies**
>
> For example, if you train a model to predict a disease from the gut microbiome but the patients are older on average than the controls, the model may partly learn age-related shifts in the microbiome and appear to predict the disease when it is in part reading age. Adjusting for age (and other host factors) as covariates or through matching has been shown to markedly reduce spurious microbiome–disease signals.
>
> *Vujkovic-Cvijin I et al. Host variables confound gut microbiota studies of human disease. Nature. 2020;587:448–454.*
Covariate correction is applied to the feature table before the model is trained. For each feature, a linear model estimates the portion of that feature's variation explained by the selected covariates. That portion is subtracted, and the residual values, the variation not explained by the covariates, are used as the model input.
Use covariates when they may influence the microbiome and could otherwise obscure the relationship between microbial features and the target. Correcting for them lets the model focus on the microbial signal related to the target variable you chose rather than these background factors.
This can help reduce the influence of known confounders, but it should be interpreted carefully. Covariate correction only adjusts for the variables you select and for the type of relationship modeled. It does not prove that the remaining microbial signal is causal or fully independent of those covariates.
> [!WARNING]
>
> Do not include variables that may lie on the biological pathway between the microbiome and the target. Adjusting for those variables can remove part of the signal you are trying to study. For example, if the microbiome affects the target by driving inflammation (microbiome to inflammation to outcome), adjusting for an inflammation marker would remove the part of the microbial signal that acts through it.
## Evaluate and optimize the model with Cross-Validation (K-fold)
Training a model raises two problems:
* **Overfitting.** The model may fit patterns specific to the training data, such as batch effects or noise, rather than real biology. It then performs well on the samples it was trained on but poorly on new ones.
* **Hyperparameter selection.** ML algorithms have *hyperparameters*, settings that are not learned from the data and must be chosen.
Cross-validation addresses both. It estimates performance on samples the model did not train on, and provides the held-out performance used to choose hyperparameters, so tuning is not judged on the same data used to fit the model.
**Number of K-folds** controls cross-validation. The dataset is split into `K` parts, called folds. The model is trained on most folds and tested on the held-out fold. This is repeated until each fold has been used as the test set once.
For example, with `5` folds, the model trains on four-fifths of the data and tests on the remaining fifth, repeating this process five times.
For most microbiome datasets, `5` folds is a good default. Use more folds only when the dataset is large enough to support stable splits. For classification, be especially careful when some classes are small: each fold needs enough samples from each class to make the evaluation meaningful.
## Run the model and read the results
Once the parameters are set, click **Apply and Run**. The model will be trained on your data and then display the results of the module described in the next two sections.
The next sections cover how to interpret the output of the **ML Classification** and **ML Regression** modules, evaluate the performances of the ML model and explore which are the microbial features (e.g: taxa, functions) that appear to be behind the biological patterns.
## Recommended parameters
### Pre-processing
> [tab] Kepler - Host-Agnostic Taxonomic Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `Raw` if samples have comparable read depths.
- `Filter` if a few samples have notably lower read depth than the rest of the cohort.
- `Rarefaction` to standardize the whole cohort to a common read depth, using the optimal depth from the [Rarefaction module](/analysis/rarefaction).
Uneven depth can make the model learn sequencing effort rather than biology, so standardize depth across groups before training. |
> | Read Depth | - `default` with `Raw` or `Filter`.
- With `Rarefaction`, use the optimal depth from the [Rarefaction module](/analysis/rarefaction). Samples below it are discarded, so depth trades against sample size.
|
> | Seed | `default` (only when method is `Rarefaction`) |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0.01` to `0.05` Filtering helps removing sparse taxa that mostly add noise and increase overfitting risk. |
> [tab] CHAMP - Human Taxonomic Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `Raw` if samples have comparable read depths.
- `Filter` if a few samples have notably lower read depth than the rest of the cohort.
- `Rarefaction` to standardize the whole cohort to a common read depth, using the optimal depth from the [Rarefaction module](/analysis/rarefaction).
Uneven depth can make the model learn sequencing effort rather than biology, so standardize depth across groups before training. |
> | Read Depth | - `default` with `Raw` or `Filter`.
- With `Rarefaction`, use the optimal depth from the [Rarefaction module](/analysis/rarefaction). Samples below it are discarded, so depth trades against sample size.
|
> | Seed | `default` (only when method is `Rarefaction`) |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0.01` to `0.05` Filtering helps removing sparse taxa that mostly add noise and increase overfitting risk. |
> [tab] Short-read 16S - Taxonomic
>
> | Parameter | Recommended value |
> | :- | :- |
> | Taxonomic Rank | `genus` |
> | Data Table Pre-processing Method | - `Raw` if samples have comparable read depths.
- `Filter` if a few samples have notably lower read depth than the rest of the cohort.
- `Rarefaction` to standardize the whole cohort to a common read depth, using the optimal depth from the [Rarefaction module](/analysis/rarefaction).
Uneven depth can confound model training; standardize depth across groups when testing subtle signals. |
> | Read Depth | - `default` with `Raw` or `Filter`.
- With `Rarefaction`, use the optimal depth from the [Rarefaction module](/analysis/rarefaction). Samples below it are discarded, so depth trades against sample size.
|
> | Seed | `default` (only when method is `Rarefaction`) |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0.01` to `0.05` Filtering helps removing sparse taxa that mostly add noise and increase overfitting risk. |
> [tab] 16S LR Amplicon profiling - Taxonomic
>
> | Parameter | Recommended value |
> | :- | :- |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `Raw` if samples have comparable read depths.
- `Filter` if a few samples have notably lower read depth than the rest of the cohort.
- `Rarefaction` to standardize the whole cohort to a common read depth, using the optimal depth from the [Rarefaction module](/analysis/rarefaction).
Uneven depth can confound model training; long-read runs are usually shallower, so check group depth before choosing `Raw`. |
> | Read Depth | - With `Rarefaction`: `100,000`, or the depth from the [Rarefaction module](/analysis/rarefaction). Samples below it are discarded, so depth trades against sample size.
- With `Filter`: `20,000`, adjusted to remove only the samples with notably lower depth.
|
> | Seed | `default` (only when method is `Rarefaction`) |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0.01` to `0.05` Filtering helps removing sparse taxa that mostly add noise and increase overfitting risk. |
> [tab] Host-Agnostic Functional
>
> | Parameter | Recommended value |
> | :- | :- |
> | Data Table Pre-processing Method | - `Raw` if samples have comparable read depths.
- `Filter` if a few samples have notably lower read depth than the rest of the cohort.
- `Rarefaction` to standardize the whole cohort to a common read depth, using the optimal depth from the [Rarefaction module](/analysis/rarefaction).
Uneven depth can make functional models track sequencing effort rather than biology; standardize depth for fair comparison. |
> | Read Depth | - `default` with `Raw` or `Filter`.
- With `Rarefaction`, use the optimal depth from the [Rarefaction module](/analysis/rarefaction). Samples below it are discarded, so depth trades against sample size.
|
> | Seed | `default` (only when method is `Rarefaction`) |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0.01` to `0.05` Filtering removes very low-prevalence functions that mostly add noise and increase model complexity. |
> [tab] CHAMP Functional (GMM, GBM, KEGG)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Data Table Pre-processing Method | `Raw` |
> | Read Depth | - `default` with `Raw` or `Filter`.
- With `Rarefaction`, use the optimal depth from the [Rarefaction module](/analysis/rarefaction). Samples below it are discarded, so depth trades against sample size.
|
> | Seed | `default` (only when method is `Rarefaction`) |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` GMM, GBM, and KEGG Orthologues and Modules are already aggregated |
> [tab] AMR/VF - Functional
>
> | Parameter | Recommended value |
> | :- | :- |
> | Data Table Pre-processing Method | `Raw` |
> | Read Depth | - `default` with `Raw` or `Filter`.
- With `Rarefaction`, use the optimal depth from the [Rarefaction module](/analysis/rarefaction).
|
> | Seed | `default` (only when method is `Rarefaction`) |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0.01` to `0.05` Filtering removes sparse resistance or virulence genes that mostly add noise and make the model harder to interpret. |
### Model settings
| Parameter | Recommended value |
| :- | :- |
| ML Algorithm | `Random Forest` as a flexible default `Linear regression` for interpretability |
| Target Variable | The variable outcome you want your model to predict. |
| Feature Metric | - `abundance` when the ML model should learn on the feature
- `presence` when ML model should learn on feature presence-absence
|
| Covariates | Known confounders with a plausible linear effect (for example age, BMI, sex) |
| Drop samples with missing target | Enabled |
| Drop samples with missing covariates | Enabled |
| Number of K-folds | `5` (use `10` for large datasets, around 1000 or more samples) |
| Top Features (N) | `10` (increase for broader exploration) |
## Parameter reference
> [accordion] ML Algorithm
>
> The machine-learning algorithm used to predict the target from microbiome features.
>
> **Options** ·
>
> * ML Regression: `Random Forest`, `Linear Regression`, `ElasticNet Regression`, `Gradient Boosting Regressor`, `Support Vector Machine Regressor`
> * ML Classification: `Random Forest`, `Logistic Regression`, `ElasticNet Logistic Regression`, `Gradient Boosting`, `Support Vector Machine`.
>
> **Default** · `Random Forest`
>
> > [!NOTE]
> >
> > Different algorithms capture different relationships: some are easier to interpret, others predict more accurately. `Random Forest` is a strong general-purpose default.
> [accordion] Target Variable
>
> The variable the ML model should predict: the biological or clinical measurement you want to estimate from microbiome data.
>
> **Options** · One metadata column from those attached to the samples in the cohort. The required type (numerical or categorical) depends on the module:
>
> * **ML Regression**: numerical metadata (for example `metabolite_concentration`, `age`, `bmi`).
> * **ML Classification**: categorical metadata, with two or more classes (for example `sex`, `health_status`, `disease_severity`, `sample_source`).
>
> **Default** · `None`
>
> **Suggested** · The variable behind your scientific question, the one you want to predict from the microbiome. For exploration or hypothesis generation, testing how well the microbiome predicts a given target is a good way to find out whether that variable could drive differences in microbiome.
> [accordion] Drop samples with missing target
>
> Whether samples with a missing target value are excluded.
>
> * \*\*Options \*\* `TRUE` or `FALSE`
> * **Default** · `TRUE`
> [accordion] Covariates
>
> Numeric or binary metadata variables to correct for potential confounding before training.
>
> **Options** · Numeric or binary metadata columns from the metadata table associated with the query
>
> **Default** · `None`
>
> **Suggested** · Variables that may confound the relationship with the target and have a plausible linear effect on features (for example age, BMI, sex).
>
> > [!NOTE]
> >
> > Example: If age is associated with both composition and the target, including it as a covariate helps separate microbiome-related signal from age-related effects.
> [accordion] Drop samples with missing covariates
>
> Whether samples with missing covariate values are excluded. Available only when one or more covariates are selected.
>
> **Options** · `TRUE` or `FALSE`
>
> **Default** · `TRUE`
>
> **Suggested** · `TRUE` when covariate values are required for Covariates adjustment.
> [accordion] Top Features (N)
>
> The number of top-ranked features shown from the best-performing model: the taxa or functions that contributed most to predicting the target.
>
> **Options** · Integer from `1` to `30`
>
> **Default** · `10`
> [accordion] Feature Metric
>
> Whether the model uses features as relative abundance or presence/absence. This defines the biological signal the model learns from.
>
> **Options** · `abundance`, `presence`
>
> **Default** · `abundance`
> [accordion] Number of K-folds
>
> The number of folds in stratified k-fold cross-validation. The data is split into this many parts (each preserving the target's class distribution), and each is used once as the test set.
>
> * **Options**: Integer from `2` to `20`
> * **Default**: `5`
# Exporting Data from Cosmos-Hub Pipelines
Source: https://docs.cosmosid.com/DAP_docs/export-from-cosmos-hub-pipelines
This guide walks you through exporting profiled samples from Cosmos-Hub Pipelines and importing them into a Cosmos-Hub 2.0 workspace
> [!NOTE]
>
> Cosmos-Hub Pipelines remains the sample profiling engine of the Cosmos-Hub ecosystem. For a refresher on how to upload and profile FASTQ files for your samples, please visit [Uploading Sequencing Data](https://docs.cosmosid.com/docs/sample-upload) and [Running Data Workflows](https://docs.cosmosid.com/docs/workflows)
>
> Profiles previously generated on Cosmos-Hub Pipelines can be imported into your Cosmos-Hub 2.0 workspaces.
## Before starting
Before starting the import, you will need to:
* Create or ensure there is a destination workspace in Cosmos-Hub 2.0 to receive the data.
* Have a folder of samples already profiled on Cosmos-Hub Pipelines.
* Have access to both Cosmos-Hub Pipelines and Cosmos-Hub 2.0 with the same account.
## Import sample profiles from Cosmos-Hub Pipelines
**1. Navigate to the folder with profiles to be exported to Cosmos-Hub 2.0**
1. Once logged on [Cosmos-Hub Pipelines](https://app.cosmosid.com/), navigate to the **Sample View** menu and open the folder with your profiled samples.
2. Set **Rows per page** to the maximum (10,000) and select all samples.
3. Click on '**Export to Cosmos-Hub 2.0**'

**2. Export selected samples to the target Cosmos-Hub 2.0 workspace**
The Export Dialog shows the list of samples selected for export and which workflows will be included.\\
1. Enter a name in the **Define the CA Name** field. Depending on the number and workflows of profiles, the export might take a while to complete. You can track progress on the [Comparative Analysis](https://app.cosmosid.com/comparative) page under the name you entered.\\
2. Select the Target Workspace from the dropdown list. Export of profiles is available only for workspaces that you have write access to.

3. Click on Export to Cosmos-Hub 2.0.
**3. Check successful import of your profiles**
When the export job's status changes to Success, the profiles will be available in the target Cosmos-Hub 2.0 workspace and ready for cohort building and analysis.
## Next step
> [card] [Create a Cohort with the Query Builder](/query-builder)
>
> Use the Query Builder to select the samples for your first analysis.
# Overview
Source: https://docs.cosmosid.com/DAP_docs/heatmap-overview
What a microbiome heatmap shows and the patterns it helps you spot across your whole dataset at a glance.
## What is a heatmap?
A heatmap visualizes the abundance of microbial features, whether taxa or functional features like genes and pathways, across many samples at once. Each **row** is a feature, each **column** is a sample, and each **cell** is color-coded to show how abundant that feature is in that sample. Annotation bars can layer metadata on top for extra context.

Together these elements let you see whether samples share similar microbial profiles, whether specific taxa or functions are enriched in certain groups, and whether features rise and fall together across your cohort.
## Why is it useful?
A heatmap surfaces patterns across your whole dataset at a glance, patterns that are hard to spot in a table of numbers. Use one to:
* **Compare groups:** see whether one group of patients has higher abundance of specific species or functions than another.
* **Spot sample groupings:** reveal whether samples from the same body site, treatment, or condition cluster by their microbial profiles.
* **Find coordinated features:** identify taxa whose abundances move together, hinting at co-occurrence or shared ecological roles.
* **Detect enrichment:** quickly see which features stand out as especially abundant (or absent) in particular samples.
* **Get an overview:** condense hundreds of features across many samples into one interpretable picture.
# Heatmap on Cosmos-Hub 2.0
Source: https://docs.cosmosid.com/DAP_docs/heatmaps
This page covers how the heatmap module works in Cosmos-Hub 2.0: how to read each part of the figure and which parameters customize it. For what a heatmap is and when to use one, see the [Heatmap overview](https://docs.cosmosid.com/DAP_docs/heatmap-overview).
# Module output and customization
* **Annotated Heatmap:** a highly customizable heatmap to inspect patterns microbial feature abundances across your cohort.

Clustered heatmap of microbial species abundance across skin samples. Species are rows and samples are columns, with both clustered by profile similarity. Colour reports relative abundance, from dark for near zero to yellow for the highest values. The annotation bars above the heatmap label each sample by dermotype and body site, so clusters can be read against the metadata.
## **Annotated Heatmap**
### Customize the heatmap cells
The cell is the basic unit of the heatmap. Each cell sits at the intersection of a microbial feature (rows by default) and a sample (columns by default), and its color indicates how abundant that feature is in that sample, with low and high values shown as opposite ends of the color scale.
#### Setting the feature color palette
* Set the color palette for feature abundance using the [Feature Color Palette](#feature-color-palette) dropdown.
> [!TIP]
>
> **Can I display features as columns and samples as rows?** Yes, use the [Heatmap orientation](#heatmap-orientation) parameter to switch whether rows represent features or samples.
#### Transforming abundance values
By default, when working with relative abundances (Analysis metric = `relative_abundance`), the color scale spans the full range (0 to 100%). This is intuitive, but microbiome data usually has a long tail of low-abundance features, where subtle - but informative - compostional patterns between your groups can be overshadowed by the high intensity of the dominant species.
The [Value Scaling](#value-scaling) parameter transforms the values before they're mapped to color. This is useful to 'inflate' low relative abundance values to make it easier to detect differences between low-abundance features:
| Transformation | What it does | When to use it |
| :- | :- | :- |
| `Log2` / `Log10` | Compresses the high end and spreads out the low end, making small differences among low-abundance features visible. | To explore variation among low-abundance features. |
| `CLR` (centered log-ratio) | Accounts for the compositional nature of microbiome data (abundances sum to a fixed total), making cross-feature comparisons more meaningful. | When you need compositionally aware comparisons across features. |
| `Presence/absence` | Reduces each cell to simply "present" or "absent." | When you care whether a feature is there rather than how much. |
### Samples (column) and features (rows) metadata annotations
Annotations are colored bars above the sample columns that overlay metadata onto the heatmap, so you can track sample characteristics alongside the microbial data.
#### Adding Sample (column) annotations
Use the [Sample Annotation](#sample-annotation) parameter to choose which metadata variables to add to the samples. **Categorical** variables (treatment group, body site, disease status) appear as distinct colors, and **numerical** variables (age, pH, BMI) appear as a graduated scale.
The [Drop samples with missing annotation](#drop-samples-with-missing-annotation) option controls whether samples that lack the chosen annotation are removed.
#### Adding Feature (row) annotations
You can also annotate the **features** (rows) to add context about the features themselves, such as taxonomic information or other feature-level attributes. Use the [Feature Annotation](#feature-annotation) parameter to choose which feature-level variables to display, and [Keep features with missing annotation](#keep-features-with-missing-annotation) to decide whether unannotated features are kept.
> [!TIP]
>
> Annotations are especially useful alongside column clustering. If samples cluster by their microbial profiles *and* the annotation bar shows they share a clinical or experimental trait, that is a strong visual cue of a real association.
#### Decide how many features to display
A typical dataset can have hundreds or thousands of features, which makes it difficult to display them all on a single heatmap.
* Limit how many rows appear by setting the [Top features (N)](#top-features-n) parameter. For example, choosing 10 shows the top 10 features from the full matrix, ordered by your ranking method.
* Decide how features are ranked by choosing a criterion with the [Feature Ranking Method](#feature-ranking-method) parameter. This sorts the features and keeps the top N:
| Ranking method | What it selects |
| :- | :- |
| `Mean` | Features with the highest average abundance across all samples. |
| `Prevalence` | Features detected in the largest number of samples. |
| `Variance` | Features that vary most across samples. These are often the most biologically interesting, since they help distinguish groups. |
| `Percentile` | Features ranked by a chosen percentile of their abundance distribution. |
### 3. Hierarchical Clustering: Ordering and clustering of rows and columns
Clustering reorders rows and columns so that similar profiles sit next to each other, which reveals patterns that a fixed order would hide. The heatmap uses **hierarchical clustering**, a method that builds a tree (called a dendrogram) grouping samples or features by similarity.
> [!TIP]
>
> **How does hierarchical clustering work?** It starts with each sample (or feature) on its own, then repeatedly joins the two most similar ones into a group, then joins groups into larger groups, until everything sits in one tree. To decide what "most similar" means, it measures the distance between two profiles using the same metrics as in [beta-diversity analysis](#beta-diversity-overview). The **distance metric** sets how that similarity is measured, and the **linkage** sets how groups are joined step by step.
The [Clustered axis](#clustered-axis) parameter sets whether you cluster columns, rows, both, or neither.
* **Columns (samples)** groups together samples with similar overall profiles. This is useful for seeing whether, for example, treatment and control samples separate. Paired with sample annotations, a cluster that matches a shared trait is a strong cue of a biological pattern.
* **Rows (features)** groups together features with similar abundance patterns across samples. This is useful for spotting co-occurring taxa that may share ecological niches or interactions.
* **Both** reorganizes the heatmap so that co-abundant features align with similar samples, revealing **blocks**, which are sets of features that are characteristically high or low in a particular set of samples. This is often where the most informative patterns emerge, such as a microbial signature specific to a treatment or disease group.
> [!NOTE]
>
> Hierarchical clustering is performed on the top N features.
#### Choosing the distance metric \[Advanced]
Choose how the similarity between pairs of profiles or features should be measured in terms of beta-diversity by selecting [Distance metric](https://docs.cosmosid.com/DAP_docs/beta-diversity-on-the-dap#:~:text=of%20statistical%20testing.-,Beta,-%2Ddiversity%20metric). To see which distance metrics are supported and how to choose, refer to [Beta Diversity on the Cosmos-Hub 2.0](https://docs.cosmosid.com/DAP_docs/beta-diversity-on-the-dap#choose-distance-metric)
#### Choose the linkage method \[Advanced]
Choose [Clustering method (linkage)](https://docs.cosmosid.com/DAP_docs/heatmaps#:~:text=produce%20different%20dendrograms.-,Clustering,-Method), which then sets how clusters are progressively merged into the tree.
In hierarchical clustering, **linkage** defines how the distance *between clusters* is calculated at each step as they are merged into a tree (dendrogram). Different linkage methods use different rules for “cluster–cluster distance,” for example
> [!TIP]
>
> We recommend trying a few combinations of Distance metrics and Linkage methods to find the most interpretable structure for your data.
### 4. Exporting the heatmap
Scroll to the end of the output page and click **Download Tables and Images** to export the heatmap in .svg and .png format, and the data table with the numerical input used to plot it.
## Recommended parameters
### Pre-processing
> [tab] Kepler - Host-Agnostic Taxonomic Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | `Raw` or `Filter` |
> | Read Depth | `default` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
> [tab] CHAMP - Human Taxonomic Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | `Raw` or `Filter` |
> | Read Depth | `default` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
> [tab] 16S SR Amplicon Classification - Taxonomic
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `genus` |
> | Data Table Pre-processing Method | `Raw` or `Filter` |
> | Read Depth | `default` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
> [tab] 16S LR Amplicon profiling - Taxonomic
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | `Raw` or `Filter` |
> | Read Depth | `default` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
> [tab] Host-Agnostic Functional Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Data Table Pre-processing Method | `Raw` |
> | Read Depth | `default` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
> [tab] CHAMP Functional (GMM, GBM, KEGG)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `cellular_abundance` |
> | Data Table Pre-processing Method | `Raw` |
> | Read Depth | `default` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
> [tab] AMR/VF - Functional
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Data Table Pre-processing Method | `Raw` |
> | Read Depth | `default` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
### Heatmap settings
| Parameter | Recommended value |
| :- | :- |
| Top Features (N) | - `10` for a concise plot
- `20` to `30` for exploration
|
| Feature Ranking Method | - `percentile` : balances prevalence and abundance.
- `mean` to highlight highly abundant features
- `prevalence` to select the most common features across samples.
|
| Value Scaling | - `None` for relative abundance
- `log2`/`log10` to reveal patterns for low-abundance features
|
| Feature Color Palette | `viridis` |
| Clustered Axis | `both` |
| Distance Metric | - `euclidean` (general)
- `braycurtis` (abundance)
- `jaccard` (presence/absence)
|
| Clustering Method | `average` |
| Heatmap Orientation | `features_rows` |
| Sample Annotation | Metadata of interest |
| Feature Annotation | A higher taxonomic level (for example `phylum`) for taxonomic heatmaps |
## Parameter reference
> [accordion] Sample Annotation
>
> One or more metadata columns used to annotate samples, shown as colored bars above the heatmap.
>
> **Options** · Columns from the metadata table associated with the query used to create the analysis
>
> **Default** · `None`
>
> **Suggested** · Variables relevant to the biological question, such as `treatment`, `disease status`, `body site`, `cohort`, `time point`, `age group`, or `sex`. Annotations help interpret patterns, but selecting too many makes the figure harder to read.
> [accordion] Drop samples with missing annotation
>
> Whether samples with missing values in the selected sample annotation are kept in the heatmap.
>
> **Options** · `TRUE` or `FALSE`
>
> **Default** · `FALSE` a default group value is assigned to all features with missing values.
>
> **Suggested** · Use `TRUE` when the annotation is essential and unannotated samples should be removed. Use `FALSE` to preserve sample size, or to see where unannotated samples cluster relative to annotated ones.
> [accordion] Feature Annotation
>
> An annotation used to group or label features (rows).
>
> **Options** · Available feature annotations, depending on the type of profiles in the Data Table (currently available only for taxonomic profiles)
>
> **Default** · `None`
>
> **Suggested** · For taxonomic heatmaps, use a higher taxonomic level (`phylum`, `class`, `family`) to annotate lower-level features such as species. .
>
> > [!NOTE]
> >
> > Feature annotations help show whether related features behave similarly, for example annotating species by phylum reveals whether specific taxonomic groups are enriched in certain samples.
> [accordion] Drop Features with missing annotation
>
> Whether features with missing annotation values are kept.
>
> * **Options** · `TRUE` or `FALSE`
>
> * **Default** · `FALSE` a default group value is assigned to all features with missing values.
>
> * **Suggested** · Use `FALSE` for most taxonomic analyses, where annotations are usually complete. Use `TRUE` if missing annotations are expected and you don't want to drop those features.
>
> > [!NOTE]
> >
> > If enabled, unannotated features are kept and assigned to a default missing-value group; if disabled, they are removed from the annotated heatmap.
> [accordion] Feature Ranking Method
>
> The method used to rank features across the whole cohort before the top *N* are selected for display.
>
> * **Options** · `mean`, `prevalence`, `variance`, `percentile`
> * **Default** · `mean`
> * **Suggested** :
> * `percentile` is a balanced option for features that are both abundant and informative.
> * Use `mean` to prioritize highly abundant features
> * `prevalence` for features seen in many samples
> * `variance` for features that vary strongly across samples.
> [accordion] Top Features (N)
>
> The number of top-ranked features to display.
>
> * **Options** · Integer from `1` to `30`
>
> * **Default** · `10`
>
> * **Suggested** · `10` for a concise, readable heatmap; `20` to `30` for a broader exploratory view.
>
> > [!NOTE]
> >
> > More features give more detail but reduce readability, use fewer for presentation, more for exploration.
> [accordion] Feature Color Palette
>
> The color palette used to display feature values.
>
> * **Options** · Palettes configured in the platform
>
> * **Default** · `viridis`
>
> * **Suggested** · Colorblind-friendly continuous palettes such as `viridis` for most heatmaps; alternatives like `inferno` when stronger contrast is needed.
>
> > [!NOTE]
> >
> > The palette only affects display, not the underlying data. Choose one that makes high and low values easy to tell apart.
> [accordion] Value Scaling
>
> Whether values are transformed before plotting.
>
> **Options** · `None`, `linear`, `log2`, `log10`, `asinh`, `clr`, `presence/absence`
>
> **Default** · `None`
>
> **Suggested**:
>
> * `None`: display values as directly as possible, especially for relative abundance.
>
> * `log2` / `log10`: reduce the visual dominance of highly abundant features.
>
> * `asinh`: a log-like transform that handles zero values more easily.
>
> * `clr`: a composition-aware transformation.
>
> * `presence/absence`: reduces each cell to whether a feature is detected, ignoring how much.
>
> > [!NOTE]
> >
> > Scaling strongly affects interpretation. Without it, highly abundant features can dominate the color range; with it, lower-abundance patterns become easier to see.
> [accordion] Heatmap Orientation
>
> Whether features or samples are displayed as rows.
>
> * **Options** · `features_rows`, `samples_rows`
>
> * **Default** · `features_rows`
>
> * **Suggested** · Use `features_rows` as standard. Use `samples_rows` when there are more features than samples, or when it improves readability.
>
> > [!NOTE]
> >
> > Orientation affects only the layout, not the values or clustering results.
> [accordion] Clustered Axis
>
> Which axis is clustered and shown with a dendrogram.
>
> * **Options** · `None`, `rows`, `columns`, `both`
>
> * **Default** · `None`
>
> * **Suggested** · Use `both` to cluster samples and features; `rows` or `columns` to focus on one dimension; `None` to keep the original order.
>
> > [!NOTE]
> >
> > Sample clustering can show whether samples from the same condition have similar profiles; feature clustering can reveal taxa or functions that behave similarly across samples.
> [accordion] Distance Metric
>
> How distances between rows or columns are calculated when clustering is enabled.
>
> **Options** · `braycurtis`, `canberra`, `correlation`, `cosine`, `euclidean`, `jaccard`, and others
>
> **Default** · `euclidean`
>
> > [!NOTE]
> >
> > Different metrics define community similarity differently and can produce different dendrograms.
> [accordion] Clustering Method
>
> How distances are converted into a dendrogram (the linkage method).
>
> * **Options** · `single`, `complete`, `average`, `centroid`, `median`, `ward`, `weighted`
>
> * **Default** · `single`
>
> > [!NOTE]
> >
> > The linkage method affects the dendrogram shape and the row/column order, but not the underlying values.
# Impact of Pre-Processing on Analyses
Source: https://docs.cosmosid.com/DAP_docs/impact-of-pre-processing
The same Analysis Module with the same set of parameters can produce widely different results depending on the pre-processing settings. Pre-processing parameters can affect diversity values, distance matrices, clustering patterns, feature importance, and statistical comparisons.
## What to look for when setting pre-processing parameters
Several properties of the Data Table determine how strongly pre-processing affects your results. How much these properties matter depends mainly on the type of sequencing data (long-read or short-read 16S, or WGS), the profile type (taxonomic or functional), and the complexity and variability of the sampled environment (e.g., soil samples tend to be more complex, whereas vaginal samples tend to be less complex):
* **Sparsity:** a feature is sparse across the Data Table when it is not detected in most samples of the cohort. Sparse features are typically taxa or genes with extremely low prevalence in the Data Table.
* **Sequencing depth:** how many reads each sample has, and how much this differs between samples in the cohort. Uneven sequencing depth introduces technical bias into comparisons and can be mistaken for a real biological difference in the variable of interest.
### Sparsity and Sequencing depth variability depending on the Cosmos-Hub Profiling Workflow
| | Suggested Taxonomic Rank (if applicable) | Notes on sparsity depending on profile type | Seq. depth variability per sequencing technology |
| - | - | - | - |
| - [**16S SR Amplicon-sequencing**](https://docs.cosmosid.com/docs/16s-metagenomics-taxonomy)
- [**ITS Amplicon Classification**](https://docs.cosmosid.com/docs/its-amplicon)
| `Genus` | - High sparsity
- Rare and sparse features (OTU, ASVs) might be spurious (PCR, copy-number bias)
| - Often large, driven by PCR amplification bias and primer efficiency
|
| - [Long-read Amplicon Profiling](https://docs.cosmosid.com/docs/emu)
| `Species` | - High sparsity but rare feature calls have higher confidence
- Features in the Data Table depend on the EMU database used for classification
| |
| - [CHAMP Human Microbiome Taxonomic and Functional Profiling](https://docs.cosmosid.com/docs/champ2)
- [KEPLER Host-Agnostic Taxonomic Profiling](https://docs.cosmosid.com/docs/kepler-microbiome-profiler)
- [Host-Agnostic Functional Profiling](https://docs.cosmosid.com/docs/functional-analysis)
- [AMR/VF Profiling](https://docs.cosmosid.com/docs/amr-vf-pipeline)
| `Species` | - High sparsity for CHAMP and KEPLER taxonomic profiles
- Lower sparsity for functional profiles generated from module-based databases (GMM, GBM, MetaCyc)
- Higher sparsity for gene-based profiles (CAZymes, GO, Enzyme Commission, AMR/VF)
| - Moderate, driven by host-DNA content and input biomass
|
### Pre-processing impact on Analysis Module outcomes
| Analysis | Sensitivity | Pre-processing suggestions | Data-type note |
| - | - | - | - |
| **Alpha diversity** | High | - Control for uneven depth when comparing Observed Richness.
- Rarefaction is not needed when comparing Alpha-diversity evenness indexes (Shannon, Simpson) between different groups.
| - Functional profiles are often more stable than taxonomic ones because of functional redudancy across taxa.
- ASV-level 16S richness can be inflated by spurious rare taxa.
|
| **Beta diversity / PCA Explorer** | Medium to High | - Rarefaction is suggested when using Beta diversity metrics that are computed on presence-absence data (e.g: Jaccard)
| - Functional profiles often separate more subtly than taxonomic ones in the ordination plots, reflecting functional redundancy across taxa.
|
| **Heatmap / Stacked Bar Charts** | Low | - Pre-processing not needed.
| |
| **ML Classification & regression** | Medium to High | - Filtering for Prevalence can reduce the risk of ML model learning from noise and sparse features.
| - High-dimensional WGS functional data usually benefits most from filtering and aggregation.
|
| **Univariate comparison** | High | - Filtering for Prevalence reduces the multiple-testing burden arising from sparse features and can improve power.
| - Sparse taxonomic features are usually more affected by pre-processing than broader, module-based functional profiles
|
## References
* Zhou R et al. Data pre-processing for analyzing microbiome data. Brief Bioinform / NIH review. 2023;24(6)
* Busato S et al. Compositionality, sparsity, spurious heterogeneity, and other pitfalls in microbiome machine learning. Patterns. 2022;3(12)
# Importing data into a study
Source: https://docs.cosmosid.com/DAP_docs/importing-data-in-studies
Once a Study has been created, it's necessary to import data into it. This page describes the main routes to import data into studies.
## Before you start
* [Create](/DAP_docs/studies#create-a-new-study) or [join](/DAP_docs/studies#access-a-study) a study already created in a workspace
## How to import data into a Study
Inside the Study Dashboard, click on '**+ Import Data**' to open the Import Dialog


### Import from Hub
> [!NOTE]
>
> Any metadata associated with your samples on Cosmos-Hub Pipelines is imported along with the data tables.

> [tab] Hub Folder Path
>
> > [accordion] Importing samples from a project folder located in Cosmos-Hub Pipelines
> >
> > Select which project folder(s) you want to import the profiles from and click on 'Compare Samples' to start importing
> >
> > 
> [tab] Hub Comparative Analysis (CA)
>
> > [accordion] Importing samples from a cohort associated to a CA from Cosmos-Hub Pipelines
> >
> > If you have a Comparative Analysis (CA) that was created on Cosmos-Hub Pipelines, you can import its data into a study.
> >
> > Choosing a CA imports the source data table along with its associated metadata, the cohort definitions from your original query, and all the workflows associated with that CA.
> >
> > 
> >
> > 1. Select comparative analyses you wish to import the profiles of the underlying cohort
> > 2. Click on 'Import' to start the import.
### Use Existing Workspace Data
Choose this option if the data you need is already available in the workspace.
Selecting **Use Existing Workspace Data** allows to select the [AI Query Builder](https://docs.cosmosid.com/DAP_docs/query-builder) where you choose a data table and filter it down to the samples your analysis needs.
> [!NOTE]
>
> If you create a study in a workspace that has no data yet, you'll be prompted to import some first — see [Import from Hub](#import-from-hub).
## Coming soon
Two more routes for importing data into a study or workspace are under development:
* **Import Custom Data**: create cohorts and run analyses on Data Tables generated outside of the Cosmos-Hub platform..
* **Import from Other Workspaces**: move data from one workspace to another and put it straight to work in a new study, without importing it again.
## Next steps
> [card] [AI Query Builder](https://docs.cosmosid.com/DAP_docs/query-builder)
>
> Shape your imported data into the exact dataset for an analysis.
> [card] [Working with Analysis Modules](/create-an-analysis)
>
> Run analysis modules on the dataset you build.
# Overview
Source: https://docs.cosmosid.com/DAP_docs/machinelearning-overview
How the ML Regression and Classification modules learn from microbiome data to predict a target, and when to use each.
## What is machine learning?
Machine learning builds a model that learns patterns from labelled examples, meaning samples where the outcome is already known, and uses those patterns to predict the outcome for new samples. This is supervised learning, where every training sample carries a known target. It differs from unsupervised methods such as clustering, which group samples by similarity without any predefined outcome.
On Cosmos-Hub 2.0, the inputs for each sample are its microbial **features** (the relative abundance of taxa or functions) together with any **covariates** (additional sample information such as sex, treatment, disease status, or BMI). The outcome the model learns to predict is the **target variable**.
The two modules differ in the **type of target** they predict:
* **ML Regression** predicts a **continuous value**, such as a metabolite concentration, an inflammation marker, or a clinical score.
* **ML Classification** predicts a **category**, such as patient versus healthy control, responder versus non-responder, or one of several body sites.
In short, regression answers *"how much?"* and classification answers *"which group?"*. Aside from the target type, the two modules share most of their workflow and parameters, which is why they are documented together. Once a model predicts accurately, it can also be inspected to rank which features contributed most, a result called **feature importance**.
## Why is it useful?
* **Predict a trait or class from the microbiome.** Build reusable models that estimate the target for unseen samples from their microbial features, for example whether a stool sample comes from a patient or a control, as commonly done in host-phenotype classification studies.
* **Find candidate feature to follow up.** Feature importance produces a data-driven shortlist of the taxa or functions that most drive accurate prediction, a common route to biomarker discovery.
* **Capture effects that linear models miss.** Flexible algorithms such as random forests or gradient boosting can model nonlinear relationships, for example a taxon that matters only above a threshold, or only in combination with another.
This module fits when you have a labelled dataset with a known outcome for each sample and want a model that generalizes to new samples. To simply ask which taxa differ between predefined groups, differential abundance testing is the more direct tool.
## How does it work?
**1. Assemble the input**
Each sample's microbial features in your Cohort's Data Table, your Target Variable that you want to predict, and covariates are assembled into the input Data Table.
**2. Train the model**
The chosen algorithm learns the patterns that relate the features to the Target Variable on part of the data.
**3. Evaluate with cross-validation**
Performance is checked on held-out samples using K-fold cross-validation, providing an estimate of how well the model generalizes to new data.
**4. Read predictions and feature importance**
Results are summarized as accuracy diagnostics plus a ranked list of the features that most influenced the predictions.
# PCA explorer on Cosmos-Hub 2.0
Source: https://docs.cosmosid.com/DAP_docs/pca-explorer
This page covers how the PCA Explorer works in Cosmos-Hub 2.0: the plot it produces, how to read it, the files you can export and the parameters you can tune. For the theory behind PCA, see the [PCA explorer overview](/DAP_docs/pcaexplorer-overview).
# Module output and customisation
* **PCA biplot**: a biplot showing how samples relate to each other, with options for how groups and features are displayed.
* **Exported files**: the plot, the data tables before and after pre-processing, and the numbers behind the plot.
## PCA biplot

PCA biplot. Each point is one sample along PC1 and PC2, with the variance explained shown on each axis. Colour is the Grouping Variable, shape is a second metadata variable, and red vectors are the selected feature loadings.
Each point is one sample, positioned along the first two principal components (PC1 and PC2). The percentage on each axis is how much of the total variation that component explains. A higher percentage means the axis captures a larger share of the differences between samples.
### Sample points and grouping
Each point of the plot represents a single sample of the cohort. By assigning categorical variables of interest (for example sample source, health status or treatment group) to colours and shapes, you can see whether samples from different groups differ in their overall microbial community.
#### Colour by one categorical variable
Choose the main categorical variable of interest with the [Grouping Variable](#grouping-variable) parameter to colour the points by group.
This shows whether samples from different groups (for example sample source, treatment group or sex) occupy different regions of the plot, and lets you judge visually whether their composition differs.
#### Add a second variable with shapes
Overlay a second categorical variable with the [Shape Variable](#shape-variable) parameter.
This is useful when two factors might both influence the data. For example, colouring points by treatment and shaping them by cohort shows whether the separation follows treatment, cohort or both, without a second plot.
#### Handling missing metadata
Samples with missing values in the grouping variable can be excluded with [Drop samples with missing grouping metadata](#drop-samples-with-missing-grouping-metadata).
> [!TIP]
>
> Keeping samples with missing metadata shows where unlabelled samples fall relative to the annotated groups. If an unlabelled sample sits deep inside one group's cluster, check its metadata for a missing or wrong entry. Position on two components is not reliable enough to assign a sample to a group.
### Group ellipses
Ellipses can be drawn around each group's points to summarise where the group sits and how spread out it is.
#### Adding group ellipses
The [Max Ellipses](#max-ellipses) parameter sets how many ellipses are shown. Ellipses make overlap or separation easier to judge than scattered points alone.
#### Setting the ellipse size
The [Confidence Level](#confidence-level) sets how large each ellipse is drawn. A higher value draws a wider ellipse that covers more of the group's samples, a lower value a tighter one. The value changes only how the spread is *drawn*, not the underlying PCA, so treat ellipses as a visual summary of group position and variability rather than as a strict boundary.
Ellipses describe PC1 and PC2 only. Groups that overlap on the plot can still differ along later components, and separated ellipses are not a statistical test. To test whether groups differ in overall composition, use PERMANOVA in [Beta diversity](/DAP_docs/beta-diversity-on-the-dap).
### Loading vectors
Loading vectors show how much each feature of the data table contributes to the principal components. They link the structure in the plot to specific taxa or functions.
They are drawn as arrows from the centre of the plot:
* The direction of an arrow shows towards which side of PC1 and PC2 the feature moves the samples that contain more of it.
* The length of an arrow shows how strongly the feature contributes to PC1 and PC2, compared with the other arrows on the plot.
The arrows are enlarged so they stay visible next to the sample points, and the plot title reports the enlargement factor. Compare arrow lengths with each other, not with the axis values.
In the example above, the arrow for *Prevotella melaninogenica* points upwards into the orange cluster. Samples with more of this species sit higher on PC2, and the length of the arrow shows that it is one of the main contributors to that axis.
The longest arrows usually belong to abundant features whose levels vary a lot between samples. A short arrow does not mean that a feature is biologically unimportant.
> [!WARNING]
>
> An arrow pointing towards a group is a visual hint, not a test. To test whether a feature differs between groups, use [Univariate comparison](/DAP_docs/univariate-comparison).
#### Include loading vectors
Set the [Number of Vectors](#number-of-vectors) parameter to display the top N contributing taxa or functional features.
## Exported files
Click **Export** to download the plot together with the tables behind it. The export contains the files below. In most of the tables the first column is an unnamed row number, which you can ignore.
| File | What it contains | Use it to |
| :- | :- | :- |
| `pca_biplot.png` | The biplot as shown on screen. | Add the figure to a report or presentation. |
| `parameters.txt` | The parameter values used. | Record how the plot was made, or repeat the run with the same settings. |
| `input_metadata.csv` | The sample metadata of the cohort defined in the query, one row per sample. | Check which samples and metadata columns entered the module. |
| `input_features.csv` | The data table before pre-processing. | Compare the original profiles with the filtered table. |
| `transformed_metadata.csv` | The sample metadata after pre-processing (e.g: without the samples dropped for missing grouping values) | Inspect which samples are in the plot. |
| `transformed_features.csv` | The data table the PCA was computed on. | Check which features passed the filters. |
| `pca_data.csv` | The sample coordinates (scores) on every principal component, one row per sample. | Re-plot the samples with your own tools, or plot components other than PC1 and PC2. |
| `loadings.csv` | The contribution of each feature to each component, one row per component and one column per feature. | Find the features that define each axis, beyond the vectors shown on the plot. |
| `explained_variance.csv` | The percentage of total variation explained by each component. The values sum to 100. | Decide how many components are worth interpreting. |
## Recommended parameters
> [tab] Kepler - Host-Agnostic Taxonomic Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `Raw` if samples have comparable read depths
- `Filter` if a few samples have notably lower read depth than the rest of the cohort
- `Rarefaction` to standardise the whole cohort to a common read depth, using the optimal depth from the [Rarefaction module](/DAP_docs/rarefaction)
Uneven depth makes samples separate by sequencing effort, not biology. |
> | Read Depth | - `default` with `Raw` or `Filter`
- With `Rarefaction`, use the optimal depth from the [Rarefaction module](/DAP_docs/rarefaction). Samples below it are discarded, so depth trades against sample size.
|
> | Seed | `default`, only when method is `Rarefaction` |
> | Feature Relative Abundance Threshold | `0.001` |
> | Feature Prevalence Threshold | `0.01` to `0.05` Filtering removes very rare, sparsely detected taxa before computing the PCA, keeping the ordination from being driven by noise. |
> | Grouping Variable | Categorical metadata of interest. Grouping defines how points are coloured and how ellipses are drawn. It is not used for statistical testing in PCA. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Number of Vectors | - `2` to `3` for a readable plot
- Up to `10` to explore more of the features behind the main patterns
|
> | Max Ellipses | Number of groups in your grouping variable (up to about `5`) |
> | Confidence Level | - `95` as standard
- `70` for tighter ellipses on crowded plots
|
> | Shape Variable | Optional second categorical variable. For example, colour by `treatment` and shape by `timepoint` to see whether groups separate only at later timepoints. |
> [tab] CHAMP - Human Taxonomic Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `Raw` if samples have comparable read depths
- `Filter` if a few samples have notably lower read depth than the rest of the cohort
- `Rarefaction` to standardise the whole cohort to a common read depth, using the optimal depth from the [Rarefaction module](/DAP_docs/rarefaction)
Uneven depth makes samples separate by sequencing effort, not biology. |
> | Read Depth | - `default` with `Raw` or `Filter`
- With `Rarefaction`, use the optimal depth from the [Rarefaction module](/DAP_docs/rarefaction). Samples below it are discarded, so depth trades against sample size.
|
> | Seed | `default`, only when method is `Rarefaction` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0.01` to `0.05` Filtering removes very rare, sparsely detected taxa before computing the PCA, keeping the ordination from being driven by noise. |
> | Grouping Variable | Categorical metadata of interest. Grouping defines how points are coloured and how ellipses are drawn. It is not used for statistical testing in PCA. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Number of Vectors | - `2` to `3` for a readable plot
- Up to `10` to explore more of the features behind the main patterns
|
> | Max Ellipses | Number of groups in your grouping variable (up to about `5`) |
> | Confidence Level | - `95` as standard
- `70` for tighter ellipses on crowded plots
|
> | Shape Variable | Optional second categorical variable. For example, colour by `treatment` and shape by `timepoint` to see whether groups separate only at later timepoints. |
> [tab] 16S SR Amplicon Classification - Taxonomic
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `genus` |
> | Data Table Pre-processing Method | - `Raw` if samples have comparable read depths
- `Filter` if a few samples have notably lower read depth than the rest of the cohort
- `Rarefaction` to standardise the whole cohort to a common read depth, using the optimal depth from the [Rarefaction module](/DAP_docs/rarefaction)
Uneven depth makes samples separate by sequencing effort, not biology. |
> | Read Depth | - `default` with `Raw` or `Filter`
- With `Rarefaction`, use the optimal depth from the [Rarefaction module](/DAP_docs/rarefaction). Samples below it are discarded, so depth trades against sample size.
|
> | Seed | `default`, only when method is `Rarefaction` |
> | Feature Relative Abundance Threshold | `0.001` |
> | Feature Prevalence Threshold | `0.01` to `0.05` Filtering removes rare, sparsely detected taxa before computing the PCA, keeping the ordination from being driven by noise. |
> | Grouping Variable | Categorical metadata of interest. Grouping defines how points are coloured and how ellipses are drawn. It is not used for statistical testing in PCA. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Number of Vectors | - `2` to `3` for a readable plot
- Up to `10` to explore more of the features behind the main patterns
|
> | Max Ellipses | Number of groups in your grouping variable (up to about `5`) |
> | Confidence Level | - `95` as standard
- `70` for tighter ellipses on crowded plots
|
> | Shape Variable | Optional second categorical variable. For example, colour by `treatment` and shape by `timepoint` to see whether groups separate only at later timepoints. |
> [tab] 16S LR Amplicon profiling - Taxonomic
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `Raw` if samples have comparable read depths
- `Filter` if a few samples have notably lower read depth than the rest of the cohort
- `Rarefaction` to standardise the whole cohort to a common read depth, using the optimal depth from the [Rarefaction module](/DAP_docs/rarefaction)
Uneven depth makes samples separate by sequencing effort, not biology. Long-read runs are usually shallower, so check sequencing depth variability on your cohort before relying on `Raw`. |
> | Read Depth | - With `Rarefaction`: `100,000`, or the depth from the [Rarefaction module](/DAP_docs/rarefaction). Samples below it are discarded, so depth trades against sample size.
- With `Filter`: `20,000`, adjusted to remove only the samples with notably lower depth.
|
> | Seed | `default`, only when method is `Rarefaction` |
> | Feature Relative Abundance Threshold | `0.001` |
> | Feature Prevalence Threshold | `0.01` to `0.05` Filtering removes very rare, sparsely detected taxa before computing the PCA, keeping the ordination from being driven by noise. |
> | Grouping Variable | Categorical metadata of interest. Grouping defines how points are coloured and how ellipses are drawn. It is not used for statistical testing in PCA. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Number of Vectors | - `2` to `3` for a readable plot
- Up to `10` to explore more of the features behind the main patterns
|
> | Max Ellipses | Number of groups in your grouping variable (up to about `5`) |
> | Confidence Level | - `95` as standard
- `70` for tighter ellipses on crowded plots
|
> | Shape Variable | Optional second categorical variable. For example, colour by `treatment` and shape by `timepoint` to see whether groups separate only at later timepoints. |
> [tab] Host-Agnostic Functional Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Data Table Pre-processing Method | `Raw` |
> | Read Depth | `default` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0.01` to `0.05` Filtering removes very rare, sparsely detected functions before computing the PCA, keeping the ordination from being driven by noise. Functional tables hold many more features than taxonomic ones, so filtering also keeps the calculation manageable. |
> | Grouping Variable | Categorical metadata of interest. Grouping defines how points are coloured and how ellipses are drawn. It is not used for statistical testing in PCA. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Number of Vectors | - `2` to `3` for a readable plot
- Up to `10` to explore more of the features behind the main patterns
|
> | Max Ellipses | Number of groups in your grouping variable (up to about `5`) |
> | Confidence Level | - `95` as standard
- `70` for tighter ellipses on crowded plots
|
> | Shape Variable | Optional second categorical variable. For example, colour by `treatment` and shape by `timepoint` to see whether groups separate only at later timepoints. |
> [tab] CHAMP - Human Functional Profiling (GBM, GMM, KEGG)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `cellular_abundance` |
> | Data Table Pre-processing Method | `Raw` |
> | Read Depth | `default` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0.01` to `0.05` GMM, GBM and KEGG Modules tables are already aggregated into pathways or modules, so they are less sparse than gene-level tables and tolerate lighter filtering. |
> | Grouping Variable | Categorical metadata of interest. Grouping defines how points are coloured and how ellipses are drawn. It is not used for statistical testing in PCA. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Number of Vectors | - `2` to `3` for a readable plot
- Up to `10` to explore more of the features behind the main patterns
|
> | Max Ellipses | Number of groups in your grouping variable (up to about `5`) |
> | Confidence Level | - `95` as standard
- `70` for tighter ellipses on crowded plots
|
> | Shape Variable | Optional second categorical variable. For example, colour by `treatment` and shape by `timepoint` to see whether groups separate only at later timepoints. |
> [tab] AMR/VF - Functional
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Data Table Pre-processing Method | `Raw` |
> | Read Depth | `default` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0.01` to `0.05` Filtering removes very rare, sparsely detected resistance or virulence genes before computing the PCA, keeping the ordination from being driven by noise. |
> | Grouping Variable | Categorical metadata of interest. Grouping defines how points are coloured and how ellipses are drawn. It is not used for statistical testing in PCA. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Number of Vectors | - `2` to `3` for a readable plot
- Up to `10` to explore more of the features behind the main patterns
|
> | Max Ellipses | Number of groups in your grouping variable (up to about `5`) |
> | Confidence Level | - `95` as standard
- `70` for tighter ellipses on crowded plots
|
> | Shape Variable | Optional second categorical variable. For example, colour by `treatment` and shape by `timepoint` to see whether groups separate only at later timepoints. |
## Parameter reference
> [accordion] Grouping Variable
>
> The metadata column used to define sample groups. It colours the points, so you can see whether samples cluster by a biological, experimental or technical category.
>
> **Options** · Categorical variables from the metadata table associated with the query used to create the analysis
>
> **Default** · `None`
>
> **Suggested** · A categorical variable relevant to your study question, such as `treatment`, `disease status`, `condition`, `body site`, `cohort`, `time point` or `sequencing batch`.
>
> > [!NOTE]
> >
> > When no grouping variable is selected, samples are shown without group colours. Use a grouping variable to check whether the main variation is associated with a known sample characteristic. For example, colouring by `treatment` shows whether treated and control samples separate, while colouring by `batch` helps detect technical effects.
> [accordion] Drop samples with missing grouping metadata
>
> Whether samples with missing values in the grouping variable are excluded from the plot.
>
> **Options** · `TRUE` or `FALSE`
>
> **Default** · `TRUE` (samples with missing values are dropped)
>
> **Suggested** · Use `TRUE` when clear group comparisons matter, since it removes samples that cannot be assigned to a group. Use `FALSE` only when keeping all samples matters more for exploratory visualisation.
>
> > [!NOTE]
> >
> > Dropping samples with missing group metadata makes the plot easier to interpret, since every displayed sample belongs to a defined group. If disabled, samples with missing values are assigned to `NaN_group`.
> [accordion] Number of Vectors
>
> The number of loading vectors drawn on the plot. Vectors indicate which taxa or functions contribute most strongly to the displayed components. This parameter does not change the number of axes, which is always two.
>
> **Options** · Integer from `1` to `10`
>
> **Default** · `2`
>
> **Suggested** · Use `2` or `3` for a simple, readable plot. Increase it to inspect more features that may contribute to the main patterns.
>
> > [!NOTE]
> >
> > More vectors give more detail but make the plot harder to read. Use few vectors for presentations and more for exploratory analysis. The full list of feature contributions is in `loadings.csv` in the export.
> [accordion] Max Ellipses
>
> The maximum number of group ellipses shown. Ellipses summarise the position and spread of the groups defined by the grouping variable.
>
> **Options** · Integer from `0` to `10`
>
> **Default** · `0`
>
> **Suggested** · Use `0` to hide ellipses, or `1` to `5` to show them for a small number of groups while keeping the plot readable.
>
> > [!NOTE]
> >
> > If the grouping variable has more groups than the maximum, only some groups get an ellipse. Ellipses do not affect the PCA calculation. For example, grouping by `body site` can show whether stool, oral and skin samples occupy different regions.
> [accordion] Confidence Level
>
> The confidence level used to draw group ellipses, which controls their size.
>
> **Options** · Integer percentage from `50` to `99`
>
> **Default** · `95`
>
> **Suggested** · Use the default for standard visualisation. Lower values draw tighter ellipses, higher values draw wider ones.
>
> > [!WARNING]
> >
> > Ellipses are visual summaries of group position and spread, not strict statistical boundaries, and not proof that exactly 95% of samples fall inside. Overlapping ellipses suggest similar or highly variable profiles. Well-separated ellipses suggest that the grouping variable is associated with one of the main sources of variation shown on PC1 and PC2.
> [accordion] Shape Variable
>
> An optional categorical metadata column shown as different point shapes, so you can display a second characteristic on top of the grouping variable.
>
> **Options** · Categorical variables from the metadata table associated with the query used to create the analysis
>
> **Default** · `None` (all samples share one shape)
>
> **Suggested** · A categorical variable that adds context, such as `sex`, `cohort`, `sample type`, `time point` or `body site`. For example, with points coloured by `treatment`, the shape can show which cohort or collection site each sample came from.
# Overview
Source: https://docs.cosmosid.com/DAP_docs/pcaexplorer-overview
What Principal Component Analysis does, how it condenses many features into a few axes, and why it's useful for microbiome data.
## What is Principal Component Analysis?
Principal Component Analysis (PCA) reduces the many microbial features per sample down to a few principal components (PCs), projecting the data onto fewer dimensions so that the main trends and patterns among samples become visible on a 2D or 3D plot. It finds this structure without any prior knowledge of the groups or variables associated with the samples.
## How does it work?

Here I would put an image similar to what I already have for Overviews of alpha- and beta-diversity
**1. Start from the Data Table**
Each sample is a vector describing the abundances of many features often hundreds or thousands of taxa. Comparing samples across that many dimensions directly is impractical, since only two or three axes can be visualized at once.
**2. Find the strongest pattern of variation (PC1)**
Features rarely vary independently — subsets of taxa tend to co-vary across samples. PCA finds the single combination of features along which samples are most spread out. This becomes the first principal component (**PC1**): the axis reflecting the largest source of variation.
**3. Find the next patterns**
PCA then finds the next strongest pattern, independent of the first, giving **PC2**, and so on. Each further component captures a smaller, distinct portion of the remaining variation.
**4. Reposition the samples**
Each sample receives a coordinate along these new axes (its *score*), which places it in the plot. How much each original feature contributes to an axis is its *loading* — the loadings reveal which taxa define each component.
## Why is it useful?
PCA condenses hundreds or thousands of features of a microbial profile into a few interpretable axes. For example, it can:
* **Reveal sample structure** — show whether samples separate into groups based on overall composition, without testing any feature individually.
* **Identify the features behind that structure** — through the loadings, point to which features contribute most to the separation seen in the plot.
* **Summarize variation compactly** — express the dominant patterns with a few components, each accounting for a known proportion of the total variation.
# Pre-processing Parameters
Source: https://docs.cosmosid.com/DAP_docs/pre-processing-parameters
Each Analysis Module's Parameter panel has a **PREPROC** section for pre-processing parameters. These parameters control how the feature table is transformed, filtered, or aggregated, across both samples and features, before it is used as the module's input.

## Analysis Metric
Controls the metric by which a feature abundances are represented and normalized in the Data Table that will be processed by the Analysis Modules. The Analysis Metrics available in the Cosmos-Hub 2.0 depend on the type of profiles (taxonomic or functional) that were used to build the cohort for the current Analysis Project.
### Analyses metrics in the Cosmos-Hub 2.0:
**Analysis Metrics Available for all Cosmos-Hub Taxonomic Profilers:**
* `counts`: the number of reads assigned to each taxon in each sample.
* `relative_abundance`: he proportion of each sample’s microbial profile represented by that taxon.
In most microbiome analyses, `relative_abundance` is the more intuitive choice because it describes community composition, for example whether a taxon makes up 1%, 10% or 50% of a sample. It also makes samples sequenced at different depths easier to compare, because each sample is rescaled to the same total.
> [!WARNING]
>
> **Relative abundance is compositional**: each taxon’s reads are divided by the sample’s total assigned reads, so values add up to 100% and a change in one taxon shifts the others. It puts samples on a common scale, but estimates from low-depth samples are less reliable. Before comparing samples, check read depth across your cohort and flag or filter out samples with much lower depth than the rest.
Use `counts` only when the analysis method expects raw read counts (e.g. rarefaction curves), or when the number of reads per feature is itself of interest (e.g. checking whether a gene or function is detected at all, regardless of its abundance in the community).
**Analysis metrics available for functional profiles (CHAMP Functional Profiling: KEGG, GMM, GBM; and Host-agnostic Functional Profiling)**
* `cellular_abundance` (CHAMP functional profiles): the summed relative abundance of all species in the community that are able to perform a given function, i.e. the estimated percentage of cells carrying that function. Because a single cell can carry many functions, values across functions are not constrained to add up to 100%. This metric is therefore not compositional and is not suitable for stacked-bar or other composition-based visualisations and measures.
* `relative_abundance` (Host-agnostic functional profiles): the relative abundance of a functional feature, expressed in CPM (counts per million). CPM is compositional: across all features in a sample it adds up to 1,000,000, and 10,000 CPM corresponds to 1%.
## Taxonomic Rank
> [!NOTE]
>
> This pre-processing parameter performs a *Feature aggregation operation* on the input Data Table
Sets the taxonomic level at which features (rows) in the Data Table are aggregated, for example species, genus, family, or phylum. This parameter applies only to taxonomic profiles. Choosing a higher Taxonomic Rank collapses all features that share the same classification at that level into a single row, summing their abundance values.
> [!NOTE]
>
> Collapsing the same Taxonomic Data Table expressed in counts by Genus
>
> > [tab] Taxonomic Rank = Species
> >
> > | Feature | Sample A | Sample B | Sample C |
> > | - | - | - | - |
> > | *Lactobacillus crispatus* | 150 | 200 | 90 |
> > | *Lactobacillus iners* | 80 | 50 | 110 |
> > | *Gardnerella vaginalis* | 50 | 120 | 60 |
> > | *Gardnerella leopoldii* | 20 | 30 | 10 |
> > | *Prevotella bivia* | 40 | 10 | 70 |
>
> > [tab] Taxonomic Rank = Genus
> >
> > | Feature | Sample A | Sample B | Sample C |
> > | - | - | - | - |
> > | *Lactobacillus* | 230 | 250 | 200 |
> > | *Gardnerella* | 70 | 150 | 70 |
> > | *Prevotella* | 40 | 10 | 70 |
## Data Table Pre-processing Method
> [!NOTE]
>
> This pre-processing parameter acts on *Sample filter and Feature filtering* on the input Data Table
The **Data Table Pre-processing method** controls pre-processing at the sample-depth level. It determines whether low-depth samples are filtered and whether retained samples are rarefied to a common read depth. This helps make samples more comparable when sequencing depth differs, particularly for analyses based on feature detection, such as observed richness.
Three strategies are available in the Cosmos-Hub 2.0:
* `Raw`: applies no sample pre-processing. All samples in the Data Table are kept, regardless sample sequencing depth.
* `Filter`: removes samples with a sequencing depth falling below the chosen **Read depth** threshold. Selecting this method reveals the **Read depth** parameter for setting the lower sequencing-depth threshold.
> [!NOTE]
>
> This Data Table Pre-processing Method operates a *Sample filtering* operation on the Data Table.
* `Rarefaction`: randomly subsamples reads from each sample down to the selected Read Depth, so that all samples in the table share the same sequencing depth.
> [!NOTE]
>
> Rarefaction applies three sequential operations to the **Data Table**, after features are grouped at the selected **Taxonomic Rank**:
>
> 1. *Sample filtering*, which discards samples whose total feature counts are below the selected **Read Depth.**
> 2. *Subsampling*, which randomly draws exactly **Read Depth** counts, without replacement, from each remaining sample's untransformed feature counts.
> 3. *Feature filtering*, which removes features with zero counts in every retained sample, such as rare features lost during subsampling or features found only in discarded samples.
> [!WARNING]
>
> Rarefaction and Filtering strategies are currently available for profiles for which Analysis Metric `counts`is available.
> [!TIP]
>
> **Filtering or Rarefaction?**
>
> * Filter out samples when depth is a clear outlier vs. the rest of the batch, falls below what's needed to detect your taxa of interest, or shows a r[arefaction curve](DAP_docs/rarefaction-on-the-dap) that hasn't plateaued.
> * Rarefaction discards reads from remaining samples to equalize depth, which can zero out sparse taxa/genes. Use rarefaction when the Analysis module you are running is depth-sensitive (e.g: Alpha diversity with observed richness or Beta Diversity with a presence-absence distance metric like Jaccard.
#### **Rarefaction Seed** *(available when Data Table Pre-processing Method is set to Rarefaction)*
Data table rarefaction works by *randomly* subsampling reads from each sample down to a common depth. Because the selection is random, running the same analysis twice could pick a slightly different set of reads each time, which means your results (diversity values, which rare features survive, and so on) could slightly vary from run to run on identical data.

> [!NOTE]
>
> This parameter only applies when the **Data Table Pre-processing Method** is set to **Rarefaction**. Ignore it when Data Table Pre-processing Method is set to `Raw` or `Filter`
The rarefaction seed fixes that randomness in place. A seed is just a starting number for the random process: as long as you keep the same seed, the subsampling makes the exact same choices every time, so your results are fully reproducible. Change the seed, and you get a different, but equally valid, random subsample.
In practice:
* **Try a few different seeds** if you want to check how stable your results are. If your conclusions hold across several seeds, they don't depend on one lucky draw; if they change a lot, that's a sign your data is sensitive to subsampling (often because samples are close to the read-depth cutoff).
## Feature Prevalence Threshold
> [!NOTE]
>
> Changing Feature Prevalence Threshold operates a *Feature filtering* operation on the input Data Table
**Feature Prevalence Threshold** filters taxa or functions based on how consistently they are detected across the cohort. A feature is retained only if it is present in at least the specified proportion of samples; features detected in fewer samples are removed from the dataset.

For example, a threshold of **10%** retains features detected in at least 10% of samples. This can reduce sparsity and remove features that are too rare for reliable downstream analysis.
> [!NOTE]
>
> Note: Presence/absence for this threshold is determined by the Feature Relative Abundance Threshold (described next). A feature is considered "present" in a sample only if its relative abundance in that sample meets or exceeds that threshold; otherwise, it is treated as absent for the purpose of calculating prevalence.
## Feature Relative Abundance Threshold
> [!NOTE]
>
> Changing the Feature Relative Abundance Threshold applies a simple *Data Transformation* to the input Data Table.
**Feature Relative Abundance Threshold** defines the minimum relative abundance a feature must reach within a sample for that value to be count as detected. Feature abundance values below the threshold are transformed to 0, treating the feature as absent from that sample's profile in the Data Table.

The Feature Relative Abundance Threshold directly affects the Feature Prevalence Threshold filter, since prevalence is calculated by counting how many samples a feature is detected as present in, and that count depends on the abundance threshold used to define "present."
> [!WARNING]
>
> This threshold works together with **Feature Prevalence Threshold**. Setting this threshold alone it won't remove any features, but will only set feature values in the Data Table to 0.
>
> **To actually remove features, set a nonzero Feature Prevalence Threshold too.**
> [!NOTE]
>
> **When to filter by Feature Prevalence**
>
> Filter by prevalence when you want to remove features detected in very few samples, since these are more likely to reflect sequencing noise, contamination, or index misassignment than real biology. A common default is to require presence in at least \~10% of samples. Avoid filtering too aggressively if your analysis specifically targets rare taxa or genes.
# Parameters reference
> [accordion] Analysis Metric
>
> The unit in which feature abundances are expressed in the input Data Table. Availabe options depend on the type of profile used to build the cohort.
>
> * **Options**: `counts` and `relative_abundance` are available for all types of taxonomic profiles; `cellular_abundance` is available for CHAMP functional profiles (KEGG KO and Modules, GBM, GMM) and Host-agnostic Functional Profiling.
> * **Default** · `counts`
> * **Suggested**
> * `relative_abundance` for most analyses, because it describes community composition and rescales every sample to the same total.
> * `counts` when the analysis method expects read counts, or when you need to filter or rarefy samples by sequencing depth. The **Data Table Preprocessing Method** is available only with `counts`.
> [accordion] Taxonomic Rank
>
> *Available only for taxonomic profiles*
>
> The taxonomic level at which features are aggregated. All features that share the same classification at the selected level are collapsed into one row, and their abundance values are summed.
>
> * **Options** · `species`, `genus`, `family`, `order` , `class`, `phylum`, `kingdom`, `domain`
> * **Default** · `species`
> * **Suggested**
> * `species` when your profiler provides reliable species-level assignments, as is usually the case for shotgun metagenomics.
> * `genus` or a higher rank when species-level assignments are less reliable, for example with short-read 16S data, or when you want a broader view of community composition.
> [accordion] Data Table Preprocessing Method
>
> *Available only when the Analysis Metric is* `counts`
>
> Controls how samples are handled according to their sequencing depth, that is, the total number of reads in each sample.
>
> * **Options** · `Raw`, `Filter`, `Rarefaction`
> * **Default** · `Raw`
> * **Suggested**
> * `Raw` keeps all samples. Use it when sequencing depth is similar across samples, or when the analysis is not sensitive to depth.
> * `Filter` removes samples below the selected **Read Depth**. Use it when a few samples have clearly lower depth than the rest of the cohort.
> * `Rarefaction` removes samples below the selected **Read Depth** and randomly subsamples the remaining samples to that depth. Use it for depth-sensitive analyses, such as alpha diversity with observed richness or beta diversity with Jaccard.
> [accordion] Read Depth
>
> *Available only when the Data Table Preprocessing Method is* `Filter` *or* `Rarefaction`
>
> The sequencing depth threshold applied to samples. With `Filter`, samples below this depth are removed. With `Rarefaction`, samples below this depth are removed and all remaining samples are subsampled to exactly this depth.
>
> * **Options** · From the minimum to the maximum sample read depth in the cohort
> * **Default** · The minimum sample read depth in the cohort, so that no sample is removed
> * **Suggested** · Check the [rarefaction curves](DAP_docs/rarefaction-on-the-dap) and choose a depth at which most curves have reached a plateau while most samples are kept. A higher value retains more information per sample but removes more samples.
> [accordion] Rarefaction Seed
>
> *Available only when the Data Table Preprocessing Method is* `Rarefaction`
>
> The starting number of the random subsampling. The same seed always produces the same subsample, so results are reproducible.
>
> * **Options** · `0` to `100`
> * **Default** · `42`
> * **Suggested** · Keep the default for routine analyses. To check whether your results depend on one random draw, run the analysis with a few different seeds and compare the conclusions.
> [accordion] Feature Relative Abundance (%) Threshold
>
> The minimum relative abundance a feature must reach in a sample to be counted as detected. Values below the threshold are set to 0.
>
> * **Options** · `0` to `10%`
>
> * **Default** · `0`
>
> * **Suggested** · Keep `0` to retain every detected feature. Use a small value to treat very low abundance signals, which often reflect sequencing noise, as absent.
>
> > [!WARNING]
> >
> > This threshold sets values to 0 but does not remove features from the Data Table. To remove features, also set a **Feature Prevalence Threshold** above 0.
> [accordion] Feature Prevalence Threshold
>
> The minimum proportion of samples in which a feature must be detected to be kept. Features detected in fewer samples are removed. Detection is defined by the **Feature Relative Abundance (%) Threshold**.
>
> * **Options** · `0` to `100%`
> * **Default** · `0`
> * **Suggested** · A value around `10%` removes features that are too rare for reliable downstream analysis. Use lower values, or `0`, when your question concerns rare taxa or genes.
# Overview
Source: https://docs.cosmosid.com/DAP_docs/preprocessing-overview
Feature table pre-processing is the preliminary step shared by all analysis modules. It defines how the feature table data are prepared before running any analysis module of Cosmos-Hub 2.0. Pre-processing affects:
* Which samples and features are included
* How microbial features are grouped
* How technical factors, such as sequencing depth or low-abundance noise, are handled.
## Why is it useful? Is it necessary?
Microbiome feature tables are often **sparse, noisy, and affected by technical variation**:
* Some features are detected at very low abundance or in very few samples.
* Some samples have much higher or lower sequencing depth than others.
* The reliability of taxonomic or functional assignments depends on the sequencing technology and reference database used.
> [!TIP]
>
> **Not sure if you need it? Check these first.**
>
> * **Sequencing depth:** are some samples much lower than the rest?
> * **Sparsity:** Does my Data Table have a lot of features with zeros?
> * **Rare features:** how many features occur in only a few samples?
Pre-processing is a trade-off:
> [!TIP]
>
> **Done well:** more robust, easier-to-interpret results.
> [!WARNING]
>
> **Done poorly:** loss of real signal or biased results (for example, by removing truly informative rare features or keeping low-depth samples that distort comparisons).
## Pre-processing the microbial feature table
In Cosmos-Hub 2.0, the feature table representing microbial composition in a cohort can be expressed with different metrics:
* **Counts:** the number of (adjusted) sequencing reads mapped to an annotated reference, such as a microbial genome, gene, or functional module.
* **Relative abundances:** the proportion of reads assigned to a feature out of the total reads in the sample, often expressed as a percentage. Relative abundances within a single profile are *compositional*, because they sum to 100%.
* **Presence / absence:** a binary value indicating only whether a feature is considered detected in a sample, without quantifying how much is present. Presence calls typically depend on a minimum relative abundance threshold.
Feature tables have a simple structure:
* **Rows are features** (taxa, genes, or pathways).
* **Columns are samples.**
* **Each cell is a value** (count, relative abundance, or presence/absence).
Data Table pre-processing acts on all three, and it helps to know which operation changes which component of the feature table:
| Operation | Acts on | What it does |
| :- | :- | :- |
| **Sample filtering** | Columns | Drops low-quality or low-depth samples so comparisons focus on reliable data. |
| **Feature filtering** | Rows | Removes low-abundance or low-prevalence features to reduce sparsity and multiple testing. |
| **Feature aggregation** | Rows (merged) | Groups features into broader units (e.g., species → genus) to simplify the table. |
| **Data transformation** | Cell values | Applies a function that recalculates each cell's value without adding or removing rows or columns. |
Each analysis module applies its own requirements on top of these pre-processing settings (for example, rarefaction depth for diversity, or specific transformations for machine learning), but they all start from the same pre-processed feature table.
# Create a cohort with Query Builder
Source: https://docs.cosmosid.com/DAP_docs/query-builder
## What is a cohort?
Building a Cohort outside the Cosmos-Hub typically requires querying metadata spreadsheets, matching that metadata to samples in the Data Table, and a lot of time-consuming data wrangling. On Cosmos-Hub 2.0, an AI agent will help you assembling the Cohort you need for an Analysis Project, without having to compose a single SQL query.
## What is the Query Builder?
The Query Builder (QB) is an AI-based chatbot that interactively guides you through composing complex metadata queries to build the Data Table used as input for your analyses.
Interacting with the QB is a hybrid experience: you can build your Cohort's metadata query either by accepting filter suggestions in the interface, or by describing what you need in natural language, which the QB interprets and translates into a formal query. As the conversation continues, you refine the query further until it captures the specific Cohort you need.
By the end of the conversation, you will have created an Analysis Project with your queried Cohort, ready for analysis in the Analysis Studio.
## Create a Cohort with the Query Builder
**1. Accessing the Query Builder**
The Query Builder can be accessed through three different routes
> [tab] When creating a new Analysis Project
>
> 
>
> Inside the Study Dashboard, click on "+ New Analysis" to open the Query builder and start the creation of a New Analysis Project.
> [tab] Import Workspace data into a Study
>
> 1. Click on "Import Data" to open the Data import dialog
> 2. Select 'Use Existing Workspace Data' to start building a cohort for the current Study
> [tab] Build a cohort from a data table
>
> Typically, the Query builder will first ask *which* type of 'omics profiles (e.g: taxonomic, functional, qPCR, metabolomics) you would like to use as primary source to create a cohort. If you already know which dataset, you can use that dataset as the starting point with the Query Builder by:
>
> 
**2. Select which dataset(s) will form the basis of the cohort**

**3. Add metadata filters using QB suggestions**
The Query Builder will start by proposing metadata filters based on the sample metadata available for the selected dataset(s):
* **Categorical Metadata**: as multiple choice options for each metadata attribute, along with the number of samples in that category, and the percentage of the dataset those samples represent.
* **Numerical Metadata**: as a slider to set the upper and lower limits defining your sample Cohort.

**4. Make requests through natural language**
The QB is a interactive chatbot. You can type any request written in natural language at any point of the conversation. The Query Builder is AI agent built to interpret any written request in natural language and apply the right metadata filters to build the correct query logic.. You can also request information about the dataset or the current cohort. Try few requests, such as:
* **Explore the metadata**: Ask which attributes are available and what values they contain. The Query Builder will report which metadata is available for the current sample selection.

* **Ask to apply multiple filters at once**

**5. Keep track of metadata filters applied so far**
As the conversation with the QB goes on, you can keep track of which filters have been applied so far from the Active Filters panel on the right.

**6. Select which Metadata Columns to keep**

The Query Builder asks which metadata columns to carry into the Analysis Project. These are the metadata fields that will be available in the Analysis Studio for an Analysis Project
> [!TIP]
>
> Not selecting any column will automatically keep all the metadata columns available for the current sample query.
**7. Confirm Creation of the Analysis**
1. Once you're satisfied with the query built so far, you're ready to finalize the Analysis Project. Click 'Looks good - Create the Analysis'.
2. Choose a name and a write a small description (optional) for your Analysis Project.
**8. Choose Analyses Modules**
Choose which Analyses Modules you plan to run on your cohort.

> [!TIP]
>
> If unsure of which ones you will actually need, click on 'Select All'. This will let you use all the modules available on Cosmos-Hub when analyzing your cohort in the Analysis Studio.
**9. Confirm and Create Analysis**
The Query Builder will provide a summary of the query built so far. Click on 'Confirm and Create Analysis' to finalize creation of the Analysis Project.

> [!TIP]
>
> Last minute change of plans? You can adjust your query at any point using the controls at the bottom of the conversation. Continue editing, start over with a new query, or undo the most recently applied filters.
**10. Track the status of the Analysis Project**
#### Jobs
You can check the status of the Analysis Project you just created from the **Jobs** tab in the Study Dashboard. This lets you monitor whether the Analysis Project was created successfully, and if it was not, review the details of the error.

## Downloading metadata for your current cohort
At any point of the conversation, click **Download Metadata** above the Active Filters panel to inspect and export the metadata for the samples currently selected.

### Column coverage
**Column coverage in this cohort** shows, for each metadata column, the percentage of samples in the cohort that have a value for it. **Export stats as CSV** downloads the coverage figures for every column.
### Choosing which columns to download
The **Columns** section controls what goes into the downloaded file. Filter the list with **Suggested columns**, **All columns** or **Chosen**, then tick columns individually, search by name, or select in bulk with **Suggested**, **All** and **None**. Each row shows that column's coverage, and the counter above the list tracks how many are selected. `sample_id` and `sample_name` are always included.
Click **Download** to export the metadata as a CSV with one row per sample and one column per attribute selected.
> [card] [Analysis Project (AP)](https://docs.cosmosid.com/DAP_docs/analysis-project-AP)
>
> Run diversity, differential abundance, ordination and machine learning modules on your cohort.
# Quickstart
Source: https://docs.cosmosid.com/DAP_docs/quickstart
Go from raw omics data to publication-ready figures in your browser, with no code required.
# Steps to get started
## 1. Sign in
Navigate to [https://dap.cosmosid.com/](https://dap.cosmosid.com/) in your browser. You can log in through your Cosmos-Hub email address and password, or through SSO with your corporate or academic email address.

* **Don't have an account?** [Contact us](https://cosmos-hub.com/contact-us) to create one or to request a free trial.
* **Forgot your password?**[ Reset it here](https://app.cosmosid.com/recover-password).
## 2. Set up or join a workspace
A [Workspace](https://docs.cosmosid.com/DAP_docs/workspaces) is a shared environment where your team can organize, manage, and collaborate on microbiome research projects, with all relevant data and bioinformatics tools centralised in one place.

* **Starting fresh?** Create a new workspace by clicking the **+ New Workspace** button in the top-right corner of the Workspaces Dashboard, give it a name and invite team members to collaborate.
* **Invited to collaborate on an existing workspace?** Select any workspace in the Workspaces dashboard that your organization has made available or that has been shared with you.
## 3. Create or join a Study to organize your research project

* **Create a new study** with the **+ New Study** button at the top of the current workspace interface.
* **Join an existing study** by selecting any of the studies available in the current workspace.
## 4. Import 'omics data into a Study
Omics data tables are the starting point of any microbiome analysis. Once a study is created, it's time to import data into it. You can import data from Cosmos-Hub Pipelines or use data already available in the workspace to build a cohort.

> [!NOTE]
>
> **Joined a study that already has data?** Skip to step 5 and start building your Cohort and Analysis Project.
There are two routes to import sample profiles into a study or workspace:
* **Import from Hub:** import any profiles previously generated by the [Cosmos-Hub Bioinformatic Pipelines](https://docs.cosmosid.com/docs/about#cosmos-hub-bioinformatic-pipelines).
* Select **Import from Hub** → **Hub Folder Path** → select the folder containing the profiles you want to import into your Cosmos-Hub 2.0 study.
> [!NOTE]
>
> If you already have some experience with Cosmos-Hub 1.0 (now Cosmos-Hub Pipelines), you can export data directly from Cosmos-Hub Pipelines into a Cosmos-Hub 2.0 workspace. See [Exporting Data from Cosmos-Hub Pipelines](https://docs.cosmosid.com/DAP_docs/export-from-cosmos-hub-pipelines).

* **Use existing workspace data:** if you joined a workspace that already contains data, you are ready to create your first analysis.
To learn more about data import or export, see [Exporting Data from Cosmos-Hub Pipelines](https://docs.cosmosid.com/DAP_docs/export-from-cosmos-hub-pipelines) and [Importing data into a study](DAP_docs/importing-data-in-studies).
## 5. Create your first Analysis Project and build a Cohort with the Query Builder
Assembling that cohort manually across multiple datasets can be one of the most time-consuming parts of a microbiome project. The [**Query Builder**](https://docs.cosmosid.com/DAP_docs/query-builder) is designed to simplify this step by helping you identify and select the samples that match your analysis criteria.
1. Click any study, either one shared with you or the one you created in step 4, to open its dashboard (shown below).

Inside Studies: the Study Dashboard
Meet the **Query Builder (QB)**: an AI-powered assistant that helps you querying your team's workspace data lake to build a cohort through an interactive experience, so you can build the right query for the cohort you need.

Building the Cohort with the Query Builder is a hybrid experience: you can either click on the metadata filters it suggests, or type a request in natural language through the chat bar.
* **Choose your data.** Click one of the suggested datasets available in the workspace (for example, Champ Taxa 1.0).
* **Explore the metadata.** Ask which attributes are available and what values they contain — for example, "which body sites are represented in my cohort?"
* **Filter the samples.** Ask the QB to restrict the cohort by body site, collection country, sequencing depth, or any other attribute — for example, "keep only samples from patients over 30."
* **Select metadata columns.** Choose the columns you will need for the analysis by clicking the suggestions or by typing a request such as "include Subject ID, Bodysite, Treatment group, and collection country as metadata columns."
As your conversation with the QB moves on, keep track of which filters have been applied to your dataset so far in the **Active Filters** panel.

3. When your query is ready:
* Click **Looks good — create the analysis**.
* Select the analysis modules you would like to run on the cohort.
* Click **Confirm and Create Analysis**.

> [!NOTE]
>
> Filters and requests can be made at any point in the conversation with the QB. You can undo filters, apply new ones, or change the metadata columns you selected.
Your analysis then appears in the [Study Dashboard](https://docs.cosmosid.com/DAP_docs/studies), ready to be explored through the Analysis Modules of Cosmos-Hub 2.0.
## 6. Analyze your cohort in the Analysis Studio
1. Navigate to the analysis you created to open its Analysis Dashboard.
2. Click **Open Current Analysis** to open the Analysis Studio for the Analysis Project you just created.

### The Analysis Studio
The Analysis Studio is the no-code analysis toolbox in Cosmos-Hub 2.0. It is designed to help you explore and analyze the cohort defined in an Analysis Project and create publication-ready figures and results.

1. Choose one of the [Analysis Modules](https://docs.cosmosid.com/DAP_docs/analysis-studio#running-analysis-modules) currently supported in Cosmos-Hub 2.0.
2. Customize the analysis by adjusting its parameters in the panel on the right.
3. Click **Run and Apply** to run the analysis and generate publication-ready figures and results.
> [!TIP]
>
> Don't worry about getting it wrong: you can run the analysis as many times as you want.
>
> See [Analysis Modules](https://docs.cosmosid.com/DAP_docs/analysis-studio#running-analysis-modules) for detailed guidance on how to tune the parameters of each module.
## 7. Export and share your analysis
#### Export your analysis
Every analysis in Cosmos-Hub 2.0 produces figures and statistical results that you can either visualize on the platform or export in the format you prefer, for example to add to a slide deck.
* Click **Export** to download all the figures, the parameters used for the analysis, all the input data used to perform it, and any statistical output table generated by the module.
#### Save and share [Snapshots](https://docs.cosmosid.com/DAP_docs/analysis-snapshots) of your Analysis Project
* **Analysis Modules** can be configured in many different ways, often using several parameters. When multiple people are working on the same analysis, saving the parameter configuration makes it easier to keep track of how a specific figure or result was generated.
* To save a Snapshot of your current Analysis Project configuration, click the floppy-disk icon and select **Save**. The snapshot stores the current parameters and output, and is available to other collaborators in the Workspace. They can open it, review the saved configuration, and continue the analysis from that point.
# Rarefaction on Cosmos-Hub 2.0
Source: https://docs.cosmosid.com/DAP_docs/rarefaction
The Rarefaction module produces rarefaction curves that show how Alpha Diversity estimates change as sequencing depth scales.
## Module output and Customization
The Rarefaction Analysis module produces four types of plots:
* [**Alpha diversity vs sequencing depth**](#alpha-diversity-vs-sequencing-depth): scatter plots relating each sample's sequencing depth to its Alpha Diversity value, to visually asses how much diversity estimates is affected by sequencing depth.
* [**Sample retention by read depth**](#sample-retention-by-read-depth): how many samples remain as the read-depth threshold increases, to help choose a depth that balances rigor with sample size.
* [**Alpha diversity rarefaction curves**](#alpha-diversity-rarefaction-curves): mean alpha-diversity assessed at increasing subsampling depths for the whole cohort. Use it to judge whether sequencing depth is sufficient to estimate diversity of your samples.
* [**Grouped alpha diversity rarefaction curves**](#grouped-alpha-diversity-rarefaction-curves): rarefaction curves with alpha-diversity metrics split by a grouping variable. Use it to compare rarefaction patterns across groups.
> [!NOTE]
>
> Rarefaction currently runs on **count-based data tables** and is fully supported for both short-read and long-read 16S taxonomic profiles. Support for shotgun metagenomic (WGS) profiles generated with KEPLER, CHAMP or Host-Agnostic Functional Profiling workflows is planned for the next release.
## Alpha diversity vs sequencing depth

Each point represents one sample, with sequencing depth shown on the x-axis, usually on a log scale, and the selected alpha-diversity metric shown on the y-axis, such as observed richness, Shannon diversity, or Simpson diversity. A fitted trend line is shown to summarize the relationship between sequencing depth and the diversity metric across the samples.
The Alpha diversity vs Sequencing Depth panel shows three scatter plots, one per each alpha-diversity metric currently supported on the Cosmos-Hub 2.0 (Observed Richness, Simpson and Shannon).
Within each scatterplot, the dots represents a single sample of your cohort. Sequencing depth is shown on the x-axis as the total number of reads per sample (displayed in a log10 scale). The y-axis reports different alpha-diversity measures (Observed richness, Shannon and Simpson diversity).
Alpha-diversity can be calculated at different Taxonomic levels. Choose the desired **Taxonomic Rank** from the pre-processing section of the parameters panel to decide at which taxonomic level you want to use as input for alpha-diversity calculation. Selecting a taxonomic rank collapses the counts of all taxa that share the same taxon parent into a single feature. For this reason, alpha-diversity indices calculated on the same dataset are lower at higher taxonomic ranks (such as `phylum`) and higher at lower ranks (such as `species`).
The red fitted line provides shows the overall alpha-diversity change across the range of sequencing depths across the cohort.
> [!TIP]
>
> **What does a plateauing red fitted line mean?** When the overall trend appears to flatten after a certain number of total reads per sample, it might indicates that increasing sequencing depth does not contribute to the detection of additional features, at a certain taxonomic level. More specifically:
>
> * Observed richness: plateauing at certain read depth, means the number of taxa detected is not influenced after that sequencing level. This suggests that the community is not undersampled. Complex environments (e.g: soil microbiome) or high-resolution taxonomic levels (e.g: species, strain, genes) typically require extremely high sequencing depths in order to exhaust detection of new diversity. If observed richness does not plateau, richness estimates may still be strongly affected by sequencing depth. *If observed richness does not plateau, richness estimates may still be strongly affected by sequencing depth. In that case, interpret group comparisons of richness or other downstream analyses based on feature presence-absence carefully and/or perform rarefaction beforehand.*
> * Shannon and Simpsons: plateauing in these two indexes suggests that sequencing depth is enough to estimate community evenness (overall composition). Since evenness-based alpha-diversity indexes keep into account also the abundance proportion at which a taxa appear in the community, it typically stabilise at lower sequencing depths with respect to observed richness.
> [!NOTE]
>
> This is an overview plot. It is computed directly from the current per-sample count table (total reads per sample against alpha-diversity) **before** rarefaction is applied.
### **Why is this plot useful?**
* **Spot unusual samples:**
* Samples that fall far from the overall trend may reflect unusual microbial profiles, technical issues, or sample-specific conditions, for example unexpectedly low or high diversity for a sample's depth, caused by handling, lab processing, contamination, storage, or a true biological shift.
* **Spot uneven sequencing depth:** the position of each dot on the x-axis is its sequencing depth. If most dots cluster in a narrow band and only a few sit at the far left or right, a handful of samples have much lower or higher depth than the rest of the cohort, worth checking before comparing diversity across samples.
## Sample retention by read depth

This plot shows how many samples remain available as the selected read-depth threshold increases. The blue line shows retained samples at each depth, while the dashed red line marks the total number of samples in the dataset. It helps choose a read depth that balances sequencing depth with sample retention.
The Sample retention by read depth plot shows, on the y-axis, *how many samples* would be retained from your cohort if you cut it at different minimum sequencing depths (x-axis). In the example above, setting a minimum rarefaction threshold of 10^6 reads would retain only 40 of the 151 samples, because the rest have fewer reads.
### Setting the span of the x-axis
The **Rarefaction Minimum Depth** and **Rarefaction Maximum Depth** parameters set the range of sequencing depth evaluated along the x-axis. **Rarefaction Steps** sets how many depths within that range are evaluated; more steps give a smoother curve.
### **Why is this plot useful?**
* **Choose an appropriate read-depth threshold** for filtering or rarefaction. As the depth increases, fewer samples have enough reads to be retained. This plot makes the trade-off visible: higher depths may improve robustness but reduce sample size, while lower depths retain more samples but include less deeply sequenced profiles.\
\
Use this trade-off to set the **Data Table Preprocessing Method** in the [PREPROC parameters](/DAP_docs/pre-processing-parameters#data-table-pre-processing-parameters) of other Analysis modules. For a given depth on the x-axis, the curve shows how many samples would be retained if the data were rarefied to that depth, since any sample with fewer reads than the threshold is dropped. A higher threshold keeps more reads per sample but retains fewer samples.
## Alpha Diversity Rarefaction Curves

Lines show the mean for difference Alpha Diversity metrics at each sequencing depth subsampling step. The left-side Y-axis of the plot refer to the Observed Richness, while the right-side Y-axis refers to Diversity indexes like Shannon and Simpsons. Shaded areas represent ± one standard deviation across samples. The plot helps you assess how observed richness, Shannon diversity, and Simpson diversity change as more reads are included.
Each dot is the mean alpha-diversity across samples at one evaluated subsampling depth; the dots are joined into a line, and the shaded band shows ± one standard deviation. A line that flattens means most detectable diversity has been captured, while a line that keeps rising means the estimate still depends on sequencing depth.
**Rarefaction Minimum Depth** and **Rarefaction Maximum Depth** set where the curve starts and ends on the x-axis, and **Rarefaction Steps** sets how many depths are evaluated between them. **Iterations** sets how many times each depth is subsampled before averaging, so more iterations give steadier points and a tighter band, while the **Rarefaction Seed** fixes that subsampling so the result is reproducible. The **Taxonomic Rank** sets what counts as a feature, shifting the height of the whole curve, with finer ranks giving higher values.
### **Why is this plot useful?**
* **Evaluate whether sequencing depth is sufficient** to capture alpha diversity in your cohort. As a curve approaches a plateau, that metric's estimate stabilizes, meaning deeper sequencing would change it little. What this tells you depends on the metric: when **observed richness** plateaus, the depth is enough to detect most of the features present, including rarer ones; when **Shannon** or **Simpson** plateaus, the depth is enough to capture the community's composition, the balance of its dominant members, which these metrics weight most heavily. Because richness is the most depth-sensitive of the three, it usually plateaus last. Curves that keep climbing suggest the estimate still depends on sequencing depth.
> [!TIP]
>
> **Plan sequencing depth for scale-up**
>
> In a pilot study, these curves help you choose a sequencing depth before scaling up. Sequence a few samples deeply, run the rarefaction analysis, and look for the depth at which the curve starts to flatten, which should correspond to where increase sequencing depth reads is not useful to detect new features at a specified taxonomic level.
>
> Sequencing the rest of your samples at around that depth is usually enough to capture the diversity detectable at the chosen taxonomic rank, without spending reads on diminishing returns. Keep in mind that the plateau depends on both the sample type and the taxonomic rank: a depth that saturates at `phylum` may still be too shallow at `species`, so choose the depth based on the rank you plan to analyse.
## Grouped alpha diversity rarefaction curves

Each panel shows one alpha-diversity metric across increasing sequencing depths. Colored lines represent the mean diversity for each group (for example, hiv\_profile), and shaded areas show within-group variability. Curves that flatten suggest the observed diversity is becoming stable; curves that keep changing suggest estimates may still depend on sequencing depth.
This output is the same rarefaction curve as above, but split by sample group instead of pooled across the whole cohort. Each panel is one alpha-diversity metric, and within a panel each line is the mean curve for one group, with the shaded area showing within-group variability. The split is controlled by the **Grouping Variable** parameter: choose a categorical metadata column (for example treatment or body site) to draw one curve per category. The **Drop samples with missing grouping metadata** parameter decides whether samples without a value for that variable are removed or kept as a separate group (displayed as a separate line labelled 'NaN\_group').
### **Why is this plot useful?**
* **Assess group-level rarefaction patterns.** When comparing groups, check whether alpha-diversity differences are consistent across depths. Stable differences are more likely to reflect real community structure, while differences that appear only at low depth may be driven by under-sampling.
* **Verify that the chosen depth for rarefaction doesn't exclude a whole group.** When rarefaction is applied, samples below the chosen threshold are discarded. If every sample in a group (a treatment, time point, or cohort) has low depth, the entire group may be removed from downstream analyses. Before proceeding, confirm a minimum number of samples per group is retained. If a group is at risk, consider lowering the rarefaction depth or investigating why those samples have lower sequencing depth.
## Recommended parameters
> [tab] Kepler - Host-Agnostic Taxonomic Profiling
>
> | Parameter | Recommended value |
> | :- | :- |
> | Taxonomic Rank | `species` |
> | Rarefaction Minimum Depth | `default` ( cohort minimum read depth) |
> | Rarefaction Maximum Depth | `default` ( cohort maximum read depth) |
> | Rarefaction Steps | `10` |
> | Iterations | `5` |
> | Rarefaction seed | `default` |
> | Grouping Variable | Metadata of interest |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> [tab] CHAMP - Human Taxonomic Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Taxonomic Rank | `species` |
> | Rarefaction Minimum Depth | `default` ( cohort minimum read depth) |
> | Rarefaction Maximum Depth | `default` ( cohort maximum read depth) |
> | Rarefaction Steps | `10` |
> | Iterations | `5` |
> | Rarefaction seed | `default` |
> | Grouping Variable | Metadata of interest |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> [tab] 16S SR Amplicon Classification - Taxonomic
>
> | Parameter | Recommended value |
> | :- | :- |
> | Taxonomic Rank | `genus` |
> | Rarefaction Minimum Depth | `default` ( cohort minimum read depth) |
> | Rarefaction Maximum Depth | `default` ( cohort maximum read depth) |
> | Rarefaction Steps | `10` |
> | Iterations | `5` |
> | Rarefaction seed | `default` |
> | Grouping Variable | Metadata of interest |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> [tab] 16S LR Amplicon profiling - Taxonomic
>
> | Parameter | Recommended value |
> | :- | :- |
> | Taxonomic Rank | `species` |
> | Rarefaction Minimum Depth | `default` ( cohort minimum read depth) |
> | Rarefaction Maximum Depth | `default` ( cohort maximum read depth) |
> | Rarefaction Steps | `10` |
> | Iterations | `5` |
> | Rarefaction seed | `default` |
> | Grouping Variable | Metadata of interest |
> | Drop samples with missing metadata values in grouping variable | ✅ |
## Parameters reference
> [accordion] Taxonomic Rank
>
> The taxonomic level at which microbial features are aggregated before running rarefaction.
>
> * **Options** · `kingdom`, `phylum`, `class`, `order`, `family`, `genus`, `species`
> * **Default** · `species`
>
> The selected rank defines what taxon counts as an observed feature in the curve. Lower ranks such as `species` give more detailed richness estimates but are more sensitive to annotation uncertainty and sparse data. Higher ranks such as `phylum` or `family` give broader compositional taxonomic summaries but hide biologically relevant differences.
> [accordion] Rarefaction Minimum Depth
>
> The lowest sequencing depth used as the starting point of the rarefaction curves.
>
> * **Options** · Integer value
>
> * **Default** · Minimum number of reads observed across samples in the dataset
>
> > [!NOTE]
> >
> > **Example** · With a minimum depth of `10,000`, the first point of the curve estimates how many features are observed after subsampling each sample to 10,000 reads.
>
> > [!NOTE]
> >
> > Samples with a read depth below the **Rarefaction Minimum Depth** are excluded before rarefaction runs.
> [accordion] Rarefaction Maximum Depth
>
> The highest sequencing depth used as the endpoint of the rarefaction curves.
>
> * **Options** · Integer value
> * **Default** · Maximum number of reads observed across samples in the dataset
> [accordion] Rarefaction Steps
>
> The number of depth intervals evaluated between the minimum and maximum rarefaction depth.
>
> * **Options** · Integer value
> * **Default** · `10`
> * **Suggested** · 3 to 15, fewer steps for quick exploratory analyses, more for smoother curves
>
> More steps create smoother curves but may increase computation time. When samples have similar depths or the depth range is narrow, fewer steps are usually enough.
>
> > [!NOTE]
> >
> > **Example** · With a minimum depth of `100,000` reads and a maximum of `1,000,000`, setting `10` steps divides the range into 10 evaluated depths.
> [accordion] Iterations
>
> The number of repeated subsampling iterations performed at each rarefaction depth.
>
> * **Options** · Integer value
> * **Default** · `5`
> * **Suggested** · 3 to 10, fewer for faster exploratory analysis, more for more stable curves
>
> Rarefaction involves random subsampling. Repeating it several times at each depth reduces the effect of random variation. More iterations make the curves more stable but increase runtime.
> [accordion] Rarefaction Seed
>
> The random seed used during rarefaction subsampling. Because rarefaction randomly subsamples reads, the seed fixes that randomness: running the same analysis with the same seed and parameters always produces the same result.
>
> * **Options** · Integer value
> * **Default** · `42`
>
> There is no "best" seed. Any value gives an equally valid subsample. What matters is that you **keep track of the seed you used**, so you (or anyone else) can reproduce the same result later. To test how robust your results are, change the seed deliberately and note which values you tried.
> [accordion] Grouping Variable
>
> The metadata column used to group samples in the grouped rarefaction outputs.
>
> * **Options**: Categorical variables from the metadata table associated with the query used to create the analysis
> * **Default** : `None`
> * **Suggested**: A biologically meaningful categorical variable, such as `treatment`, `condition`, `disease status`, `body site`, `cohort`, `time point`, or `ethnicity`
>
> The grouping variable lets you compare rarefaction trends across sample groups, for example whether disease and control samples reach a richness plateau at similar sequencing depths.
> [accordion] Drop samples with missing grouping metadata
>
> Whether samples with missing values in the selected grouping variable are removed from grouped outputs.
>
> **Options** · `TRUE` or `FALSE`
>
> **Default** · `TRUE`
>
> If enabled, samples with missing grouping metadata are removed. If disabled, they are kept and assigned to a default missing-value group. The best choice depends on sample size and whether missing metadata is meaningful for your analysis.
# Rarefaction Overview
Source: https://docs.cosmosid.com/DAP_docs/rarefaction-analysis-overview
## What is Rarefaction?
Rarefaction describes how the number of features that are detected in a sequenced sample, whether distinct taxa, genes, or other units, changes as sequencing depth (i.e the number of sample reads) increases.
A microbial community can comprise of hundreds to thousands of taxa (in complex environments), present at different abundances. If we extend the description of microbial profiles to functional genes, virulence factors or antimicrobial-resistance genes, the full feature space might extend well beyond thousands of features.
In metagenomics, detecting a microbial species or genes encoding for an enzyme or AMR, regardless of the sequencing technology, requires enough reads originating from the corresponding genomic fragment in the sequenced sample. The probability of recovering enough reads to make a confident call on the presence of a feature depends mainly on two factors:
* **Feature abundance in the community**: Read counts scale with the relative amount of the corresponding DNA in the sequenced library, which depends on the abundance of the organism, its genome size and target copy number, and on how the sample was processed before sequencing.
* **Sequencing depth** ( i.e the **total number of reads** ): deeper sequencing samples more DNA fragments from the library and increases the chance of recovering enough reads from low-abundance taxa and genes. The depth required depends on the study goals: broad community profiling can be feasible at lower depth, whereas detecting rare taxa, AMR genes, differentiating between closely related strains requires deeper sequencing.
Rarefaction is a resampling analysis that repeatedly subsamples each sample’s feature-count table to a range of read depths and recalculates alpha diversity at each depth. It helps to asses:
* Whether, and to what extent, diversity estimates depend on sequencing depth
* How many samples would be retained at a chosen minimum read depth
* Whether differences between groups in downstream analyses may be driven by unequal sequencing depth rather than biological variation
## Why would I do rarefaction?
### Separating biology from sequencing depth
> [!NOTE]
>
> Two groups—for example, antibiotic-treated mice and untreated controls—can appear to differ in alpha diversity (diversity within a single sample) simply because one group was sequenced to a greater depth than the other. If the biological factor of interest (treatment) and the technical factor (sequencing depth) happen to push richness in the same direction, their effects are confounded: you cannot tell how much of the observed difference is biological versus technical without first correcting for depth.
Differences in sequencing depth can arise during library preparation, sequencing, and downstream quality-control steps. Library preparation methods and sequencing platforms can introduce systematic technical variation, while high host-DNA content (such as low-biomass microbiomes, e.g: vaginal microbiome) can reduce the number of microbial reads available for microbial profiling after host read filtering..
Rarefaction helps separate biological and technical effects by showing how richness grows as more reads are included. Rarefaction curves let you see whether one group is consistently richer across a range of depths or only appears richer at higher sequencing effort, and, for a given sample type and taxonomic rank, they indicate depths beyond which few new taxa are detected. In complex ecosystems such as soil, some low-abundance taxa stay undetected at any realistic sequencing depth, because sampling never exhausts true sample richness.
In practice, rarefaction curves are often used to choose a single rarefaction depth at which to normalize samples before calculating alpha diversity, beta diversity or performing other downstream analyses.
### Was my sequencing depth enough?
A rarefaction curve that is still rising at your maximum sequencing depth means the sampling has not reached saturation: additional reads would likely reveal more taxa, or genes that remain undetected. This is a sign that your current depth may be insufficient to fully characterize the community, particularly for rare or low-abundance members.
The depth at which a rarefaction curve begins to plateau is a practical, data-driven target for how much sequencing effort is needed to adequately characterize a given sample type. This is especially useful when planning for larger studies: rarefaction curves from a pilot dataset can help you estimate the sequencing depth required per sample before scaling up, balancing the cost of additional sequencing against the marginal gain in detected diversity.
## How does it work?
The input to rarefaction is the feature table that describes the taxonomic or functional composition of your samples: the taxa or genes detected in each sample, given as read counts.
**1. Start from the microbial profile**
The input to rarefaction analysis is the Cohort Data Table built when the Analysis Project was created The Data Table describes each sample by the features detected in it and their abundances.
**2. Subsample to increasing read depths**
Reads are randomly subsampled without replacement to simulate sequencing of the same sample at series of increasing depths. At low sequencing depths, only the most abundant features tend to be observed; rare features appear only as the depth increases.
**3. Count what is detected**
At each sequencing depth step, count how many features are observed at the chosen taxonomic rank, for example ASVs, genera, or species and compute an Alpha diversity metric.
**4. Build the rarefaction curve**
Plot Alpha diversity metrics against sequencing depth to generate a rarefaction curve. A curve that flattens means most detectable features have been captured at that rank; a curve that keeps rising means deeper sequencing would still reveal additional taxa.
# Stacked bar charts on Cosmos-Hub 2.0
Source: https://docs.cosmosid.com/DAP_docs/stacked-bar-charts
This page covers how the stacked bar chart works in Cosmos-Hub 2.0: how to read each part of the figure and which parameter shapes it. For what a stacked bar chart is and when to use one, see the [Stacked bar chart overview](https://docs.cosmosid.com/DAP_docs/stackedbarchart-overview). Because the chart is highly customizable, the output and its controls are described together below.
# Module output and customization
* **Annotated Stacked Bar Chart:** a stacked bar chart to inspect and compare microbial composition across your cohort, one bar per sample or per group. Sample metadata can be highlighted above the bars, and samples can be sorted, faceted, or collapsed by your variables of interest.

Stacked bar chart of phylum-level relative abundances across skin samples, faceted by body site and sorted by dermotype within each facet. Each bar represents one sample, with segments colored by phylum. Low-abundance phyla are grouped under "Others." Color-coded annotation strips above each facet indicate the body site and dermotype of each sample.
## Annotated Stacked Bar Chart
### 1. Set the bar values and scale
> [!NOTE]
>
> All figures on this page show **relative abundance** (each bar scaled to the same height). You can display composition expressed as counts by setting [Y-axis values](#y-axis-values) to `absolute` and Analysis Metric to `counts`
The sample bar is the basic unit of stacked bar charts: one bar per sample, divided into stacked colored segments, where each segment's size is that feature's abundance in the sample (a **feature** being a single taxon or function). A single bar is a snapshot of the sample's whole composition.
The scale of y-axis depends on the selected metric used to express feature abundance. Set the scale with [Y-axis values](#y-axis-values):
* `relative` shows the proportion of every feature within the sample. Sample bars reach the same height. Best for comparing composition across samples.
* **`absolute`** shows feature counts, so bar heights may also reflect differences in sequencing depth or total counts between samples.
### 2. Choose how features to show per each Bar
The colored segments are the microbial features (taxa or functions). A single sample profile can include hundreds of features (thousands or more for functional profiles), which can make it hard to visualize all of them within the same Bar. To facilitate comparison between samples, it is suggested to limit the number of features shown per bar by visualizing the most abundant, prevalent or variable features across the cohort, and group remaining features into an aggregate category (**Others)**.
* Use the [Top features (N)](#top-features-n) parameter to set *how many* features are displayed individually, and [Feature ranking method](#feature-ranking-method) to decide the ranking criteria to sort microbial features to be selected:
| Ranking method | What it prioritizes | When to use it |
| :- | :- | :- |
| `mean` | Highest average abundance across the cohort | Show the dominant taxa or functions. |
| `prevalence` | Detected in the largest fraction of samples | Highlight common features shared across many samples. |
| `variance` | Abundance varies most across samples | Highlight features that may separate groups. |
| `percentile` | Reaches high abundance in a meaningful fraction of samples | Capture features important in specific subgroups, even if not dominant everywhere. |
> [!TIP]
>
> **How `percentile` ranking works.** Each feature is ranked by the 90th percentile of its abundance across samples. This favors features that reach a high abundance in at least part of the cohort, making it a balanced middle ground between `mean`, which favors features that are abundant on average, and `prevalence`, which favors features detected in many samples.
Where the aggregated category sits in the stack and legend is set by [Place "Others" / "Unassigned"](#place-others-unassigned), usually `last`, since these represent less informative features.
### 3. Annotate samples with metadata
The colored strips above the bars display sample metadata chosen.
* Choose which metadata to display through [Sample annotation](#sample-annotation) parameter: **categorical** variables (sex, treatment, disease status, cohort) appear as distinct colors, and **numerical** variables (age, BMI) as a continuous scale. \
* Remove from the plot samples lacking chosen annotation by checking [Drop samples with missing annotation](#drop-samples-with-missing-annotation).
> [!TIP]
>
> **Why annotations matter.** Compositional patterns become meaningful once they can be linked to sample characteristics. With metadata aligned across many samples, a shift that consistently follows a variable like treatment or disease status stands out, suggesting how the variable may shape the community.
### 4. Set the feature colors
The colors of the feature segments are set by the [Feature color palette](#feature-color-palette). Since communities are compared visually by color, a clear, distinguishable palette is what lets real compositional differences stand out rather than blur together among similar shades. This affects appearance only, not the data.
### 5. Arrange and group the samples
How the bars are organized is controlled by [Sample arrangement](#sample-arrangement), with three options:
| Option | What changes visually | When to use it |
| :- | :- | :- |
| `Sort` | Keeps all samples in one chart, ordered by selected metadata. | Inspect all samples together while stratifying by metadata (sex, cohort, disease status). |
| `Facet` | Splits the chart into separate panels by metadata. | Compare groups while still seeing individual sample bars. |
| `Collapse` | Combines samples by group, one bar per group. | A compact summary of overall composition per group. |
Each option unlocks one or two follow-up parameters:
**`Sort`** uses [Sample ordering metadata](#sample-ordering-metadata) to set the order, with [Samples in ascending order](#samples-in-ascending-order) for the direction. This places samples that share a value (same treatment, cohort, or disease status) next to each other. The ordering options come from whatever you selected in [Sample annotation](#sample-annotation).\

Stacked Bar Chart obtained by setting Sample Arrangement to 'sort', and using 'bodysite ' and 'dermotype' as Sample ordering metadata
* **`Facet`** also uses [Sample ordering metadata](#sample-ordering-metadata) to order samples within each panel, and adds [Metadata columns for faceting](#metadata-columns-for-faceting) to choose the variable that splits the panels.

Stacked Bar Chart faceted by Bodysite and sorted by Dermotype
* **`Collapse`** also uses [Sample ordering metadata](#sample-ordering-metadata) to define the groups, and shows one bar per group. Each feature segment is the collapsed (summed) composition of the samples in that group, displayed as relative abundance. This is useful for spotting features that shift on group average, but it hides sample-to-sample variability, so it is best when group-level patterns matter more than individual samples.

Stacked barchart obtained by setting Sample Arrangement to 'collapse' and 'ethnicity' as Sample Ordering Metadata
> [!NOTE]
>
> **Which parameters appear depends on the arrangement.** `Sort`, `Facet`, and `Collapse` all reveal [Sample ordering metadata](#sample-ordering-metadata) (and its direction). `Facet` additionally reveals [Metadata columns for faceting](#metadata-columns-for-faceting). In every case, the metadata available for ordering is whatever you chose in [Sample annotation](#sample-annotation).
### 6. Show or hide sample labels
[Show sample labels](#show-sample-labels) toggles the sample names along the x-axis. Keep them on for small cohorts where identifying individual samples helps, and off for large cohorts where labels would crowd the plot.
> [!WARNING]
>
> Stacked bar charts are descriptive and exploratory. A visible difference in composition should be confirmed with appropriate statistical analysis (differential abundance testing, diversity analysis, or machine-learning models) depending on the question.
## Recommended parameters
### Pre-processing
Select your workflow. These pre-processing values vary by data type; the display settings below are the same regardless of workflow.
> [tab] Kepler - Host-Agnostic Taxonomic Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `Raw` if samples have comparable read depths
- `Filter` if a few samples have notably lower read depth than the rest of the cohort
|
> | Read Depth | `default` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
> [tab] CHAMP - Human Taxonomic Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `Raw` if samples have comparable read depths
- `Filter` if a few samples have notably lower read depth than the rest of the cohort
|
> | Read Depth | `default` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
> [tab] 16S SR Amplicon Classification - Taxonomic
>
> | Parameter | Recommended value |
> | :- | :- |
> | Taxonomic Rank | `genus` |
> | Data Table Pre-processing Method | - `Raw` if samples have comparable read depths
- `Filter` if a few samples have notably lower read depth than the rest of the cohort
|
> | Read Depth | `default` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
> [tab] 16S LR Amplicon profiling - Taxonomic
>
> | Parameter | Recommended value |
> | :- | :- |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `Raw` if samples have comparable read depths
- `Filter` if a few samples have notably lower read depth than the rest of the cohort
|
> | Read Depth | `default` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
> [tab] Host-Agnostic Functional Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Data Table Pre-processing Method | `Raw` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
> [tab] CHAMP Functional (GMM, GBM, KEGG)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Data Table Pre-processing Method | `Raw` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
> [tab] AMR/VF - Functional
>
> | Parameter | Recommended value |
> | :- | :- |
> | Data Table Pre-processing Method | `Raw` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | `0` |
### Stacked Bar Chart settings
| Parameter | Recommended value |
| :- | :- |
| Y-axis Values | `relative` |
| Top Features (N) | `30` |
| Feature Ranking Method | - `percentile` : balances prevalence and abundance.
- `mean` : to highlight highly abundant features
- `prevalence` : select the most common features across samples.
- `variance` : highlight most variable features.
|
| Feature Color Palette | `tab20b` |
| Sample Arrangement | - `none` : quick default overview.
- `sort` : group samples by metadata
- `facet`: re-group the cohort by a metadata variable.
- `collapse` : collapses composition of same group samples into a single bar. Useful to get a compact view of cohort composition.
NOTE: to sort, facet or collapse by one or more metadata fields, specify the variable through the Sample Ordering Metadata parameter |
| Place "Others" / "Unassigned" | `last` |
| Show Sample Labels | ✅ with small cohorts (\< 40 samples) |
| Sample Annotation | Metadata of interest (avoid selecting too many) |
## Parameter reference
> [accordion] Sample Annotation
>
> One or more metadata columns shown as colored strips above the bars, connecting composition patterns to sample metadata.
>
> **Options** · Columns from the metadata table associated with the query used to create the analysis
>
> **Default** · `None`
>
> **Suggested** · Variables relevant to the biological question, such as `treatment`, `disease status`, `body site`, `cohort`, `time point`, `age group`, `sex`, or `sequencing batch`. Avoid selecting too many, or the plot becomes hard to read.
> [accordion] Drop samples with missing annotation
>
> Whether samples with missing values in the selected annotation are removed from the plot.
>
> **Options** · `TRUE` (drop them) or `FALSE` (keep them)
>
> **Default** · `TRUE`
>
> **Suggested** · Leave `TRUE` when the annotation is essential and unannotated samples should not appear. Use `FALSE` to preserve sample size and see where unannotated samples fall.
>
> > [!NOTE]
> >
> > When `TRUE`, samples missing the chosen annotation are removed from the plot. When `FALSE`, they are kept and assigned to a default missing-value group.
> [accordion] Feature Ranking Method
>
> How features are ranked before the top *N* are chosen for display.
>
> **Options** · `mean`, `prevalence`, `variance`, `percentile`
>
> **Default** · `mean`
>
> **Suggested** · `percentile` is balanced, surfacing features that reach high abundance in a meaningful fraction of samples. Use `mean` for dominant features, `prevalence` for widely shared ones, and `variance` for features that change strongly across samples.
>
> > [!NOTE]
> >
> > The ranking method controls which features get their own colors. `percentile` ranks each feature by the 90th percentile of its abundance across samples (zeros included), so sparse features that spike in only a few samples still rank low. Different methods surface different biological patterns.
> [accordion] Top Features (N)
>
> The number of top-ranked features shown with individual colors.
>
> **Options** · Integer from `1` to `30` **Default** · `10`
>
> **Suggested** · `5–20` depending on dataset complexity and readability; `10` is a practical default.
>
> > [!NOTE]
> >
> > Features are first ranked by the chosen method, then the top `N` are displayed individually; the rest are grouped into `Others` / `Unassigned`. For example, `mean` ranking with `N = 10` shows the 10 features with the highest average abundance.
> [accordion] Y-axis Values
>
> Whether the y-axis shows absolute read counts or relative abundance.
>
> **Options** · `absolute`, `relative`
>
> **Default** · `absolute`
>
> **Suggested** · `relative` for most cross-sample comparisons, since it makes bars directly comparable. `absolute` when read-count differences are biologically or technically relevant.
>
> > [!NOTE]
> >
> > Relative abundance is usually easier to interpret; absolute counts vary with sequencing depth, so compare them carefully.
> [accordion] Feature Color Palette
>
> The palette used to color feature segments.
>
> **Options** · Discrete palettes configured in the platform
>
> **Default** · `tab20b`
>
> **Suggested** · A palette that makes features easy to tell apart. Discrete palettes are recommended, since each color represents a different taxon or function.
> [accordion] Show Sample Labels
>
> Whether sample names are displayed along the x-axis.
>
> **Options** · `TRUE` or `FALSE`
>
> **Default** · `TRUE`
>
> **Suggested** · `TRUE` for small cohorts where identifying samples helps; `FALSE` for many samples where labels crowd the plot.
> [accordion] Sample Arrangement
>
> How samples are organized in the chart.
>
> **Options** · `None`, `sort`, `facet`, `collapse`
>
> **Default** · `None` (samples are ordered alphabetically by sample name)
>
> **Suggested** ·
>
> * `None`, no metadata ordering; samples are ordered alphabetically by sample name.
>
> * `sort`, order samples by metadata so similar samples sit together.
>
> * `facet`, split into panels by a categorical variable to compare groups while keeping individual bars.
>
> * `collapse`, summarize into group-level bars for a compact overview.
>
> > [!NOTE]
> >
> > Arrangement changes only how the chart is organized, not the underlying values. It also determines which follow-up parameters appear: `sort`, `facet`, and `collapse` all enable [Sample ordering metadata](#sample-ordering-metadata), and `facet` additionally enables [Metadata columns for faceting](#metadata-columns-for-faceting). Example: to compare taxonomic profiles across cancer subtypes while showing treatment status, facet by subtype and annotate by treatment.
> [accordion] Sample Ordering Metadata
>
> *Available when Sample arrangement is set to `sort`, `facet`, or `collapse`.*
>
> The metadata column(s) used to order samples. The available choices are the variables you selected in [Sample annotation](#sample-annotation).
>
> **Options** · Any metadata chosen in Sample annotation
>
> **Default** · `None`
>
> **Suggested** · A variable that makes the plot easier to read, such as `disease status`, `treatment`, `cohort`, `time point`, `body site`, or `read depth`. Sorting by read depth, for instance, can reveal whether composition tracks sequencing depth.
> [accordion] Samples in Ascending Order
>
> *Available when at least one column is chosen in Sample ordering metadata.*
>
> The direction of sorting for the selected ordering metadata.
>
> **Options** · `TRUE` (ascending) or `FALSE` (descending)
>
> **Default** · `TRUE`
>
> **Suggested** · Whichever direction makes the plot easiest to interpret. Affects visual order only, not feature values or sample inclusion.
> [accordion] Place "Others" / "Unassigned"
>
> Whether the aggregated `Others` / `Unassigned` segment, which combines the abundance of all features outside the top `N`, appears at the top or the bottom of each sample's bar.
>
> **Options** · `first`, `last`
>
> **Default** · `last`
>
> **Suggested** · `last` for most plots, since this segment represents aggregated, less informative features.
>
> > [!NOTE]
> >
> > Features outside the top `N` are grouped into `Others` / `Unassigned` to keep the chart readable; this controls where that group sits in the bar.
> [accordion] Metadata Columns for Faceting
>
> *Available when Sample arrangement is set to `facet`.*
>
> The categorical column used to create panels when the chart is faceted.
>
> **Options** · Categorical columns chosen in [Sample ordering metadata](#sample-ordering-metadata)
>
> **Default** · `None`
>
> **Suggested** · A categorical variable defining the main groups to divide the chart into, such as `disease status`, `treatment`, `cohort`, `body site`, `cancer subtype`, or `time point`.
>
> > [!NOTE]
> >
> > Used only when arrangement is `facet`. Example: faceting by `cancer subtype` creates a panel per subtype, while sample annotations can still show treatment, sex, or cohort.
# Overview
Source: https://docs.cosmosid.com/DAP_docs/stackedbarchart-overview
What a stacked bar chart shows about microbial composition, and the exploratory questions it helps you answer.
## What is a stacked bar chart?
A stacked bar chart visualizes the microbial composition of samples. Each **bar** is one sample (or one group of samples), and each colored **segment** inside the bar is a microbial feature (a taxon or function), sized by how much it contributes to the profile. For example, if a species fills half of a sample's bar, it accounts for roughly 50% of that sample's microbial profile.
## Why is it useful?
Stacked bar charts give a quick, intuitive way to compare taxonomic or functional composition across samples: whether profiles look similar, whether specific taxa dominate certain samples, and whether biological or experimental groups differ. They're especially useful for questions like:
* Do treated and control samples have visibly different taxonomic profiles?
* Are specific taxa enriched in one disease group?
* Do samples from the same body site show similar composition?
* Are there dominant taxa that characterize a subgroup of samples?
* Is a metadata variable associated with a visible shift in composition?
> [!WARNING]
>
> Stacked bar charts are **exploratory**. They reveal visual patterns and generate hypotheses, but they don't test statistical significance on their own. Follow up a visible difference with differential abundance testing, diversity analysis, or a machine-learning model, depending on your question.
# Studies
Source: https://docs.cosmosid.com/DAP_docs/studies
A centralized repository for everything related to a research project: ’omics data, sample metadata, analysis projects, results, and the knowledge generated over time.
## What is a Study?
#### A single research project
A **Study** is a project-level container within a Workspace, representing a single research project carried out by a research unit. The purpose of a Study is to group all the project's omics data, sample metadata, Analysis Projects and output results, along with supplementary files, under a common scientific context.
#### A traceable analytical record of your research
Studies keep analyses connected to the data and cohorts they use, along with the parameters and configurations that produced the research outputs. This makes results easier to understand, trace, and reproduce over time. Anyone joining the project can quickly see what has already been done and continue from the existing work, without being hampered by missing context or undocumented steps.
In the Cosmos-Hub hierarchy, a Study sits inside a [**Workspace**](https://docs.cosmosid.com/DAP_docs/workspaces). Entering a Workspace opens the Studies Dashboard, which lists all the Studies created in that Workspace.

## Accessing a Study
Enter a Study by clicking on its name. Entering a Study opens the [Study Dashboard](#inside-a-study-the-study-dashboard), which gives access to all the assets contained in the Study.
## Create a new Study
1. Inside a Workspace, click on "+ **New Study**" in the top-right corner of the interface to set up study details.
2. Choose a *name for the new study*, set *Study Sharing* permissions \[Feature in active development] and add a Study description to provide context about the study.

3. Once created, the new Study will appear on the Studies Dashboard.
## Searching and filtering the Studies Dashboard

Use the Studies Dashboard search bar and display controls to quickly find and organise studies within a Workspace.
1. **Show Filters**: displays dynamic filters below the column names in the Studies List. Use these filters to search within specific study metadata columns by entering text or numbers.
2. **Manage Columns**: toggle study metadata columns to be displayed from the Studies List.
3. **Full screen**: expands the Studies List to full-screen mode, making it easier to review, filter, and manage large lists of studies.
## Edit properties of existing Studies
Select the study to edit by clicking the checkbox next to its name. Once a study is selected, the row is highlighted and the action buttons become available above the Studies List.

### Renaming a Study
Select a single study and click on **Rename** to change its name.
> [!WARNING]
>
> Study names must be unique within the same Workspace.
### Deleting a Study
Select a single study and click on **Delete**.
> [!CAUTION]
>
> Be careful when deleting a Study: it's permanent and cannot be undone. All associated data, settings, and results will be removed.
### Copying a Study \[*Feature in Active Development*]
Select a single study and click on **Copy** to copy it into another Workspace.
### Adding Tags to Studies \[*Feature in Active Development*]
Select a single study and associate Study Tags for easy searching.
# Univariate comparison on Cosmos-Hub 2.0
Source: https://docs.cosmosid.com/DAP_docs/univariate-comparison
This page covers how univariate comparison works in Cosmos-Hub 2.0: the outputs it produces, how to read them, and the parameters you can tune. For the method behind it, see the Univariate comparison overview.
# Module output and customization
* **Feature-level group comparison boxplot panels:** One panel for each differentially abundant feature, repeated for each abundance test you selected. Within a panel, one boxplot per group shows how that feature's relative abundance is distributed across groups of interest.
* **Differential prevalence table \[1]:** A table reporting which features are differentially *prevalent* (detected in a different proportion of samples) across your groups of interest.
* **Univariate Statistical testing tables \[3]:** Three tables reporting the statistical output for the abundance and prevalence test: the Kruskal-Wallis test per feature (always run), the Dunn's post-hoc pairwise comparisons, and the pairwise differential-abundance results from your selected test.
## Feature-level group comparison boxplot panels

Feature-level group comparison. The distribution of one feature across groups, one dot per sample. Brackets mark significant pairwise comparisons; the title reports the overall group-level test.
The module produces one boxplot panel for each feature (e.g: microbial taxa, gene, function) whose abundance is significantly different between at least one pair of groups.
Within a panel, one boxplot per group summarizes that feature's counts or relative abundance, one dot marks each sample, and brackets connect the group pairs that are significantly different.
#### Define which groups to compare
Univariate comparison finds which microbial features are associated with a categorical variable of interest by testing which features are differentially abundant or prevalent between its groups.
Select one categorical metadata variable using the [Grouping Variable](#grouping-variable) parameter. The values of this variable define the groups that every feature is compared across.
#### Choosing the right statistical test for group comparison
Univariate Comparison module find abundance and prevalence associations to your variable of interest by running statistical tests on *all possible pairwise group combinations*. Depending on this, choose which tests you want to use:
**Differential abundance** compares the relative abundance of each feature between groups. Use the [Differential Abundance test](#differential-abundance-test) dropdown to choose which statistical test is used for testing differential abundances:
* `Mann-Whitney U` for independent groups (e.g: cross-sectional unrelated subjects)
* `Wilcoxon signed-rank` for paired samples (e.g: subjects longitudinally sampled)
* `t-test` when comparing distributions that are approximately normal.
> [!NOTE]
>
> #### **Which test fits my design?**
>
> \
> First ask: *are the same subjects measured in more than one group, or are all subjects different?*
>
> * **Use `Mann–Whitney U` for independent groups.**\
> Example: You compare alpha diversity between 10 treated mice and 10 untreated mice. Each mouse appears in only one group, so values cannot be paired across groups. The groups are independent → `Mann–Whitney U` is appropriate.
> * **Use `Wilcoxon` for paired or matched samples.**\
> Example: You compare alpha diversity in the same 10 mice before and after treatment. Each mouse contributes one “before” and one “after” value, so every value has a natural partner from the same animal. The samples are paired → `Wilcoxon` tests the within-subject change.
**Differential prevalence** compares how often each feature is detected between groups. Choose the contingency test with [Differential Prevalence Test](#differential-prevalence-test):
* `Fisher's exact` the standard, conservative default. Fast and reliable, especially with small samples.
* `Barnard` more powerful than Fisher for two-group comparisons, but computationally heavy and might require more time to run.
* `Boschloo` at least as powerful as Fisher for two-group comparisons. Choose it when sensitivity matters most.
> [!TIP]
>
> **Kruskal-Wallis + Dunn test**
>
> Alongside your chosen test, a **Kruskal-Wallis** test with **Dunn's post-hoc** always runs. Kruskal-Wallis is a non-parametric test that asks whether a feature's distribution differs across all groups at once, and Dunn's post-hoc then identifies which specific group pairs differ. The same logic appears in the [alpha diversity](https://docs.cosmosid.com/DAP_docs/alpha-diversity#a-special-statistical-test-kruskal-wallis-and-dunn’s-test) group comparisons.
#### Choose when a feature association counts as significant
Significance brackets and p-values/q-values of boxplot panels are reported when comparisons are reported as statistically significant. Choose statistical significance threshold (usually 0.05) through [P-value threshold](#p-value-threshold) parameter.
Because many features and group pairs are tested at once, the risk of incurring in associations that are false positives increases significantly. This is why p-values are usually adjusted (Q-value) by weighting on how many hypotheses have been tested. Set the False Discovery Rate threshold to decide when a Q-value should be marked as significant.
* [Diff. Abundance tests FDR threshold](#differential-abundance-tests-fdr-threshold) for the abundance comparisons between more than
* [Diff. Prevalence tests FDR threshold](#differential-prevalence-tests-fdr-threshold) for the prevalence comparisons.
A higher threshold returns more significant results but more false positives; a lower one returns fewer with higher confidence.
> [!NOTE]
>
> Note: a boxplot panel of a feature is displayed only when there's at least a pair of groups where the differentially abundant feature association was found to be **statistically significant**.
>
> Deciding where to set this threshold depends on the goals of the analysis and how confident you need to be. To produce plots also for exploratory purposes and see feature-level group boxplots panels for features that we suggest to increase the FDR threshold
These FDR thresholds are also what select which features are drawn as boxplot panels, and on each panel only pairs that pass the abundance threshold are marked with a significance bracket.
> [!NOTE]
>
> The [P-value threshold](#p-value-threshold) is a fallback, not the main cutoff. When a run has too few tests for multiple-testing correction to be meaningful (for example, only one valid comparison for a test), significance falls back to this raw p-value threshold instead of the FDR one. In a normal multi-taxon run, the two FDR thresholds are what matter.
#### Set how many panels are shown
A real dataset can produce more significant features than are useful to view at once.
* The [Max figures to display](#max-figures-to-display) parameter limits how many boxplots appear on screen per test, showing only the top results. Note that **exporting includes every significant feature's boxplot**, not just those shown on screen.
Samples with no value for the grouping variable are handled by [Drop samples with missing metadata](#drop-samples-with-missing-grouping-metadata).
#### **Why is this plot useful?**
* **Reveals associations between a feature and a clinical or experimental variable.** It tells you whether a taxon's abundance is statistically associated with the grouping variable, which is a starting point for relating that microbe to disease, treatment, or other characteristics.
* **Localizes the association to specific groups.** The pairwise comparisons show *which* groups a feature distinguishes, pinpointing where the association is strongest.
* **Separates statistical significance from biological size.** Showing the full distribution alongside the p-values lets you judge whether a significant association is also a sizeable, consistent shift, rather than a small difference made significant by sample size.
* **Generates focused, testable hypotheses.** Out of thousands of features, it isolates one feature and a specific set of group differences as candidate markers for follow-up.
## Univariate Statistical Testing tables
> [tab] Contingency Tests
>
> Prevalence testing asks whether a feature is *detected* in a different proportion of samples across groups, rather than whether its amount differs. For each feature, the number of samples where it is present and absent is tabulated per group, and the contingency test you selected in [Differential Prevalence Test](#differential-prevalence-test) evaluates whether detection frequency differs more than chance would explain. The results are FDR-corrected using the [Diff. Prevalence tests FDR threshold](#differential-prevalence-tests-fdr-threshold).
>
> | Column | Description |
> | :- | :- |
> | `variable` | Metadata column used as the grouping variable |
> | `taxa` | The feature being tested |
> | `group1` | First group in the comparison |
> | `group2` | Second group in the comparison |
> | `present_group1` | Samples in `group1` where the feature is detected |
> | `not_present_group1` | Samples in `group1` where the feature is not detected |
> | `present_group2` | Samples in `group2` where the feature is detected |
> | `not_present_group2` | Samples in `group2` where the feature is not detected |
> | `_pvalue` | Unadjusted p-value from the selected test on the 2×2 table |
> | `_fdr` | Benjamini–Hochberg adjusted p-value |
> | `_significant` | `1` if if the FDR for the tested feature is below the selected Diff. Abundance FDR Threshold, `0`otherwise. |
> | `combined_fdr` | Adjusted p-value used for reporting significance |
> [tab] Kruskal–Wallis
>
> Kruskal–Wallis result for each feature, testing whether its abundance differs across the levels of the grouping variable.
>
> | Column | Description |
> | :- | :- |
> | `feature` | Feature tested, for example a taxon or a functional category |
> | `H_stat` | Kruskal–Wallis H statistic. Larger values indicate greater separation between groups |
> | `p_value` | Unadjusted p-value of the Kruskal–Wallis test |
> | `fdr` | Benjamini–Hochberg adjusted p-value across all features tested |
> [tab] Dunn's Post-hoc
>
> Pairwise follow-up comparisons performed after the general Kruskal–Wallis test to identify which specific pairs of groups differ.
>
> | Column | Description |
> | :- | :- |
> | `feature` | Feature tested |
> | `group_value1` | First group in the comparison |
> | `group_value2` | Second group in the comparison |
> | `q_value` | FDR-adjusted p-value for this pair |
> [tab] Diff. Abundance Pairwise
>
> Pairwise differential abundance results for the test(s) selected in the analysis parameters.
>
> | Column | Description |
> | :- | :- |
> | `variable` | Grouping variable chosen in the parameters |
> | `feature` | Feature tested |
> | `group1` | First group in the comparison |
> | `group2` | Second group in the comparison |
> | `n1` | Number of samples in `group1` |
> | `n2` | Number of samples in `group2` |
> | `median1` | Median abundance of the feature in `group1` |
> | `median2` | Median abundance of the feature in `group2` |
> | `effect` | Effect size reported as the difference between `median2` and `median1`. Negative values indicate higher abundance in `group1` |
> | `_stats` | Test statistic for the selected differential abundance test |
> | `_pvalue` | Unadjusted p-value |
> | `_fdr` | Benjamini–Hochberg adjusted p-value |
> | `_significant` | `1` if if the FDR for the tested feature is below the selected Diff. Abundance FDR Threshold, `0`otherwise. |
> | `combined_fdr` | Combined FDR-adjusted p-value |
## Recommended parameters
Select your workflow. Read depth recommendations and supported pre-processing methods differ by data type; the analysis parameters are otherwise consistent.
> [tab] Kepler - Host-Agnostic Taxonomic Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `raw` if samples have comparable read depths
- `filter` if a few samples have notably lower read depth than the rest of the cohort
- `rarefaction` to standardize the whole cohort to a common read depth
If read depth is systematically higher in one group, standardize it with `filter` or `rarefaction` before testing prevalence. Deeper samples detect more features, so the difference may be technical. Check depth per group in the [Rarefaction module](/DAP_docs/rarefaction-on-the-dap). |
> | Read Depth | - With `rarefaction`, use the [Rarefaction module](DAP_docs/rarefaction-on-the-dap) to choose the optimal depth.
- With `filter`, choose a threshold that removes only the samples with notably lower depth than the rest of the cohort. Use the [Rarefaction module](DAP_docs/rarefaction-on-the-dap) retention plot helps identify them.
|
> | Rarefaction Seed | `42` (default) |
> | Feature Relative Abundance Threshold | `0.001` |
> | Feature Prevalence Threshold | - Testing differential abundance: `0.05` to `0.1`
- Testing differential prevalence: `0.01`
|
> | Grouping Variable | Biologically or technically relevant metadata column. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Differential Prevalence Test | - Standard choice: `fisher`, exact and reliable on small counts
- More power on a 2x2 comparison: `boschloo` or `barnard`, at higher computational cost
|
> | Diff. Prevalence FDR Threshold | - Standard: `0.05`
- Exploratory: `0.1`
|
> | Differential Abundance Test | - `Mann-Whitney` independent groups, each subject in one group only (for example case versus control)
- `Wilcoxon` paired samples, each subject in both groups (for example pre versus post treatment)
- `t-test` independent groups, roughly normal values, at least 20 samples per group
[Which test fits my design?](#which-test-fits-my-design) |
> | Diff. Abundance FDR Threshold | - Standard: `0.05`
- Exploratory: `0.1`
|
> | Kruskal-Wallis p-value Threshold | `0.05` |
> | Max Figures to Display | - Concise report: `1` to `5`
- Exploratory review: `10` to `20`
|
> [tab] CHAMP - Human Taxonomic Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `raw` if samples have comparable read depths
- `filter` if a few samples have notably lower read depth than the rest of the cohort
- `rarefaction` to standardize the whole cohort to a common read depth
If read depth is systematically higher in one group, standardize it with `filter` or `rarefaction` before testing prevalence. Deeper samples detect more features, so the difference may be technical. Check depth per group in the [Rarefaction module](/DAP_docs/rarefaction-on-the-dap). |
> | Read Depth | - With `rarefaction`, use the [Rarefaction module](DAP_docs/rarefaction-on-the-dap) to choose the optimal depth. Any sample below the chosen depth is discarded, so the depth sets a trade-off between depth and sample size.
- With `filter`, choose a threshold that removes only the samples with notably lower depth than the rest of the cohort. Use the [Rarefaction module](DAP_docs/rarefaction-on-the-dap) retention plot helps identify them.
|
> | Rarefaction Seed | `42` (default) |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | - Testing differential abundance: `0.05` to `0.1`
- Testing differential prevalence: `0.01`
|
> | Grouping Variable | Biologically or technically relevant metadata column. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Differential Prevalence Test | - Standard choice: `fisher`, exact and reliable on small counts
- More power on a 2x2 comparison: `boschloo` or `barnard`, at higher computational cost
|
> | Diff. Prevalence FDR Threshold | - Standard: `0.05`
- Exploratory: `0.1`
|
> | Differential Abundance Test | - `Mann-Whitney` independent groups, each subject in one group only (for example case versus control)
- `Wilcoxon` paired samples, each subject in both groups (for example pre versus post treatment)
- `t-test` independent groups, roughly normal values, at least 20 samples per group
[Which test fits my design?](#which-test-fits-my-design) |
> | Diff. Abundance FDR Threshold | - Standard: `0.05`
- Exploratory: `0.1`
|
> | Kruskal-Wallis p-value Threshold | `0.05` |
> | Max Figures to Display | - Concise report: `1` to `5`
- Exploratory review: `10` to `20`
|
> [tab] 16S SR Amplicon Classification - Taxonomic
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `genus` |
> | Data Table Pre-processing Method | - `raw` if samples have comparable read depths
- `filter` if a few samples have notably lower read depth than the rest of the cohort
- `rarefaction` to standardize the whole cohort to a common read depth
If read depth is systematically higher in one group, standardize it with `filter` or `rarefaction` before testing prevalence. Deeper samples detect more features, so the difference may be technical. Check depth per group in the [Rarefaction module](/DAP_docs/rarefaction-on-the-dap). |
> | Read Depth | - With `rarefaction`, use the [Rarefaction module](DAP_docs/rarefaction-on-the-dap) to choose the optimal depth. Any sample below the chosen depth is discarded, so the depth sets a trade-off between depth and sample size.
- With `filter`, choose a threshold that removes only the samples with notably lower depth than the rest of the cohort. Use the [Rarefaction module](DAP_docs/rarefaction-on-the-dap) retention plot helps identify them.
|
> | Rarefaction Seed | `42` (default) |
> | Feature Relative Abundance Threshold | `0.001` |
> | Feature Prevalence Threshold | - Testing differential abundance: `0.05` to `0.1`
- Testing differential prevalence: `0.01`
Short-read 16S carries spurious rare ASVs, so `0` is rarely appropriate. |
> | Grouping Variable | Biologically or technically relevant metadata column. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Differential Prevalence Test | - Standard choice: `fisher`, exact and reliable on small counts
- More power on a 2x2 comparison: `boschloo` or `barnard`, at higher computational cost
|
> | Diff. Prevalence FDR Threshold | - Standard: `0.05`
- Exploratory: `0.1`
|
> | Differential Abundance Test | - `Mann-Whitney` independent groups, each subject in one group only (for example case versus control)
- `Wilcoxon` paired samples, each subject in both groups (for example pre versus post treatment)
- `t-test` independent groups, roughly normal values, at least 20 samples per group
[Which test fits my design?](#which-test-fits-my-design) |
> | Diff. Abundance FDR Threshold | - Standard: `0.05`
- Exploratory: `0.1`
|
> | Kruskal-Wallis p-value Threshold | `0.05` |
> | Max Figures to Display | - Concise report: `1` to `5`
- Exploratory review: `10` to `20`
|
> [tab] 16S LR Amplicon profiling - Taxonomic
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | `species` |
> | Data Table Pre-processing Method | - `raw` if samples have comparable read depths
- `filter` if a few samples have notably lower read depth than the rest of the cohort
- `rarefaction` to standardize the whole cohort to a common read depth
If read depth is systematically higher in one group, standardize it with `filter` or `rarefaction` before testing prevalence. Deeper samples detect more features, so the difference may be technical. Long-read runs are usually shallower, so check depth per group in the [Rarefaction module](/DAP_docs/rarefaction-on-the-dap). |
> | Read Depth | - With `rarefaction`, use the [Rarefaction module](DAP_docs/rarefaction-on-the-dap) to choose the optimal depth. Any sample below the chosen depth is discarded, so the depth sets a trade-off between depth and sample size.
- With `filter`, choose a threshold that removes only the samples with notably lower depth than the rest of the cohort. Use the [Rarefaction module](DAP_docs/rarefaction-on-the-dap) retention plot helps identify them.
|
> | Rarefaction Seed | `42` (default) |
> | Feature Relative Abundance Threshold | `0.001` |
> | Feature Prevalence Threshold | - Testing differential abundance: `0.05` to `0.1`
- Testing differential prevalence: `0.01`
|
> | Grouping Variable | Biologically or technically relevant metadata column. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Differential Prevalence Test | - Standard choice: `fisher`, exact and reliable on small counts
- More power on a 2x2 comparison: `boschloo` or `barnard`, at higher computational cost
|
> | Diff. Prevalence FDR Threshold | - Standard: `0.05`
- Exploratory: `0.1`
|
> | Differential Abundance Test | - `Mann-Whitney` independent groups, each subject in one group only (for example case versus control)
- `Wilcoxon` paired samples, each subject in both groups (for example pre versus post treatment)
- `t-test` independent groups, roughly normal values, at least 20 samples per group
[Which test fits my design?](#which-test-fits-my-design) |
> | Diff. Abundance FDR Threshold | - Standard: `0.05`
- Exploratory: `0.1`
|
> | Kruskal-Wallis p-value Threshold | `0.05` |
> | Max Figures to Display | - Concise report: `1` to `5`
- Exploratory review: `10` to `20`
|
> [tab] Host-Agnostic Functional Profiling (WGS)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | Not applicable |
> | Data Table Pre-processing Method | `raw` only |
> | Read Depth | Not applicable with `raw` |
> | Rarefaction Seed | Not applicable with `raw` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | - Testing differential abundance: `0.05` to `0.1`
- Testing differential prevalence: `0.01`
|
> | Grouping Variable | Biologically or technically relevant metadata column. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Differential Prevalence Test | - Standard choice: `fisher`, exact and reliable on small counts
- More power on a 2x2 comparison: `boschloo` or `barnard`, at higher computational cost
|
> | Diff. Prevalence FDR Threshold | - Standard: `0.05`
- Exploratory: `0.1`
|
> | Differential Abundance Test | - `Mann-Whitney` independent groups, each subject in one group only (for example case versus control)
- `Wilcoxon` paired samples, each subject in both groups (for example pre versus post treatment)
- `t-test` independent groups, roughly normal values, at least 20 samples per group
[Which test fits my design?](#which-test-fits-my-design) |
> | Diff. Abundance FDR Threshold | - Standard: `0.05`
- Exploratory: `0.1`
|
> | Kruskal-Wallis p-value Threshold | `0.05` |
> | Max Figures to Display | - Concise report: `1` to `5`
- Exploratory review: `10` to `20`
|
> [tab] CHAMP Functional (GMM, GBM, KEGG)
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `cellular abundance` |
> | Taxonomic Rank | Not applicable |
> | Data Table Pre-processing Method | `raw` only |
> | Read Depth | Not applicable with `raw` |
> | Rarefaction Seed | Not applicable with `raw` |
> | Feature Relative Abundance Threshold | `0.0001` |
> | Feature Prevalence Threshold | - Testing differential abundance: `0.05` to `0.1`
- Testing differential prevalence: `0.01`
|
> | Grouping Variable | Biologically or technically relevant metadata column. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Differential Prevalence Test | - Standard choice: `fisher`, exact and reliable on small counts
- More power on a 2x2 comparison: `boschloo` or `barnard`, at higher computational cost
|
> | Diff. Prevalence FDR Threshold | - Standard: `0.05`
- Exploratory: `0.1`
|
> | Differential Abundance Test | - `Mann-Whitney` independent groups, each subject in one group only (for example case versus control)
- `Wilcoxon` paired samples, each subject in both groups (for example pre versus post treatment)
- `t-test` independent groups, roughly normal values, at least 20 samples per group
[Which test fits my design?](#which-test-fits-my-design) |
> | Diff. Abundance FDR Threshold | - Standard: `0.05`
- Exploratory: `0.1`
|
> | Kruskal-Wallis p-value Threshold | `0.05` |
> | Max Figures to Display | - Concise report: `1` to `5`
- Exploratory review: `10` to `20`
|
> [tab] AMR/VF - Functional
>
> | Parameter | Recommended value |
> | :- | :- |
> | Analysis Metric | `relative_abundance` |
> | Taxonomic Rank | Not applicable |
> | Data Table Pre-processing Method | `raw` only |
> | Read Depth | Not applicable with `raw` |
> | Rarefaction Seed | Not applicable with `raw` |
> | Feature Relative Abundance Threshold | `0.0001`, or `0` for binary presence and absence profiles |
> | Feature Prevalence Threshold | `0.01` to `0.05`, raised if the table is very sparse |
> | Grouping Variable | Biologically or technically relevant metadata column. |
> | Drop samples with missing metadata values in grouping variable | ✅ |
> | Differential Prevalence Test | - Sparse or binary profiles: `fisher`, strongly recommended
- More power on a 2x2 comparison: `boschloo` or `barnard`, at higher computational cost
|
> | Diff. Prevalence FDR Threshold | - Standard: `0.05`
- Exploratory: `0.1`
|
> | Differential Abundance Test | - `Mann-Whitney` independent groups, each subject in one group only (for example case versus control)
- `Wilcoxon` paired samples, each subject in both groups (for example pre versus post treatment)
- `t-test` independent groups, roughly normal values, at least 20 samples per group
[Which test fits my design?](#which-test-fits-my-design) |
> | Diff. Abundance FDR Threshold | - Standard: `0.05`
- Exploratory: `0.1`
|
> | Kruskal-Wallis p-value Threshold | `0.05` |
> | Max Figures to Display | - Concise report: `1` to `5`
- Exploratory review: `10` to `20`
|
## Parameter reference
> [accordion] Grouping Variable
>
> The metadata column that defines the groups to compare. This is the comparison the whole module performs.
>
> **Options** · Categorical variables from the metadata table associated with the query used to create the analysis
>
> **Default** · `None`
>
> **Suggested** · A categorical variable reflecting your biological question, such as `disease status`, `treatment`, `response status`, `body site`, `cohort`, `time point`, or `HIV profile`.
> [accordion] Drop samples with missing grouping metadata
>
> Whether samples with missing values in the grouping variable are removed from the analysis.
>
> **Options** · `TRUE` or `FALSE`
>
> **Default** · `TRUE `
> [accordion] Differential Prevalence Test
>
> One or more tests comparing feature **prevalence** (how often a feature is detected) across groups.
>
> **Options** · `fisher`, `barnard`, `boschloo`
>
> **Default** · `fisher`
> [accordion] Differential Prevalence Tests FDR Threshold
>
> The FDR threshold for reporting significant differential-prevalence results after p-value adjustment.
>
> **Options** · `0.01` to `1.0`, step `0.01`
>
> **Default** · `0.1`
> [accordion] Differential Abundance Test
>
> The statistical test used to compare alpha-diversity values between groups. Available when a **Grouping Variable** is selected. The right test depends on your study design, in particular whether samples are independent or paired/matched. In addition to the test(s) you choose here, **Kruskal-Wallis (followed by Dunn's post-hoc) is always run and reported**.
>
> **Options** · `Wilcoxon`, `Mann-Whitney`, `T-test`
>
> > [!NOTE]
> >
> > **Which test fits my design?**\
> > First ask: *are the same subjects measured in more than one group, or are all subjects different?*
> >
> > * **Use** `Mann–Whitney U `**for independent groups.**\
> > Example: You compare alpha diversity between 10 treated mice and 10 untreated mice. Each mouse appears in only one group, so values cannot be paired across groups. The groups are independent → `Mann–Whitney U` is appropriate.
> > * **Use** `Wilcoxon `**for paired or matched samples.**\
> > Example: You compare alpha diversity in the same 10 mice before and after treatment. Each mouse contributes one “before” and one “after” value, so every value has a natural partner from the same animal. The samples are paired → `Wilcoxon` tests the within-subject change.
> >
> > **Reminder:** Equal group sizes do **not** make a design paired. Two groups of 10 different mice are still independent, and `Mann–Whitney U` is the correct nonparametric test.
> [accordion] Differential Abundance Tests FDR Threshold
>
> The FDR threshold for reporting significant differential-abundance results after p-value adjustment.
>
> **Options** · `0.01` to `1.0`, step `0.01`
>
> **Default** · `0.1`
>
> **Suggested** · `0.05` for standard analyses; `0.1` for exploratory or small studies; lower for high-dimensional or confirmatory analyses.
>
> > [!NOTE]
> >
> > Applied after multiple-testing correction. Lower values give a shorter, more conservative list; higher values increase sensitivity and false positives.
> [accordion] P-value Threshold
>
> A fallback significance cutoff, applied only when there are too few tests for multiple-testing correction to be meaningful. In normal runs, significance is shown as the FDR thresholds instead, so this parameter usually has no effect.
>
> **Options** · `0.01` to `1.0`, step `0.01`
>
> **Default** · `0.05`
> [accordion] Max Figures to Display
>
> The maximum number of feature-level boxplots shown on screen per test.
>
> **Options** · `0` to `20`, step `1`
>
> **Default** · `5`
>
> **Suggested** · `5` for a concise output; `10–20` to inspect more significant results in the interface.
# Overview
Source: https://docs.cosmosid.com/DAP_docs/univariatecomparison-overview
## What is univariate comparison?
The Univariate Comparison module identifies which microbial features (such as species, genes, or pathways) are associated with a categorical variable of interest (such as study condition, disease, ethnicity, or treatment). It compares the groups defined by that variable and tests each feature to find which ones are differentially **abundant** (present at different amounts) or differentially **prevalent** (detected in different proportions of samples).
Alpha diversity, beta diversity, stacked bar charts, and heatmaps reveal the global patterns that distinguish groups. Univariate comparison zooms in to pinpoint which features drive those differences. For example, it can tell you whether *E. coli* differs in abundance or prevalence across your groups, and exactly which groups it separates. It is called *univariate* because each comparison is driven by a single grouping variable.
## How does it work?
The feature table describes which microbial taxa (or other features) appear across the sample profiles in a cohort, and in a typical study it can hold thousands of features. Only a fraction of them drive the differences between groups, and univariate comparison exists to find that fraction. The module works through the table one feature at a time, testing whether each feature differs between the groups defined by the grouping variable.
A feature can differ in two biologically distinct ways, so each is tested separately: **abundance** (how much of the feature is present) and **prevalence** (how often it is detected).
**1. 1. Test each feature, for each pair of groups**
For every feature (for example, each microbial species detected in the cohort), a statistical test compares each possible pair of groups. With four groups (A, B, C, D), that means six unique pairwise comparisons. Each test determines whether the feature differs significantly between the two groups being compared.
**2. 2. Assess abundance and prevalence separately**
Each feature can differ between groups in two distinct ways, so each is tested separately:
* **Differential abundance** captures whether the *amount* of the feature differs between groups. For example, *E. coli* reaches a higher relative abundance in group A than in group B.
* **Differential prevalence** captures whether the feature is *detected* in a different proportion of samples per group. For example, *A. baumannii* is present in 30% of group A samples but 70% of group B samples.
**3. 3. Correct for multiple testing**
Testing thousands of features across every pair of groups means testing a very large number of hypotheses at once, and some comparisons would reach significance by chance alone. A **false discovery rate (FDR)** correction is applied to guard against this, bounding the expected proportion of false positives among the comparisons declared significant.
**4. 4. Return features associated with your variable of interest**
The output is a focused list of features whose abundance or prevalence is significantly associated with the variable of interest, along with the specific groups each feature separates.
## Why is it useful?
* **Which features drive the difference between my groups?** Diversity and ordination show *that* groups differ, but not why. Univariate comparison attributes the difference to specific taxa or pathways and, through pairwise testing, tells you between which groups each difference occurs. This reduces a large feature table to a focused set of results.
* **Is a feature different because it is detected more often, or because there is more of it?** The module separates these two signals: a change in how *often* a feature is detected (**prevalence**) versus a change in *how much* of it is present where it occurs (**abundance**). They have different biological meanings, and the module tests them distinctly.
* **With thousands of features tested, how do I know the results are not chance?** Testing a whole table means thousands of simultaneous hypotheses. An **FDR correction** limits the expected fraction of false positives among the features called significant, so the result set comes with a known level of confidence.
# Workspaces
Source: https://docs.cosmosid.com/DAP_docs/workspaces
The digital counterpart of a microbiome research unit: a virtual space where members of a research team can keep all the assets, omics data, analysis tools and results together.
## What is a workspace?
#### A virtual microbiome research unit
The **Workspace** is the virtual representation of the microbiome bioinformatics research unit of a laboratory or research team. It's a shared environment where the work, assets, analytical tools, and knowledge ever produced by a team are organised around a specific project or research activity.
The Workspace brings experimental data, metadata, analyses, results, and research knowledge into a single query-able environment. As data is processed, analysed, interpreted, and reviewed, its relationships and scientific context are preserved.
Over time, each project also contributes to a growing body of institutional knowledge, allowing teams to build on previous analyses, findings, and expertise rather than starting from scratch.
In the Cosmos-Hub hierarchy, a Workspace is the top-level container for the Studies carried out by the research unit.
The Workspace Dashboard is the first interface a user lands on after logging into the Cosmos-Hub 2.0. The Workspace Dashboard lists all workspaces visible to your account, including:
* Workspaces you created
* Workspaces you were invited to collaborate on.
* Workspaces made visible to you by an administrator of your Cosmos-Hub subscription or organization
Each entry of the Workspace Dashboard shows workspace metadata, such as the Number of Studies it contains, the Owner of the workspace and when was the last time a study was modified.

## Accessing a workspace
Enter a workspace by clicking on its name. Entering a Workspace will show the list of [**Studies**](https://docs.cosmosid.com/DAP_docs/studies) (if any has been created).
## **Create a new workspace**
1. From the Workspaces Dashboard, click on "+ New Workspace" in the top-right corner of the interface to open the Workspace Creation dialog.\

2. Once created, the new workspace will appear on the Workspace Dashboard
## Searching and filtering the Workspace Dashboard

Use the workspace search and display controls to quickly find and filter specific workspaces across the dashboard. The **Search workspaces** bar allows you to find a workspace by entering its name or any part of its name.
1. **Show Filters**: displays dynamic filters below the column names in the Workspaces List. Use these filters to search within specific workspace metadata columns by entering text or numbers.
2. **Manage Columns**: toggle workspace metadata columns to be displayed from the list of workspaces.
3. **Full screen**: expands the Workspaces List to full-screen mode, making it easier to review, filter, and manage large lists of workspaces.
## Edit properties of existing workspaces
To edit the properties of one or multiple workspaces in the Workspaces Dashboard, tick the checkbox(s) to make editing buttons visible the screen. Selecting a workspace will allow to manage access, add tags \[*feature in active development*]*,* rename or delete a workspace.
> [!NOTE]
>
> Editing workspace properties requires the appropriate permissions. If you believe you should have editing access, please contact the administrator(s) of your Cosmos-Hub subscription or workspace.

### Share workspace access to individual Users or User Groups \[*Feature in Active Development*]
Click on 'Manage Access' button while a single workspace is selected from the workspaces dashboard. The 'Share Workspace' menu allows to:

* **User Groups tab**: grant access to the workspace to specific user groups.
* **Users**: grant access to individual users in your organisation.
* **People with Access**: view users that can access to the selected workspace.
### Renaming a workspace
Select a *single* workspace and click on **Rename**.
> [!WARNING]
>
> Workspace names must be unique across the Workspace Dashboard.
### Deleting a workspace
Select one or more workspace and click on **Delete**.
> [!CAUTION]
>
> Deleting a workspace is permanent and cannot be undone. All associated data, settings, and results will be removed.
# 16S Amplicon Classification
Source: https://docs.cosmosid.com/docs/16s-metagenomics-taxonomy
The 16S workflow implements the DADA2 algorithm (3) as its core engine and utilizes the Nextflow ampliseq pipeline (1) definitions to run it on our cloud infrastructure. Briefly, primer removal is done with Cutadapt (4), and quality trimming parameters are passed to DADA2 to ensure that the median quality score over the length of the read exceeds a certain Phred score threshold.
## 16S Metagenomics Profilng Methodology
Within DADA2, forward and reverse reads are each trimmed to a uniform length based on the quality of reads in the sample—higher quality data will generally result in longer reads. DADA2 uses machine learning with a parametric error model to learn the error rates for the forward and reverse reads, based on the premise that correct sequences should be more common than any particular error-variant. DADA2 then applies its core sample inference algorithm to the filtered and trimmed data, applying these learned error models. Paired-end reads are then merged if they have at least 12 bases of overlap and are identical across the entire overlap.
The resulting table of sequences and observed frequencies is filtered to remove chimeric sequences (those that exactly match a combination of more-prevalent “parent” sequences). Taxonomy and species-level identification (where possible) are conducted with DADA2’s naive Bayesian classifier, using the Silva version 138 database.
Lastly, the predicted functional potential of the community was profiled using PICRUST2 (5)(6)(7)(8)(9). Briefly, PICRUSt2 (**Phylogenetic Investigation of Communities by Reconstruction of Unobserved States**) is a tool that predicts functional capabilities and abundances of a microbial community based on the observed amplicon (marker gene) content. Functional capabilities are given by EC classifiers, or MetaCyc ontologies, and these can be aggregated to predict pathways that are likely present in a given sample.
## What is a primer sequence and why is it needed to for 16S workflow?
Primers are short, artificial DNA strands of about 18 to 25 nucleotides that match the beginning and end of the DNA fragment to be amplified. In amplicon sequencing methods, PCR with specific primers produces the amplicon of interest. These primer sequences need to be trimmed from the reads before further processing and any downstream analytics. Please do not use any technical sequence such as adapter sequences but only the primer sequence that matches the biological amplicon. For example:
\--Forward Primer "GTGYCAGCMGCCGCGGTAA" --Reverse Primer "GGACTACNVGGGTWTCTAAT”
## What does the different modes (Mode Q25, Q20 and Q15) represent for Amplicon 16S results view?
The modes Q15, Q20, and Q25 represent distinct Phred quality score thresholds utilized in the Amplicon 16S workflow. For example, mode Q25, with a Phred quality score of 25, ensures that retained reads maintain a median quality score of 25 across the read's length, along with a maximum expected error of 6 bases per read. Moreover, for each mode, a minimum of 20% of reads per sample will be preserved. However, if there are insufficient reads meeting the respective Phred score quality thresholds, the results will progressively incorporate lower quality reads to achieve the minimum requirement.

## What is an ASV?
An **amplicon sequence variant** (ASV) is any one of the inferred single DNA sequences recovered from a high-throughput sequencing analysis of marker genes. Because these sequences are created following the removal of erroneous sequences generated during PCR and sequencing, using ASVs makes it possible to distinguish sequence variation by a single nucleotide change. The uses of ASVs include classifying groups of species based on DNA sequences, finding biological and environmental variation, and determining ecological patterns.
## What does the “ASV count” represent on the single sample taxonomic results explorer?
The ASV count represents the number of observations of an ASV in that sample.
## What does the “raw count” represent on the single sample functional results explorer?
The raw count represents the read depth per ASV multiplied by the predicted function abundances per ASV.
## Why would you choose ASVs methods over OTUs methods for inferring taxonomic composition from your 16S data?
OTU clustering reduces resolution by clustering similar sequences over a certain threshold into one specific sequence or one specific consensus sequence. ASVs capture the fine scale variation that exists and allows more sensitivity and thus the ability to get closer to “True” taxonomic composition
## The advantages of ASVs over OTUs
1. There are many arguments in the microbiome community to move 16S analysis approach to ASV based methods (10)
2. ASV methodology have showcased sensitivity and specificity as good or better than OTU methods and allow better discrimination of ecological patterns (10)
3. ASV methods are reproducible since these are exact sequences, generated without clustering or reference databases (10)
4. OTUs often overestimate bacterial richness when compared to ASVs (10)
## What does the “percentage of reads retained” imply?
You can track how many reads were retained and rejected through each step in the 16S workflow. It’s normal to lose some reads during each step, but large drops at particular steps can indicate specific issues with the data. For example, if a large number of reads are lost during filtering, it could indicate poor sequence data overall, while a major decrease at the chimera-removal step frequently indicates an issue with primer removal, so we suggest confirming the primer sequences are correct and adapters are trimmed.
## How do you upload your 16S amplicon data to the HUB?
You have the option to upload your data from your desktop or your Illumina BaseSpace account or from NCBI SRA as well.
## How do you generate comparative analysis to aggregate and compare your 16S results across cohorts?
Results can be [downloaded](/docs/download-your-results) or compared to other 16S samples for visualizations through the Cosmos-Hub [Comparative Analysis tool](/docs/new-comparative-analysis).
**16S OTU Workflow Methodology** For taxonomic profiling based amplicon 16S data, the Cosmos-Hub 16S data analysis pipeline starts with preprocessing of the raw reads from either paired-end or single-end Fastq files through read-trimming to remove adapters as well as reads and bases of low quality. If the reads are in a paired-end format, the forward and reverse overlapping pairs are joined together; the unjoined R1 and R2 reads are then added to the end of the file. The file is then converted to Fasta format and used as input for OTU picking. OTUs are identified against the Cosmos-Hub curated 16S database using a closed-reference OTU picker and 97% sequence similarity through the QIIME framework. The final results are then presented in tabular format with the taxonomic names, OTU IDs, frequency, and relative abundance. Results can be [downloaded](/docs/download-your-results) or compared to other 16S samples for visualizations through the Cosmos-Hub [Comparative Analysis tool](/docs/new-comparative-analysis).
## Why Are Mitochondria and Chloroplasts Showing Up in My 16S Data?
It’s common for researchers to observe mitochondrial and chloroplast reads in their 16S rRNA sequencing results—especially when analyzing samples derived from plant or eukaryotic tissue (e.g., roots, leaves, gut biopsies). This is not an error or contamination in the workflow, but rather a well-understood and expected limitation of current 16S sequencing approaches and reference databases.
### The Evolutionary Origin: Why This Happens
Mitochondria and chloroplasts are *endosymbiotic organelles* that originated from free-living bacteria. As such, they retain genes, including the 16S rRNA gene, that are evolutionarily and structurally homologous to bacterial 16S genes. Even though most 16S protocols use bacterial-specific primers (e.g., V3–V4 or V4), these primers can still amplify organellar 16S genes due to sequence similarity.
This leads to co-amplification of host-derived (eukaryotic) sequences, particularly:
* **Mitochondrial 16S rRNA**, typically from animal tissue in gut or fecal samples
* **Chloroplast 16S rRNA**, highly abundant in plant material such as root or leaf tissues, or soil containing plant detritus
### A Database-Level Constraint
The Cosmos-Hub platform uses the **SILVA 16S rRNA gene reference database**, a gold-standard, curated, and taxonomically comprehensive resource. Importantly, SILVA includes mitochondrial and chloroplast sequences as part of its taxonomy structure. As a result, if those sequences are present in the input FASTQ files, they will be profiled alongside true bacterial sequences.
This is a **standardized behavior across all tools using SILVA (or similarly broad 16S databases)** and is not specific to Cosmos-Hub.
### How to Address This
Because mitochondrial and chloroplast sequences are legitimate reads from the sample’s DNA content, they cannot be filtered after taxonomic profiling has been completed. Instead, the **appropriate approach is to remove these reads prior to uploading data into Cosmos-Hub**.
This is typically done by:
1. **Aligning raw reads** against curated mitochondrial and chloroplast databases (e.g., using BLAST, Bowtie2, or BWA).
2. **Filtering out mapped reads**, leaving only bacterial-origin reads.
3. **Re-processing the filtered FASTQ files** through Cosmos-Hub for taxonomic profiling.
This preprocessing must be done **outside the Cosmos-Hub environment** and requires command-line tools and some bioinformatics expertise.
### Need Help Removing Host-Derived Reads?
The Cmbio team offers **custom bioinformatics support** for projects requiring removal of organellar reads, especially in plant-rich or host-associated datasets. We typically extract, filter, and clean these reads in a reproducible manner, followed by reprofiling in the Hub. If you'd like us to assist with this as part of your project scope, please contact us directly to initiate a custom analysis plan.
## References:
1. Straub, D. *et al.* Interpretations of Environmental Microbial Community Studies Are Biased by the Selected 16S rRNA (Gene) Amplicon Sequencing Pipeline. *Front. Microbiol.* **11**, 1–18 (2020).
2. Callahan, B. J., McMurdie, P. J. & Holmes, S. P. Exact sequence variants should replace operational taxonomic units in marker-gene data analysis. *ISME J.* **11**, 2639–2643 (2017).
3. Callahan, B. J. *et al.* DADA2: High-resolution sample inference from Illumina amplicon data. *Nat. Methods* **13**, 581–583 (2016).
4. Martin, M. Cutadapt removes adapter sequences from high-throughput sequencing reads. *EMBnet.journal* **17**, 10 (2011).
5. Douglas, G. M. *et al.* PICRUSt2 for prediction of metagenome functions. *Nat. Biotechnol.* **38**, 685–688 (2020).
6. Barbera, P. *et al.* EPA-ng: Massively Parallel Evolutionary Placement of Genetic Sequences. *Syst. Biol.* **68**, 365–369 (2019).
7. Czech, L., Barbera, P. & Stamatakis, A. Genesis and Gappa: processing, analyzing and visualizing phylogenetic (placement) data. *Bioinformatics* **36**, 3263–3265 (2020).
8. MIRARAB, S., NGUYEN, N. & WARNOW, T. SEPP: SATé-Enabled Phylogenetic Placement. in *Biocomputing 2012* 247–258 (WORLD SCIENTIFIC, 2011). doi:10.1142/9789814366496\_0024.
9. Louca, S. & Doebeli, M. Efficient comparative phylogenetics on large trees. *Bioinformatics* **34**, 1053–1055 (2018).
10. Ye, Y. & Doak, T. G. A Parsimony Approach to Biological Pathway Reconstruction/Inference for Genomes and Metagenomes. *PLoS Comput. Biol.* **5**, e1000465 (2009).
11. Chiarello, M., McCauley, M., Villéger, S. & Jackson, C. R. Ranking the biases: The choice of OTUs vs. ASVs in 16S rRNA amplicon data analysis has stronger effects on diversity measures than rarefaction and OTU identity threshold. *PLoS One* **17**, 1–19 (2022).
# PCA
Source: https://docs.cosmosid.com/docs/3d-pca
Principal Component Analysis (PCA) is used to visually explore complex data in a way that makes it easier to emphasize variation to bring out strong patterns.
## Why use PCA?
You use PCA to help identify samples that cluster together and form groups based on their composition. For example, if you have many microbiome samples from different body sites and you want to see if they have similar overall bacterial species you can use PCA to determine if they group together based on the body site of origin.
## How does it work?
PCA simplifies complexity among samples while retaining trends and patterns by transforming the data into fewer dimensions. It finds patterns without prior knowledge about where the samples come from or different variables associated with the samples. PCA projects the data geometrically onto lower dimensions call principal components (PCs). You would typically use PCA plots to find potential clusters and can be used to explore data to understand the key variables in the data and to spot outliers.

## Options for viewing PCA
* **Rotate graph** - Click anywhere on the 3D PCA and hold down to rotate the graph.
* **Labels** - You can click on a label to hide samples belonging to the corresponding cohort, click it again to show them.
* *Please note that selecting cohort labels in the Legend does not recompute the plot but only hides/reveals the corresponding samples while re-scaling the axis. The axis label values for % variability explained by each principal component (PC) axis are not recalculated and correspond to a visualization including all cohorts and samples.*
* **Export** - Click "Export" in the top right corner to download the PCA as a PDF, PNG or SVG.
# about
Source: https://docs.cosmosid.com/docs/about

Cosmos-Hub is an secure AWS-based microbiome analysis platform designed to streamline sequencing data analysis through comprehensive and automated bioinformatics pipelines. The Hub efficiently supports diverse data types, including raw, unassembled sequencing reads (FASTQ files) generated by **shotgun metagenomics**, **metatranscriptomics**, and **amplicon 16S/ITS** (*both short-reads and long-reads*), delivering precise taxonomic and functional profiling in just hours—not weeks.
> [card] [Getting Started](https://docs.cosmosid.com/docs/quick-start)
>
> New to the platform? Get a brief onboarding here
> [card] [Bioinformatic Pipelines](https://docs.cosmosid.com/docs/workflows)
>
> Learn about our taxonomic and functional pipelines and the use cases
> [card] [Uploading Data](https://docs.cosmosid.com/docs/sample-upload)
>
> Cosmos-Hub accepts raw, unassembled reads (FASTQ) files via multiple methods
> [card] [Comparative Analysis](https://docs.cosmosid.com/docs/new-comparative-analysis)
>
> Fast and comprehensive cohort analysis with our statistical toolbox
> [card] [Video Library](https://docs.cosmosid.com/docs/video-library)
>
> Find a number of tutorials and videos to help walk you though the platform
> [card] [Release Notes](https://docs.cosmosid.com/docs/updates)
>
> Read the latest updates within the Cosmos-Hub
> [card] [Contact Support](https://cosmos-hub.com/support)
>
> Reach our full support team for quick responses to your questions or feedback
> [card] [Download Your Data](https://docs.cosmosid.com/docs/download-your-raw-fastqs)
>
> Download your raw FASTQ files, profiling data, and comparative analyses
# **Key Features and Capabilities**
* **Intuitive User Interface**: Effortlessly upload data, manage study metadata, and create virtual cohort analysis with dynamic visualizations
* **Comprehensive Data Management**: Easily analyze data from 16S rRNA, ITS, shotgun metagenomic, and metatranscriptomic studies
* **Metadata Tracking and Cohort Generation**: Upload your own metadata to describe samples and generate virtual cohorts for comparative analysis.
* **Automated Bioinformatics Pipelines**: Process raw FASTQ files directly, delivering taxonomic and functional profiling rapidly and accurately.
* **Scalable, Secure Cloud Infrastructure**: Hosted on AWS for rapid processing and seamless scalability.
# Cosmos-Hub Bioinformatic Pipelines
> [accordion] CHAMP™ | Human Microbiome Profiler
>
> Tailored for human-associated microbiome analysis with a proprietary phylogenetic marker-based algorithm to minimize false positives/negatives.
>
> Provides multi-kingdom taxonomic profiling informed from real-world human microbiome data, along with functional modules like Gut-Brain/Gut-Metabolic Modules and KEGG pathway outputs.
>
> Pita et al. [**CHAMP delivers accurate taxonomic profiles of the prokaryotes, eukaryotes, and bacteriophages in the human microbiome**](https://doi.org/10.3389/fmicb.2024.1425489). Frontiers in Microbiology, 2024.
> [accordion] Kepler™ | Host-Agnostic Microbiome Profiler
>
> Suitable for any sample type, including environmental, agricultural, and animal microbiomes. Using a high-precision k-mer-based identification approach, Kepler supports taxonomic profiling across bacteria, fungi, viruses, and protists, leveraging a database of 150,000 genomes and genes encompassing >30,000 species.
>
> Read our whitepaper here: [Kepler Benchmarking Whitepaper](https://hubs.ly/Q03cpmlN0)
> [accordion] Functional | Host-Agnostic Functional Profiling
>
> Employs an optimized humann3 framework, which can be used for metagenomic and metatranscriptomic data.
>
> Outputs include functional annotations from [MetaCyc](https://metacyc.org/), [GeneOntology (GO)](https://geneontology.org/), [Pfam](http://pfam.xfam.org/), [CAZy](https://www.cazy.org/), and [EnzymeCommission](https://enzyme.expasy.org/) databases, enabling comprehensive functional analyses across diverse microbial environments.
> [accordion] Kepler AMR/VF | Resistome and Virulome Profiler
>
> Characterize antimicrobial resistance genes and virulence factors with trusted databases like ResFinder and VFDB.
> [accordion] EMU | Long-Read Amplicon Profiling
>
> Profile long-read 16S/18S/ITS data generated by PacBio or Oxford Nanopore using our customizable EMU pipeline with multi-database support
> [accordion] DADA2 | 16S rRNA ASV Pipeline
>
> High-resolution bacterial community profiling using the DADA2 ASV algorithm and the SILVA 138 database, providing both taxonomic and predicted functional insights.
> [accordion] QIIME | 16S rRNA OTU Pipeline
>
> Utilizes the QIIME2 framework for clustering sequences based on 97% similarity threshold into Operational Taxonomic Units (OTUs) for taxonomic identification based on the SILVA v138 Database.
> [accordion] QIIME | ITS OTU Pipeline
>
> Focuses on fungal communities using Internal Transcribed Spacer (ITS) sequencing with the UNITE database for accurate classification.
> [accordion] Comparative Analysis Visualization & Reporting Module
>
> Integrates alpha/beta diversity analyses, differential abundance analyses, and configurable visualizations such as heatmaps, stacked bar charts, PCA, and more, enabling user-friendly interpretation and publication-ready results.
# Access and Pricing
The Cosmos-Hub is available to any researchers with access to a web browser.
We offer *monthly and yearly subscription model* with per-sample analysis charges depending on the data type.
There are flexible options with a number of modules to suit your analysis needs, as well as academic pricing. Contact [info@cosmos-hub.com](mailto:info@cosmos-hub.com) for more info.
# [Request a 14 day free trial!](https://cosmosidhub.com/book-a-demo/)
# Abundance Distribution
Source: https://docs.cosmosid.com/docs/abundance-distribution
Abundance Distribution module allows you to visualize the distribution of individual taxa/features using boxplot across your chosen cohorts.
For taxonomic results, any features from any taxonomic levels can be visualized as well by selecting the desired level from the top bar. The video below demonstrates the different functionalities of abundance distribution module.
Abundance Distribution module also allows you to do wilcoxon rank sum test to discern if the difference in abundance distribution is significant or not. The Wilcoxon rank sum test can be overlayed on the boxplot using wilcoxon overlay toggle button.

# Alpha-diversity
Source: https://docs.cosmosid.com/docs/alpha-diversity
## What is alpha diversity and how is it calculated?
It's crucial for understanding how diverse or rich your microbiome sample is in terms of different microorganisms. When talking about alpha diversity, we are looking at two things:
* **Species richness** - a count of the number of different species present in a sample. It does not take into account the abundance of the species or their relative distributions.
* **Species evenness** - a measure of relative abundance of different species that make up the richness.
The input metric for Alpha Diversity is **Normalized Reads Frequency**, which is the genome-normalized number of reads that reflects the underlying microbiome composition of the community. The aggregation level of the input data for Comparative Analysis has been set to species level.
## Metrics for Alpha Diversity
> [!NOTE]
>
> New to ecology statistics?
>
> Read our page on [Alpha Diversity Metrics: How to Chose the Right One](https://docs.cosmosid.com/docs/blog/alpha-diversity-what)
> [tab] CHAO1 Index
>
> Citation: Chao, A. (1987). “Estimating the population size for capture-recapture data with unequal catchability.” Biometrics 43(4): 783–791.
>
> The **CHAO1 Index** is an estimator of species richness that estimates the true number of species in a community based on the abundance pattern of rare species in your sample. Unlike simple species counts, CHAO1 accounts for species that are likely present but were not detected due to insufficient sampling depth.
>
> **How CHAO1 Works**
>
> CHAO1 operates on the capture-recapture principle and specifically uses **Singletons** (f₁, species observed exactly once in the sample) and **Doubletons** (f₂, species observed exactly twice in the sample).
>
> The estimator assumes that if many species are observed only once or twice, there are likely additional species present that were not captured at all. The more singletons relative to doubletons, the higher the estimated number of unobserved species.
>
> ## **Mathematical Formula**
>
> The CHAO1 estimate is calculated as **CHAO1 = S\_observed + (f₁²)/(2 × f₂)**
>
> *Where: S\_observed = number of species actually observed in the sample, f₁= number of species represented by exactly one read (singletons), and f₂ = number of species represented by exactly two reads (doubletons).*
>
> ## **Why CHAO1 is Valuable for Microbiome Data**
>
> CHAO1 is particularly useful for microbiome datasets because sequencing often undersamples rare species due to sequencing depth limitations. Many microbiome samples contain a number of low-abundance species, and CHAO1 provides a more accurate estimate of true community diversity than observed richness alone. It also helps compare samples with different sequencing depths.
>
> This estimator does **not** assume any particular statistical distribution for the total number of organisms in the sample, but rather relies on the empirical pattern of rare species detection to infer total richness.
> [tab] Shannon Index
>
> Citation: Shannon, C. E. (1948). “A mathematical theory of communication.” Bell System Technical Journal, 27, 379–423 & 623–656.)
>
> The **Shannon Diversity Index** (also known as Shannon-Weaver Index or Shannon Entropy) is a measure that quantifies both the **richness** (total number of different species present) and **evenness** (how equally abundant the different species are) of species in a community. Unlike simple richness measures that only count the number of different species, the Shannon Index considers how abundance is distributed among those species.
>
> ## **How the Shannon Index Works**
>
> The Shannon Index is rooted in information theory and measures the amount of "uncertainty" or "surprise" in predicting the species identity of a randomly selected individual from the community. Higher uncertainty indicates higher diversity.
>
> **Mathematical Formula**
>
> The Shannon Index is calculated as: **H' = -Σ(pi × ln(pi))**
>
> *Where: H' = Shannon diversity index, pi = proportion of individuals belonging to species i (pi = ni/N, where ni = number of individuals of species i, N = total number of individuals in the sample), ln = natural logarithm, and Σ = sum across all species.*
>
> ## **Understanding the Scale**
>
> ## **Minimum value (0)**: Occurs when only one species is present (no diversity)
>
> ## **Maximum value**: Increases with both the number of species and evenness of their distribution
>
> ## **Typical range**: Most microbiome samples fall between 1-4, with higher values indicating greater diversity
>
> ## **Practical Example**
>
> Consider two microbial communities with 4 species each:
>
> **Community A (Low evenness):**
>
> Species 1: 97 individuals
>
> Species 2: 1 individual
>
> Species 3: 1 individual
>
> Species 4: 1 individual
>
> Shannon Index ≈ 0.24
>
> **Community B (High evenness):**
>
> Species 1: 25 individuals
>
> Species 2: 25 individuals
>
> Species 3: 25 individuals
>
> Species 4: 25 individuals
>
> Shannon Index ≈ 1.39
>
> Both have the same richness (4 species), but Community B has much higher diversity due to evenness.
>
> ## **Why Shannon Index is Valuable for Microbiome Analysis**
>
> ## Shannon Index **captures both richness and evenness** in a single metric and is **sensitive to rare species**. This means it accounts for low-abundance taxa that might be ecologically important. This index is also **widely comparable** across studies and ecosystems and **robust to sampling differences** when calculated from relative abundances. The index is also **ecologically meaningful** as it relates to community stability and function.
>
> ## **Important Considerations**
>
> The Shannon Index calculates diversity based on the observed species and their relative abundances in your sample. It does **not** assume that all possible species are represented, nor does it require any specific sampling assumptions beyond the data you provide. The metric reflects the uncertainty in species identity when randomly selecting from the observed community composition.
> [tab] Simpson Index
>
> Citation: Simpson, E. H. (1949). “Measurement of diversity.” Nature, 163(4148), 688.
>
> The **Simpson Diversity Index** is a measure of community diversity that quantifies the probability that two individuals randomly selected from a sample belong to different species. Unlike the Shannon Index, which weighs all species more equally, Simpson's Index is more sensitive to changes in the most abundant species, making it particularly useful for detecting dominance patterns in microbial communities.
>
> **How the Simpson Index Works**
>
> The Simpson Index measures **dominance** rather than diversity directly. It calculates the probability that two randomly chosen individuals from the same sample belong to the same species. The index is then often converted to express diversity rather than dominance.
>
> In a highly diverse community with even abundances, the probability of randomly selecting two individuals of the same species is low. In a community dominated by one or few species, this probability is high.
>
> **Mathematical Formulations**
>
> Simpson's Dominance Index **(D): D = Σ(pi²)**, which is then converted to:
>
> Simpson's Diversity Index (1-D): **1-D = 1 - Σ(pi²)**, which is the reported value.
>
> *Where: pi = proportion of individuals belonging to species i (pi = ni/N, where ni = number of individuals of species i, and N = total number of individuals in the sample), Σ = sum across all species*
>
> ## **Understanding the Numerical Meaning:**
>
> Simpson's Diversity (1-D) ranges from 0 to 1, with higher values = greater diversity. 0 = no diversity, 1 = maximum possible diversity.
>
> High Simpson diversity often correlates with community stability. Low Simpson diversity may indicate disturbance or selective pressures. Useful for tracking recovery after perturbations (e.g., antibiotics)
>
> ## **Practical Example**
>
> Consider two microbial communities with identical richness (4 species, 100 individuals each):
>
> **Community A (High dominance):**
>
> Species 1: 94 individuals (p₁ = 0.94)
>
> Species 2: 2 individuals (p₂ = 0.02)
>
> Species 3: 2 individuals (p₃ = 0.02)
>
> Species 4: 2 individuals (p₄ = 0.02)
>
> D = (0.94)² + (0.02)² + (0.02)² + (0.02)² = 0.885
>
> 1-D = 0.115 (low diversity)
>
> **Community B (Low dominance):**
>
> Species 1: 25 individuals (p₁ = 0.25)
>
> Species 2: 25 individuals (p₂ = 0.25)
>
> Species 3: 25 individuals (p₃ = 0.25)
>
> Species 4: 25 individuals (p₄ = 0.25)
>
> D = 4 × (0.25)² = 0.25
>
> 1-D = 0.75 (high diversity)
>
> **Key Characteristics for Microbiome Analysis**
>
> The Simpson Index (1-D) is **sensitive to abundant species**, meaning that small changes in dominant species abundances significantly affect Simpson values. It is less sensitive to rare species compared to Shannon Index and is excellent for detecting shifts in community dominance structure. This index is also less affected by sequencing depth variations than richness-based metrics and stable across different sampling efforts when calculated from relative abundances.
>
> **Important Considerations**
>
> The Simpson Index reflects the dominance structure of the observed community based on relative abundances. It does not make assumptions about unobserved species or require specific sampling models. The metric directly quantifies the probability-based concept of diversity within your sample's observed composition.
## Alpha Diversity Statistics: Wilcoxon rank-sum test
> [!TIP]
>
> **How does this test work and what do the results mean?**
>
> This *non-parametric statistical test* investigates whether two independent cohorts have significantly different alpha diversity distributions. The null hypothesis is that a randomly selected value from one cohort has an equal chance of being greater or less than a value from another cohort.
>
> P-values below 0.05 indicate a significant difference, meaning the cohorts have distinct alpha diversity distributions. A negative test statistic indicates that Cohort 1 has a lower median alpha diversity compared to Cohort 2, while a positive statistic indicates the opposite.
>
> **Viewing the Test Results**
>
> Above the alpha diversity charts, the **Result Switcher** allows viewing results for "ALL" cohorts or only those with "SIGNIFICANT" differences (p\<0.05). The default is "NONE."
>
> The **Cohort Menu** offers additional filtering, enabling selection of specific cohort combinations to display test statistics and p-values. Results can be exported as TSV.
>
> Statistical P-values can also be visualized on the boxplot by turning on the **add wilcoxon overlay** toggle
### Box plots
Users have the option to visualize the alpha diversity distribution using box plot for each sample cohort selected using labels when creating comparative analysis: Wilcoxon rank sum test can also be overlayed on the boxplot chart by turning on the **add wilcoxon overlay** toggle

## Citations
**Chao1 Index** (Chao, A. (1987). “Estimating the population size for capture-recapture data with unequal catchability.” Biometrics 43(4): 783–791.+
**Shannon-Weaver Index** (Shannon, C. E. (1948). “A mathematical theory of communication.” Bell System Technical Journal, 27, 379–423 & 623–656.)
**Simpson Index** (Simpson, E. H. (1949). “Measurement of diversity.” Nature, 163(4148), 688.)
# AMR/VF Profiling
Source: https://docs.cosmosid.com/docs/amr-vf-pipeline
The Antimicrobial Resistance (AMR) and Virulence Factor (VF) profiling pipeline in Cosmos-Hub leverages Kepler to provide high-resolution, accurate detection and quantification of resistance and virulence genes from sequencing data. This pipeline uses a sophisticated k-mer-based algorithm and the Resfinder database to achieve rapid and reliable analysis.
## Pipeline Overview
The Kepler-AMR/VF Profiling pipeline leverages advanced k-mer-based algorithms and hierarchical data structures to deliver accurate, efficient, and high-resolution insights into antimicrobial resistance and virulence factors in metagenomic samples.
### Database Construction:
The pipeline utilizes a curated nucleotide gene sequences from **ResFinder** \[1] that has been split into smaller fragments called n-mers. The n-mers are categorized as:
* *Shared Biomarker Attributes*: Homologous or overlapping sequences present across multiple AMR genes.
* *Unique Biomarker Attributes*: Unique sequences specific to individual genes.
These biomarkers are organized into a hierarchical, tree-like data structure, with the backbone of the tree representing shared biomarkers between genes and the leaves representing individual genes with their unique biomarkers.
### Query Phase:
During analysis, sequencing reads from the query sample are split into k-mer sets (a type of n-mer with fixed length). These k-mers are queried against the pre-computed database to find exact matches between query biomarkers and reference biomarkers. This approach avoids the need for genome assembly, making it computationally efficient and suitable for analyzing raw sequencing reads directly.
### Abundance Estimation:
The algorithm calculates abundance by examining composite k-mer statistics and estimating coverage depth. A weighted biomarker score or abundance score is then assigned based on these calculations, reflecting the presence and prevalence of specific AMR genes or VFs in the sample.
AMR and VF features are reported as individual genes (with reference IDs where applicable) or stratified based on antimicrobial resistance classes.
### Advantages of the Kepler AMR/VF Profiler
*Efficiency*: The k-mer-based approach eliminates the need for genome assembly, reducing computational overhead while maintaining high sensitivity and specificity.
*Resolution*: The use of shared and unique biomarkers enables precise identification of AMR genes at a fine-grain level, even distinguishing between closely related genes.
*Scalability*: The tree-like data structure facilitates rapid querying and classification across large datasets.
### Applications
The pipeline is particularly valuable for clinical metagenomics, microbiome research, and antimicrobial resistance surveillance. By integrating AMR/VF data with other microbiome profiling tools in the Cosmos-Hub, researchers can perform comprehensive analyses of microbial communities and their functional attributes.
### Patented Technology
The core technology behind this pipeline is protected under several patents (US10108778B2, US20200294628A1, and ES2899879T3).
## Methodology for manuscripts
Antimicrobial resistance genes (AMR) and virulence factors (VF) were classified using the Resfinder \[1] AMR database, the VFDB \[2] VF database, and the Kepler-AMR/VF Profiler the within the Cosmos-Hub \[3]. This pipeline utilizes a pre-computed database of curated nucleotide sequences, split into n-mers and organized into a hierarchical tree-like structure based on shared biomarker attributes (homologous shared/overlap sequences among AMR genes as the tree backbone) and unique biomarker attributes (unique sequence for respective genes as the tree leaves). Metagenomic sequencing reads were divided into k-mer sets and queried against this database for exact matches. Abundance is calculated using fine-grain composite k-mer statistics and coverage depth estimation, resulting in a weighted biomarker score (abundance score) that is translated to relative abundance.
References:
1. Ferrer Florensa, A., Kaas, R. S., Clausen, P. T. L. C., Aytan-Aktug, D., & Aarestrup, F. M. (2022). ResFinder – an open online resource for identification of antimicrobial resistance genes in next-generation sequencing data and prediction of phenotypes from genotypes. Microbial Genomics, 8(1), 000748. [https://doi.org/10.1099/mgen.0.000748](https://doi.org/10.1099/mgen.0.000748)
2. Liu, B., Zheng, D., Zhou, S., Chen, L., & Yang, J. (2021). VFDB 2022: A general classification scheme for bacterial virulence factors. Nucleic Acids Research, 50(D1), D912–D917. [https://doi.org/10.1093/nar/gkab1107](https://doi.org/10.1093/nar/gkab1107)
3. Cosmos-Hub, [www.cosmos-hub.com](http://www.cosmos-hub.com)
# API Documentation
Source: https://docs.cosmosid.com/docs/api-reference/api-documentation
The bioinformatic pipelines within the Cosmos-Hub can be accessed via the Command Line through API integration.
Using the command line, you can seamlessly integrate CHAMP™, Kepler, and more into your automated workflows and operations while also leveraging our cloud infrastructure.
This guide will provide step-by-step instructions for running each of our workflows via the command line. You can find additional information on our CLI at [https://github.com/CosmosID/cosmosid-cli/blob/master/README.md](https://github.com/CosmosID/cosmosid-cli/blob/master/README.md).
> [card] [Install and Setup](https://docs.cosmosid.com/docs/api-reference/install-and-setup)
> [card] [Running the CLI](https://docs.cosmosid.com/docs/api-reference/running-the-cli)
> [card] [Example Commands: Running CHAMP](https://docs.cosmosid.com/docs/api-reference/example-running-champ)
> [card] [Example Commands: Running 16S ASV](https://docs.cosmosid.com/docs/api-reference/upload_16s)
# Example: Running CHAMP
Source: https://docs.cosmosid.com/docs/api-reference/example-running-champ
This example requires the CLI to be fully set up and operational. Please refer to the [*"Install and Setup"*](/docs/api-reference/install-and-setup) page for details. You can test your installation by typing the following command:
```bash theme={null}
#To test installation
cosmosid
```
## 1. Uploading samples for CHAMP analysis
1. In the command line, navigate to your directory containing paired-ended WGS samples in FASTQ format. CLI supports files of following extensions: 'fasta', 'fna', 'fasta.gz', 'fastq', 'fq', 'fastq.gz', 'bam', 'sra'
2. Create a cloud directory for your uploads and grab the folder key
```bash theme={null}
cosmosid --api_key --base_url https://app.cosmosid.com mkdir --name champ_test
```
1. This command will produce a folder UUID that will be used for further commands.
2. *Example output*: Folder champ\_test: 0e8ac013-07db-4ccf-a4ef-c22477556185 has been created
3. Upload your data to your new parent directory using the folder UUID and workflow command using the upload command:
```bash theme={null}
cosmosid --api_key --base_url https://app.cosmosid.com upload
--parent
--type metagenomics
--wf champ_taxa_functional_gbm_gmm
--dir $(pwd)
```
Allow \~24hours for analysis to complete.
## 2. Download results in .zip format
1. Check the list of samples and their statuses using the files command and grab the Sample UUID:
```
cosmosid --api_key --base_url https://app.cosmosid.com files
--parent
```
OR Use the following command to export all sample UUIDs within your parent directory
```
cosmosid --api_key --base_url https://app.cosmosid.com files
--parent -f csv | tail -n +3 | cut -f3 -d ‘,’ > champ_ids.tsv
```

1. Select the sample UUID(s) and use it in the reports command to download results.
```bash theme={null}
cosmosid --api_key
```
OR Use the following command with the champ\_ids.tsv file to download all of your samples within your parent directory:
```bash theme={null}
cat champ_ids.tsv | sed ‘s/”//g’ | while read line; do echo $line; cosmosid
--api_key \ --base_url reports --id $line; done
```
# Install and Setup
Source: https://docs.cosmosid.com/docs/api-reference/install-and-setup
These details are written for Terminal on Mac. Please adjust for Windows use.
> [tab] MacOS
>
> ## 1. Register with the Cosmos-Hub and obtain API key
>
> To access the pipelines within the Cosmos-Hub CLI, you need an active account on the Cosmos-Hub. Please contact your Business Development representative to obtain an account if you do not have one yet. Once you have an account credentials:
>
> Login to [https://app.cosmosid.com/](https://app.cosmosid.com/).
>
> Open [Account Details page](/docs/setting-up-your-account) and click Generate New API-Key.
>
> Copy the generated API key and use it in the subsequent CLI commands.
>
> ### Saving your API Key to local credential file
>
> To automatically authenticate your local environment, you can create credential file *\~/.cosmosid* and store your API Key into it in the following format:
>
> ```bash theme={null}
> > {
> > "api_key": ""
> > }
> ```
>
> If you chose not to store your API key in a credential file, you must directly input your API Key in each command. To use command-based API Key authentication, pass your key as an argument to the *cosmosid* command:
>
> ```bash theme={null}
> cosmosid --api_key=YOUR_API_KEY
> ```
>
> > [!WARNING]
> >
> > Please secure your API key when sharing code, as it will give any user access to your account, data, and credits.
>
> ## 2. Prepare the environment and install CLI
>
> The CLI tool requires a Python environment. We recommend using a virtual environment with Python versions 3.7-3.11. If you need more details about the virtual environment, you can review the pyenv documentation and the python venv module documentation.
>
> CosmosID CLI version 2.1.17 can be installed using either of the following commands in the command line:
>
> **PIP3**:
>
> ```bash theme={null}
> sudo pip3 install cosmosid_cli
> ```
>
> **CONDA**:
>
> ```bash theme={null}
> conda install -c cosmosid -c conda-forge cosmosid-cli
> ```
>
> ## 3. Test your install
>
> To test your install, type:
>
> ```bash theme={null}
> cosmosid
> ```
>
> 
> [tab] Windows
# Running the CLI
Source: https://docs.cosmosid.com/docs/api-reference/running-the-cli
Each command must be submitted with your API Key (unless stored in a credential file) and a Base URL:
```
cosmosid --api_key --base_url https://app.cosmosid.com
```
There are several types of commands supported by the Cosmos-Hub CLI:

### Each command has options
To get usage information for each Cosmos-Hub CLI command, the user can simply run:
```bash theme={null}
cosmosid --api_key --base_url https://app.cosmosid.com --help
```

# Example: Running 16S Short-Read
Source: https://docs.cosmosid.com/docs/api-reference/upload_16s
This example requires the CLI to be fully set up and operational. Please refer to the [*"Install and Setup"*](/docs/api-reference/install-and-setup) page for details. You can test your installation by typing the following command:
```bash theme={null}
#To test installation
cosmosid
```
## 1. Uploading samples for 16S ASV analysis
1. In the command line, navigate to your directory containing paired-ended WGS samples in FASTQ format. CLI supports files of following extensions: 'fasta', 'fna', 'fasta.gz', 'fastq', 'fq', 'fastq.gz', 'bam', 'sra'
2. Create a cloud directory for your uploads and grab the folder key
```bash theme={null}
cosmosid --api_key --base_url https://app.cosmosid.com mkdir --name 16S_project
```
1. This command will produce a folder UUID that will be used for further commands.
2. *Example output*: Folder 16S\_project: 0e8ac013-07db-4ccf-a4ef-c22477556185 has been created
3. Upload your data to your new parent directory using the folder UUID and workflow command using the upload command:
```bash theme={null}
cosmosid --api_key --base_url https://app.cosmosid.com upload \
--file sample_R1.fastq.gz --file sample_R2.fastq.gz \
--parent \
--type amplicon-16s \
--wf ampliseq \
--forward-primer \
--reverse-primer \
--dir $(pwd)
```
Allow \~24hours for analysis to complete.
## 2. Download results in .zip format
1. Check the list of samples and their statuses using the files command and grab the Sample UUID:
```
cosmosid --api_key --base_url https://app.cosmosid.com files
--parent
```
OR Use the following command to export all sample UUIDs within your parent directory
```
cosmosid --api_key --base_url https://app.cosmosid.com files --parent -f csv | tail -n +3 | cut -f3 -d ‘,’ > 16s_ids.tsv
```

1. Select the sample UUID(s) and use it in the reports command to download results.
```bash theme={null}
cosmosid --api_key
```
OR Use the following command with the 16S\_ids.tsv file to download all of your samples within your parent directory:
```bash theme={null}
cat champ_ids.tsv | sed ‘s/”//g’ | while read line; do echo $line; cosmosid --api_key --base_url reports --id $line; done
```
# Beta Diversity
Source: https://docs.cosmosid.com/docs/beta-diversity
Beta diversity is a fundamental concept in microbiome analysis that measures the differences in species composition between multiple samples or cohorts, providing insight into the variation across different environments or conditions.
## What is beta diversity and how is it calculated?
In a microbiome study, beta diversity can indicate how environmental factors, treatments, or other variables may affect microbial composition. For example, samples from a healthy gut microbiome may cluster closely together on a PCoA plot, whereas samples from a diseased gut may be more spread out, indicating greater variability in microbial composition.
Beta diversity is the ratio between the regional and local species diversity. In other words, it measures the distance or dissimilarity between each sample pair. **Relative abundance** is used as the input metric to reflect the underlying microbiome composition of the community. The aggregation level of the input data has been set to species level.

## Measures of Beta Diversity
> [!NOTE]
>
> Not sure which metric to use? Or don't know the difference between Alpha and Beta diversity?
>
> Read our page on [Beta Diversity Metrics: What They Mean & When to Use Them](https://docs.cosmosid.com/docs/blog/beta-diversity-what)
> [tab] Bray-Curtis (recommended)
>
> Citation: Bray, J. R. & Curtis, J. T. (1957). “An ordination of the upland forest communities of southern Wisconsin.” Ecological Monographs, 27, 325–349.
>
> **Bray Curtis Dissimilarity**
>
> This metric compares the abundance of species between samples. It ranges from 0 to 1, where 0 means the samples have identical compositions, and 1 means they are completely different. Imagine comparing two fruit baskets: if both have the same types and amounts of fruit, their Bray-Curtis score would be 0. If one basket is full of apples and the other is filled with oranges, the score would be closer to 1.
>
> This metric takes abundance into account and is non-phylogeny based.
> [tab] Jaccard
>
> Citation: Jaccard, Paul (1901). “Étude comparative de la distribution florale dans une portion des Alpes et des Jura.” Bulletin de la Société vaudoise des sciences naturelles (in French). 37 (142): 547–579.; Jaccard, Paul (February 1912). “The Distribution of the Flora in the Alpine Zone. 1.” New Phytologist. 11 (2): 37–50. doi:10.1111/j.1469-8137.1912.tb05611.x.
>
> **Jaccard Index**
>
> This metric measures how similar samples are based on the presence or absence of species, without considering their abundance. It ranges from 0 to 1, where 0 means no species are shared between samples, and 1 means they share the exact same species. Going back to the fruit basket analogy, if both baskets have at least one apple, their Jaccard score would be closer to 1, even if the number of apples differs.
## PCoA
Cosmos-Hub uses **PCoA (Principal Coordinate Analysis)** plots to visualize beta diversity results. PCoA plots represent samples in a two-dimensional space where the distance between points reflects the dissimilarity between samples.
* Bray-Curtis PCoA plots will show how much the composition of species differs between samples based on their relative abundances.
* Jaccard PCoA plots will reflect whether or not species are present in both samples, without considering how many of each species are found.
### Options for viewing PCoA
* **2D/3D View** - The switcher to switch between 2D and 3D view
* **Rotate graph** - Click anywhere on the PCoA and hold down to rotate the graph.
* **Labels** - You can click on a label to hide samples belonging to the corresponding cohort, click it again to show them.
* *Please note that selecting cohort labels in the Legend does not recompute the plot but only hides/reveals the corresponding samples while rescaling the axis. The axis label values for % variability explained by each principal coordinate (PCo) axis are not recalculated and correspond to a visualization including all cohorts and samples.*
* **Export** - Click "Export" in the top right corner to download the PCoA as a png or svg.
## Beta Diversity Statistics: PERMANOVA
> [!TIP]
>
> **How does PERMANOVA work and what do the results mean?**
>
> PERMANOVA (Permutational Multivariate Analysis of Variance) is a non-parametric test used to evaluate differences in beta diversity between cohorts. It calculates pairwise distances, measures within- and between-cohort variability, and employs an F test based on permutations to assess significance.
>
> A significant result (p ≤ 0.05) indicates differences in either centroid positions or dispersion among cohorts, meaning they differ compositionally.
>
> Results for each cohort comparison include sample sizes, permutation counts, F statistics, and p-values, all exportable as TSV.
>
> **Viewing the test results**
>
> The **Result Switcher** (default: "NONE") above the charts enables viewing results for either "ALL" cohort comparisons or only those with "SIGNIFICANT" differences (p\<0.05).
>
> The **Cohort Menu** allows further filtering of cohort comparisons via checkboxes, adjusting the displayed results accordingly. Export options to TSV are available.
## References
Anderson, M. (2001). A new method for non‐parametric multivariate analysis of variance. Austral Ecology 26(1), 32-46. [https://dx.doi.org/10.1111/j.1442-9993.2001.01070.pp.x](https://dx.doi.org/10.1111/j.1442-9993.2001.01070.pp.x)
Anderson, M. (2014). Permutational Multivariate Analysis of Variance (PERMANOVA). Wiley StatsRef: Statistics Reference Online. [https://doi.org/10.1002/9781118445112.stat07841](https://doi.org/10.1002/9781118445112.stat07841)
**Jaccard Index** (Jaccard, Paul (1901). “Étude comparative de la distribution florale dans une portion des Alpes et des Jura.” Bulletin de la Société vaudoise des sciences naturelles (in French). 37 (142): 547–579.; Jaccard, Paul (February 1912). “The Distribution of the Flora in the Alpine Zone. 1.” New Phytologist. 11 (2): 37–50. doi:10.1111/j.1469-8137.1912.tb05611.x.)
**Bray-Curtis Dissimilarity** (Bray, J. R. & Curtis, J. T. (1957). “An ordination of the upland forest communities of southern Wisconsin.” Ecological Monographs, 27, 325–349.)
# Alpha Diversity Metrics: How to Choose the Right One
Source: https://docs.cosmosid.com/docs/blog/alpha-diversity-what
Alpha diversity is all about the variety **within** a single sample. Think: how many different species are there (richness)? And how evenly are those species spread out (evenness)? There are a few ways to measure this, depending on what you're looking for.
> [!TIP]
>
> Typically, **we recommend report results for all calculated metrics** (e.g., "CHAO1: p=0.002, Shannon: p=0.042, Simpson: p=0.067") as they may show different patterns depending on the underlying community changes.
There are several metrics in which diversity is measured. The Cosmos-Hub features the most common in microbiome research:
**Chao1 Index** (Chao, A. (1987). “Estimating the population size for capture-recapture data with unequal catchability.” Biometrics 43(4): 783–791.+
**Shannon-Weaver Index** (Shannon, C. E. (1948). “A mathematical theory of communication.” Bell System Technical Journal, 27, 379–423 & 623–656.)
**Simpson Index** (Simpson, E. H. (1949). “Measurement of diversity.” Nature, 163(4148), 688.)
## **❓"I want to know how many species are really there (even the rare ones)."**
➡ **Use: CHAO1 Index**
* Best when your sample has lots of low-abundance organisms (like in microbiome studies).
* Estimates the total number of species by using the pattern of rare species detection (singletons and doubletons).
* Useful when you suspect that sequencing depth limitations prevented detection of some species.
* Based on capture-recapture principles—doesn't assume any particular statistical distribution for your data.
**Takeaway:** CHAO1 is your go-to when you're trying to estimate the **true** number of species, including the ones that are too rare to be detected reliably in your sample.
## **❓"I care about both how many species there are and how evenly they're spread."**
➡ **Use: Shannon Index**
* A balanced metric that considers both richness (how many) and evenness (how equal).
* Measures the "uncertainty" in predicting species identity when randomly selecting an individual.
* Sensitive to both common and rare species in the community.
* Higher values indicate greater diversity through either more species or more even distribution.
**Takeaway:** Shannon Index gives you a comprehensive picture of community complexity. If your sample has 10 species but one makes up 90% of the total, the Shannon score will reflect that imbalance and show lower diversity.
## **❓"I'm mostly interested in the dominant players."**
➡ **Use: Simpson Index**
* Focuses heavily on the most abundant species in the community.
* Measures the probability that two randomly selected individuals belong to different species.
* Less sensitive to rare or low-abundance species compared to Shannon.
* Excellent for detecting changes in community dominance structure.
**Takeaway:** Simpson Index is great when you're interested in who's **really** running the show in your community and how dominance patterns change between samples.
## **🧭 So…which one should I use?**
Best practice is to calculate and report all three metrics, as they capture different aspects of diversity. However, if focusing on one metric for your analysis:
| **Goal** | **Best Metric** | **Why** |
| :- | :- | :- |
| Estimate total species richness | CHAO1 | Accounts for undetected rare species |
| Comprehensive diversity assessment | Shannon Index | Balances richness and evenness |
| Focus on dominance patterns | Simpson Index | Emphasizes abundant species |
| Compare across studies | Use combination | Different metrics reveal different patterns |
## **📈 What About Statistical Testing?**
Alpha diversity metrics can be statistically compared between groups using **non-parametric tests**:
**Wilcoxon Rank-Sum Test (Mann-Whitney U):** For comparing two groups
* Tests whether the distributions of diversity values differ significantly between groups
* Appropriate when data may not be normally distributed
**Kruskal-Wallis Test:** For comparing more than two groups
* Non-parametric equivalent of one-way ANOVA
* Follow with post-hoc tests if significant differences are found
**Important Considerations:**
* Always visualize your data first (boxplots, violin plots)
* Check for outliers that might influence results
* Consider multiple testing corrections when comparing many groups
* Report effect sizes alongside p-values when possible
# Beta Diversity Metrics: How to Choose the Right One
Source: https://docs.cosmosid.com/docs/blog/beta-diversity-what
Beta diversity helps you compare **differences between samples**. So if alpha diversity is about what’s inside a single sample, beta is about how different two samples are from each other. Whether you’re comparing treatment groups, timepoints, or environments, beta diversity gives you insight into how microbial communities shift.
Cosmos-Hub calculates beta diversity using **relative abundance at the species level**, which makes comparisons consistent across all your samples.
There are several metrics in which diversity is measured. The Cosmos-Hub features the most common in microbiome research:
**Jaccard Index** (Jaccard, Paul (1901). “Étude comparative de la distribution florale dans une portion des Alpes et des Jura.” Bulletin de la Société vaudoise des sciences naturelles (in French). 37 (142): 547–579.; Jaccard, Paul (February 1912). “The Distribution of the Flora in the Alpine Zone. 1.” New Phytologist. 11 (2): 37–50. doi:10.1111/j.1469-8137.1912.tb05611.x.)
**Bray-Curtis Dissimilarity** (Bray, J. R. & Curtis, J. T. (1957). “An ordination of the upland forest communities of southern Wisconsin.” Ecological Monographs, 27, 325–349.)
### ❓“I want to compare both what species are there *and* how abundant they are.”
**➡ Use: Bray-Curtis Distance (Recommended)**
* Accounts for both the species present **and** their relative abundances.
* Great if you're studying treatments or interventions that affect microbial load.
* Helps detect even subtle shifts in species proportions (not just who's there).
* Ideal for biologically meaningful comparisons where abundance matters.
🧠 **Takeaway:** Bray-Curtis gives you a score from 0 (identical samples) to 1 (totally different). For example, if two samples have the same species but wildly different proportions (like 90% vs. 10% E. coli), Bray-Curtis picks up that difference. Jaccard wouldn’t.
🔬 **Example:** If healthy gut samples cluster tightly (i.e., look similar) while diseased ones scatter across the PCoA plot, it suggests that disease increases variation in community composition.
### ❓“I only care about whether species are present, not how many.”
**➡ Use: Jaccard Distance**
* Looks only at **presence or absence** of species. Ignores how abundant they are.
* Great for studying colonization patterns or species co-occurrence.
* Useful when abundance data is noisy or not biologically meaningful.
* Helps answer questions like: “Do these two environments host the same species?”
🧠 **Takeaway:** Two samples can have the same Jaccard distance whether a species is at 1% or 99%. If the species are there, they’re counted. No more, no less.
### 📊 How Do I Interpret the Results?
Cosmos-Hub visualizes both Bray-Curtis and Jaccard using **PCoA (Principal Coordinates Analysis)** plots.
* **Distance between dots = how different the samples are**
* **Tight clusters = similar communities**
* **Wide spread = more variation**
* **Group separation = distinct community types (e.g., treated vs. untreated)**
### 🧭 Which One Should I Use?
Best practice is to report p-values for all metrics (e.g., Bray-Curtis p=0.001, Jaccard p=0.042). But if only plotting one metric in your paper, follow these guidlines:
| Goal | Best Metric |
| - | - |
| Compare species + abundance (quantitative) | **Bray-Curtis** |
| Compare species presence only (qualitative) | **Jaccard** |
| Get the full picture | **Use both** |
#### ✔️ Bray-Curtis:
* You're analyzing treatment effects or dose-response changes
* Abundance differences are biologically meaningful
* Studying metabolic activity or disease progression
#### ✔️ Jaccard:
* You're focusing on who’s there, not how much
* Abundance is unreliable or irrelevant
* Looking at biogeography or species colonization
#### ✔️ Both:
* You want to distinguish **species turnover** from **abundance shifts**
* You're publishing and want reviewers to see both angles
* You need complementary insights (structure and membership)
### 📈 What About Statistical Testing?
Both Bray-Curtis and Jaccard can be analyzed using **PERMANOVA** (Permutational Multivariate Analysis of Variance):
* Tests if microbial communities differ significantly between groups
* Outputs include **F-statistics** and **p-values**
* Helpful for validating patterns seen in your visualizations
### ✅ Cosmos-Hub Recommends…
Start with **Bray-Curtis**. It’s the most **biologically informative** metric for most use cases in microbiome research. But don’t hesitate to layer on Jaccard if your study asks broader questions about community membership.
# Extending MaAsLin3: Exporting Input Data and Building Prevalence Models
Source: https://docs.cosmosid.com/docs/blog/extending-ma-as-lin3-how-to-export-input-data-and-build-prevalence-presence-absence-models-in-cosmos-hub
Learn how to export MaAsLin3 input data from Cosmos‑Hub and build custom presence/absence logistic regression models aligned with the MaAsLin3 prevalence framework.
# Building Custom Prevalence Models
MaAsLin3 in Cosmos‑Hub simultaneously models both **abundance** and **prevalence** associations from the same microbiome feature table, making it one of the most comprehensive tools available for differential microbiome analysis. This guide explains how MaAsLin3 defines prevalence internally, how to export the correct data from Cosmos‑Hub, and how to use that data to build custom logistic regression models for secondary prevalence analyses.
> [!NOTE]
>
> This guide is intended for researchers who have already run MaAsLin3 in Cosmos‑Hub and want to extend their prevalence analysis using external tools such as R or Python. If you have not yet run MaAsLin3, start with the [MaAsLin3 overview](https://docs.cosmosid.com/docs/maaslin3).
***
## How MaAsLin3 Models Prevalence
MaAsLin3 is a generalized multivariable modeling framework designed to identify microbial associations in complex, high-dimensional datasets. Unlike approaches that model only abundance, MaAsLin3 captures two complementary biological signals from the same input feature table:
* **Prevalence** – *how often* a feature is detected across samples, modeled via logistic regression on a binary presence/absence profile.
* **Abundance** – *how much* of a feature is present when detected, modeled via log‑linear regression on non‑zero abundances.
As described in the MaAsLin3 paper ([Nature Methods, 2025](https://www.nature.com/articles/s41592-025-02923-9)):
> "MaAsLin 3 takes as input a table of microbial community feature abundances and metadata. These feature data are normalized, filtered, split into prevalence (present versus absent) and log‑transformed nonzero abundances, and fit with a modified logistic model and a linear model, respectively."
When MaAsLin3 runs in Cosmos‑Hub, the workflow proceeds as follows:
1. The input feature abundance table (taxa, pathways, or functional features) is normalized — by default using total‑sum scaling to relative abundances.
2. Optional filtering is applied to remove extremely rare or low-variance features based on **minimum prevalence**, **minimum abundance**, and **minimum variance** thresholds.
3. The filtered table is split into:
* A **binary prevalence profile** (present = 1, absent = 0) for logistic regression.
* A **non‑zero abundance subset** (log‑transformed) for linear regression.
This means that the same abundance values in the `Input Data` export are the source of both the prevalence and abundance models.
***
## Defining Presence for Custom Logistic Regression
A common question when extending MaAsLin3 results is: **what threshold should I use to define "presence"?**
The answer is straightforward. MaAsLin3 defines presence as **any non‑zero value** in the normalized feature table. There is no alternative recommended cutoff (such as >1e‑4 or >1% relative abundance) in the MaAsLin3 documentation or paper. Sparsity is managed through **feature filtering parameters** applied before the model, not by changing the definition of presence itself.
### Recommended binary coding
| Value in Input Data | Prevalence Code | Interpretation |
| - | - | - |
| > 0 | **1** | Present |
| = 0 | **0** | Absent |
Using this coding ensures your external logistic regression models are conceptually consistent with the prevalence associations reported by MaAsLin3 in Cosmos‑Hub.
> [!TIP]
>
> If your study has a validated **limit of detection (LOD)** — for example, from spike‑in calibration or qPCR — you may choose to define presence as "above LOD" rather than strictly "> 0." This is a valid study‑specific decision but is not required by MaAsLin3 itself.
***
## Exporting MaAsLin3 Input Data from Cosmos‑Hub
To build a presence/absence matrix that mirrors MaAsLin3, start from the exact feature table used in the Hub run.
**1. Open your MaAsLin3 comparative analysis**
Navigate to your MaAsLin3 run from the [Comparative Analysis dashboard](https://docs.cosmosid.com/docs/new-comparative-analysis) in Cosmos‑Hub.
**2. Click Export**
Click the **Export** button in the top‑right of the analysis view. Cosmos‑Hub will generate and download a ZIP archive containing all output files for your MaAsLin3 run.
**3. Locate the three key files**
Inside the ZIP, you will find:
* **`Input Data`** — A `.tsv` abundance matrix used as MaAsLin3's feature input (samples as rows, features as columns). This is the primary file for building presence/absence variables.
* **`Input Metadata`** — A `.tsv` file with all metadata variables used as covariates and outcomes in the model.
* **`Association Results`** — The full MaAsLin3 output table with model type (abundance vs prevalence), beta coefficients, p‑values, and q‑values (FDR).
The official documentation for MaAsLin3 results and exports is available here:\
[https://docs.cosmosid.com/docs/maaslin3-view-results](https://docs.cosmosid.com/docs/maaslin3-view-results)
***
## Building a Presence/Absence Matrix
Once you have exported the `Input Data` file, follow these steps to create a binary presence/absence matrix for logistic regression.
**1. Load the Input Data table**
Import the `Input Data` `.tsv` file into R, Python, or your preferred statistical environment. The table has samples as rows and microbial features (taxa, pathways, etc.) as columns.
**2. Recode each feature column to binary**
For each feature (column), apply the following rule:
* Assign **1** if the value is **> 0** (present).
* Assign **0** if the value is **= 0** (absent).
**3. Apply a minimum prevalence filter**
Before fitting logistic models, exclude features that are extremely rare. See the section below on choosing a minimum prevalence threshold.
**4. Run logistic regression**
Use the binary presence/absence matrix as the response variable and the `Input Metadata` variables as predictors.
Because you are using the same feature table that MaAsLin3 used, your custom prevalence models will be directly comparable to the "Prevalence" associations shown in the MaAsLin3 Association Results tab and export files.
***
## Choosing a Minimum Prevalence Threshold
Running logistic regression on extremely rare features — those present in only a few samples — leads to unstable model estimates, separation issues, and uninterpretable results. It is therefore recommended to apply a **minimum prevalence filter** to your feature set before modeling.
### How to calculate prevalence
For each feature, compute its prevalence as:
*Prevalence (%) = \[Number of samples where feature is present (> 0)]/\[Total number of samples]]*
### Recommended thresholds
| Study size | Suggested minimum prevalence |
| - | - |
| Large cohort (n > 100) | 5% of samples |
| Medium cohort (n = 50–100) | 10% of samples |
| Small cohort (n \< 50) | 10–20% of samples |
These thresholds are informed by common MaAsLin‑style workflow guidance, which recommends removing low-prevalence features prior to association testing to improve model stability and interpretability.
Reference: [Running MaAsLin2 Workflow – Cosmos‑Hub](https://docs.cosmosid.com/docs/maaslin2-running-workflow) (prevalence filtering guidance is equally applicable to MaAsLin3 downstream analyses).
> [!WARNING]
>
> Setting your minimum prevalence threshold too low (e.g., 1% of samples in a small cohort) may introduce unstable logistic models with inflated or non-convergent estimates. Always check that your included features have sufficient "events" (presence observations) to support the number of predictors in your model.
***
## Example Methods Text
Use the following template for your manuscript or internal SOP methods section, adapted to your study:
> "For secondary prevalence analyses, the MaAsLin3 input abundance matrix was exported from Cosmos‑Hub ([www.cosmos-hub.com](http://www.cosmos-hub.com), Cmbio, Germantown, MD). Each microbial feature was coded as present (1) when its input abundance was non‑zero and absent (0) otherwise, consistent with the binary presence/absence framework used by MaAsLin3 for logistic prevalence modeling \[cite MaAsLin3 paper]. Features with prevalence below \[X]% of samples were excluded prior to logistic regression to reduce model instability driven by extremely rare taxa."
Replace **\[X]%** with your chosen minimum prevalence threshold (e.g., 5%, 10%).
***
## Frequently Asked Questions
> [accordion] Should I use the Input Data or the Association Results file to build my prevalence matrix?
>
> Use the **Input Data** file. This contains the normalized abundance matrix that MaAsLin3 used as input, from which you can derive binary presence/absence values. The Association Results file contains model outputs (coefficients, p‑values), not the raw feature table.
> [accordion] Does MaAsLin3 recommend a specific presence threshold higher than >0?
>
> No. The MaAsLin3 paper and Bioconductor documentation do not recommend any threshold other than non-zero for defining presence. Sparsity is controlled via pre-model filtering parameters (minimum prevalence, minimum abundance), not by adjusting the presence definition.
> [accordion] Can I use a relative abundance cutoff (e.g., >0.01%) to define presence?
>
> You can, but only if justified by a study-specific rationale such as a known LOD. It is not consistent with how MaAsLin3 internally defines prevalence, and it may reduce comparability with your MaAsLin3 results.
> [accordion] What filtering does MaAsLin3 apply before splitting the data into prevalence and abundance?
>
> By default, MaAsLin3 applies minimum prevalence, minimum abundance, and minimum variance filters to remove uninformative features. The exact parameters used in your Cosmos-Hub run are reflected in the filtered `Input Data` export, so any features that were excluded by MaAsLin3 prior to modeling will not appear in the export.
***
## Reference Links
> [card] [MaAsLin3 in Cosmos‑Hub](https://docs.cosmosid.com/docs/maaslin3)
>
> Overview and setup guide for running MaAsLin3 in the Cosmos‑Hub statistics toolbox.
> [card] [Viewing MaAsLin3 Results](https://docs.cosmosid.com/docs/maaslin3-view-results)
>
> Guide to interpreting MaAsLin3 outputs and exporting Input Data, Input Metadata, and Association Results.
> [card] [MaAsLin3 Paper (Nature Methods)](https://www.nature.com/articles/s41592-025-02923-9)
>
> Nearing et al. (2025). MaAsLin 3: refining and extending generalized multivariable linear models for meta‑omic association discovery.
> [card] [MaAsLin3 on PubMed / PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC11661281/)
>
> Open-access version of the MaAsLin3 methods paper via PubMed Central.
> [card] [MaAsLin3 User Manual](https://www.bioconductor.org/packages/release/bioc/vignettes/maaslin3/inst/doc/maaslin3_manual.html)
>
> Full Bioconductor vignette covering MaAsLin3 parameters, normalization, filtering, and model types.
> [card] [MaAsLin3 Tutorial](https://bioc.r-universe.dev/articles/maaslin3/maaslin3_tutorial.html)
>
> Step-by-step MaAsLin3 tutorial from the Huttenhower Lab covering input formats, model options, and outputs.
> [card] [Create Comparative Analysis](https://docs.cosmosid.com/docs/new-comparative-analysis)
>
> How to create and configure a comparative analysis in Cosmos‑Hub for running MaAsLin3 and other statistics.
> [card] [MaAsLin2 Workflow & Filtering](https://docs.cosmosid.com/docs/maaslin2-running-workflow)
>
> Filtering guidance for MaAsLin-style workflows, including minimum prevalence thresholds applicable to downstream MaAsLin3 analyses.
# Bubble Graph
Source: https://docs.cosmosid.com/docs/bubble-graph
## What is a bubble graph?
A bubble graph shows the different organisms identified in your sample based on their relative abundance.

## When to use a bubble graph
It is useful for looking at the distribution of abundance - is the sample composed of a few organisms that are present at a high abundance and many organisms at a much lower abundance or are the organisms present at equal abundances, for example.
# CHAMP Human Microbiome and Functional Profiling
Source: https://docs.cosmosid.com/docs/champ2
This documentation is intended for researchers who require detailed understanding of the CHAMP pipeline architecture, underlying methods, and functional profiling outputs.
> **CHAMP is published in Frontiers in Microbiology!**
>
> Read about pipeline and benchmarking stats in our recent paper, [*"CHAMP delivers accurate taxonomic profiles of the prokaryotes, eukaryotes, and bacteriophages in the human microbiome"*](https://www.frontiersin.org/journals/microbiology/articles/10.3389/fmicb.2024.1425489/full)
# Overview
CHAMP is a next-generation human microbiome profiling pipeline developed to deliver high-resolution taxonomic and functional insights from shotgun metagenomic sequencing data. By leveraging an expansive and highly curated reference database, CHAMP offers precise species-level identification, robust functional potential profiling, and superior performance compared to other commonly used tools in the field. Some highlights of the pipeline include:
* **Species-level resolution** across prokaryotes, eukaryotes, and viruses.
* **Built on 400,000+ metagenome-assembled genomes (MAGs)** from >30,000 human microbiome samples
* **Benchmark-leading accuracy** compared to MetaPhlAn4, Kraken2, Bracken, and Centrifuge
* **Functional annotations** from [Gut-Brain Module (GBM)](https://raeslab.org/software/gbms.html), [Gut-Metabolic Module (GMM)](https://github.com/raeslab/GMMs), and [KEGG](https://www.genome.jp/kegg/)
* **Supports phage/virome detection**, strain-level profiling, and clonal resolution (custom analysis; contact [info@cmbio.io](mailto:info@cmbio.io))
.png?fit=max\&auto=format\&n=1_URKzklO7hYjRsk\&q=85\&s=6faae1115d215530cbd5516dd2f97702)
### Use Cases:
* **Human health studies** (e.g., IBD, metabolic disorders)
* **Probiotic development** (strain-specific tracking, clonal resolution)
* **Population-scale microbiome research**
* **Virome and bacteriophage profiling**
# Reference Database Construction
1. **Reference catalog is derived from:**
* Publicly available MAGs (UHGG, ELGG)
* Clinical Microbiomics/Cmbio in-house MAGs
* NCBI/PATRIC genomes (to capture pathogens, probiotics, food-related species)
2. **MAG Processing**
* Assembly tools: Megahit, metaSPAdes
* Binning: VAMB
* Quality control: CheckM2 (>90% completeness, \<5% contamination), GUNC
* Annotation: GTDB-Tk with GTDB r214
3. **Species Clustering**
* MAGs clustered at 95% ANI using dRep/FastANI
* Pan-genomes constructed in 3 stages using MMseqs2 and CD-HIT
* Final database includes \~6,567 prokaryotic species clusters and 244 eukaryotic species
* Final non-redundant gene catalog: >25 million genes
# Species Quantification
**Signature Gene Selection**
Each species is represented by up to 250 **signature genes**, selected for:
* Uniqueness (no cross-species matches at >97% identity for >=100 bp)
* Core gene status (present in >=60% of MAGs)
* Length (>=200 bp and \<=20 kbp)
If fewer than 20 unique genes are available, segments without homologs are selected and masked accordingly.
# Read Mapping & Quantification
1. **Preprocessing:**
* Human host-filtering (GRCh38 via Bowtie2)
* Adapter and quality trimming (AdapterRemoval)
* Paired-read retention (both reads >=100 bp)
2. **Read Mapping:**
* BWA-MEM with >=95% identity over >=100 bp and MAPQ >=20
* Reads categorized as uniquely mapped, multi-mapped, or unmapped
3. **Abundance Estimation:**
* Based on a negative binomial model using signature gene counts
* Adjusted for gene length and mapping confidence
* Outlier filtering via quantile boundaries
* Final species abundances normalized to sum to 100% per sample
# Read Count Adjustment and Reporting
Due to the sample-specific removal of outlier genes from abundance estimation, effective genome length varies across samples. As a result, raw species read counts are not directly proportional to estimated species abundance.
To correct for this, raw species read counts are adjusted to reflect abundance using the following procedure:
* Each species abundance is multiplied by the sum of effective gene lengths for its signature genes (all signature genes are included in the sum, even those flagged as outliers).
* These scaled values are then normalized so that their sum matches the total number of reads mapping to signature genes in the sample.
* Finally, adjusted values are rounded to integers, minimizing rounding discrepancy and ensuring the aggregate read count remains unchanged
> [!NOTE]
>
> \*\*Why are counts and RA (Relative Abundance) not proportional?
\*\*
>
> Species read counts and relative abundance (RA) are not directly proportional because outlier signature genes are removed per sample, causing the effective genome length of each species to fluctuate. This technical adjustment ensures consistency but means that counts and RA reflect different underlying calculations, as described in the methodology above
# Functional Profiling
**Functional Annotation**
* **Prokaryotic genes:** Annotated using EggNOG-mapper (v5.0) for orthologous groups and KEGG Orthology (KO)
* **Eukaryotic genes:** Annotated with KofamScan using KO assignments
**Functional Modules**
CHAMP links functional potential to taxonomic identity through defined modules:
1. [**KEGG Modules**](https://www.genome.jp/kegg/)
* Defined as sets of KO identifiers encoding a biological function or pathway
* A species is considered to possess a KEGG module if:
1. It contains genes for >= 2/3 of the required steps
2. For modules with alternative paths, only one must meet the 2/3 threshold
3. Modules with \<=3 steps require all steps present
* **Module Abundance (Cellular Abundance):** Computed as the sum of relative abundances of species possessing the module
2. [**Gut-Brain Modules (GBMs)**](https://raeslab.org/software/gbms.html)
* 56 microbial pathways involved in the synthesis/degradation of neuroactive compounds (e.g., GABA, dopamine)
* Pathways defined using KO, TIGRFAM, and EggNOG orthologs
* Same 2/3-rule applies for species inclusion
3. [Gut Metabolic Modules (GMMs)](https://github.com/raeslab/GMMs)
* 103 conserved gut microbiome pathways (e.g., SCFA production, bile acid metabolism)
* Module completion and quantification rules follow KEGG module logic
> [!TIP]
>
> **Cellular Abundance vs. Relative Abundance**
>
> | Metric | Cellular Abundance (CHAMP) | Relative Abundance (e.g., Kepler) |
> | :- | :- | :- |
> | Basis | Species-level gene presence & pathway completeness | Read alignment to functional gene signatures |
> | Weighting | Based on species abundance | Based on normalized read counts (e.g., CPM) |
> | Output Interpretation | Fraction of species capable of function | Proportional activity/presence of gene products |
> | Data Flow | Species -> Function | Reads -> Function |
>
> 
# CHAMP Benchmarking
CHAMP demonstrates best-in-class performance using both CAMI and NIBSC benchmarks against the best and most widely used profiling pipelines in the field.
* Compared to MetaPhlAn4, CHAMP showed 16% greater sensitivity (recall) across different human body sites and showed an astounding 400 times lower false signal in the NIBSC mock community benchmark compared to state-of-the-art profilers (MetaPhlAn4, Centrifuge, Kraken, and Bracken). This means that when CHAMP detects something, you can trust it's there.
* CHAMP uses the latest GTDB annotation which includes more rare species and, compared to NCBI, often classifies sub-species as species in their own right.
* Read the benchmark whitepaper here: [CHAMP Benchmark Whitepaper](https://hubs.ly/Q03y7s_L0)

# Detailed Methods Summary
> [accordion] Gene Catalog and Species Definition
>
> The Clinical Microbiomics Human Microbiome Reference HMR05 gene catalog is derived primarily from high-quality (HQ) prokaryotic MAGs (metagenome-assembled genomes) identified from 30,382 human microbiome samples collected from nine distinct human body sites: gut (n = 19,296), oral (n = 4994), skin (n = 4306), urine (n = 934), small intestine (n = 780), nasopharyngeal (n = 422), vaginal (n = 367), airway (n = 108), and milk (n = 100). This includes MAGs available from UHGG (89,262 MAGs, PMID: 32690973) and from ELGG (25,303 MAGs, PMID: 36050292). 11% (n = 3317) of the samples were not publicly available. In addition, genome assemblies from NCBI and PATRIC were added to capture otherwise missing species of interest (human-associated pathogens, probiotics, food ingredients, and species relevant for benchmarking). Human-relevant eukaryotic species were manually identified from various sources, including an analysis of gut fungal species (PMID: 29178920), publicly available lists of pathogens, the eukaryotes profiled by MetaPhlAn 4 (PMID: 36823356), and various species relevant for benchmarking, resulting in 2740 genomes representing 244 species.
>
> For MAGs not obtained from publicly available MAG collections, reads were host-filtered, trimmed, and assembled into contigs with Megahit (v. 1.2.9, PMID: 25609793) or metaSPAdes (v. 3.15.5, PMID: 28298430), and then binned using VAMB (v. 3.0.6, PMID: 33398153). MAGs were considered high-quality if they had > 90% completeness and \< 5% contamination based on CheckM2 (v. 2022-07-19) and passed the GUNC chimerism test (v. 1.0.5, PMID: 34120611). All MAGs were taxonomically annotated using GTDB-Tk (v. 2.3.0, PMID: 36218463) with GTDB database version r214 (PMID: 34520557). To combine MAGs from multiple VAMB batches and MAG collections, MAGs annotated to the same species were merged into species clusters. MAGs without GTDB-Tk species-level annotations were merged with each other or with existing species clusters at 95% ANI (dRep, PMID: 28742071; FastANI, PMID: 30504855). This resulted in 6567 prokaryotic species clusters, 10% of which were unannotated at species level. To derive a pan-genome catalog for each species, we used a three-step clustering approach. First, genes were clustered with MMseqs2 (v. 14, PMID: 29959318) with 98% identity and 90% bi-directional coverage. Second, the representatives from the first iteration were clustered with MMseqs2 with 95% identity and 90% bi-directional coverage. Representatives of the second iteration were chosen as the ones with highest cardinality from the first iteration. Third, the second iteration representatives were clustered with cd-hit (cd-hit-est, v. 4.8.1, PMID: 23060610) with 95% identity and 90% coverage of the shorter sequence. Genes shorter than 100 bp or with species prevalence \< 1% were discarded.
>
> For prokaryotes and eukaryotes separately, the entire set of pangenomes were then clustered with MMseqs2 with 97% identity and 90% bi-directional coverage to obtain between-species clusters. The pan-genomes from prokaryotic (n = 6567) and eukaryotic (n = 244) species were merged into a final gene catalog of 25,761,278 genes. To enable quantification of each species in the database, up to 250 signature genes were selected for each species based on core genes (> 60% prevalence in species MAGs) with a length > 200 bp and \< 20 kbp. Furthermore, signature genes were required to be species-unique, with no alignments of 100 bp with > 97% sequence-identity to other genes in the catalog; however, if fewer than 20 genes meeting this criteria were available for a species, then genes with segments > 200 bp without alignments to other genes were used, and non-unique segments of these genes were masked.
> [accordion] Sequencing data preprocessing
>
> Raw FASTQ files were filtered to remove human genomic contamination by discarding read pairs in which either read mapped to the human reference genome GRCh38.p14 with Bowtie2 (v. 2.4.2, Langmead and Salzberg 2012, PMID: 22388286) in local alignment mode. Reads were then trimmed to remove adapters and bases with a Phred score below 30 using AdapterRemoval (v. 2.3.1, Schubert et al. 2016, PMID: 26868221). Trimmed, host-filtered read pairs with both lengths > 100 bp, defined as high-quality non-host (HQNH) reads, were retained
> [accordion] Mapping reads to the gene catalog
>
> HQNH reads were mapped to the gene catalog using BWA mem (v. 0.7.17) (Li and Durbin 2009, PMID: 19451168). An individual read was considered uniquely mapped to a gene if the MAPQ was >= 20 and the read aligned with >= 95 % identity over >= 100 bp. However, if > 10 bases of the read did not align to the gene or extend beyond the gene, the read was considered unmapped. Reads meeting the alignment length and identity criteria but not the MAPQ threshold were considered multi-mapped.
>
> Each read pair was counted as either 1) uniquely mapped to a specific gene, if one or both individual reads were uniquely mapped to a gene, or 2) multi-mapped, if neither read was uniquely mapped, and at least one was multi-mapped, or 3) unmapped, if both individual reads were unmapped. If the two reads were each uniquely mapped to a different gene, the gene mapped by read 1 was counted but not the gene mapped by read 2. A gene count table was created with the number of uniquely mapped read pairs for each gene.
> [accordion] Read Count Adjustment and Reporting
>
> The sample-specific removal of outlier genes for abundance estimation means that the effective genome length of a given species often varies from sample to sample. Thus, the raw species read counts are not directly proportional to the estimated species abundance and thus cannot be readily compared using standard count-based statistical methods. Therefore, the species read counts were adjusted to be proportional to species abundances with the following procedure: First, each species abundance was multiplied by the sum of its signature gene effective gene lengths (with all signature genes included, even those that were removed as outliers). Second, these values were scaled to sum to the total number of reads mapping to signature genes. Finally, these values were rounded to integers such that the rounded/unrounded discrepancy was minimized while retaining the total number of reads.
> [accordion] Species relative abundance calculation
>
> The expected read counts for signature genes in each species in each sample were modeled with a negative binomial distribution as follows. First, if >=50 of the signature genes for a species had non-zero read counts and >=99% of genes were expected to have non-zero read counts given the total read count for that species (1-(((n\_genes-1)/n\_genes)^n\_reads)>=0.99), then signature genes with zero reads were ignored in that sample. Second, the expected 99% quantile (between 0.5% and 99.5%) of read counts were calculated for each gene based on a negative binomial distribution with a mean proportional to the effective gene length (accounting for read length and mapping alignment criteria) and dispersion defined as log2(effective gene length). The abundance of each species was then calculated as the mean read count normalised by effective gene length based on reads mapping to signature genes with observed read counts within the expected 99% quantile. Species abundances were set to zero if less than 5 genes with non-zero read counts were within the 99% quantile. Furthermore, species with \<66% of genes with non-zero read count within the 99% quantile were set to zero, unless the median abundance of signature genes was non-zero, in which case the median gene-length-corrected abundance of non-zero genes was used. Abundances were then normalized sample-wise such that the total abundance of all species sums to 100 %.
> [accordion] Functional annotation and profiling
>
> EggNOG-mapper (v. 2.1.7, Diamond mode, Cantalapiedra et al. 2021, PMID: 34597405) was used to map prokaryotic genes in the gene catalog to the EggNOG orthologous groups database (v. 5.0, Huerta-Cepas et al. 2019, PMID: 30418610) and Kyoto Encyclopedia of Genes and Genomes (KEGG) Orthology (KO) database. Eukaryotic genes were annotated using KofamScan (PMID: 31742321). Functional potential profiles based on KOs were calculated as the proportion of the total gene abundance that mapped to a given KO.
>
> Kyoto Encyclopedia of Genes and Genomes (KEGG) modules (v. 78.2) (Kanehisa and Goto 2000, PMID: 10592173) are defined as a set of KOs that enable a specific function or pathway. Functional potential profiles based on KEGG modules were generated from the species profiles. For this, we identified the set of species associated to each of the KEGG modules by following three criteria: 1) a species was associated to a KEGG module if it included at least 2/3 of the genes encoding the proteins/enzymes needed to complete the functionality of the module, 2) if a module had alternative reaction paths, only one of these was required to be 2/3 complete, 3) for modules with three or fewer steps, all steps were required to be comprised in the given species. KEGG module profiles based on counts, relative abundances, rarefied counts and rarefied relative abundances were then calculated by adding, respectively, the number of counts, relative abundances, rarefied counts and rarefied relative abundances from each species associated to a given KEGG module.
> [accordion] Gut-Brain Modules (GBM)
>
> **New Accordion**
>
> The gut-brain modules (GBMs) are a set of 56 microbial pathways for metabolizing neuroactive compounds (molecules that have the potential to interact with the human nervous system). Each GBM corresponds to a single neuroactive compound synthesis or degradation process by members of the gut microbiota and is defined as a series of enzymatic steps represented by ortholog group identifiers (KEGG, TIGRFAM, and eggNOG version 3.0 orthology databases in order of preference) (Valles-Colomer et al. 2016, PMID: 30718848). We consider a species to contain a given module if the species includes genes annotated to at least 2/3 of the steps needed to complete the functionality of the module. If a module has alternative reaction paths, only one of these is required to be 2/3 complete. For modules with three or fewer steps, all steps are required to be comprised in the species.
> [accordion] Gut Metabolic Modules (GMM)
>
> Gut Metabolic Modules (GMMs) are a set of 103 conserved human gut metabolic pathways, each defined as a series of enzymatic steps represented by Kyoto Encyclopedia of Genes and Genomes orthology (KO) identifiers (Vieira-Silva et al. 2016, PMID: 27573110). Functional potential profiles based on GMMs were generated from the species profiles. For this, we identified the set of species associated to each of the GMMs by following three criteria: 1) a species was associated to a GMM if it included at least 2/3 of the genes encoding the proteins/enzymes needed to complete the functionality of the module, 2) if a module had alternative reaction paths, only one of these was required to be 2/3 complete, 3) for modules with three or fewer steps, all steps were required to be comprised in the given species. GMM profiles based on counts, relative abundances, rarefied counts and rarefied relative abundances were then calculated by adding, respectively, the number of counts, relative abundances, rarefied counts and rarefied relative abundances from each species associated to a given GMM.
# Collapsible Tree
Source: https://docs.cosmosid.com/docs/collapsible-tree
## What is a collapsible tree?
A collapsible taxonomic tree allows you to collapse or expand nodes as needed.

## Why use a collapsible tree?
This can be useful for figures that show strains or species of interest while hiding those that may be less meaningful or just for viewing the relatedness of the organisms found in your sample.
[https://p-AeFvB6.t2.n0.cdn.getcloudapp.com/items/KouJx4dR/39d8dad0-0de4-431f-9bf8-79af59a6c48a.mp4](https://p-AeFvB6.t2.n0.cdn.getcloudapp.com/items/KouJx4dR/39d8dad0-0de4-431f-9bf8-79af59a6c48a.mp4)
Click on nodes to collapse them or expand them
## Exporting
To export your tree, click on "Export" in the top right corner of your browser and select "PNG" or "SVG".
# Organize Your Data
Source: https://docs.cosmosid.com/docs/create-folders-and-organize-files
View, rename, create folders and move your samples using the sample dashboard
To view all of your samples, click on the "Samples" dashboard. From here, you can manage and organize your samples in the Cosmos-Hub.
## Creating Folders
To add a new folder, click the +Folder icon in the upper right corner. Name your folder and then click "create".

## Moving Samples to Folders
To move samples into the folder, click on the samples to select them. Hold down the Command key (Mac) or Control key (PC) to select multiple samples, or hold down Shift to select multiple samples in a row. Once the samples are highlighted, click on the 3 dots in the top right again. Click "Move To" and select the folder you wish to move your samples into by highlighting it from the drop down menu.

## Renaming Samples or Folders
To rename a folder or sample, click on the sample or folder to highlight it. Edit the name as needed and click "save".

## Deleting Folders
**You can only delete empty folders.** First, move or delete all of the samples in the folder. After this you will be able to delete the folder. From the dashboard, click beside the folder name and on the top right, click the trash bin icon.

## Use the Filter sidepane to limit your sample view to samples of interest. Read more on our [Filtering Samples by Metadata page](/v2-0/documentation/guides/navigating-the-sample-dashboard/filtering-samples-by-metadata).
## Recovering Deleted Samples
If you accidentally deleted samples in your account, please [Submit a help-ticket](www.cosmos-hub.com/support) or email us at [help@cosmos-hub.com](mailto:help@cosmos-hub.com) with the email of your account and the sample name that contains the samples you'd like recovered.
# Sharing Data
Source: https://docs.cosmosid.com/docs/data-sharing
You can easily share profiling data, folders, or comparative analyses with those inside your team network.
> [!WARNING]
>
> Data sharing only available for annual subscribers. To add additional team members to your sharing network, contact [help@cosmos-hub.com](mailto:help@cosmos-hub.com)
[YouTube video player](https://www.youtube.com/embed/fAu4eIAazuU?si=kxqVDQxUPX1dgs4u)
# **Data Sharing in Cosmos-Hub**
This guide provides a concise overview of how to share data with your teammates using the Cosmos-Hub platform.
## **How to Share Data**
1. **Select Data to Share**
* Choose the folder, sample(s), or comparative analysis you wish to share within the Cosmos-Hub interface.
2. **Initiate Sharing**
* Click the **share icon** associated with your selected folder or sample.
3. **Choose Recipients**
* You can share a copy of the data with anyone within your subscription network.
## **Managing Shareable Accounts**
* **Add More Addresses:**\
If you need to add more addresses to your list of shareable accounts, contact the Cosmos-Hub support team at [help@cosmos-hub.com](mailto:help@cosmos-hub.com) or submit a help ticket.
## **Sharing Comparative Analyses**
* You can also share comparative analyses with your teammates, not just raw data or folders.
## **Accessing Shared Data**
* Once data is shared, teammates can sign into their Cosmos-Hub account.
* The shared data will appear as a folder, clearly marked as shared by the originating account.
## **Support**
For further assistance, reach out to Cosmos-Hub support at [help@cosmos-hub.com](mailto:help@cosmos-hub.com).
# Database Species Lists
Source: https://docs.cosmosid.com/docs/database-information
Use the following links to download species lists for each database.
## CHAMP Human Microbiome Profiler Species List
CHAMP Taxonomic Database includes 6809 species (bacteria, fungi, metazoa).
> [card] [Download the species list here](https://hubs.ly/Q02QtGd80)
## Kepler Host-Agnostic Microbiome Profiler Species List
Kepler Taxonomic Database includes 30,204 species (bacteria, archaea, viruses, protists). This list can also be queried using the "DB Info" option in the main sidebar menu
> [card] [Download the species list here](https://hubs.ly/Q02QtFqY0)
# Donut Graph
Source: https://docs.cosmosid.com/docs/donut-graph
## What is a donut graph?
A donut graph is a circular visualization of the organisms identified, shown one taxonomic level at a time.

## How to use it
You can select different values to use for the donut graphs:
**Relative Abundance** - Click on “relative abundance” to use relative abundance for the donut visualization. **Abundance Score** - Click on “abundance score” to use abundance score for the donut visualization. **% Others** - Enter a number in front of %others to group more or fewer organisms into the “others” category. This is useful if you have many lower abundance organisms and you would like to get a better view of the higher level calls.
## Exporting
To export your donut graph, click on "Export" in the top right corner of your browser and select "PNG" or "SVG".
# Raw Data Download
Source: https://docs.cosmosid.com/docs/download-your-raw-fastqs
The Cosmos-Hub allows you to store and download your raw fastqs/sequencing data from the dashboard.
> [!WARNING]
>
> Raw FASTQ files are only accessible for 30 days after upload, after which the files are moved to archives for 1 year. When archived, the data is unavailable for direct download or workflow use. To unarchive, please email your sample list to [help@cosmos-hub.com](mailto:help@cosmos-hub.com); a \$500 fee applies.
[YouTube video player](https://www.youtube.com/embed/VomAmmmAFDs?si=DWZwoRX-HMdVy49w)
**1. Get Download URLs**
Start by selecting your samples in the "Cohorts and Metadata" menu, and select the "Export Samples" → "Get Download URLs" to generate download links in either CSV or TSV format.
**2. Open the file in a spreadsheet or text app (i.e., Excel)**
Open it in a spreadsheet or text app to get the links. The URL column contains the download link for that particular sample (paired-end files will have 2 files with 2 unique URLs).

**3. Use the generated URLs or preformatted commands (CURL, POWERSHELL, or WGET) to download raw fastqs**
**Browser Method:**\
Paste URLs from the "URL" column directly into your web browser to initiate the download to your default Downloads folder.
**Terminal Method:**\
Use the provided preformatted commands (CURL, POWERSHELL, or WGET) from the spreadsheet. Simply navigate to your target directory in the terminal and paste the commands.
#### How can you download raw fastqs for multiple samples all at once using UNIX terminal or PowerShell from the download URL CSV/TSV file?
The bash/PowerShell commands can be used for downloading multiple files using the download URL CSV/TSV
```shell MacOS - wget theme={null}
## Downloading multiple files using download URL CSV
tail -n +2 samples_download_urls_2023_03_23_21_58.csv | cut -d',' -f6 | while read url; do
wget "$url"
done
## Downloading multiple files using download URL TSV
tail -n +2 samples_download_urls_2023_03_23_21_58.tsv | cut -f6 | while read url; do
wget "$url"
done
```
```powershell Windows 11 - PowerShell theme={null}
## Downloading multiple files using download URL CSV
Import-Csv -Path ".\.csv" -Delimiter ',' |
ForEach-Object {
$url = $_.URL.Trim()
if (-not [string]::IsNullOrWhiteSpace($url)) {
$filename = [System.IO.Path]::GetFileName(([Uri]$url).AbsolutePath)
if (-not (Test-Path -LiteralPath $filename)) {
Invoke-WebRequest -Uri $url -OutFile $filename
}
}
}
## Downloading multiple files using download URL TSV
Import-Csv -Path ".\.tsv" -Delimiter "`t" |
ForEach-Object {
$filename = [System.IO.Path]::GetFileName(($_.URL -split '\?')[0])
if (-not (Test-Path $filename)) {
Invoke-WebRequest -Uri $_.URL -OutFile $filename
}
}
```
# Downloading WGET on MacOS
> [!NOTE]
>
> **macOS users:** wget is not installed by default on macOS. You'll need to install it first using Homebrew:
>
> 1. Install Homebrew (if not already installed):
> ```bash theme={null}
> /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
> ```
> 2. Install wget:
> ```bash theme={null}
> brew install wget
> ```
# Downloading on Windows 11
> [!NOTE]
>
> **Windows 11 users:**
>
> 1. **Download the CSV file from Cosmos Hub**\
> Download the CSV/TSV file that contains your sample download links. You can follow steps 1 and 2 here at [https://docs.cosmosid.com/docs/download-your-raw-fastqs](https://docs.cosmosid.com/docs/download-your-raw-fastqs)
> 2. **Create a new empty folder**\
> Create an empty folder on your computer and move the CSV/TSV file into it.
> 3. **Open PowerShell in that folder**\
> Open the folder, right click on an empty space, and select **Open in Terminal**. If you do not see it, click **Show more options** first.
> 4. **Copy and paste this command into the PowerShell terminal** \
> **Note**: Make sure to replace `"./.csv" ` with the exact name of your downloaded CSV/TSV file (e.g:`"./samples_download_urls_2026-05-08_18_46.csv"`).
> \
> **For CSV file**
> ```powershell theme={null}
> Import-Csv -Path ".\.csv" | ForEach-Object { $filename = [System.IO.Path]::GetFileName(($_.URL -split '\?')[0]); if (-not (Test-Path $filename)) { Invoke-WebRequest -Uri $_.URL -OutFile $filename } }
> ```
> **For TSV file**
> ```powershell theme={null}
> Import-Csv -Path ".\.tsv" -Delimiter "`t" | ForEach-Object { $filename = [System.IO.Path]::GetFileName(($_.URL -split '\?')[0]); if (-not (Test-Path $filename)) { Invoke-WebRequest -Uri $_.URL -OutFile $filename } }
> ```
> Note: Opening or editing the CSV or TSV file in spreadsheet software such as Microsoft Excel may change the delimiter used to separate the columns, depending on your local settings. If this happens, you may need to update the `-Delimiter` value in the PowerShell command accordingly.
> 5. **Press Enter**\
> The downloads will start automatically. Keep the PowerShell window open until all files finish downloading. \
> \
> **Note**: depending on the number of files and their size, the download may take some time. Make sure your computer has enough available storage space before starting.
# Exporting Your Profiling Results
Source: https://docs.cosmosid.com/docs/download-your-results
You can download your sample results files as well as visualizations and comparative analysis results.
### Download tab-separated-value (tsv) files for one or multiple samples at the same time
From the datasets dashboard, con a sample or several samples - hold down the shift key to select multiple contiguous samples or the command key (Mac) or control key (PC) to select non-contiguous samples. Click on the dots in the upper right corner of the browser and select "Export to CSV". Your results will download in a zipped file and can be opened in Excel after unzipping. A download link of the zipped file will also be emailed to the registered email of the app account. This allows you to share the results via email or refer back to the results at a later time. This link does expire after 7 days.
When looking at the results for an individual sample, you can download the tsv file at any time. Just click "Export" in the upper right corner and select "TSV".

### Download PDF, PNG, or SVG files
When looking at the results for an individual sample you can also download the file which contains the tabular results as well as the visualizations for that sample. Just click "Export" in the upper right corner and select "PDF".

## Comparative Analysis Results
### Download TSV and Image Files for Comparative Analysis
To download the matrix of your comparative analysis as a TSV file, when viewing the comparative analysis results, click "Export" in the upper right corner of the browser. Select "TSV". Your matrix will download and can be opened in Excel.
When viewing a comparative analysis visualization, such as a heat map or PCA, click "Export" in the upper right corner of your browser. Select "PNG" or "SVG" to download and save.

# Long-Read Amplicon Profiling
Source: https://docs.cosmosid.com/docs/emu
Profile long-read amplicon data from Oxford Nanopore or PacBio
The Long-Read Amplicon Pipeline on Cosmos-Hub is an [Emu-based](https://www.nature.com/articles/s41592-022-01520-4) algorithm that delivers species-level microbial community profiling from full-length 16S/18S/ITS rRNA genes sequences generated by long-read sequencing platforms like PacBio and Oxford Nanopore Technologies (ONT).
Unlike traditional short-read 16S approaches that target only hypervariable regions (V3-V4), long-read amplicon sequencing captures the entire \~1,500 bp gene, including all nine hypervariable regions (V1-V9). This comprehensive coverage unlocks species- and subspecies-level resolution that short-read methods simply cannot achieve.

> [!NOTE]
>
> ***How does Cosmos-Hub's Emu implementation differ from the standard Emu pipeline?***
>
> The Cosmos-Hub implementation includes several enhancements over the standard Emu parameters:
>
> * Optimal performance across diverse sample types through improved fine tuning of minimap2 parameters
> * Enhanced EM Configuration via probability and iteration parameters for improved convergence and reduced false positives
> * Multi-database support with parallel processing across specialized reference databases
> * End-to-end automation from raw reads to publication-ready taxonomic profiles
> * Advanced quality control with comprehensive filtering statistics and visualizations
> * Parameter-rich customization tailored to your specific study requirements
# Required Parameters
There are a few preprocessing parameters that are required to run the long-read amplicon pipeline:
1. **Database Selection**: select the database most appropriate for your sample type (up to 2, see below for definitions of databases)
2. **Minimum/Maximum Read Length**: Should be adjusted based on amplicon region (V1-V8 vs V1-V9) and expected sequence quality. Minimum length should range between \~800 (archaea-enriched or low-quality sequenced samples) and \~1200 bases for single gene sequencing, and \~3500 for full operon sequencing.
3. **Minimum Read Quality**: Recommended thresholds based on data source:
* High quality data (expected from Cmbio): Q-score ≥ 20
* Medium quality data: Q-score 17-20
* Lower quality data: Q-score 15-17
4. **Alignment Preset Settings**: choose the sequencing platform used to produce the data among ONT or PacBio
5. **Maximum EM Iterations**: Numbers above 20 (recommended), in most cases do not lead to significant precision improvement, while causing longer running times. Choices of higher values (e.g. 30/40) could be beneficial in case of complex communities such as soil samples.
6. **Probability cutoff**: reduce false positive hits in case of bad primary alignments. Too high values lead to overestimation of the most abundant species and can be supported in case of simple and well defined communities, with taxa phylogenetically distant (e.g. mock communities).
While more details on the choice of the reference database are reported in the next section, here we suggest the combinations of parameters for the most common user cases:
| Type of Sequences | HQ 16S bacterial V1-V8 | HQ 16S bacterial V1-V9 | MQ 16S bacterial V1-V9 | HQ 18S eukaryotic V4-V9 | HQ ITS Fungal ITS1 / ITS2 | Full Operon 16S-ITS-23S rRNA operon |
| :- | :- | :- | :- | :- | :- | :- |
| HUB Workflow Name | Long Read 16S/18S Amplicon Profiling | Long Read 16S/18S Amplicon Profiling | Long Read 16S/18S Amplicon Profiling | Long Read 16S/18S Amplicon Profiling | Long Read ITS Amplicon Profiling | Full Length rRNA Amplicon (16S-ITS-23S) Profiling (Beta) |
| Min. read length | 1100 | 1200 | 1000 | 500 | 100 | 2500 |
| Max. read length | 2000 | 2500 | 10000 | 2000 | 5000 | 10000 |
| Min. read quality | 20 | 20 | 17 | 20 | 20 | 20 |
| Max. EM iterations | 20 | 20 | 25 | 25 | 25 | 20 |
| Probability cutoff | 0.95 | 0.95 | 0.9 | 0.9 | 0.9 | 0.9 |
| Reference DB | GTDB | GTDB | GTDB | SILVA | UNITE | MIrROR |
> [!WARNING]
>
> # Why no primer trimming or barcode/adapter removal?
>
> Long-Read Amplicon Profiling accepts raw FASTA/FASTQ files without built-in primer trimming, barcode demultiplexing, or adapter removal, unlike short-read 16S pipelines.
>
> Short-read methods require primer trimming for DADA2-based ASV reconstruction and optimal taxa assignment, but long-read mapping (minimap2 + EM error correction) gains no accuracy benefit from it.
>
> Users should pre-process barcodes/adapters externally if needed; library kit choice typically does not affect downstream mapping as long as reads meet quality/length thresholds.
# Database Selection
Emu supports multiple curated databases, each optimized for specific sample types and research applications:
> [!TIP]
>
> **Most users should use GTDB + GreenGenes2 as the default combination.**
**Available Databases**
* **SILVA r138.1**: Comprehensive, manually curated database ideal for environmental samples
* **GTDB r220**: Genome Taxonomy Database with standardized prokaryotic taxonomy
* **Greengenes2 202210**: Updated classification system with improved phylogenetic framework (not updated to newest version 202409 because of problems with important taxonomies, such as the lack of reference sequences labelled as *Escherichia coli* [https://github.com/biocore/q2-greengenes2/issues/29](https://github.com/biocore/q2-greengenes2/issues/29))
* **HOMD v15.23**: Specialized for oral microbiome studies
* **MiDAS v5.3**: Optimized for activated sludge and wastewater treatment systems
* **UNITE v10.0**: Fungal ITS sequences for multi-kingdom studies
* **MIrROR v2.0**: Ribosomal RNA gene database (16S-ITS-23S rRNA operon sequences extracted from bacterial genomes)
* **Emu Default v3.4.5**: Curated combination of rrnDB v5.6 and NCBI 16S RefSeq
## **Sample-Specific Database Recommendations**
| ### Sample Type/Environment | ### Recommended Database(s) |
| - | - |
| Human gut microbiome | GTDB, Greengenes2, eHOMDB (for oral-associated strains) |
| Human skin microbiome | GTDB, Greengenes2 |
| Human vaginal microbiome | GTDB, Greengenes2 |
| Oral microbiome | HOMD, SILVA |
| Soil/Environmental samples | SILVA, GTDB, Greengenes2 |
| Aquatic (marine/freshwater) | SILVA, GTDB, Greengenes2 |
| Activated sludge/wastewater | MiDAS |
| Fungal-dominated samples | UNITE (for ITS), SILVA (for multi-kingdom) |
| Poorly characterized biomes | Combine GTDB + SILVA or GTDB + Greengenes2 |
| Fast analysis of simple communities | Emu default |
> [!TIP]
>
> # Key Benefits Over Short-Read Approaches
>
> **Species-Level Resolution**: Full-length gene coverage enables discrimination between highly similar species
>
> **Reduced Misclassification**: Complete sequence information minimizes ambiguous taxonomic assignment.
>
> **Enhanced Phylogenetic Resolution**: Critical for distinguishing closely related species in complex microbiomes
>
> **Improved Rare Taxa Detection**: Better sensitivity for low-abundance community members
# Core Methodology
The Emu workflow implements a sophisticated two-stage process optimized for both high-quality and error-prone long-read data:
**1. Stage 1: Alignment Generation**
The pipeline begins by generating alignments between input reads and the supplied reference database using *minimap2*, a versatile pairwise aligner optimized for long sequences. *Minimap2* employs a seed-chain-align procedure that:
* Collects minimizers from reference sequences and indexes them in a hash table
* Identifies exact matches (anchors) between query and reference sequences
* Chains collinear anchors and applies dynamic programming for base-level alignment
* Accounts for the error profiles specific to ONT and PacBio sequencing platforms
**2. Stage 2: Expectation-Maximization (EM) Error Correction**
The core innovation of Emu lies in its EM-based error correction algorithm:
> [accordion] Initial Probabilities:
>
> * Establishes alignment likelihoods P(r|t) between each read r and taxonomy in reference database
> * Calculates probabilities for nucleotide alignment types: mismatch (X), insertion (I), deletion (D), and softclip (S)
> * Initializes sample composition vector F with uniform distribution
> [accordion] Iterative Refinement
>
> * E-step (Expectation): Computes the probability that each read originated from each species P(t|r) using Bayes' theorem
> * M-step (Maximization): Updates species abundance estimates F(t) based on read assignment probabilities
> * Evaluates total log likelihood L(R) and continues iteration until convergence (improvement \< 0.01)
> [accordion] Final Processing
>
> * Applies abundance threshold filtering to remove false positives (default: 1 read for \<1000 reads, 10 reads for larger samples)
> * Performs final redistribution to generate species-level abundance profiles
# Performance Benchmarking
Extensive validation studies demonstrate Emu's superior performance compared to alternative long-read taxonomic profilers:
* **L1-norm Error**: Consistently lowest relative abundance error across test datasets
* **Precision/Recall**: Optimal balance between true positive detection and false positive control
* **Species Detection**: Superior identification of closely related species (e.g., 97% ANI discrimination)
# Data Upload and Analysis
### **Supported Input Formats**
* Raw FASTA and FASTQ files (compressed format supported: fastq,fastq.gz,fastq.bz2,fasta,fastq,fastq.gz,fastq.bz2,fq,fq.gz)
* Demultiplexed long-read sequences
* Both single-end and paired-end data
### Sample Assessment Features
* Real-time read quality visualization
* Sequence length distribution analysis
* Taxonomic assignment confidence scoring
* Comparative analysis with other samples
### Results Format
* 7 Taxonomic-level (down to species) abundance profiles
* Taxonomic classification tables
* Quality control metrics
* Interactive visualization dashboards
### Comparative Analysis Integration:
Results seamlessly integrate with Cosmos-Hub's comparative analysis tools for multi-sample comparison and statistical analysis.
Data is exportable in standard formats along with publication-ready vizualizations.
# Methodology publications and validation studies
* Curry, K.D., et al. "Emu: Species-Level Microbial Community Profiling for Full-Length Nanopore 16S Reads." Nature Methods (2022)
* Li, H. "Minimap2: pairwise alignment for nucleotide sequences." Bioinformatics (2018)
# Applications and Use Cases
> [card] Microbiome Research
>
> * Species-level community profiling
> * Functional pathway prediction
> * Longitudinal microbiome dynamics
> * Multi-kingdom microbiome analysis
> [card] Clinical Microbiology
>
> * Rapid pathogen identification from clinical specimens
> * Outbreak investigation and epidemiological studies
> [card] Environmental Microbiology
>
> * Biodiversity assessment
> * Ecosystem health monitoring
> * Biogeochemical cycle studies
> * Contamination source tracking
# FAQs
> [accordion] What does “Unmapped species” mean in the reported profile?
>
> “Unmapped species” represent the portion of the metagenome that the workflow has not been able to recognize in the reference. More precisely, these are the sequenced reads that have no successful alignment (i.e. not passing the quality thresholds) against the database sequences.
> [accordion] What does “Unclassified species” mean in the reported profile?
>
> “Unclassified species” represent, instead, the portion of species that are likely not present. This is a particular feature of Emu that defines "Unclassified mapped reads" as those mapped only to database sequences of species that are presumed to not be present (likely due to low overall abundance).
# FASTQC
Source: https://docs.cosmosid.com/docs/fastqc
During sequencing, the nucleotide bases in a DNA or RNA sample (library) are determined by the sequencer. For each fragment in the library, a sequence or commonly known as read is generated which is simply a succession of nucleotides.
Modern sequencing technologies can generate a massive number of sequence reads in a single experiment. However, no sequencing technology is perfect, and each instrument will generate different types and amount of errors, such as incorrect nucleotides being called. These wrongly called bases are due to the technical limitations of each sequencing platform.
Therefore, it is necessary to understand and identify error-types that may impact the interpretation of downstream analysis. In order to do quality control on sequencing reads, Cosmos-Hub has integrated FastQC to generate a comprehensive QC report which can spot problems which originate either in the sequencer or in the starting library material.
The different analysis modules of fastQC(1) that are supported on the hub are
1. **Basic Statistics** - The Basic Statistics module generates some simple composition statistics for the file analysed.
2. **Per Base Sequence Quality** - The plot shows an overview of the range of quality values across all bases at each position in the FastQ file.
3. **Per Sequence Quality Score** - The per sequence quality score report allows you to see if a subset of your sequences have universally low quality values. It is often the case that a subset of sequences will have universally poor quality, often because they are poorly imaged (on the edge of the field of view etc), however these should represent only a small percentage of the total sequences.
4. **Per Base Sequence Content** - Per Base Sequence Content plots out the proportion of each base position in a file for which each of the four normal DNA bases has been called
5. **Per Sequence GC Content** - This module measures the GC content across the whole length of each sequence in a file and compares it to a modelled normal distribution of GC content.
6. **Per Base N Content** - If a sequencer is unable to make a base call with sufficient confidence then it will normally substitute an N rather than a conventional base call. This module plots out the percentage of base calls at each position for which an N was called.
7. **Sequence Length Distribution** - Some high throughput sequencers generate sequence fragments of uniform length, but others can contain reads of wildly varying lengths. This module generates a graph showing the distribution of fragment sizes in the file which was analysed.
8. **Sequence Duplication Levels** - In a diverse library most sequences will occur only once in the final set. A low level of duplication may indicate a very high level of coverage of the target sequence, but a high level of duplication is more likely to indicate some kind of enrichment bias (eg PCR over amplification). This module counts the degree of duplication for every sequence in a library and creates a plot showing the relative number of sequences with different degrees of duplication.
9. **Adapter Content** - The plot shows a cumulative percentage count of the proportion of your library which has seen each of the adapter sequences at each position. Once a sequence has been seen in a read it is counted as being present right through to the end of the read so the percentages you see will only increase as the read length goes on.
## Where can I view the FastQC results on the Hub?
The FastQC results are available from the results dropdown menu on the single sample explorer page.
## How can I aggregate the sequencing QC results of multiple samples on the Hub?
The Comparative Analysis on Cosmos-Hub Microbiome allows users to aggregate the sequencing QC metrics using MultiQC(2) and explore the trends visually across all the samples of interest. Simply create a comparative analysis and select "MultiQC"
## References
1. Brabraham Institute. May 12, 2022. FastQC version 0.11.9. Source code, [https://www.bioinformatics.babraham.ac.uk/projects/fastqc/](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/)
2. Ewels P, Magnusson M, Lundin S, Käller M. MultiQC: summarize analysis results for multiple tools and samples in a single report. *Bioinformatics*. 2016;32(19):3047-3048. doi:10.1093/bioinformatics/btw354
# Taxonomic Filtering
Source: https://docs.cosmosid.com/docs/filtering
FOR KEPLER RESULTS ONLY: Kepler enables filtering of low-confidence taxa.
## Filtered vs Total Results
Cosmos-Hub provides a filtering method that allows you to view both filtered and total (unfiltered) results for your samples. Filtered results show calls that meet our filtering threshold for high confidence that these calls are in the sample. Total results contain additional calls that are below the filtering threshold and may need further validation to determine if they are truly present in the sample.
You would typically use filtered results when you are looking at data where you want high confidence in your calls, like when working with clinical data. Many people use unfiltered (total) results when looking at environmental samples where there may be organisms whose genomes are more novel or diverge from most reference genomes.
## How It Works
The filtering threshold which determines if results are considered significant is based on internal statistical scores determined by analyzing a large number of diverse metagenomes. Organisms listed in the filtered results are likely to be present in the sample. Unfiltered (total) results include those in the filtered results and usually additional organisms. Organisms listed in the unfiltered (total) results but not in the filtered results need further validation to determine if they are actually present in the sample - either by deeper sequencing of the sample followed by re-analysis or by orthogonal validation using targeted PCR or other methods.
You will see filtering options in 2 places:
### 1. Sample Results
When reviewing your sample results, you have the ability to view filtered results or total results:

### 2. Comparative Analysis
When setting up a new comparative analysis, you can select filtered or total results.
# Functional Host-Agnostic Profiling
Source: https://docs.cosmosid.com/docs/functional-analysis
Functional profiling via whole genome shotgun metagenomics or metatranscriptomics provides actionable insights into the molecular, biochemical, and metabolic capacity of microbial communities.
# Functional Profiling in Cosmos-Hub
Cosmos-Hub delivers an end-to-end, host-agnostic workflow for characterizing the functional potential of microbiomes across research, clinical, and environmental projects. The platform integrates state-of-the-art bioinformatics for read QC, translated gene family assignment, annotation, normalization, and interactive visualization.
### Functional Databases Available in the Cosmos-Hub
| Database | Role/What It Captures | Application Example | Functional Insight |
| :- | :- | :- | :- |
| EC | Enzymatic reactions | Enzyme-level annotation | Mechanistic metabolic view |
| MetaCyc | Pathway networks | Pathway prediction | System-level metabolism |
| Pfam | Protein domains/motifs | Domain prediction | Structural adaptation |
| CAZy | Carbohydrate enzymes | Fiber/glycan profiling | Fiber vs mucin processing |
| GO Terms | Broad gene function | Activity trends | Broad functional overview |
## Pipeline Overview
> [!TIP]
>
> 1. **QC & Processing:** reads are cleaned and trimmed using BBDuk.
> 2. **Gene Family Mapping:** Reads are aligned via translated search to [UniRef90](https://www.uniprot.org/uniref), a non-redundant protein cluster database, enabling robust assignment to community-wide gene families.
> 3. **Functional Annotation:** Gene families are mapped to five cornerstone databases:
> * [**EC (Enzyme Commission)**](https://enzyme.expasy.org/)**:** Classifies sequences by biochemical reactions.
> * [**MetaCyc Pathways**](https://metacyc.org/)**:** Links genes to known metabolic networks, supporting pathway-level inference.
> * [**Pfam**](https://www.ebi.ac.uk/interpro/entry/pfam/)**:** Identifies protein domains and conserved motifs.
> * [**CAZy**](https://www.cazy.org/)**:** Focuses on carbohydrate-active enzymes, resolving fiber, mucin, glycan processing.
> * [**GeneOntology (GO) Terms**](https://geneontology.org/)**:** Hierarchical gene ontology terms for molecular functions, biological processes, and cellular components.
> 4. **Normalization:** Abundances normalized as “copies per million,” facilitating cross-sample and cross-study comparisons.
> 5. **Visualization & Analysis:** Results rendered as heatmaps and barcharts; enables differential testing (LEfSe, MaAsLin) on functional categories, supporting biomarker discovery, R\&D, and regulatory submissions.
## Viewing the Functional Profiling Results
[YouTube video player](https://www.youtube.com/embed/jK0jnAN8bPU)
Each sample's functional analysis can be navigated using the "Results" dropdown in the Sample Menu, which includes:
* A tabular summary of database-level annotations
* Visual charts for intuitive inspection of pathway and enzymatic profiles
* Links for feature-level exploration on source database websites
The single sample view of functional workflow entails the tabular view of all databases along with stacked bar chart and donut chart to aid in visual inspection of functional capabilities of the microbiome population.

## Accessing the Reference Database Entries via Hyperlinks
Clicking on the first column for each respective functional databases will take you to that specific feature's description on that respective database's website.

## Technical Notes
* Reads mapped with weighting for mapping quality, coverage, and gene sequence length.
* Annotations use curated crosswalks from UniRef90 to EC, MetaCyc, Pfam, CAZy, and GO Terms.
* Abundance values normalized for sequencing depth using Total-sum scaling (TSS) (copies per million).
* Reference guides: Bushnell 2021, UniProt 2016, Franzosa et al. 2018, Caspi et al. 2007, Carbon et al. 2008.
## **Why perform functional analysis on your microbiome data?**
> [!TIP]
>
> By integrating all these annotation types, Cosmos-Hub (and similar functional profiling frameworks) can:
>
> * **Map the “wiring” of metabolism**: EC → MetaCyc lets you see how individual enzymatic steps may assemble into pathways.
> * **Go beyond metabolism**: GO and Pfam capture regulatory, structural, transport, signaling, and other auxiliary functions.
> * **Provide specialization where it’s needed**: CAZy focuses on carbohydrate metabolism, which is often key in microbiome studies (e.g. gut fiber degradation).
> * **Differential functional analysis**: you can compare which functional categories are enriched or depleted across sample groups (e.g. disease vs healthy) in an interpretable manner (e.g. “glycolysis up,” “cell wall polysaccharide degradation down”).
>
> In other words, rather than only asking “which taxa are present?”, you can ask “what can they do or are likely capable of doing?” in biochemical, ecological, or physiological terms.
## Example Use Cases of Functional Profiling for Gut Microbiome
### *Healthy vs. Disease (e.g., Inflammatory Bowel Disease)*
> [accordion] Enzyme Commission (EC): pinpointing altered enzymatic activity
>
> Cosmos-Hub identifies specific enzyme families (via EC numbers) whose abundance changes between groups.
>
> * **Healthy gut:** Higher abundance of enzymes such as *butyrate kinase* (EC 2.7.2.7) and *acetate-CoA transferase* (EC 2.8.3.8), reflecting active **short-chain fatty acid (SCFA)** production that supports gut barrier integrity.
> * **IBD gut:** Increased *nitrate reductase* (EC 1.7.99.4) and *formate dehydrogenase* (EC 1.17.1.9), suggesting a shift toward **oxidative and nitrate respiration**, consistent with inflammatory and dysbiotic states.
>
> *EC-level insights give you mechanistic clues about which chemical reactions dominate in each condition.*
> [accordion] MetaCyc Pathways: reconstructing disrupted metabolic networks
>
> Using EC annotations, Cosmos-Hub infers pathway presence and abundance through **MetaCyc**.
>
> * **Healthy gut:** Enrichment in pathways like *butyrate biosynthesis I (PWY-5676)*, *methanogenesis from H₂/CO₂ (METHANOGENESIS-PWY)*, and *vitamin K₂ (menaquinone) biosynthesis (PWY-5838)* — all key for maintaining energy balance and mucosal health.
> * **IBD gut:** Enrichment in *lipopolysaccharide (LPS) biosynthesis* and *nitrate reduction pathways*, consistent with a pro-inflammatory metabolic signature.
>
> *MetaCyc translates raw gene potential into interpretable, system-level metabolism.*
> [accordion] Pfam: detecting shifts in protein architecture and stress functions
>
> Pfam domain profiling highlights structural motifs that increase in disease.
>
> * **Healthy gut:** More *ABC transporter permease* domains (PF02653) supporting nutrient import/export.
> * **IBD gut:** Elevated *TonB-dependent receptor* domains (PF00593) and *heat shock protein* domains (PF00012), reflecting **stress adaptation** and **host-derived substrate utilization**.
>
> *Pfam captures subtle domain-level adaptations beyond classical enzyme functions.*
> [accordion] CAZy: revealing changes in carbohydrate metabolism
>
> Carbohydrate-active enzymes show clear ecological reprogramming:
>
> * **Healthy gut:** Enrichment of *GH43* and *GH3* families involved in **dietary fiber degradation** (xylan, arabinoxylan, cellulose).
> * **IBD gut:** Drop in fiber-degrading CAZymes and rise in *GH98* and *GH92* families targeting **host mucins**, suggesting a shift toward mucosal glycan foraging.
>
> *CAZy data reveals how the microbiome’s “diet” shifts from plant polysaccharides to host glycans.*
> [accordion] GO Terms: summarizing broad biological trends
>
> At the ontology level, Cosmos-Hub maps genes to GO terms to show system-wide changes:
>
> * **Healthy gut:** Enrichment in *oxidation-reduction process* and *fermentation* (biological process), *cell wall biosynthesis* (molecular function).
> * **IBD gut:** Upregulation of *response to oxidative stress*, *iron ion transport*, and *biofilm formation* — markers of an inflamed microenvironment.
>
> *GO Terms provide a top-down lens linking molecular activity to community-level biology.*
> [!WARNING]
>
> **Considerations & Limitations**
>
> * DNA/transcript-based annotation infers functional potential, not direct activity.
> * Some taxa and functions may be underrepresented in current databases.
> * Pathway completeness is predicted; presence does not guarantee metabolic flux.
For custom protocols, sample-type recommendations, or application-specific database advice, contact [help@cosmos-hub.com](mailto:help@cosmos-hub.com).
## Technical Appendix
### FUNCTIONAL Workflow:
Initial QC, adapter trimming and preprocessing of metagenomic sequencing reads are done using BBduk (1). The quality controlled reads are then subjected to a translated search against a comprehensive and non-redundant protein sequence database, UniRef 90. The UniRef90 database, provided by UniProt (2), represents a clustering of all non-redundant protein sequences in UniProt, such that each sequence in a cluster aligns with 90% identity and 80% coverage of the longest sequence in the cluster. The mapping of metagenomic reads to gene sequences are weighted by mapping quality, coverage and gene sequence length to estimate community wide weighted gene family abundances as described by Franzosa et al (3). Gene families are then annotated to MetaCyc (4) reactions (Metabolic Enzymes) to reconstruct and quantify MetaCyc (4) metabolic pathways in the community as described by Franzosa et al (3). Furthermore, the UniRef\_90 gene families are also regrouped to Enzyme Commission Enzymes, Pfam protein domains, CAZy enzymes and GO Terms in order to get an exhaustive overview of gene functions in the community. Lastly, to facilitate comparisons across multiple samples with different sequencing depths, the abundance values are normalized using Total-sum scaling (TSS) normalization to produce "Copies per million" (analogous to TPMs in RNA-Seq) units.
References:
1. Bushnell, B. (2021). BBDuk Guide - DOE Joint Genome Institute. Retrieved 1 August 2021, from [https://jgi.doe.gov/data-and-tools/bbtools/bb-tools-user-guide/bbduk-guide/](https://jgi.doe.gov/data-and-tools/bbtools/bb-tools-user-guide/bbduk-guide/)
2. UniProt: the universal protein knowledgebase. (2016). Nucleic Acids Research, 45(D1), D158-D169. doi: 10.1093/nar/gkw1099
3. Franzosa, E., McIver, L., Rahnavard, G., Thompson, L., Schirmer, M., & Weingart, G. et al. (2018). Species-level functional profiling of metagenomes and metatranscriptomes. Nature Methods, 15(11), 962-968. doi: 10.1038/s41592-018-0176-y
4. Caspi, R., Foerster, H., Fulcher, C., Kaipa, P., Krummenacker, M., & Latendresse, M. et al. (2007). The MetaCyc Database of metabolic pathways and enzymes and the BioCyc collection of Pathway/Genome Databases. Nucleic Acids Research, 36(Database), D623-D631. doi: 10.1093/nar/gkm900
5. Carbon, S., Ireland, A., Mungall, C., Shu, S., Marshall, B., & Lewis, S. (2008). AmiGO: online access to ontology and annotation data. Bioinformatics, 25(2), 288-289. doi: 10.1093/bioinformatics/btn615
# Heatmap
Source: https://docs.cosmosid.com/docs/heat-map
Cosmos-Hub's heat map visualizes comparative analysis results using a red-to-blue color spectrum, where red indicates high values and blue represents low values.
## Heatmap Overview
For example, in relative abundance data, red highlights organisms with high abundance, yellow indicates medium abundance, and blue shows low abundance.
The heat map assigns "hot" colors (red/orange) to high values and "cold" colors (blue) to low values. These colored cells are displayed on a matrix, helping you easily identify patterns, samples, or taxa of interest.
###
> [!NOTE]
>
> **Why Use a Heatmap?**
>
> Heat maps are ideal for spotting trends in large datasets, such as identifying organisms consistently abundant in one cohort but not another. This makes them a valuable tool for discovering taxa or patterns worth further investigation.

## Heatmap Customization
The heatmap visualization tool provides various modification options to tailor the display to your analysis needs. Below are the customization features available:
**Clustering Options**
* **Sample Clustering**: Group samples based on similarities in their feature abundance profiles.
* **Cohort Clustering**: Organize samples based on predefined cohorts or metadata categories.
* **Feature Clustering**: Cluster features (e.g., microbial taxa) based on their abundance profiles across samples while also maintaining Cohort Clustering in alphanumeric order.
**Most Abundant Features**
* Select the number of top-abundant features to display on the heatmap. Adjust the numerical value and click Apply to refresh the visualization.
* Most abundant features are calculated by averaging abundances across all samples (i.e., all cells on the row) and sorts it by largest to smallest.
**Color Palette**: Choose from predefined color gradients to enhance visual interpretation (e.g., Red-Yellow-Blue: a gradient that transitions from red (high abundance) to blue (low abundance))
**Mouse hover**: if you hover your mouse over the heat map it will show the organism called in that cell, the actual value represented in the heat map, and the label that the sample belongs to, if applicable.
**Scroll**: if the heat map is larger than the screen, use your mouse to scroll up and down while hovering over the heat map.
**Zoom**: The user can left-click and drag creating a highlighted area. The visualization will zoom into this area to allow closer investigation. Double-Clicking will reset the visualization prior to zooming in.
**Fit-To-Screen**: The fit to screen option alters the visualization to fit the user's screen. This is useful when processing a large number of metagenomic samples. The visualization by default does not always fit within the page and this allows a concise view.
**Export**: to download the heat map, click "Export" in the top right corner and select your preferred format:
* **TSV**: exports the relative abundance table as a tab-separated values file
* **PNG, SVG, PDF**: exports the heatmap visualization as an image file
**Change taxonomy**: To change taxonomic levels for organism databases, you can click on the levels on the top bar:

**Logscale**: Sometimes it is difficult to discriminate low abundance calls if you have some results that are at a very low abundance and some that are high abundance. In order to better distinguish between low abundance calls, we provide an option to view the log scale version of your data. To view the log base 2 version of your heat map you can do so by selecting "Yes" next to Logscale in the upper menu bar.

# Host Read Removal Workflow
Source: https://docs.cosmosid.com/docs/host-read-removal-workflow
In metagenomics, biological specimens are sometimes collected from a tissue of a host that contains a high ratio of host to bacterial DNA. Removal of host DNA can increase precision and accuracy in microbiome profiling, especially for functional data.
When shotgun metagenomics sequencing data are generated for these specimens, they normally contain a large fraction of host reads compared to microbial reads. Analyzing microbiome data with high host ratio can lead to spurious data especially in the case of functional characterization.
In order to address this issue bioinformatically, we offer a preprocessing workflow to remove host sequencing reads from your metagenomics sequencing data. Once a user uploads their metagenomics sequencing reads to the HUB, they will be allowed to choose from a list different hosts to de-host their sequencing reads.
The total number of discarded host reads will be viewable from the single sample view.
If you want to download de-hosting stats for multiple samples at once, please use the Metadata CSV export from the Metadata & Cohorts menu as shown in the video below.
# ITS Amplicon Classification
Source: https://docs.cosmosid.com/docs/its-amplicon
Fungal community profiling using ITS amplicon sequencing and the UNITE database
## Overview
The Internal Transcribed Spacer (ITS) region is the universal DNA barcode marker for fungi. ITS amplicon sequencing enables identification and quantification of fungal communities in environmental, clinical, and agricultural samples. The Cosmos-Hub ITS workflow processes your sequencing data and classifies fungi using the UNITE reference database.
## When to use ITS sequencing
ITS amplicon sequencing is ideal for:
* **Fungal diversity studies** — Characterize mycobiome composition in soil, plant, or host-associated samples
* **Clinical mycology** — Identify fungal pathogens in patient samples
* **Food and fermentation** — Monitor fungal communities in food production
* **Agricultural research** — Study plant-fungal interactions and soil health
> [!NOTE]
>
> ITS sequencing targets fungi specifically. For bacterial profiling, use the [16S Amplicon workflow](/docs/16s-metagenomics-taxonomy). For comprehensive microbial profiling including bacteria, fungi, and viruses, consider [shotgun metagenomics](/docs/champ2).
## Understanding ITS results
When you view your ITS sample results from the datasets dashboard, you'll see a table with the following columns:
| Column | Description |
| - | - |
| **Name** | Organism identified at the taxonomy level you are viewing |
| **OTU ID** | Operational Taxonomic Unit identifier — a group of organisms clustered by DNA sequence similarity |
| **Frequency** | Number of reads that matched the OTU |
| **Relative Abundance** | Normalized abundance of the OTU based on frequency |

See [View Results](/docs/view-sample-results) for more information about the visualizations available for amplicon samples.
## What is an OTU?
An **Operational Taxonomic Unit (OTU)** is a cluster of similar DNA sequences used as a proxy for species or taxonomic groups. In the ITS workflow, sequences sharing 97% or greater similarity are grouped into the same OTU. This clustering approach accounts for sequencing errors and minor intraspecific variation while maintaining taxonomic resolution.
## Technical methods
The Cosmos-Hub ITS pipeline processes your data through the following steps:
### 1. Preprocessing
Raw reads from paired-end or single-end FASTQ files undergo quality filtering:
* Adapter trimming removes technical sequences
* Low-quality reads and bases are filtered out
* For paired-end data, overlapping forward and reverse reads are merged; unjoined reads are appended to the end of the file
### 2. Format conversion
Preprocessed reads are converted from FASTQ to FASTA format for OTU picking.
### 3. OTU clustering and classification
OTUs are identified using the QIIME framework with:
* **Reference database**: UNITE Database version 8.3
* **Method**: Closed-reference OTU picking
* **Similarity threshold**: 97% sequence identity
### 4. Results generation
Final results are presented in tabular format with taxonomic names, OTU IDs, frequency counts, and relative abundances.
## Downloading and comparing results
Results can be [downloaded](/docs/download-your-results) in multiple formats for downstream analysis. To compare fungal communities across samples, use the Cosmos-Hub [Comparative Analysis tool](/docs/new-comparative-analysis) to generate visualizations including diversity metrics, heatmaps, and ordination plots.
## Reference database
The ITS workflow uses the **UNITE Database version 8.3**, a curated fungal ITS sequence database maintained by the UNITE community. UNITE provides reliable taxonomic assignments for fungi and is the standard reference for ITS-based fungal identification.
For more information about databases used in Cosmos-Hub, see [Database Information](/docs/database-information).
# Kepler Host-Agnostic Taxonomic Profiling
Source: https://docs.cosmosid.com/docs/kepler-microbiome-profiler
Kepler is a novel taxonomic profiling pipeline engineered to extract optimal value from metagenomic data. Combining the sensitivity of K-mer (nucleotide sequence of a certain length) exact-matching and the precision and accuracy of probabilistic alignment, Kepler achieves robust identification and enumeration of microbial taxa spanning bacteria, viruses, fungi, and protists.
> [!TIP]
>
> The core of Kepler's technology is patented in both the US Patent office (US10108778B2, US20200294628A1) and European Patent Office (ES2899879T3).

## How does Kepler work?
The patented Kepler multi-kingdom taxonomic profiler is a comprehensive algorithm consisting of three interwoven pipelines:
> [accordion] Pre-computational stage for curating and building a comprehensive biomarker database (GenBook™)
>
> The first iteration of database curation involves the selection of high quality microbial genomes based on high completeness/low contamination ratio, quality of genome assembly (genomes with high fragmentation/# of contigs discarded when better representatives for that clade are present), and prioritization of intra-species diversity instead of redundancy. Once the library of high quality genome assemblies are selected, the genome assemblies are then scrubbed clean of low complexity sequences, prophages, plasmids, and human/mouse contaminated regions to maximize for taxonomically informative signal to noise ratio. The final database (GenBook™) includes >30,000 species encompassing multiple microbial kingdoms including Bacteria, Viruses, Protists, Fungi, and Phages. Next, the second iteration of database building involves splitting the curated and cleaned collection of microbial genomes into n-mers of variable length. The n-mers are then categorized as either shared or unique biomarkers across individual genomes, which is facilitated by a phylogenetic tree-like data structure. The tree backbone represents shared genomic biomarkers between different taxa, while the tree leaves are individual microbial genomes with unique biomarkers.
> [accordion] K-mer based Taxonomic classification/Identification
>
> This first comparator phase splits the millions of sequencing reads for each sample into k-mer sets. It then looks for exact matches between sample k-mers and reference biomarkers that are dispersed across the different phylogenetic branches and leaves of the GenBook™ database. . By focusing on small genomic regions of large differential informational content, this phase eliminates 99% of genomes which are almost certainly not in the metagenomic sample and generates a short list of nearest reference strains. This highly efficient and accurate classification readily admits sub-species taxonomy to an ANI divergence less than 0.003. Classification sensitivity and accuracy is maintained through biomarker aggregation statistics, coverage depth estimation, and abundance estimation–but with an inhomogeneous variance that is parsed into Step (3).
> [accordion] Probabilistic Smith-Waterman based Abundance Estimation and Classification Refinement
>
> The second comparator phase uses an edit distance-scoring based probabilistic Smith-Waterman algorithm \[1] to compare sequencing reads with a reference set of identified microbial taxa from Step (2). This involves a more computationally-intensive processing of the remaining 1% of strains to eliminate any false positives and achieve abundance estimations which are more homogeneous, more accurate, and have significantly less variance. Given an example scenario of 10 reads–where reads 1-8 belong to strain A, read 9 belongs to strain B, and read 10 belongs to both strain A and strain B with equal alignment score–KEPLER will probabilistically split read 10’s abundance into strain A with an abundance of 8.89 and strain B with an abundance of 1.11. Given a more complicated metagenomic sample scenario, contested reads are apportioned according to implied priors from uncontested reads. An iterative Maximum Likelihood Estimation algorithm is then converged to the final read abundance estimates. To summarize, overall abundance precision and classification accuracy is achieved by running the comparators in sequence, scoring the entire read probabilistically against the reference set, and distinguishing homologous regions.
## Kepler Benchmarking
The performance of Kepler on benchmark datasets, as highlighted in our benchmark whitepaper, demonstrates its superiority in species-level identification and functional annotation. Kepler outperformed other tools in detecting microbial species, especially in complex environments like low-biomass samples. It showed enhanced accuracy and precision in taxonomic classification across a range of sample types.
Key findings from the benchmarking include:
* **Higher Sensitivity**: Kepler was able to detect microbial species that other tools missed, particularly in datasets with lower microbial diversity.
* **Improved Speed and Scalability**: Compared to competing tools, Kepler processed larger datasets more quickly, making it suitable for large-scale studies.
* **Superior Functional Annotation**: The tool provided more detailed functional profiles, linking microbial presence to potential biological functions more effectively than other systems.
# [Read the Kepler Benchmarking Whitepaper](https://hubs.ly/Q048CZ670)

## Cited by:
The papers have cited the Cosmos-Hub in their methodology. Consult these for examples:
* [https://www.science.org/doi/10.1126/science.adj3502](https://www.science.org/doi/10.1126/science.adj3502)
* [https://www.frontiersin.org/journals/medicine/articles/10.3389/fmed.2023.1165980/full](https://www.frontiersin.org/journals/medicine/articles/10.3389/fmed.2023.1165980/full)
* [https://www.cell.com/cell-host-microbe/pdfExtended/S1931-3128(19)30158-1](https://www.cell.com/cell-host-microbe/pdfExtended/S1931-3128\(19\)30158-1)
* [https://www.nature.com/articles/s41598-022-14118-9#Sec2](https://www.nature.com/articles/s41598-022-14118-9#Sec2)
* [https://journals.asm.org/doi/full/10.1128/mbio.00591-22](https://journals.asm.org/doi/full/10.1128/mbio.00591-22)
You can find additional studies at our[ literature page](https://www.cosmosid.com/literature/).
## FAQ
To learn more about Kepler™ and its benchmarking,[ please download the benchmarking whitepaper](https://hubs.ly/Q03BlC8d0).
> [accordion] I have samples I ran previously on Cosmos-Hub and I would like to rerun them with Kepler, how do I do that?
>
> 1. Please contact [help@cosmos-hub.com](mailto:help@cosmos-hub.com) for more information on how to re-profile your existing data on Cosmos-Hub with Kepler.
> [accordion] For upcoming/future Bioinformatics services project delivery, will I automatically get taxonomic profiling results through Kepler?
>
> 1. Yes, the Bioinformatics services team will deliver your data on Kepler going forward. If you would like your old data re-profiled using Kepler, please contact [help@cosmos-hub.com](mailto:help@cosmos-hub.com)
> [accordion] Will my Kepler profiling results differ from the current taxa workflow results?
>
> 1. Yes, some differences are expected due to updates of the algorithm, database and taxonomy.
> [accordion] Will Kepler provide taxonomic profiling data with GTDB taxonomy?
>
> 1. Yes, Kepler uses GTDB taxonomy for providing lineage information on identified Bacteria and Archaea. To learn more about the differences between GTDB taxonomy and NCBI taxonomy for Bacteria and Archaea, please visit [GTDB and NCBI taxonomy comparison](/docs/gtdb-and-ncbi-taxonomy-comparison)
# LEfSe Biomarker Discovery Analysis
Source: https://docs.cosmosid.com/docs/lefse-biomarker-discovery-analysis
> [!TIP]
>
> Read the LEfSe paper here: Segata, N., Izard, J., Waldron, L. *et al.* Metagenomic biomarker discovery and explanation. *Genome Biol* **12**, R60 (2011). [https://doi.org/10.1186/gb-2011-12-6-r60](https://doi.org/10.1186/gb-2011-12-6-r60)
## What is LEfSe Biomarker Discovery Analysis?
LEfSe (Linear discriminant analysis effect size) is an algorithm for High-Dimensional biomarker discovery that identifies genomic features (genes, pathways, or taxa) characterizing the differences between two or more biological conditions. It emphasizes both statistical significance and biological relevance, allowing researchers to identify discriminative features that are that are statistically different among biological classes.
Specifically, the non-parametric factorial Kruskal-Wallis (KW) sum-rank test is used to detect features with significant differential abundance with respect to the class of interest. As a last step, LEfSe uses Linear Discriminant Analysis to estimate the effect size of each differentially abundant feature and rank the feature accordingly.
## How do you generate LEfSe biomarker discovery analysis?
In oder to run LEfSe biomarker discovery analysis, at-least 2 datasets and 2 cohorts are required for comparative analysis creation. 2 parameters are required for LEFSE biomarker discovery analysis.
1. Alpha: Alpha is a threshold value for non parametric factorial Kruskal-Wallis test which is used to judge whether a test statistic is statistically significant when comparing two or more cohorts or groups
2. Threshold: Threshold represents the linear discriminant analysis score or effect size cutoff value for discriminative biomarker or feature.
## What do the columns represent in LEfSe table results view?
LEFSE Table comprises of 4 columns. The column description is given below.
1. **Feature**: The feature column lists out the feature name that has been found to be discriminative among cohorts
2. **Enriched Cohort**: The enriched column lists out the cohort name in which the respective feature has been found to be discriminative
3. **LDA**: LDA represents the Linear Discriminant Analysis score or effect size for discriminative biomarker or feature
4. **P-value**: P-value represents the p-value for factorial Kruskal-Wallis test among cohort

## How do you interpret LEfSe Barchart results view?
LEfSe Barchart is a visual representation of discriminative features/biomarkers found by LEfSe tool ranking them accordingly to their LDA Score/Effect Size. The barchart is dynamic and can be filtered using both LDA score and P-value.

# MaAsLin2 for Differential Abundance
Source: https://docs.cosmosid.com/docs/maaslin2
## What is MaAsLin Differential Abundance Analysis?
[MaAsLin](https://huttenhower.sph.harvard.edu/maaslin/) (Microbiome Multivariable Association with Linear Models) is comprehensive tool for efficiently determining multivariable associations between experimental metadata and microbial meta-omics features. The MaAsLin2 in Cosmos-Hub enables users to easily configure parameters and run analyses through the Advanced Comparative Analysis module.
If you use the MaAsLin2 tool, please cite the reference manuscript:
> Mallick H, Rahnavard A, McIver LJ, Ma S, Zhang Y, Nguyen LH, Tickle TL, Weingart G, Ren B, Schwager EH, Chatterjee S, Thompson KN, Wilkinson JE, Subramanian A, Lu Y, Waldron L, Paulson JN, Franzosa EA, Bravo HC, Huttenhower C (2021). Multivariable Association Discovery in Population-scale Meta-omics Studies. PLoS Computational Biology, 17(11):e1009442. [https://doi.org/10.1371/journal.pcbi.1009442](https://doi.org/10.1371/journal.pcbi.1009442)
## MaAsLin2 Tutorial
[YouTube video player](https://www.youtube.com/embed/_3mA-CIqrd4?si=KVvDRjtRyhGjfPLZ)
## Microbiome Association Detection with MaAsLin 2
MaAsLin2 finds associations between taxonomic and functional features from metagenomic data and complex metadata. The tool relies on general linear models to accommodate most modern microbiome study designs, including support for cross-sectional, longitudinal, multiple covariates, and repeated measures. along with a variety of filtering, normalization, and transformation methods. There are multiple analysis methods, such as filtering, normalization, and transformation options to customize analysis for your specific study.
MaAsLin2 workflow two inputs, which are generated in the Cosmos-Hub:
### Profiling Data (feature table)
This includes taxonomic or functional results generated by any of our pipelines. These are .tsv tables where rows are samples and columns are microbial or feature. MaAsLin2 can take raw counts or relative abundances as input.
### Metadata
Metadata that describes is required for this analysis, and [tutorials on metadata input can be found here](/docs/metadata-and-cohorts).
> [card] [Running the MaAsLin2 Workflow](/docs/maaslin2-running-workflow)
> [card] [Interpreting MaAsLin2 Results](/docs/maaslin2-view-results)
# Running MaAsLin 2 Workflow
Source: https://docs.cosmosid.com/docs/maaslin2-running-workflow
We recommend running MaAsLin analyses independent of other comparative analyses. Once the parameters are set, click the Create button to start the MaAsLin2 workflow. Cosmos-Hub will process the data and return the results when the analysis is complete. Depending on the size of the dataset, the analysis may take a few minutes to 1+ hour.
> [!WARNING]
>
> ## A note about running MaAsLin2:
>
> Users are responsible for selecting parameters that best suit their study data and research objectives. While we provide basic recommendations, it is crucial to have a thorough understanding of the MaAsLin2 tool and the statistical methods employed to ensure accurate and reproducible results. We strongly encourage users to familiarize themselves with the tool’s capabilities and limitations to make informed decisions regarding their analysis settings.
# Launching the MaAsLin2 Tool
Before running MaAsLin2, you will need to process your .fastq files through one of the **taxonomic** or **functional** workflows available within the Cosmos-Hub. You will also need to add **metadata** to each of your samples to define cohorts needed for comparative analysis. Ensure your metadata encompasses all variables that you want to measure and that may affect your results, with clear groupings for main comparative variables.
After profiling, select the samples that you would like to compare in the "Cohorts and Metadata" menu and click "Create CA" to initiate the configuration of your parameters.
## MaAsLin2 Comparative Workflows
Select one of the following workflows depending on your input data:
* ***MaAsLin2 Kepler-Taxa*** - conduct differential abundance analysis on Taxa-Kepler results for host agnostic profiling
* ***MaAsLin2 CHAMP-Taxa*** - conduct differential abundance analysis on Taxa-CHAMP results for human-based profiling
* ***MaAsLin2 HostAgnostic Functional***- conduct differential abundance analysis on Functional 2.0 (MetaCyc, GO Terms, Pfam, CAZy, EnzymeCommission) profiling results
* ***MaAsLin2 CHAMP-Functional***- conduct differential abundance analysis on GBM/GMM/KEGG results
# Recommended Workflow Parameters
This section outlines suggested settings for MaAsLin2 to optimize differential abundance analysis. Proper configuration ensures accurate results and helps address specific research questions effectively. Use these guidelines to select appropriate fixed and random effects, normalization techniques, and statistical models tailored to your study design. Adjusting these parameters based on your dataset’s characteristics and research objectives will enhance the reliability and interpretability of your findings.
> [tab] Kepler-Taxa
>
> | Parameter | Recommended Value |
> | - | - |
> | Metric | Relative Abundance |
> | Taxonomic Level | Species |
> | Min. Abundance (A single hit can always be a sequencing error, contamination error, or other noise variables etc. Implementing a minimum abundance with minimum prevalence cutoff can ensure more accurate multi-variate association analysis data.) | 0.001 |
> | Min. Prevalence (Samples are far richer in functional hits than in taxonomic hits. Non-prevalent functions can sharply increase computational time and may include false positives, which is why more stringent cutoffs are recommended.) | 0.05 |
> | Q Threshold | 0.1 |
> | Normalization | NONE |
> | Transformation | LOG |
> | Analysis Method | LM |
> | Multiple Correction | BH |
> | Standardization | ✓ |
> | N Heatmap | ✓ |
> [tab] HostAgnostic Functional
>
> | Parameter | Recommended Value |
> | :- | :- |
> | Metric | CPM |
> | Taxonomic Level | NA |
> | Min. Abundance (A single hit can always be a sequencing error, contamination error, or other noise variables etc. Implementing a minimum abundance with minimum prevalence cutoff can ensure more accurate multi-variate association analysis data.) | 10 |
> | Min. Prevalence (Samples are far richer in functional hits than in taxonomic hits. Non-prevalent functions can sharply increase computational time and may include false positives, which is why more stringent cutoffs are recommended.) | 0.25 |
> | Q Threshold | 0.1 |
> | Normalization | TSS |
> | Transformation | LOG |
> | Analysis Method | LM |
> | Multiple Correction | BH |
> | Standardization | ✓ |
> | N Heatmap | ✓ |
> [tab] CHAMP-Taxa
>
> | Parameter | Recommended Value |
> | :- | :- |
> | Metric | Relative Abundance |
> | Taxonomic Level | Species |
> | Min. Abundance (A single hit can always be a sequencing error, contamination error, or other noise variables etc. Implementing a minimum abundance with minimum prevalence cutoff can ensure more accurate multi-variate association analysis data.) | 0.001 |
> | Min. Prevalence (Samples are far richer in functional hits than in taxonomic hits. Non-prevalent functions can sharply increase computational time and may include false positives, which is why more stringent cutoffs are recommended.) | 0.05 |
> | Q Threshold | 0.1 |
> | Normalization | NONE |
> | Transformation | LOG |
> | Analysis Method | LM |
> | Multiple Correction | BH |
> | Standardization | ✓ |
> | N Heatmap | ✓ |
> [tab] CHAMP-Functional
>
> | Parameter | Recommended Value |
> | :- | :- |
> | Metric | Cellular Abundance |
> | Taxonomic Level | NA |
> | Min. Abundance (A single hit can always be a sequencing error, contamination error, or other noise variables etc. Implementing a minimum abundance with minimum prevalence cutoff can ensure more accurate multi-variate association analysis data.) | 0.01 |
> | Min. Prevalence (Samples are far richer in functional hits than in taxonomic hits. Non-prevalent functions can sharply increase computational time and may include false positives, which is why more stringent cutoffs are recommended.) | 0.25 |
> | Q Threshold | 0.1 |
> | Normalization | NONE |
> | Transformation | LOG |
> | Analysis Method | LM |
> | Multiple Correction | BH |
> | Standardization | ✓ |
> | N Heatmap | ✓ |
> [tab] AMR/VF
>
> | Parameter | Recommended Value |
> | :- | :- |
> | Metric | Abundance Score |
> | Taxonomic Level | n/a |
> | Min. Abundance (A single hit can always be a sequencing error, contamination error, or other noise variables etc. Implementing a minimum abundance with minimum prevalence cutoff can ensure more accurate multi-variate association analysis data.) | 10 |
> | Min. Prevalence (Samples are far richer in functional hits than in taxonomic hits. Non-prevalent functions can sharply increase computational time and may include false positives, which is why more stringent cutoffs are recommended.) | 0.25 |
> | Q Threshold | 0.1 |
> | Normalization | NONE |
> | Transformation | LOG |
> | Analysis Method | LM |
> | Multiple Correction | BH |
> | Standardization | ✓ |
> | N Heatmap | ✓ |
> [tab] ShortRead 16S-Taxa
>
> | Parameter | Recommended Value |
> | :- | :- |
> | Metric | Relative Abundance |
> | Taxonomic Level | Species |
> | Min. Abundance (A single hit can always be a sequencing error, contamination error, or other noise variables etc. Implementing a minimum abundance with minimum prevalence cutoff can ensure more accurate multi-variate association analysis data.) | 0.001 |
> | Min. Prevalence (Samples are far richer in functional hits than in taxonomic hits. Non-prevalent functions can sharply increase computational time and may include false positives, which is why more stringent cutoffs are recommended.) | 0.05 |
> | Q Threshold | 0.1 |
> | Normalization | NONE |
> | Transformation | LOG |
> | Analysis Method | LM |
> | Multiple Correction | BH |
> | Standardization | ✓ |
> | N Heatmap | ✓ |
> [tab] ShortRead 16S-Functional
>
> | Parameter | Recommended Value |
> | :- | :- |
> | Metric | Raw Counts |
> | Taxonomic Level | NA |
> | Min. Abundance (A single hit can always be a sequencing error, contamination error, or other noise variables etc. Implementing a minimum abundance with minimum prevalence cutoff can ensure more accurate multi-variate association analysis data.) | 10 |
> | Min. Prevalence (Samples are far richer in functional hits than in taxonomic hits. Non-prevalent functions can sharply increase computational time and may include false positives, which is why more stringent cutoffs are recommended.) | 0.25 |
> | Q Threshold | 0.1 |
> | Normalization | TSS |
> | Transformation | LOG |
> | Analysis Method | LM |
> | Multiple Correction | BH |
> | Standardization | ✓ |
> | N Heatmap | ✓ |
> [tab] LongRead 16S
>
> | Parameter | Recommended Value |
> | :- | :- |
> | Metric | Relative Abundance |
> | Taxonomic Level | Species |
> | Min. Abundance (A single hit can always be a sequencing error, contamination error, or other noise variables etc. Implementing a minimum abundance with minimum prevalence cutoff can ensure more accurate multi-variate association analysis data.) | 0.0001 |
> | Min. Prevalence (Samples are far richer in functional hits than in taxonomic hits. Non-prevalent functions can sharply increase computational time and may include false positives, which is why more stringent cutoffs are recommended.) | 0.05 |
> | Q Threshold | 0.25 |
> | Normalization | NONE |
> | Transformation | LOG |
> | Analysis Method | LM |
> | Multiple Correction | BH |
> | Standardization | ✓ |
> | N Heatmap | ✓ |
# Selecting Fixed and Random Effects
Choosing appropriate *fixed* and *random* effects is critical for the success of MaAsLin2 analyses. These variables define how samples are grouped into comparative cohorts, directly impacting the results. Fixed effects are the primary variables of interest, such as treatment groups or time points, while random effects account for potential confounding factors, like age or sample ID. Properly defining these effects ensures that your analysis accurately reflects the biological questions you are exploring and minimizes biases in the model.
### Fixed Effects
Fixed effects are metadata variables that relates to your hypothesis. These are the primary variables that you are interested in obtaining specific comparative results against. A fixed effect must have 2 or more groups for comparison (we recommend a max of 5 groups).
For example, a fixed effect could be:
* "Condition" \[Control vs. Treatment]
* "DiseaseState" \[Healthy vs. IBD vs. Crohn's]
* "Time Point" \[baseline vs. mid-study vs. endpoint]
* Drug Dosage \[0ng vs. 50ng vs. 100ng]
Multiple fixed effects can be selected for comparisons across multiple metadata variables. Results will be presented in the analysis results for every variable/level.
### Random Effects
Random effects are metadata variables that may not be interested in evaluating but may present variability in the study data. Use these to account for confounding variables that might introduce noise, such as subject-specific differences (e.g., BMI, age). This helps in minimizing bias from uncontrolled factors. Only include relevant confounders to prevent model overfitting.
For example, a random effect could be:
* BMI
* Age
* Cage number
* Days of antibiotic administration
* SampleID (for longitudinal samplings from the same individual/host)
* Experimental blocks
> [!NOTE]
>
> ## Selecting Effect Variable Parameters
>
> 
>
> When defining fixed and random effects, it’s essential to select appropriate **data types** and **reference values**.
>
> Fixed effects should include categorical variables with clear groups or continuous variables. For categorical data, specify a reference value (if applicable) to serve as a baseline for comparison (e.g., day0, control, healthy). Should a categorical data type be selected without a reference value, MaAsLin2 by default sets the first category in alphabetical order as the reference.
>
> Random effects account for variability due to confounding factors (e.g., subject ID in longitudinal studies, age, cage number). Correctly setting these parameters ensures robust statistical modeling and accurate interpretation of results.
## Selecting Other Model Parameters
### Filterset
***Filtered*** results contain the calls that have met the machine learning threshold for high confidence that the organism called is actually in the sample.
***Total*** results contain all calls, providing a more comprehensive but potentially noisier dataset. Calls that fall below the filtering threshold and may need further validation to determine if they are truly present in the sample.
### Metric
Options for taxonomic data:
* ***Relative abundance***: percentage abundance per sample
* ***Normalized reads frequency***: counts normalized to the size of their matching genome; not synonymous with the "Normalization" parameter
* ***Reads frequency***: raw read counts
Options for functional data:
* ***CPM*** (Kepler): copies per million (normalized counts for functional data)
* ***Relative abundance*** (Kepler): percentage abundance per sample
* ***Cellular abundance*** (CHAMP): represents the relative percentage of species that are able to perform a given function in the microbiome community
### Taxonomy Level
Options include: Phylum, Class, Order, Family, Genus, Species, Strain
Select the desired phylogenetic level of calls for differential abundance analysis.
Recommended: Species
### Minimum Abundance
The minimum abundance threshold for each feature.
Set thresholds to filter low-abundance features, reducing noise and focusing on biologically relevant data.
### Minimum Prevalence Percentage
The minimum percent of samples for which a feature is detected at minimum abundance.
This parameter helps filter out rare features that may not provide meaningful insights by defining the minimum proportion of samples in which a feature must be present to be included in the analysis. Selecting an appropriate threshold reduces noise and focuses on features that are consistently observed across the study cohort. Typically, a threshold of 5% is recommended, but this can vary based on the study design and specific research questions.
> [!NOTE]
>
> ### Prevalence and abundance filtering in MaAsLin2
>
> Typically, it only makes sense to test for feature-metadata associations if a feature is non-zero "enough" of the time. "Enough" can vary between studies, but a 10-50% minimum prevalence threshold is not unusual (and up to 70-90% can be reasonable). Selecting a minimum prevalence filter of 5% will test only features with at least 5% non-zero values.
>
> Similarly, it's often desirable to test only features that reach a minimum abundance threshold in at least this many samples. By default, MaAsLin2 will consider any non-zero value to be reliable, and if you've already done sufficient QC in your dataset, this is appropriate. However, if you'd like to filter more or be conservative, you can set a minimum abundance threshold like min\_abundance = 0.001 to test only features reaching at least this (relative) abundance.
### Q Value Significance Threshold
The maximum q-value threshold the be considered significant.
The Q value threshold controls the false discovery rate, helping to reduce false positives in multiple comparisons. A typical threshold is ≤ 0.1, but this can vary depending on the dataset (0.05-0.25). Adjust based on your study’s balance between identifying true associations and minimizing errors.
### Normalization
Different normalization techniques adjust for varying sequencing depths or compositional biases:
* **TSS (Total Sum Scaling)**: *(default)* normalizes the feature table by dividing each feature by the total sum of features per sample.
* **TMM (Trimmed Mean of M-values)**: assumes that most taxa are not differentially expressed between samples; computationally intensive for large data sets
* **CLR (Centered Log Ratio)**: Useful for compositional data, particularly when the data is sparse.
* **CSS (Cumulative Sum Scaling)**: Suited for sparse count data, normalizing features based on cumulative sums.
### Transformation
Choose transformations depending on the data distribution:
* **Log**: *(default)* Apply for skewed data, typically in microbial abundance
* **Log10**: A base-10 log transformation, less aggressive than natural log
* **Logit**: For binary data (e.g., presence/absence).
* **None**: Use with caution; generally reserved for count models like NEGBIN or ZINB.
### Analysis Method (Statistical Model)
Several different types of statistical models can be used for association testing in MaAsLin. The pros and cons of each model is discussed in the [MaAsLin2 manuscript](https://www.biorxiv.org/content/10.1101/2021.01.20.427420v1). While the default is generally appropriate for most analyses, a user might want to select a different model under some circumstances. This is true for many different microbial community data types (taxonomy or functional profiles), environments (human or otherwise), and measurements (counts or relative proportions), as long as alternative models are used with appropriately modified normalization/transformation schemes.
*For non-count (relative abundance, CPM) data:* use **LM** or **CPLM**.
*For count data (reads frequency/normalized reads frequency):*, use **NEGBIN** and **ZINB**
Options include:
* **LM (Linear Model)**: A traditional linear regression model suitable for both positive and negative values. It assumes normally distributed errors and a linear relationship between dependent and independent variables. Ideal for data with no zeros or minimal skewness, such as relative abundance data that has been transformed (e.g., log-transformed).
* **CPLM (Compound Poisson Linear Models)**: Models continuous data with exact zeros using the Tweedie distribution, which combines a point mass at zero with a continuous positive distribution. Ideal for zero-inflated continuous data, such as sparse microbiome functional profiles where many samples have zero abundance for specific features.
* CPLM requires the data to be positive. Therefore, any transformation that produces negative values will typically NOT work for CPLM.
* **NEGBIN (Tweedie compound Poisson linear models)**: A count-based model that handles overdispersion, where variance exceeds the mean. It includes an extra parameter to model this variability. Suitable for count data with high variability and zero counts, such as raw microbial read counts.
* **ZINB (Zero-inflated negative binomial regression)**: Extends the NEGBIN model by incorporating an additional component to model excess zeros, accounting for true and false zeros separately. Ideal for highly sparse count data where zero inflation is prominent, such as environmental or clinical microbiome datasets with many undetected features.
> [!TIP]
>
> ### If you're not sure which to use, select LM
>
> LM is the only model that works on both positive and negative values (following normalization and transformation), and (as per the manuscript), it is generally much more robust to parameter changes (which are typically limited for non-LM models). Regarding whether to use LM, CPLM, or other models, intuitively, CPLM or a zero-inflated alternative should perform better in the presence of zeroes, but based on tool benchmarking, there is no evidence that CPLM is significantly better than LM in practice.
All the non-LM models use an intrinsic log link transformation due to their close connection to GLMs and they are recommended to be run with no transformation.
| Model | Data Type | Normalization | Transformation |
| - | - | - | - |
| LM | count and non-count | TSS,CLR, NONE | LOG, LOGIT, AST, NONE |
| CPLM | count and non-count | TSS, TMM, CSS, NONE | NONE |
| NEGBIN | count | TMM, CSS, NONE | NONE |
| ZINB | count | TMM, CSS, NONE | NONE |
### Multiple Hypothesis Correction Method
Correction for multiple testing is a statistical method used to reduce the likelihood of false positive results when performing multiple comparisons or tests. This produces a **q value**, which complements the corresponding **p value**. When many statistical tests are conducted simultaneously, the chance of finding a significant result purely by chance increases. To address this, correction methods adjust the significance levels to control the overall error rate.
Options include:
* **BH (Benjamini-Hochberg FDR)**: *(default)* This method controls the False Discovery Rate (FDR), which is the expected proportion of false positives among the declared significant results. The p-values are ranked, and a threshold is determined based on the desired FDR.
* Strengths/Weaknesses: Less conservative than Bonferroni, so it is more likely to detect true positives, making it useful in large datasets. While it reduces the chance of false positives, some false discoveries may still occur.
* **Bonferroni Correction**: This is the simplest and most conservative method ideal for small datasets. The p-value threshold is adjusted by dividing the original significance level (α) by the number of comparisons (m). For example, if you are testing 100 hypotheses with a significance level of 0.05, the adjusted p-value threshold would be 0.05/100 = 0.0005.
* Strengths/Weaknesses: Controls the family-wise error rate (FWER), meaning it reduces the risk of any false positives. However, it can be overly conservative, especially when there are many comparisons, leading to false negatives (missing true associations).
* **Holm**: A stepwise version of the Bonferroni method. It adjusts the p-value thresholds sequentially, beginning with the smallest p-value. Each p-value is compared to a threshold based on its rank (smallest p-value gets divided by the number of tests, second smallest by one less, and so on).
* Strengths/Weaknesses: More powerful than the Bonferroni correction, especially in situations with a smaller number of comparisons. However, it is still fairly conservative, which can reduce power.
* **None**: No correction applied.
### Standardize Numeric/Continuous Metadata Variable
Apply z-score standardization so continuous metadata are on the same scale.
Standardizing a numeric or continuous metadata variable involves transforming the values to have a mean of zero and a standard deviation of one. This process, also known as z-score normalization, allows variables with different units or scales to be compared directly. Standardization is crucial when variables differ significantly in their ranges or units, ensuring that each variable contributes equally to the model and preventing any one variable from disproportionately influencing the analysis. It is commonly used in linear models and clustering algorithms.
> [!NOTE]
>
> ### Why standardize your numeric variables?
>
> Suppose you have a microbiome dataset where you want to analyze the impact of participants' age and BMI on microbial abundance. Since age and BMI have different scales, standardizing these variables (e.g., converting age from years and BMI from kg/m² to z-scores) ensures that both contribute equally to the analysis. This prevents the model from being disproportionately influenced by the variable with the larger numerical range, allowing for more balanced and interpretable results.
### Plot Heatmap
Generate a heatmap for the significant associations.
### Number of Significance Features in Heatmap
In heatmap, plot top N features with significant associations.
### Plot Scatter
Generate scatter plots for the significant associations.
### Workflow
Select the version of your taxonomic/functional workflows.
# Viewing the MaAsLin2 Results
Source: https://docs.cosmosid.com/docs/maaslin2-view-results
By navigating to the "Comparative Analysis" menu, you'll be able to view your generated MaAsLin2 comparatives. The comparative analysis will contain data in different tabs (as described below).
## MaAsLin2 Results
### Input Data
A pre-formatted .tsv table containing taxonomic or functional profiling results (values dependent on input parameters).
### Input Metadata
A pre-formatted .tsv table containing all sample metadata.
### Association Results
Perhaps the most important output from MaAsLin 2 is the list of significant associations displayed in the Association Results, which displays significant associations between metadata and microbial features along with effect size, p-values, and q-values.
The full list of associations that pass MaAsLin 2's significance threshold is ordered by increasing q-values. Columns are:
* *Metadata*: the variable name being associated with a microbial feature.
* *Feature Name*: the microbial feature (taxon, gene, pathway, etc.).
* *Value Name*: for categorical features, the specific feature level for which the coefficient and significance of association is being reported.
* *Coefficient/EffectSize*: the model coefficient value
* Coefficients for categorical variables indicate the contrast between the each metadata category versus the reference.
* *Standard Error*: the standard error from the model.
* *N*: the total number of samples used in the model for this association (since minimum abundance/prevalence can exclude samples from comparisons).
* *N not Zero*: the total of number of these samples in which the feature is non-zero.
* *P-value*: the nominal significance of this association.
* *Q-value*: the corrected significance is computed with p.adjust with the correction method (BH, etc.).

### Box and Scatter Plots
A tab is presented for each Fixed Effect, which includes plots for each of the significant associations in the Association Results (boxplots for categorical variables, scatter plots for continuous). These can be viewed within the GUI and exported via .ZIP file.

### Heatmap
Top 50 (unless otherwise specified) features with significant associations.

### Volcano
Volcano plot depicting all significant variables for each fixed effect

### Forest
Forest plot helps to visually summarize the significant features effect size from the model contrasts along with their confidence intervals.
X-axis represents the contrast effect size; Y-axis represents the significant features that were found in respective contrasts of interest. The dot and the lines from the dot represents the individual feature’s effect size and the confidence interval of the effect size respectively
## Exporting the Data

All data can be exported as a .ZIP file by navigating to the comparative analysis and selecting the "Export" button in the top right corner. This .ZIP file will contain all input tables, results table, all figures (PDF), and a maaslin2.log for debugging purposes.
# MaAsLin3 for Differential Abundance
Source: https://docs.cosmosid.com/docs/maaslin3
MaAsLin3 (Microbiome Multivariable Association with Linear Models) is the latest iteration of the tool's framework, currently in beta testing.
[MaAsLin3](https://huttenhower.sph.harvard.edu/maaslin3/) is designed to determine associations between microbial features (e.g., taxonomic compositions, functional profiles) and metadata (e.g., clinical or environmental variables). MaAsLin3 offers enhanced performance, greater flexibility in modeling, and improved stability.
If you use the MaAsLin3 tool, please cite the reference pre-print manuscript:
> Nickols WA, Kuntz T, Shen J, Maharjan S, Mallick H, Franzosa EA, Thompson KN, Nearing JT, Huttenhower C. MaAsLin 3: refining and extending generalized multivariable linear models for meta-omic association discovery. Nat Methods. 2026 Mar;23(3):554-564. doi: 10.1038/s41592-025-02923-9. Epub 2026 Jan 15. PMID: 41540124; PMCID: PMC12982127.
[YouTube video player](https://www.youtube.com/embed/IkVrZ2FbMDo)
## Microbiome Association Detection with MaAsLin3
Relative to MaAsLin 2, MaAsLin 3 introduces the ability to quantify and test for both **abundance** and **prevalence** associations while better accounting for compositionality. By incorporating generalized linear models, MaAsLin 3 accommodates most modern study designs, including cross-sectional and longitudinal studies. it efficiently identifies meaningful associations while controlling for confounding factors and handling complex data structures.
Through the Cosmos-Hub, researchers can easily upload their raw fastq data for profiling and configure MaAsLin3 through the Comparative Analysis module. Results can be interpreted via automatically generated tables, heatmaps, and summary files—ultimately streamlining the discovery of significant microbiome–metadata relationships.
MaAsLin3 workflow two inputs, which are generated in the Cosmos-Hub:
### Profiling Data (feature table)
A table where rows represent samples and columns represent microbial features (e.g., species, genes, pathways). Each cell in the table provides the abundance of that feature in that sample. MaAsLin3 can take raw counts or relative abundances as input. This is the default output of a comparative analysis within the Cosmos-Hub.
### Metadata
Metadata that describes is required for this analysis, and [tutorials on metadata input can be found here](/docs/metadata-and-cohorts).
> [card] [Running the MaAsLin3 Workflow](/docs/maaslin3-running-workflow)
> [card] [Interpreting MaAsLin3 Results](/docs/maaslin3-view-results)
# Longitudinal and Complex Association Testing with MaAsLin3
Source: https://docs.cosmosid.com/docs/maaslin3-longitudinal
MaAsLin3 (Multivariate Association with Linear Models) enables complex modeling of associations between microbial features and metadata using R’s `lme4` formula syntax. The Cosmos-Hub automatically translates user-selected variables into valid MaAsLin3 formulas, supporting a wide range of study designs. This extends beyond the typical "Fixed" and "Random" effects by implementing other variables such as:
> [accordion] Interaction Terms
>
> Interaction terms model how the effect of one variable depends on another.
>
> * **Syntax**: `salmonella_enterica*days_of_life`
> * **Example**: Testing if the impact of `salmonella_enterica` differs across days of life.
> [accordion] Group Effects
>
> * For **ANOVA-style group testing**, checks if any level differs from the others overall. This will group variables into a common cluster for analysis.
> * **Syntax**: `group(variable)`
> * **Example**: When multiple levels of a categorical variable should be treated jointly.
> **Note**: Group effects can be combined with fixed and random effects.
> [accordion] Ordered Effects
>
> For testing **stepwise differences between levels**, like "mild \< moderate \< severe". Used for ordinal metadata where the order matters but the scale is not linear.
>
> * **Syntax**: `ordered(variable)`
>
> * **Example**: Disease stages (Stage I, II, III) or ordered diet interventions.
>
> > **Note**: Ordered effects can be combined similarly with fixed/random effects.
> [accordion] Strata Effects
>
> * For **matched case-control designs**, where samples are paired/matched within strata. Strata effects separate the analysis across strata of a variable and **cannot be combined** with other formula components.
> * **Syntax**: `strata(variable)`
> * **Example**: Stratifying analyses by distinct clinical groups.
# Basic Formula Components
**1. Fixed Effects (Simple relationships)**
```text theme={null}
~ diet + age + sex
```
This means: "Model the abundance of each feature as influenced by diet, age, and sex."
**This will perform the same function as adding each variable as a fixed effect in the standard GUI.**
Each variable is assumed to have an independent effect on the microbial feature's abundance and/or prevalence.
**2. Interaction Terms**
```text theme={null}
~ diet * sex
```
Expands to:
```text theme={null}
diet + sex + diet:sex
```
This tests if the **effect of diet** is **different between males and females**.
**3. Random Effects (Repeated Measures or Hierarchies)**
```text theme={null}
~ treatment + (1 | subject_id)
```
This tells MaAsLin3: "Model treatment effects, while accounting for multiple samples from the same subject."
Random effects help control for **non-independence of observations** (e.g., same person measured over time).
Multiple random effects are supported:
```text theme={null}
~ treatment + (1 | subject_id) + (1 | batch)
```
**4. Group, Ordered, and Strata Variables**
```text theme={null}
~ group(treatment_group) + ordered(severity)
```
**Note**: Group/ordered predictors should **not** appear in random effects.
Only one strata variable can be used in a model:
```text theme={null}
age + strata(pair_id)
```
# Example
Let’s say you're analyzing a microbiome dataset of gut samples from different diets, ages, and sexes, with repeated sampling across time:
```text theme={null}
~ diet * sex + age + (1 | subject_id)
```
This means:
* Main effects of diet, sex, age
* Diet × sex interaction
* Random effect for individual subjects
If you're doing a matched study (e.g., pre/post), you could use:
```text theme={null}
~ treatment + strata(subject_pair)
```
# Formula Scenarios
| Scenario | Formula Syntax | Description |
| - | - | - |
| **Fixed Effects** | `~ diet + age` | Basic effects of variables like diet or age |
| **Random Effects** | `~ diet + (1 \| subject_id)` | Accounts for repeated measurements within individuals |
| **Interaction Terms** | `~ diet * sex` | Tests whether the effect of one variable depends on another |
| **Fixed + Random + Interaction** | ` ~ diet * sex + (1\| subject_id)` | Full model with main, interaction, and repeated effects |
| **Group Effects** | `~ group(diet)` | Treats all levels of a categorical variable jointly |
| **Ordered Effects** | `~ ordered(stage)` | Tests stepwise effects in ordinal variables (e.g., Stage I \< II \< III) |
| **Strata Effects (Exclusive)** | `~ strata(pair_id)` | For matched case-control studies (cannot be combined with other effects) |
### Combining Effect Types
Effect types can often be mixed—except **strata**, which must stand alone:
| Combination | Example |
| - | - |
| Fixed + Random | `~ age + (1 \| subject_id)` |
| Fixed + Interaction | `~ age + treatment + age:treatment` |
| Fixed + Group | `~ group(treatment) + age` |
| Fixed + Ordered | `~ ordered(dose_level) + age` |
| Fixed + Random + Group | `~ group(treatment) + age + (1 \| subject_id) ` |
| Fixed + Random + Interaction | `~ treatment * timepoint + (1 \| subject_id ) ` |
| **Strata Only** | `~ strata(pair_id)` |
### Syntax Notes
* **Interaction Terms**: `var1:var2` models whether the effect of `var1` changes across `var2`.
* **Group Effects**: `group(var)` aggregates all levels for joint testing.
* **Ordered Effects**: `ordered(var)` evaluates progression across ordered categories.
* **Strata Effects**: `strata(var)` conditions the analysis on matched groups (e.g., case-control pairs) and **cannot be combined** with other effects.
# Cosmos-Hub Smart Formula Handling
* Automatic parsing: Your selections in the Cosmos-Hub interface are converted into the correct formula string.
* Validation: Invalid or unsupported combinations (e.g., using `strata` with `random`) are flagged before submission.
* Support for prevalence and abundance.
### Key Considerations
* **Strata** must be the only term in the formula—no other variables allowed.
* **Group and ordered** variables behave like fixed effects but are tested differently.
* **Interaction models** are essential for longitudinal or treatment-timepoint designs.
# Running MaAsLin3 Workflow
Source: https://docs.cosmosid.com/docs/maaslin3-running-workflow
> [!WARNING]
>
> **A note about running MaAsLin3**
>
> Users are responsible for selecting parameters that best suit their study data and research objectives. While we provide basic recommendations, it is crucial to have a thorough understanding of the MaAsLin3 tool and the statistical methods employed to ensure accurate and reproducible results.
>
> We strongly encourage users to familiarize themselves with the tool’s capabilities and limitations to make informed decisions regarding their analysis settings.
>
> Please note that (Beta) indicates the status of the MaAsLin3 pipeline, which is currently in beta stages upon the publish of their pre-print article.
# Launching the MaAsLin3 Tool
Before running MaAsLin3, you will need to process your .fastq files through one of the **taxonomic** or **functional** workflows available within the Cosmos-Hub. You will also need to add **metadata** to each of your samples to define cohorts needed for comparative analysis. Ensure your metadata encompasses all variables that you want to measure and that may affect your results, with clear groupings for main comparative variables.
After profiling, select the samples that you would like to compare in the "Cohorts and Metadata" menu and click "Create CA" to initiate the configuration of your parameters.
## Selecting the MaAsLin3 Comparative Workflow
Select one of the following workflows depending on your input data:
* ***MaAsLin3 Kepler-Taxa*** - conduct differential abundance analysis on Taxa-Kepler results for host agnostic profiling
* ***MaAsLin3 CHAMP-Taxa*** - conduct differential abundance analysis on Taxa-CHAMP results for human-based profiling
* ***MaAsLin3 HostAgnostic Functional***- conduct differential abundance analysis on Functional 2.0 (MetaCyc, GO Terms, Pfam, CAZy, EnzymeCommission) profiling results
* ***MaAsLin3 CHAMP-Functional***- conduct differential abundance analysis on GBM/GMM/KEGG results
* ***MaAsLin3 16S/ITS*** are also available for relevant datasets.
# Recommended Workflow Parameters
This section outlines suggested settings for MaAsLin3 to optimize differential abundance analysis. Proper configuration ensures accurate results and helps address specific research questions effectively. Use these guidelines to select appropriate fixed and random effects, normalization techniques, and statistical thresholds tailored to your study design. Adjusting these parameters based on your dataset’s characteristics and research objectives will enhance the reliability and interpretability of your findings.
> [tab] Kepler-Taxa
>
> | Parameter | Recommended Value |
> | - | - |
> | Metric | Relative Abundance |
> | Taxonomic Level | Species |
> | Fixed Effect | Metadata of interest |
> | Random Effect | OptionalVariables |
> | Longitudinal and Complex Association Formula (Optional) | [See page](https://docs.cosmosid.com/docs/maaslin3-longitudinal) |
> | Min. Abundance | 0.001 |
> | Zero Threshold | 0 |
> | Min. Prevalence | 0.05 |
> | Minimum Variance | 0 |
> | Q Threshold | 0.1 |
> | Normalization | NONE |
> | Transformation | LOG |
> | Multiple Correction | BH |
> | Standardization | TRUE |
> | Augmentation | TRUE |
> | Median Comparison Abundance Compositional Correction | TRUE |
> | Median Comparison Abundance Threshold | 0 |
> | Median Comparison Prevalence Compositional Correction | FALSE |
> | Subtract Median | FALSE |
> | Maximum Number of Associations to Plot (Increase or decrease according to plot quality) | 50 |
> | Number of Features in Summary Plot (Increase or decrease according to plot quality) | 30 |
> [tab] HostAgnostic Functional
>
> | Parameter | Recommended Value |
> | :- | :- |
> | Metric | Relative Abundance |
> | Taxonomic Level | n/a |
> | Fixed Effect | Metadata of interest |
> | Random Effect | OptionalVariables |
> | Longitudinal and Complex Association Formula (Optional) | [See page](https://docs.cosmosid.com/docs/maaslin3-advanced) |
> | Min. Abundance | 0.001 |
> | Zero Threshold | 0 |
> | Min. Prevalence | 0.25 |
> | Minimum Variance | 0 |
> | Q Threshold | 0.1 |
> | Normalization | NONE |
> | Transformation | LOG |
> | Multiple Correction | BH |
> | Standardization | TRUE |
> | Augmentation | TRUE |
> | Median Comparison Abundance Compositional Correction | TRUE |
> | Median Comparison Abundance Threshold | 0 |
> | Median Comparison Prevalence Compositional Correction | FALSE |
> | Subtract Median | FALSE |
> | Maximum Number of Associations to Plot (Increase or decrease according to plot quality) | 50 |
> | Number of Features in Summary Plot (Increase or decrease according to plot quality) | 30 |
> [tab] CHAMP-Taxa
>
> | Parameter | Recommended Value |
> | :- | :- |
> | Metric | Relative Abundance |
> | Taxonomic Level | Species |
> | Fixed Effect | Metadata of interest |
> | Random Effect | OptionalVariables |
> | Longitudinal and Complex Association Formula (Optional) | [See page](https://docs.cosmosid.com/docs/maaslin3-advanced) |
> | Min. Abundance | 0.001 |
> | Zero Threshold | 0 |
> | Min. Prevalence | 0.05 |
> | Minimum Variance | 0 |
> | Q Threshold | 0.1 |
> | Normalization | NONE |
> | Transformation | LOG |
> | Multiple Correction | BH |
> | Standardization | TRUE |
> | Augmentation | TRUE |
> | Median Comparison Abundance Compositional Correction | TRUE |
> | Median Comparison Abundance Threshold | 0 |
> | Median Comparison Prevalence Compositional Correction | FALSE |
> | Subtract Median | FALSE |
> | Maximum Number of Associations to Plot (Increase or decrease according to plot quality) | 50 |
> | Number of Features in Summary Plot (Increase or decrease according to plot quality) | 30 |
> [tab] CHAMP-Functional
>
> | Parameter | Recommended Value |
> | :- | :- |
> | Metric | Cellular Abundance |
> | Taxonomic Level | n/a |
> | Fixed Effect | Metadata of interest |
> | Random Effect | OptionalVariables |
> | Longitudinal and Complex Association Formula (Optional) | [See page](https://docs.cosmosid.com/docs/maaslin3-advanced) |
> | Min. Abundance | 0.1 |
> | Zero Threshold | 0 |
> | Min. Prevalence | 0.25 |
> | Minimum Variance | 0 |
> | Q Threshold | 0.1 |
> | Normalization | NONE |
> | Transformation | LOG |
> | Multiple Correction | BH |
> | Standardization | TRUE |
> | Augmentation | TRUE |
> | Median Comparison Abundance Compositional Correction | TRUE |
> | Median Comparison Abundance Threshold | 0 |
> | Median Comparison Prevalence Compositional Correction | FALSE |
> | Subtract Median | FALSE |
> | Maximum Number of Associations to Plot (Increase or decrease according to plot quality) | 50 |
> | Number of Features in Summary Plot (Increase or decrease according to plot quality) | 30 |
> [tab] AMR/VF
>
> | Parameter | Recommended Value |
> | :- | :- |
> | Metric | Relative Abundance |
> | Taxonomic Level | n/a |
> | Fixed Effect | Metadata of interest |
> | Random Effect | OptionalVariables |
> | Longitudinal and Complex Association Formula (Optional) | [See page](https://docs.cosmosid.com/docs/maaslin3-advanced) |
> | Min. Abundance | 0.001 |
> | Zero Threshold | 0 |
> | Min. Prevalence | 0.05 |
> | Minimum Variance | 0 |
> | Q Threshold | 0.1 |
> | Normalization | NONE |
> | Transformation | LOG |
> | Multiple Correction | BH |
> | Standardization | TRUE |
> | Augmentation | TRUE |
> | Median Comparison Abundance Compositional Correction | TRUE |
> | Median Comparison Abundance Threshold | 0 |
> | Median Comparison Prevalence Compositional Correction | FALSE |
> | Subtract Median | FALSE |
> | Maximum Number of Associations to Plot (Increase or decrease according to plot quality) | 50 |
> | Number of Features in Summary Plot (Increase or decrease according to plot quality) | 30 |
> [tab] ShortRead 16S-Taxa
>
> | Parameter | Recommended Value |
> | :- | :- |
> | Metric | Relative Abundance |
> | Taxonomic Level | Genus |
> | Fixed Effect | Metadata of interest |
> | Random Effect | OptionalVariables |
> | Longitudinal and Complex Association Formula (Optional) | [See page](https://docs.cosmosid.com/docs/maaslin3-advanced) |
> | Min. Abundance | 0.001 |
> | Zero Threshold | 0 |
> | Min. Prevalence | 0.05 |
> | Minimum Variance | 0 |
> | Q Threshold | 0.1 |
> | Normalization | NONE |
> | Transformation | LOG |
> | Multiple Correction | BH |
> | Standardization | TRUE |
> | Augmentation | TRUE |
> | Median Comparison Abundance Compositional Correction | TRUE |
> | Median Comparison Abundance Threshold | 0 |
> | Median Comparison Prevalence Compositional Correction | FALSE |
> | Subtract Median | FALSE |
> | Maximum Number of Associations to Plot (Increase or decrease according to plot quality) | 50 |
> | Number of Features in Summary Plot (Increase or decrease according to plot quality) | 30 |
> [tab] ShortRead 16S-Functional
>
> | Parameter | Recommended Value |
> | :- | :- |
> | Metric | Relative Abundance |
> | Taxonomic Level | n/a |
> | Fixed Effect | Metadata of interest |
> | Random Effect | OptionalVariables |
> | Longitudinal and Complex Association Formula (Optional) | [See page](https://docs.cosmosid.com/docs/maaslin3-advanced) |
> | Min. Abundance | 0.001 |
> | Zero Threshold | 0 |
> | Min. Prevalence | 0.25 |
> | Minimum Variance | 0 |
> | Q Threshold | 0.1 |
> | Normalization | NONE |
> | Transformation | LOG |
> | Multiple Correction | BH |
> | Standardization | TRUE |
> | Augmentation | TRUE |
> | Median Comparison Abundance Compositional Correction | TRUE |
> | Median Comparison Abundance Threshold | 0 |
> | Median Comparison Prevalence Compositional Correction | FALSE |
> | Subtract Median | FALSE |
> | Maximum Number of Associations to Plot (Increase or decrease according to plot quality) | 50 |
> | Number of Features in Summary Plot (Increase or decrease according to plot quality) | 30 |
> [tab] LongRead 16S
>
> | Parameter | Recommended Value |
> | :- | :- |
> | Metric | Relative Abundance |
> | Taxonomic Level | Species |
> | Fixed Effect | Metadata of interest |
> | Random Effect | OptionalVariables |
> | Longitudinal and Complex Association Formula (Optional) | [See page](https://docs.cosmosid.com/docs/maaslin3-advanced) |
> | Min. Abundance | 0 |
> | Zero Threshold | 0 |
> | Min. Prevalence | 0 |
> | Minimum Variance | 0 |
> | Q Threshold | 0.25 |
> | Normalization | NONE |
> | Transformation | LOG |
> | Multiple Correction | BH |
> | Standardization | TRUE |
> | Augmentation | TRUE |
> | Median Comparison Abundance Compositional Correction | TRUE |
> | Median Comparison Abundance Threshold | 0 |
> | Median Comparison Prevalence Compositional Correction | FALSE |
> | Subtract Median | FALSE |
> | Maximum Number of Associations to Plot (Increase or decrease according to plot quality) | 50 |
> | Number of Features in Summary Plot (Increase or decrease according to plot quality) | 30 |
# Building the statistical model (Fixed + Random Effects)
Building the MaAsLin3 model is dependent upon *fixed* and *random* effects that can be input as metadata variables (added using the "+ADD" button). **Fixed effects are required**, while random effects are optional (but recommended for when relevant metadata is available).
These variables define how samples are grouped into comparative cohorts, directly impacting the results. *Fixed effects* are the primary variables of interest, such as treatment groups or time points, while *random effects* account for potential confounding factors, like number of reads, age, or grouping variables. Properly defining these effects ensures that your analysis accurately reflects the biological questions you are exploring and minimizes biases in the model.
### Fixed Effects
Fixed effects are metadata variables that relate to your hypothesis. These are the primary variables that you are interested in obtaining specific comparative results against. **A fixed effect must have 2 or more groups for comparison (we recommend a max of 5 groups).**
For example, a fixed effect could be:
* "Condition" \[Control vs. Treatment]
* "DiseaseState" \[Healthy vs. IBD vs. Crohn's]
* "Time Point" \[baseline vs. mid-study vs. endpoint]
* "Drug Dosage" \[25ng vs. 50ng vs. 100ng]
* "Cancer Stage" \[1 vs. 2 vs. 3 vs. 4]
Multiple fixed effects can be selected for comparisons across multiple metadata variables. Results will be presented in the analysis results for every variable/level.
> [!NOTE]
>
> **Selecting Effect Variable Parameters (Data Type + Reference Value)**
>
> When defining fixed and random effects, it’s essential to select appropriate **data types** and **reference values**.
>
> Fixed effects should include categorical variables with clear groups or continuous variables. For categorical data, specify a reference value (if applicable) to serve as a baseline for comparison (e.g., day0, control, healthy). Should a categorical data type be selected without a reference value, MaAsLin3 by default sets the first category in alphabetical order as the reference.
>
> Random effects account for variability due to confounding factors (e.g., subject ID in longitudinal studies, age, cage number). Correctly setting these parameters ensures robust statistical modeling and accurate interpretation of results.
### Testing level-versus-level differences, rather than all groups against a reference value
Another feature of MaAsLin3 is the ability to test for level-versus-level differences using ordered predictors and contrast tests. Ordered predictors are categorical variables with a natural ordering such as cancer stage, consumption frequency of a dietary factor, or dosage group.
Say you want to test all fixed effects groups against one another, rather than to the reference value. For example, you want to test Drug Dosage across all levels \[25ng vs. 50ng, 50ng vs. 100ng, 25ng vs. 100ng] instead of against baseline \[25ng vs. 50ng, 25ng vs. 100ng – this is the default workflow when selecting the reference value].
To do so, [you will have to incorperate "ordered(DrugDosage)" into the Longitudinal and Complex Association Formula, and you can read how to do so here](https://docs.cosmosid.com/docs/maaslin3-longitudinal). This will perform a contrast test for whether there is a difference between each pair of subsequent levels. The coefficient, standard error, and p-value all correspond to the difference between the level in value and the previous level. Ordered predictors should only be included as fixed effects (i.e., no ordered predictors as random effects etc.).
### Random Effects
> [!WARNING]
>
> Implementing random effects with fewer than 5 observations per group may produce poor model fits and subsequently no significant associations.
Random effects are metadata variables that may not be interested in evaluating but may present variability in the study data. Use these to account for confounding variables that might introduce noise, such as subject-specific differences (e.g., BMI, age). This helps in minimizing bias from uncontrolled factors. Only include relevant confounders to prevent model overfitting.
For example, a random effect could be:
* BMI
* Age
* Cage number
* Days of antibiotic administration
* Experimental blocks
* Longitudinal time points (requires a Group Effect Longitudinal and Complex Association Formula)
> [!TIP]
>
> **Adding Number of Reads as a Random Effect**
>
> Because MaAsLin 3 identifies prevalence (presence/absence) associations, sample read depth (number of reads) should be included. Deeper sequencing will likely increase feature detection in a way that could spuriously correlate with metadata of interest when read depth is not included in the model.
> [!NOTE]
>
> **Advanced modeling with Longitudinal and Complex Association Formula**
>
> You can also utilize the optional *Longitudinal and Complex Association Formula* to incorporate advanced metadata groupings, such as:
>
> * Group Effects (such as participant\_id for longitudinal studies)
> * Ordered Effects (to cross-compare categorical variables with a natural ordering such as cancer stage, consumption frequency, or dosage group)
> * Strata Effects (a single grouping variable to be included in matched case-control studies)
>
> To learn more, consult the [Longitudinal and Complex Associations with MaAsLin3](https://docs.cosmosid.com/docs/maaslin3-longitudinal) documentation.
## Selecting Other Model Parameters
### Taxonomy Level
Options include: Phylum, Class, Order, Family, Genus, Species (**recommended**), Strain
Select the desired phylogenetic level of calls for differential abundance analysis.
Recommended: Species
### Metric
Options for taxonomic data:
* ***Relative abundance***: percentage abundance per sample (**recommended**)
* ***Normalized reads frequency***: counts normalized to the size of their matching genome; not synonymous with the "Normalization" parameter
* ***Reads frequency***: raw read counts
Options for functional data:
* ***CPM*** (Kepler): copies per million (normalized counts for functional data) (**recommended** for Kepler))
* ***Relative abundance*** (Kepler): percentage abundance per sample
* ***Cellular abundance*** (CHAMP): represents the relative percentage of species that are able to perform a given function in the microbiome community (**recommended** for CHAMP)
### Workflow
Indicates the version of analysis pipeline for generated data. If only 1 version of the pipeline has been run, there will only be one option selected by default. We recommend running analysis with the most up-to-date version of your pipeline.
### [Longitudinal and Complex Associations Formula](https://docs.cosmosid.com/docs/maaslin3-longitudinal)
See dedicated documentation page linked above.
### Minimum Abundance
Features with abundances of at least in of the samples will be included for analysis. The threshold is applied before normalization and transformation.
Set thresholds to filter low-abundance features, reducing noise and focusing on biologically relevant data.
Default: 0.001
### Minimum Prevalence Percentage
The minimum percent of samples for which a feature is detected at minimum abundance. Also see "Minimum Abundance" description above.
This parameter helps filter out rare features that may not provide meaningful insights by defining the minimum proportion of samples in which a feature must be present to be included in the analysis. Selecting an appropriate threshold reduces noise and focuses on features that are consistently observed across the study cohort. Typically, a threshold of 5% for taxonomic analysis and 25% for functional analysis is recommended, but this can vary based on the study design and specific research questions.
> [!NOTE]
>
> **Prevalence and abundance filtering in MaAsLin3**
>
> Typically, it only makes sense to test for feature-metadata associations if a feature is non-zero "enough" of the time. "Enough" can vary between studies, but a 10-50% minimum prevalence threshold is not unusual (and up to 70-90% can be reasonable). Selecting a minimum prevalence filter of 5% will test only features with at least 5% non-zero values.
>
> Similarly, it's often desirable to test only features that reach a minimum abundance threshold in at least this many samples. By default, MaAsLin3 will consider any non-zero value to be reliable, and if you've already done sufficient QC in your dataset, this is appropriate. However, if you'd like to filter more or be conservative, you can set a minimum abundance threshold like min\_abundance = 0.001 to test only features reaching at least this (relative) abundance.
### Zero Threshold
Default: 0
Abundances less than or equal to zero\_threshold will be treated as zeros. This is primarily to be used when the abundance table has likely low-abundance false positives.
### Minimum Variance
Default: 0
Features with abundance variances less than or equal to Minimum Variance will be dropped. This is primarily used for dropping features that are entirely zero.
### Q Value Significance Threshold
The maximum q-value threshold the be considered significant.
The Q value threshold controls the false discovery rate, helping to reduce false positives in multiple comparisons. A typical threshold is ≤ 0.1, but this can vary depending on the dataset (0.05-0.25). Adjust based on your study’s balance between identifying true associations and minimizing errors.
### Normalization
Different normalization techniques adjust for varying sequencing depths or compositional biases:
* **NONE**: *(default)*
* **TSS (Total Sum Scaling)**: *(recommended)* normalizes the feature table by dividing each feature by the total sum of features per sample.
* **CLR (Centered Log Ratio)**: Useful for compositional data, particularly when the data is sparse.
* **CSS (Cumulative Sum Scaling)**: Suited for sparse count data, normalizing features based on cumulative sums.
* **TMM (Trimmed Mean of M-values)**: assumes that most taxa are not differentially expressed between samples; computationally intensive for large data sets
### Transformation
The transformation to apply to the features after normalization and before analysis. The option LOG is recommended, but PLOG (pseudo-log with a pseudo-count of half the dataset minimum non-zero abundance replacing zeros, particularly for metabolomics data) and NONE can also be used.
Choose transformations depending on the data distribution:
* **LOG, base 2**: *(default)* Apply for skewed data, typically in microbial abundance
* **Logit**: For binary data (e.g., presence/absence)
* **AST (Arcsine square root transformation)**: take the arcsine of the square root of a proportion (a number between 0 and 1), essentially "stretching out" the ends of a distribution to stabilize variance, particularly useful when analyzing data that represents proportions or percentages across different groups
* Recommended for metabolomics data
* **None**: Use with caution
### Multiple Hypothesis Correction Method
Correction for multiple testing is a statistical method used to reduce the likelihood of false positive results when performing multiple comparisons or tests. This produces a **q value** (or False Discovery Rate, FDR), which complements the corresponding **p value**. When many statistical tests are conducted simultaneously, the chance of finding a significant result purely by chance increases. To address this, correction methods adjust the significance levels to control the overall error rate.
Options include:
* **Benjamini-Hochberg Procedure (BH)**: *(default)* This method controls the False Discovery Rate (FDR), which is the expected proportion of false positives among the declared significant results. The p-values are ranked, and a threshold is determined based on the desired FDR.
* Strengths/Weaknesses: Less conservative than Bonferroni, so it is more likely to detect true positives, making it useful in large datasets. While it reduces the chance of false positives, some false discoveries may still occur.
* **Bonferroni Correction**: This is the simplest and most conservative method ideal for small datasets. The p-value threshold is adjusted by dividing the original significance level (α) by the number of comparisons (m). For example, if you are testing 100 hypotheses with a significance level of 0.05, the adjusted p-value threshold would be 0.05/100 = 0.0005.
* Strengths/Weaknesses: Controls the family-wise error rate (FWER), meaning it reduces the risk of any false positives. However, it can be overly conservative, especially when there are many comparisons, leading to false negatives (missing true associations).
* **Holm's Step-down Procedure**: A stepwise version of the Bonferroni method. It adjusts the p-value thresholds sequentially, beginning with the smallest p-value. Each p-value is compared to a threshold based on its rank (smallest p-value gets divided by the number of tests, second smallest by one less, and so on).
* Strengths/Weaknesses: More powerful than the Bonferroni correction, especially in situations with a smaller number of comparisons. However, it is still fairly conservative, which can reduce power.
* **Hochberg's Step-up Procedure**: an adjustment method that is less conservative than the Bonferroni correction but more conservative than the Benjamini-Hochberg procedure. It involves sorting the p-values in ascending order. Starting from the smallest, each p-value is compared to a threshold calculated as α/(m+1−i), where α is the desired overall alpha level, m is the total number of tests, and i is the rank of the current p-value. The process stops when a p-value exceeds its corresponding threshold, and all smaller p-values are considered significant.
* Strengths/Weaknesses: It is more powerful than the Bonferroni correction, especially when dealing with a smaller number of hypotheses. However, it can still be conservative, particularly with a large number of hypotheses, which may reduce its power. Less effective in situations where there is a high dependency among tests.
* **Hommel's Method** : controls the family-wise error rate (FWER). It is a generalization of the Bonferroni and Holm's procedures and provides a balance between stringency and power. Similar to Holm’s step-down method, it adjusts p-values but uses a more complex set of calculations to determine the critical values for each step. It modifies the thresholds for significance in a way that is adaptive based on the number of tests still under consideration.
* Strengths/Weaknesses: Generally more powerful than both Holm's and Bonferroni methods, as it adjusts the critical values more finely. Controls the FWER effectively, making it suitable for scenarios where controlling the type I error is crucial. However, like other methods controlling FWER, it may be too conservative when dealing with a large number of hypotheses, potentially leading to an increase in type II errors.
* **Benjamini-Yekutieli Procedure (BY)**: an extension of the more commonly known Benjamini-Hochberg (BH) false discovery rate (FDR) controlling procedure. It adjusts for the testing of multiple hypotheses while considering the dependency between test statistics, which is often not addressed by other methods including BH. The procedure controls the expected proportion of incorrectly rejected hypotheses (false discoveries) under any dependency structure among the test statistics.
* Strengths/Weaknesses: Robust against any type of dependency structure among the hypotheses, which is particularly relevant in complex biological data like microbiome studies where variables (e.g., presence of specific taxa) may be interdependent. Provides a more conservative approach than BH, reducing the likelihood of false positives in the presence of dependency among tests. However, it is more conservative than Benjamini-Hochberg, especially in cases of positive dependency, which can reduce statistical power to detect true effects when the dependencies among tests are strong. The increased conservativeness means that BY might not reject as many hypotheses as BH, potentially missing some true associations.
### Standardize Numeric/Continuous Metadata Variable
Apply z-score standardization so continuous metadata are on the same scale.
Standardizing a numeric or continuous metadata variable involves transforming the values to have a mean of zero and a standard deviation of one. This process, also known as z-score normalization, allows variables with different units or scales to be compared directly. Standardization is crucial when variables differ significantly in their ranges or units, ensuring that each variable contributes equally to the model and preventing any one variable from disproportionately influencing the analysis. It is commonly used in linear models and clustering algorithms.
> [!NOTE]
>
> **Why standardize your numeric variables?**
>
> Suppose you have a microbiome dataset where you want to analyze the impact of participants' age and BMI on microbial abundance. Since age and BMI have different scales, standardizing these variables (e.g., converting age from years and BMI from kg/m² to z-scores) ensures that both contribute equally to the analysis. This prevents the model from being disproportionately influenced by the variable with the larger numerical range, allowing for more balanced and interpretable results.
### Augment
To avoid linear separability in the logistic regression, at each input data point, add an extra 0 and an extra 1 observation weighted as the number of predictors divided by two times the number of data points. This is almost always recommended to avoid linear separability while having a minor effect on fit coefficients otherwise.
### Median Comparison Abundance/Prevalence Compositional Corrections
When "*Median Comparison Abundance Compositional Correction*" or "*Median Comparison Prevalence Compositional Correction*" is checked on, the coefficients for a metadatum will be tested against the median coefficient for that metadatum (median across the features). Otherwise, the coefficients will be tested against 0.
For abundance associations, this is designed to account for compositionality: the idea that if only one feature has a positive association with a metadatum on the absolute scale (cell count), the other features will have apparent negative associations with that metadatum on the relative scale (proportion of the community) because relative abundances must sum to 1.
More generally, associations on the relative scale are not necessarily the same as the associations on the absolute scale in magnitude or sign, so testing against zero on the relative scale is not equivalent to testing against zero on the absolute scale. When testing associations on the relative scale, the coefficients should be tested against 0 (median comparison off). However, since these tests do not correspond to tests for associations on the absolute scale, we instead use a test against the median, which can enable some inference on the absolute scale.
There are two interpretations of this test for absolute abundance associations:
* In linear models without sparsity (or with sparsity under some assumptions), if two features' associations with a particular metadatum on the log absolute scale differ by some value *d*, the features' associations with that metadatum on the log relative scale (total-sum scaling) will also differ by *d*. That is, the absolute and relative coefficients for a particular feature-metadatum association are different, but the ordering of the relative coefficients is the same as the ordering of the absolute coefficients for a metadatum, and the difference between two coefficients on the relative scale is the same as the difference between the corresponding coefficients on the absolute scale. Therefore, the test against the relative coefficient median can always be interpreted as "a test of whether a particular association is significantly different from the typical (median) association on the absolute scale."
* Under the assumption that at least half the features are not changing on the absolute scale, the median true absolute coefficient is 0, so this can be interpreted as a test of whether the feature has a non-zero association on the absolute scale.
By contrast, sparsity should be less affected by compositionality since a feature should still be present even if another increases or decreases in abundance. (Note that, because the read depth is finite, this might not always be true in practice.) Therefore, Median ComparisonPrevalence Compositional Corrections is off by default, but it can be turned on if the user is interested in testing whether a particular prevalence association is significantly different from the typical prevalence association.
In both cases, if the tested coefficient is within **Median Comparison Abundance/Prevalence Threshold** of the median, it will automatically receive a p-value of 1. This is based on the idea that the association might be statistically significantly different but not substantially different from the median and therefore is likely still a result of compositionality.
To conclude:
* **Median Comparison Abundance Compositional Corrections** is activated by default. *This is recommended for relative abundance data but should not be used for absolute abundance data.* This will enable abundance coefficients to be tested against a null value corresponding to the median coefficient for a metadata variable across the features. Otherwise, test against 0. When this is TRUE, only the p-values and q-values change. The coefficients returned are still the relative abundance coefficients unless **Subtract Median** is set to TRUE, in which case the median will be subtracted.
* **Median Comparison Abundance Compositional Corrections** should be FALSE when (1) testing for significant relative associations, (2) testing for absolute abundance associations under the assumption that the total absolute abundance is not changing, or (3) testing for significant absolute associations when supplying spike-in or total abundances with unscaled\_abundance.
* **Median Comparison Prevalence Compositional Corrections** is deactivated by default. This is only recommended to be activated if the user is interested in how feature prevalence associations compare to each other or if there is likely strong compositionality-induced sparsity. This tests prevalence coefficients against a null value corresponding to the median coefficient for a metadata variable across the features. Otherwise, test against 0.
* **Median Comparison Abundance Threshold** (default 0): Coefficients within this threshold of the median association will automatically be counted as insignificant (p-value set to 1) since they likely represent compositionality-induced associations. This threshold will be divided by the metadata variable's standard deviation if the metadatum is continuous to ensure the threshold applies to the right scale.
* **Median Comparison Abundance Threshold** (default 0): Same as the abundance threshold but applied to the prevalence associations.
* **Subtract Median** (default FALSE): Subtract the median from the coefficients.
### Maximum Number of Associations to Plot
Number of significant associations to plot in the volcano plots
Recommended: 50
### Number of features in Summary Plot
Number of features to plot in the summary plot/heatmap
Recommended: 50
# Viewing the MaAsLin3 Results
Source: https://docs.cosmosid.com/docs/maaslin3-view-results
By navigating to the "Comparative Analysis" menu, you'll be able to view your generated MaAsLin3 comparatives. The comparative analysis will contain data in 7+ different tabs (as described below).
## MaAsLin3 Results
### Input Data
A pre-formatted .tsv table containing taxonomic or functional profiling results (values dependent on input parameters).
### Input Metadata
A pre-formatted .tsv table containing all sample metadata.
### Association Results
Perhaps the most important output from MaAsLin 2 is the list of significant associations displayed in the Association Results, which displays significant associations between metadata and microbial features along with effect size, p-values, and q-values.
The full list of associations that pass MaAsLin 2's significance threshold is ordered by increasing q-values. Columns are:
* *Feature Name*: the microbial feature (taxon, gene, pathway, etc.).
* *Metadata*: the variable name being associated with a microbial feature.
* *Value Name*: for categorical features, the specific feature level for which the coefficient and significance of association is being reported.
* *Coefficient/EffectSize* + *Standard Error*: fit coefficient and standard error from the model.
* In abundance models, a one-unit change in the metadatum variable corresponds to a 2^coef fold change in the relative abundance of the feature.
* In prevalence models, a one-unit change in the metadatum variable corresponds to a coef change in the log-odds of a feature being present.
* *Model*: specifies whether the association is abundance or prevalence.
* *N*: the total number of samples used in the model for this association (since minimum abundance/prevalence can exclude samples from comparisons).
* *N not Zero*: the total of number of these samples in which the feature is non-zero.
* *P-value*: the nominal significance of this association.
* *Q-value*: the corrected significance is computed with p.adjust with the correction method (BH, etc.).
### Heatmap

This figure contain a combined coefficient plot and heatmap of the top 25 (unless otherwise specified) significant associations. In the heatmap, one star indicates the individual q-value is below the parameter max\_significance, and two stars indicate the individual q-value is below max\_significance divided by 10.
### Box and Scatter Plots

A **tab is presented for each Fixed Effect**, which includes plots for each of the significant associations in the Association Results (boxplots for categorical variables, scatter plots for continuous).
**Scatter plots** are used for continuous metadata abundance associations.
**Box plots** are used for categorical data abundance associations.
**Box plots** are used for continuous data prevalence associations.
**Grids** are used for categorical data prevalence associations.
Data points plotted are after filtering, normalization, and transformation so that the scale in the plot is the scale that was used in fitting.
\_At the top right of each association plo\_t is the name of the significant association in the results file, the FDR corrected q-value for the individual association, the number of samples in the dataset, and the number of samples with non-zero abundances for the feature. In the plots with categorical metadata variables, the reference category is on the left, and the significant q-values and coefficients in the top right are in the order of the values specified above. Because the displayed coefficients correspond to the full fit model with (possibly) scaled metadata variables, the marginal association plotted might not match the coefficient displayed. However, the plots are intended to provide an interpretable visual while usually agreeing with the full model.
### Volcano
Volcano plot depicting all significant variables for each fixed effect

### Forest
Forest plot helps to visually summarize the significant features effect size from the model contrasts along with their confidence intervals.
X-axis represents the contrast effect size; Y-axis represents the significant features that were found in respective contrasts of interest. The dot and the lines from the dot represents the individual feature’s effect size and the confidence interval of the effect size respectively

## Exporting the Data

All data can be exported as a .ZIP file by navigating to the comparative analysis and selecting the "Export" button in the top right corner. This .ZIP file will contain all input tables, results table, all figures (PDF), and a maaslin3.log for debugging purposes.
# Matrix Table
Source: https://docs.cosmosid.com/docs/matrix-table
## Matrix table overview
A matrix table displays the data that is used for comparative analysis. It displays all of the selected samples across the first row of a spreadsheet and all of the organisms or genes (in the case of antibiotic resistance or virulence factors) down the first column. If labels were used when creating the comparative analysis, the samples are organized by label. For each sample you can see the presence or absence of organisms present and the value that was chosen when creating the comparative analysis (relative abundance, frequency, total matches % or unique matches %). For any given organism you can see which samples it is present in. This table is useful as it contains data for all of your samples in one table and it can be used for many analyses including heat maps, PCA, and other comparative visualizations.

## Sorting the matrix
You can sort the matrix by clicking on a sample name, search the matrix, download as a TSV file, or change taxonomic levels.
## Downloading the matrix
You can download this matrix and use it for your own analyses as well. To download the matrix, when you are viewing it, click "Export" in the upper right corner and select "TSV".
## Other Buttons and Navigation
**Logscale**: Sometimes it is difficult to discriminate low abundance calls if you have some results that are at a very low abundance and some that are high abundance. In order to better distinguish between low abundance calls, we provide an option to view the log scale version of your data. To view or download the log base 2 version of your matrix you can do so by selecting "Yes" next to Logscale in the upper menu bar.

**Name**: Organism or gene name
**Sorting**: You can sort by sample by clicking on the arrows next to the sample name or by label by clicking the arrow next to the label.
**Shading**: The colors on the matrix range from white (zero or very low abundance) to dark red (high abundance).
**Scroll through matrix**: If the matrix is too large to fit on the screen you can scroll through it on the bottom right.
**Change taxonomy**: To change taxonomic levels for organism databases, you can click on the levels on the top bar:

**Download matrix**: Click "Export" on the top right to download the matrix as a TSV file. This file can be opened in Excel or loaded into R for further analysis.

# Uploading Metadata
Source: https://docs.cosmosid.com/docs/metadata-and-cohorts
Cosmos-Hub streamlines the process of organizing and analyzing your microbiome data by linking it to relevant experimental or sample metadata. Follow these detailed instructions to ensure smooth and efficient metadata integration into your analysis workflows.
> [accordion] What is metadata?
>
> > [!TIP]
> >
> > Metadata provides contextual information about your samples, such as:
> >
> > * Collection details (e.g., date, location, method)
> > * Sample type (e.g., stool, soil, wastewater)
> > * Experimental variables (e.g., treatment groups, timepoints)
> > * Demographic details (e.g., age, sex, BMI, clinical data)
> >
> > Adding metadata enhances the power of your analysis by enabling cohort creation, comparative studies, and advanced statistical modeling.
> >
> > **Best Practices for Metadata Upload**
> >
> > 1. Consistent Identifiers: Ensure your metadata variables are consistent across groups
> > 2. Comprehensive Details: Include as much metadata as possible to support robust downstream analyses.
> > 3. Regular Updates: Keep your metadata files up-to-date, especially for longitudinal studies.
> > 4. Group Wide-Ranging Continuous Variables: if you have a wide-ranging numerical value for metadata (e.g., ages ranging from 0-60), consider grouping them into categories (Age: 0-18years, 19-39 years, 40-60years). Pick relevant ranges according to your study.
## Video walkthrough of Metadata import and generating comparative analyses
[https://p-AeFvB6.t2.n0.cdn.getcloudapp.com/items/E0umPx69/57febfd4-7417-48c7-b4c5-d4124bfdb02e.mp4?source=viewer\&v=b6b928e6f1fde4dc71ef757c1d8459a7](https://p-AeFvB6.t2.n0.cdn.getcloudapp.com/items/E0umPx69/57febfd4-7417-48c7-b4c5-d4124bfdb02e.mp4?source=viewer\&v=b6b928e6f1fde4dc71ef757c1d8459a7)
# Adding New Metadata
Metadata can be added or edited for one or more samples by selecting them in the "Samples" Menu and clicking "Edit Metadata". Depending on the number of samples selected, you will be prompted to edit metadata categories through a pop-up (Single Edit) or a template .CSV file (Batch Edit).

## 1. Editing Single-Sample Metadata

1. When Editing Metadata for a single sample, a pop-up window will appear to edit default metadata or New Custom Fields.
2. Enter a text/numeric/datetime value for relevant metadata categories, or add a new metadata category by selecting "Create Custom Field".
3. Click "Save" once complete to view the updated metadata in the sidebar.
## 2. Editing Multi-Sample Metadata by Template Batching
When Editing Metadata for multiple samples, select all files and download the **template CSV**. We prefer to edit these in Excel, ensuring that no formulas/special characters are added and the file be saved as a .csv.

# Filling out the Metadata Template Form
When downloading the template CSV, you can download a template in 2 formats, as well as the option to include predefined metadata categories (Sample Biom Type, Sample Host, Read Type, Illumina Fragment Length, Sample Collection Date, GPS Coordinates, Study Objectives, DNA Extraction Kit, Library Preparation Kit, Sequencing Platform, Project Name)
The platform supports two template formats:
> [tab] Long Format (default selection)
>
> **Long format metadata**
>
> * Each sample is represented in columns. Each column has a Unique Sample ID (e.g., 1fb0f270-4848-4965-940a-df04b48662f3) and Sample Name (e.g., Sample1) as headers in rows 1 and 2 respectively.**The first two rows need to stay constant and should not be modified or rearranged.**
> * Each metadata field gets its own row. Identifying metadata variables (like sampleID or treatment group) may have repeated values across each row.
> * Metadata groups are represented in row 3 and beyond.
> * To add a new metadata group, simply create a new row, with the metadata variable name in Column A and the data-type in Column B (either text, decimal, or datetime)
> * *If predefined metadata is selected:* row 3-15 represents system metadata fields which are optional fields to fill out if relevant to your project.
>
> 
>
> **Other metadata requirements:**
>
> * Both **Label** and \*\*Type (One of: text | decimal | datetime) \*\*are required in columns A and B.
> * Custom Metadata Field Labels cannot contain any special characters or spaces.
> * Text fields should not exceed 32 characters.
>
> **Note:** Before uploading, always confirm that (1) no column headers are duplicated, (2) all date values are in the required format (dictated by your [Account Settings](/docs/setting-up-your-account), and (3) text fields comply with the 32-character length limit. See Troubleshooting, below, for more details.
>
> > [!TIP]
> >
> > You can filter your sample list based on metadata variables using the [**Sample Filtering panel**](/v2-0/documentation/guides/navigating-the-sample-dashboard/filtering-samples-by-metadata)
> [tab] Wide Format
>
> **Wide format metadata**
>
> * Each sample is represented as an individual row.
> * Metadata variables get their own column representing your metadata fields of choice.
> * Column A and B contain the Unique Sample ID (e.g., 1fb0f270-4848-4965-940a-df04b48662f3) and Sample Name (e.g., Sample1) respectively.**The first two columns need to stay constant and should not be modified or rearranged.**
> * To add a new metadata group, simply create a new column, with the metadata variable name in Row 1 and the data-type in Row 2 (either text, decimal, or datetime)
>
> 
> [!NOTE]
>
> # How to delete existing metadata categories
>
> To delete existing metadata categories entirely, follow these steps:
>
> 1. download a template CSV for your samples
> 2. delete the variables for each sample, leaving the text in the Key/Label/Type/Example (columns A-D).
> 3. Save the file and reupload to the platform.
> 4. You'll now see that the variable category has been completely deleted.
>
> Here is a video tutorial for troubleshooting:
>
> [YouTube video player](https://www.youtube.com/embed/2HubzRF21CE)
> [card] [Facing issues with metadata?](https://docs.cosmosid.com/docs/technical-appendix/technical-appendix/metadata-errors)
>
> Read through common pitfalls and errors during metadata upload at our [Troubleshooting Common Metadata Upload Errors](https://docs.cosmosid.com/docs/technical-appendix/technical-appendix/metadata-errors) page.
***
# (Meta)Transcriptomic Analysis in the HUB
Source: https://docs.cosmosid.com/docs/metatranscriptomic-analysis-in-the-hub
> [!NOTE]
>
> The Cosmos-Hub is a powerful tool for functional profiling of mixed transcriptomic datasets, particularly from microbial consortia (metatranscriptomics). It bypasses traditional alignment and gene-by-gene counting, instead focusing on k-mer–based matching to generate global functional profiles.
>
> * **Yes, you can input RNA-seq data into the HUB**—but this only makes sense for applications where function-level (not gene-level) interpretation is acceptable.
> * For **traditional host-focused** applications (e.g., looking at a handful of specific cytokine genes in human cells), the HUB will not provide the individual gene counts that many researchers require. However, we can assist through our custom bioinformatics offerings by contacting [info@cosmos-hub.com](mailto:info@cosmos-hub.com).
>
> By keeping these differences in mind, you can choose the appropriate pipeline for your biological questions, ensuring a smooth and informed RNA-seq or metatranscriptomic analysis workflow.
## Overview
**Transcriptomic (RNA-seq)** analyses have traditionally focused on a single organism (e.g., human, mouse, or a particular bacterium). They typically aim to quantify the expression levels of each gene in the organism’s genome, then compare these levels across various conditions (e.g., treated vs. untreated).
**Metatranscriptomic** analyses, on the other hand, attempt to capture the transcriptome of mixed microbial communities—multiple bacterial (and sometimes fungal, viral, or other) species within a given sample. This approach focuses on identifying the functional (i.e., gene-category–level) expression patterns of entire microbial consortia.
Cosmos-Hub offers a k-mer–based functional pipeline that can be applied to both metatranscriptomic data and “traditional” transcriptomic (RNA-seq) data. However, there are some major differences and caveats for traditional host RNA-seq.
## The Traditional RNA-seq Pipeline (Host-Focused)
> [!TIP]
>
> **Typical Research Goals**
>
> * Identify individual genes that are upregulated or downregulated in response to treatment.
> * Look for specific host pathways (e.g., inflammatory pathways, adhesion molecules, growth factors) to see which are differentially expressed.
> * Example: “CADM1 was higher in Treatment vs. Control,” and we interpret its specific biological role.
A standard host RNA-seq pipeline typically includes:
1. Raw Reads Quality Control
1. Trimming low-quality bases/adapters
2. Checking read quality via tools like FastQC
2. Alignment to a Reference Genome
1. Mapping reads to the known genome/transcriptome (e.g., human, mouse, a single bacterial species)
2. Tools commonly used: STAR, HISAT2, Bowtie2
3. Count Summarization
1. Generating counts for each annotated gene (or transcript)
2. Tools commonly used: featureCounts, HTSeq
4. Differential Expression Analysis
1. Statistical comparison of gene expression across conditions (e.g., treated vs. control)
2. Tools commonly used: MaAsLin2, LEfSe, DESeq2, EdgeR, Limma
5. Functional/Pathway Analysis
1. Performing gene set enrichment analysis (GSEA) or pathway analyses
2. Tools such as HUMAnN2, GSEA, DAVID, or KEGG-based analyses
> [!WARNING]
>
> Because Cosmos-Hub's functional pipeline does not perform steps 2-4 (alignment, count summarization, classical differential expression), it is not ideal for researchers who need detailed, gene-by-gene expression patterns in a host organism.
## Cosmos-Hub's Host-Agnostic Functional Profiling
Cosmos-Hub can analyze metatranscriptomic data using a k-mer–based approach to assign reads to functional categories (e.g., MetaCyc pathways, Pfam domains, Gene Ontology terms, CAZy families, Enzyme Commission numbers). Here’s how it broadly works:
1. Raw Reads Input
1. Reads are checked and processed through Cosmos-Hub's "[FUNCTIONAL Host-Agnostic Profiling](/docs/functional-analysis)"
2. Functional Assignment via K-mers
1. Reads are compared against large reference databases of known functional genes/sequences.
2. The pipeline assigns reads to functional categories (e.g., “all adhesion-related genes”) rather than to individual genes based on the database entries.
3. Relative Abundance/Copies-per-Million (CPM) Calculation
1. For each functional category, pipeline calculates a relative abundance metric (CPM).
4. Statistical Analysis
1. Utilize heatmaps and barcharts to
2. Tools such as LEfSe, MaAsLin2, or MaAsLin3 can be used on the functional categories to identify which categories are differentially abundant between groups.
3. This process is analogous to differential expression analysis, but at the functional (gene-set) level rather than at the individual gene level.
> [!NOTE]
>
> **Why This is Great for Metatranscriptomics**
>
> In metatranscriptomics, multiple microbial genomes are present in a sample. Using a single reference genome for alignment can be impractical, and analyzing thousands of genes across dozens or hundreds of species individually becomes cumbersome.
>
> * A functional approach is often more biologically meaningful for mixed communities (e.g., gut microbiome, soil microbiome) since the focus is on which biochemical pathways are active.
> * This approach gives a high-level overview of the community’s functional capacity and changes in response to treatments or environmental shifts.
> [!WARNING]
>
> **When It’s Not Ideal for Host Transcriptomics**
>
> For host-focused RNA-seq (human, mouse, or single-bacterium), researchers often need to pinpoint specific genes (e.g., TNF-α, IL-6, CADM1) and see if they are up or down.
>
> The Cosmos-Hub pipeline groups reads into broad functional categories, so you won’t get a direct gene-by-gene differential expression result such as “CADM1 has a 2.5-fold increase in expression." Instead, you'll be able to see larger-scaled trends such as "Genes relating to cellular adhesion were more expressed in the treatment group."
## Differential Expression: HUB vs. Traditional Pipelines
In traditional pipelines for differential abundance, tools like DESeq2 or EdgeR specifically handle gene-level count data to yield p-values, fold changes, and adjusted p-values for each gene.
By contrast, in the Cosmos-Hub:
* You receive functional category abundances (e.g., GO terms, MetaCyc pathways).
* You can perform differential analysis using something like LEfSe, MaAsLin2, or MaAsLin3 on these functional categories.
* The results might look like: “Adhesion genes have higher relative abundance in the Treatment group,” rather than “Gene X was upregulated in the Treatment group.”
## Example Use Cases & References
### Metatranscriptomic Study of the Human Gut Microbiome
* Researchers might use the Cosmos-Hub to identify changes in carbohydrate metabolism pathways (CAZy families) among different treatment groups.
* For an example of such functional metatranscriptomic approaches, see:
* Franzosa et al. (2014). Functional metagenomic profiling of fecal samples from healthy humans. Genome Medicine.
* Shakya et al. (2019). A multi-omics approach for understanding host–microbe interactions. mSystems.
### Soil Microbiome Activity Under Different Environmental Conditions
* K-mer–based approaches can quickly identify shifts in nitrogen cycling or stress-response genes in a complex microbial community.
* Example reference:
* Tringe et al. (2005). Comparative metagenomics of microbial communities. Science.
### Traditional Host RNA-seq for Disease Biomarkers
* Typically uses alignment and gene-count–based analyses.
* Standard references might include:
* Anders et al. (2013). Count-based differential expression analysis of RNA sequencing data using R and Bioconductor. Nature Protocols.
* Love et al. (2014). Moderated estimation of fold change and dispersion for RNA-seq data with DESeq2. Genome Biology.
# Recommendations & Best Practices
* Use Cosmos-Hub for Metatranscriptomics
* When you have a mixed microbial sample and your question is: “Which functional categories are expressed, and how do these categories change across conditions?”
* The HUB’s functional approach is faster, more straightforward, and more biologically oriented for diverse microbial communities.
* Use Traditional RNA-seq Pipelines for Host or Single-Organism Transciptomes
* If your research question is: “Which exact genes in a single genome (e.g., human, mouse, or E. coli) are up or down in response to treatment X?”
* This requires alignment to a single genome and classic differential expression analysis (DESeq2, EdgeR, etc.).
* Consider a Hybrid Approach
* There are some cases where you can use both approaches: (e.g., metatranscriptome of bacteria and a host cell line in the same sample), you could process your data in two ways:
* Host alignment using standard RNA-seq tools.
* Cosmos-Hub for the microbial part of the data.
* Note that this is a more manual approach and can become computationally intensive.
# Compare Samples (Comparative Analysis)
Source: https://docs.cosmosid.com/docs/new-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"

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

### 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, `'`, `&`, `(`, `)`, `[`, `]`, `+`, `!`, `.`, `-`, `_`
# Quickstart
Source: https://docs.cosmosid.com/docs/quick-start
An overview of how to get started with Cosmos-Hub and our award winning pipelines.
> [!TIP]
>
> We recommend running the Cosmos-Hub in Google Chrome, with browser zoom at 80%. To avoid local memory constraints (and to clear your head), avoid having too many tabs open.
[YouTube video player](https://www.youtube.com/embed/WilR6OjqDIQ?si=xCLqcmP-2MZRIMEZ\&fs=1)
# Steps to get started:
**1. Sign In (or request a free trial)**
Navigate to [https://app.cosmosid.com](https://app.cosmosid.com) in your browser.
* Don't have an account? [Book a 14 day free trial](https://cosmosidhub.com/book-a-demo/) by reaching out to us.
* Forgot your password? [Reset it here](https://app.cosmosid.com/recover-password).
**2. Upload Your FASTQ Files**
Expand the navigation menu by clicking the hamburger icon on upper left side of the screen. Click "**Upload**" to navigate to the upload page.
There are 4 options for uploading either single- or paired-end data to the Cosmos-Hub:
1. Drag and drop upload from your local drive
2. Connect an Illumina BaseSpace account
3. Upload samples from NCBI SRA
4. Upload local and cloud data through our [**Cosmos-Hub CLI**](https://dashboard.mintlify.com/docs/api-documentation)
> [!NOTE]
>
> **Samples are analyzed on a per-sample fee basis and a credit system**
>
> Contact [info@cosmos-hub.com](mailto:sales@cosmos-hub.com) for pricing.
**3. Select Workflow Parameters**
Upon importing samples into the platform, you will be prompted to:
* Select your data type (Shotgun, 16S, ITS)
* Remove host reads (optional)
* Upload your Metadata (optional)
* Select your workflow (CHAMP, Kepler, Functional, 16S, ITS)
**4. Grab a coffee while your samples are automatically analyzed**
Profiling typically takes 1-24 hours to process depending on the size of the dataset.
**5. View Your Data**
To view results for individual samples, click on the "Samples" icon on the left navigation bar and click on your sample name. For details about samples, visualizations, filtering, changing taxonomic levels, etc., go to [View Results](/docs/view-sample-results).
**6. Interpret Your Results**
Generate comparatives to discern and visualize taxonomic and functional patterns in your microbiome data. Please go to [Create Comparatives](/docs/new-comparative-analysis) to learn how to make comparatives with your data.
# Radial Tree
Source: https://docs.cosmosid.com/docs/radial-tree
## What is a radial tree?
A radial tree is a taxonomic tree visualized as a circle.

## Why use a radial tree
Since it sometimes it is difficult to fit a tree in small vertical space it can be useful to view it more compactly as a circle to see the taxonomic relationships of calls.
## Exporting
To export a radial tree, click "Export" in the top right corner of your browser and select "PNG" or "SVG".
# Read Statistics
Source: https://docs.cosmosid.com/docs/read-statistics
The number of reads in each sample compared on a graph.
## What are Read Statistics?
Generally it is good to know if some samples have significantly more or less reads than other samples in the same cohort.
# Changing Order and Color of Cohorts in CA Visualizations
Source: https://docs.cosmosid.com/docs/rearranging-cohorts
Customize the color and order of cohorts/metadata groups when generating a comparative analysis.
When creating your comparative analysis, you have the option to assign specific colors and order to the metadata variables of interest. In the Create CA page (after you've split samples into cohorts), you can drag-and-drop cohorts around to match your desired order. You can also change the colors using the color switcher. These will be reflected in the generated comparative analysis.
> [!WARNING]
>
> We are actively integrating tools to edit comparative analyses after they are generated. In the meantime, please edit your comparatives order and color when generating a new CA
[YouTube video player](https://www.youtube.com/embed/vSxHjf8QC40?si=Qzm6jYLF0r8l3Q04)
# RITA Microbiome Assistant
Source: https://docs.cosmosid.com/docs/rita
Whether you're navigating a complex dataset, formulating a hypothesis, or preparing a manuscript, RITA is here to help you and your colleagues move faster and smarter.
Welcome to **RITA** (Revealing Insight Through Ai), the AI Microbiome Assistant from Cosmos-Hub, designed to accelerate and simplify your microbiome data interpretation. This guide will help you get started, understand RITA’s capabilities, and make the most of its features.
## **Key Features**
* **Natural Language Querying:** Ask scientific questions in plain English.
* **Evidence-Based Answers:** Receive responses backed by curated literature and databases.
* **Data Exploration:** Analyze microbiome datasets, taxa, functions, and pathways.
* **Reference Linking:** Access direct links to relevant publications and resources.
* **Workflow Integration:** Use RITA alongside Cosmos-Hub’s analysis and reporting tools.
## To get started, go to [**rita.cosmosid.com**](http://rita.cosmosid.com)
> [!TIP]
>
> Login credentials for RITA are different from your Cosmos-Hub login. If you have not created an account, please click "Create an account" and our support team will activate your credentials within 24 hours.
[YouTube video player](https://www.youtube.com/embed/uTHBlrf4zn4?si=a9Kr7osm6t4L0ltW\&fs=1)
## **How to Interact with RITA**
Type your question into the RITA chat box for a literature-based response from our database of microbiome/microbiology papers . RITA understands both simple and complex queries, such as:
* “Which microbial taxa are associated with inflammatory bowel disease?”
* “How can metabolic function be inferred from my shotgun metagenomics data?”
* “What are the latest findings on Akkermansia muciniphila in metabolic health?”
## **Example Use Cases**
* **Hypothesis Generation:**\
“Suggest potential microbial biomarkers for type 2 diabetes.”
* **Data Interpretation:**\
“How does lower alpha diversity indicate health and disease in skin microbiome data?”
* **Literature Review:**\
“Summarize recent publications on gut-brain axis microbiome interactions.”
* **Pathway Analysis:**\
\ “Which metabolic pathways are related to my hypothesis on Crohn's disease?”
## **Tips for Effective Queries**
* Be specific: The more detail you provide, the more tailored RITA’s response.
* Use scientific terminology where appropriate.
* For data analysis, ensure your data is formatted correctly and include metadata if possible.
* Explore follow-up questions to refine your insights.
## **Frequently Asked Questions (FAQ)**
**Q: What types of questions can I ask RITA?**\
A: RITA can answer questions about microbial taxa, functions, pathways, disease associations, and more. It can also analyze results from your uploaded datasets.
**Q: How does RITA source its information?**\
A: RITA leverages curated scientific literature, public databases, and Cosmos-Hub’s proprietary knowledge base.
**Q: Can I use RITA for clinical decision-making?**\
A: RITA is intended for research and informational purposes. For clinical applications, consult with qualified professionals.
## **Support**
For further assistance:
* Visit the [Cosmos-Hub Help Center](https://cosmos-hub.com/support).
* Contact support via email at [help@cosmos-hub.com](mailto:help@cosmos-hub.com)
* [Book a live demo or training session](https://cosmos-hub.com/book-a-demo) with our team.
# Sample Abundance Table
Source: https://docs.cosmosid.com/docs/sample-dashboard-table
The sample abundance table is the main page for viewing individual samples.
You will see the results listed for the database you have selected and you can navigate through all of the databases and sample visualizations such as the sunburst, tree, and stacked bar graphs. Tables vary according to pipeline.
> [tab] CHAMP Results
>
> ## Definition of Columns
>
> * **Name** - the name of the organism or functional group, depending on the selected database (taxonomic names based on GTDB nomenclature)
> * **Relative Abundance** - describes the contribution/proportion of a given taxon/feature to the total microbial community detected.
> * **Counts** - number of normalized reads aligning to the reference genome/entry
> * **Cellular Abundance (functional data)** - represents the relative percentage of species that are able to perform a given function in the microbiome community
> [tab] Kepler Results
>
> 
>
> ## Definition of Columns
>
> * **Name** - the name of the organism or taxonomic level or the name of the antibiotic resistance gene or virulence factor, depending on the selected database (taxonomic names based on GTDB nomenclature)
>
> * **Tax ID** - a link to the NCBI taxonomic ID for the organism
>
> * **GTDB ID** - a link to the GTDB taxonomic entry for the organism
>
> * **Relative Abundance** - The Relative Abundance describes the contribution of a given taxon to the total microbial community detected. Relative Abundance is expressed in % and calculated as follows: Relative Abundance = Normalized Reads Frequency (taxon *n*) / Sum of Abundance Score (all taxa). This metric is suitable for downstream comparative analysis.
>
> * **Reads Frequency** - number of raw reads aligning to the reference genome/entry
>
> * **Normalized Reads Frequency** - used to calculate the Relative Abundance (%). This is the number of reads but normalized according to the size of the reference genome. This ensures differences in read counts are not due to larger/smaller genomes and is suitable for downstream comparative analysis or differential abundance analysis.
>
> > [!NOTE]
> >
> > **% Total vs. Unique Matches**
> >
> > **% Total Matches** is the number of *shared*+*unique* kmer matches identified in the sample divided by the total number of pre-calculated shared+unique matches available in the reference database. Shared kmers are shared with similar organisms of the same lineage in the phylogenetic tree, which makes this a useful metric for approximating gene coverage, or for assessing the likelihood of a detected taxon or gene actually being present.
> >
> > **% Unique Matches** is the number of *unique* kmers found in the sample that are unique to the organism divided by the total number of pre-calculated unique kmers available for the organism in the database. If unique coverage is very low for an organism, it could mean a couple of things:
> >
> > 1. For strains, this could indicate that the exact strain in our reference database is not a perfect match to the strain in the sample. However, if you also see a high percent TOTAL coverage for this same strain, this is a good indication that a near taxonomic neighbor of the reference strain is in your sample.
> >
> > 2. For some organisms that have high representation in sequencing space (E. coli, for example), there may not be many unique areas in the genome available for strain level identification. As more and more similar genomes are added to the database, we trade-off the ability to discriminate between those that are highly similar to each other. This will cause the percent unique coverage to be low.
> >
> > > [!WARNING]
> > >
> > > **This metric is not recommended for downstream comparative analysis.**
> > >
> > > This metric is used by the Filtered setting to rule out likely false positive calls.
> > >
> > > A common use of **% Total Matches** is for comparative analysis of antibiotic resistance genes or virulence factors, as these databases are gene-based rather than organism-based. The number of total k-mers identified enables a meaningful in understanding how well the gene has been covered by the reads in the sample.
> > >
> > > Use the **% Total Matches** metric to compare how coverage changes between samples, and use the **Relative Abundance** metric to compare how the composition of marker genes changes between samples.
>
> ##
## Other Table Features
* Sort - to sort samples by different columns, click on the column name.
* Search - to search for a sample name, click the magnifying glass and enter your search term.
To understand the top navigation menu and switching taxonomic levels, just go here: [View Results](/docs/view-sample-results).
# Uploading Sequencing Data
Source: https://docs.cosmosid.com/docs/sample-upload
The Cosmos-Hub supports importing raw FASTQ data for both amplicon and shotgun metagenomic workflows using multiple upload sources.
> [!WARNING]
>
> **Samples are analyzed on a per-sample basis**, and uploading requires pre-purchased sample credits. Contact [info@cosmos-hub.com](mailto:info@cosmos-hub.com) for pricing.
# There are 4 upload methods to choose from:
> [card] Upload from your Computer
>
> Upload local FASTQ, SRA, or BAM files via drag-and-drop.
> [card] Link a BaseSpace Account
>
> Connect your Illumina BaseSpace account and import data directly.
> [card] Import from NCBI SRA
>
> Use public SRA accession numbers to fetch data.
> [card] [Use the Command Line Interface](/docs/api-documentation)
>
> Use our CLI or API for large batch uploads and automation.
>
> (Click for API documentation)
***
# Select Your Data Type
> [tab] Amplicon (16S / ITS)
>
> Amplicon pipelines are used to identify bacterial or fungal communities based on specific genes. These workflows support both ****single-end and paired-end**** reads.
>
> > [accordion] Requirements
> >
> > * **Read type**: Paired-end or single-end
> > * **Min samples**: 10 (for ASV/DADA2 workflows)
> > * **File size**: ≤ 1 GB uncompressed (250 MB compressed)
> > * **PHRED score** ≥ 20
> > * **Formats**: `.fastq.gz`, `.fq.gz`, `.fasta.gz`, `.sra.gz`
> > * **Paired-end naming**:
> > * `SampleID_R1_001.fastq.gz`
> > * `SampleID_R2_001.fastq.gz`
> > * Reads must **overlap ≥ 15 bp**
> > * **Watch the 16S Tutorial Video**
> >
> > [YouTube video player](https://www.youtube.com/embed/QOpRLdqmEQc?si=bTu_L6hXY7n0pIDR\&fs=1)
>
> > [accordion] Workflow Options
> >
> > * **ASV 16S rRNA Profiling** (DADA2-based)
> > * **OTU ITS rRNA Profiling** (QIIME2-based)
>
> > [accordion] Common Pitfals
> >
> > * Filenames with **spaces or special characters** will break pairing
> > * Unpaired files will appear as "Single-read samples"
> [tab] Shotgun Metagenomics
>
> Shotgun workflows analyze entire microbial genomes and functional markers. These require **paired-end** reads and support large files.
>
> > [accordion] Requirements
> >
> > * **Read type**: Paired-end only
> > * **File size**: ≤ 50 GB
> > * **PHRED score** ≥ 20
> > * **Formats**: `.fastq.gz`, `.bam`, `.fq.gz`, `.sra.gz`
> > * **Naming**:
> > * `SampleID_R1.fastq.gz`
> > * `SampleID_R2.fastq.gz`
>
> > [accordion] Host Removal
> >
> > * Select host genome (e.g., Human, Mouse, Pig)
> > * If using **CHAMP**, select **"None"** — it performs built-in host filtering
>
> > [accordion] Workflow Options
> >
> > * **CHAMP**: Human-specific taxonomic & functional profiling
> > * **Kepler**: Host-agnostic taxonomic profiling
> > * **Host-Agnostic Functional Profiling**: MetaCyc, GO, EC, Pfam, CAZy
> > * **AMR/Virulence Marker Detection** *(requires add-on module)*
> [tab] SRA Upload
>
> The [Sequence Read Archive (SRA)](https://www.ncbi.nlm.nih.gov/sra) is a publicly accessible database of raw sequencing data hosted NCBI. It contains high-throughput sequencing data from numerous research projects worldwide, covering a wide range of study types and organisms, including metagenomic and microbiome studies. Researchers deposit their sequencing reads in SRA to make data publicly available in accordance with scientific publication practices, fostering transparency and reproducibility in science. This is typically referenced in the paper with a [BioProject](https://www.ncbi.nlm.nih.gov/bioproject) number in the Data Availability section.
>
> > [!TIP]
> >
> > **Why Import SRA Data for Microbiome Analysis?**
> >
> > **Access to Publicly Available Data**: Researchers can leverage publicly available SRA datasets to replicate studies, validate findings, or perform meta-analyses against their own data.
> >
> > **Cost Efficiency**: Using existing SRA datasets reduces the need for sequencing of new samples when performing secondary analyses or meta-analyses. By importing previously published data, users can rapidly evaluate different datasets or integrate multiple studies without the need to collect and sequence new samples.
> >
> > **Extended Contextual Analysis**: By analyzing previously published microbiome datasets from SRA, researchers can add context to their own data. This can provide valuable insights by comparing microbiomes across different populations, environments, diseases, or experimental conditions.
> >
> > **Data Reuse for Novel Insights**: Many research questions can be answered by revisiting older datasets with new hypotheses or more advanced analysis techniques. The Cosmos-Hub allows users to explore data from fresh perspectives using its comprehensive suite of microbiome analysis tools, potentially leading to novel discoveries.
> >
> > **Be sure to leverage the SRA Run Selector to export tables of SRA accession IDs as well as relevant metadata. Typically, original manuscripts need to be referenced for primer sequences.**
# Uploading Metadata
You can upload a metadata CSV during or after your data upload through the **Cohorts and Metadata** page.

***
# Workflow Selection
After upload, choose a workflow that matches your data type. The Cosmos-Hub will only show valid options based on your selections.

***
> [!WARNING]
>
> **Do not close your browser while uploading.** Progress is shown in the bottom-right. Allow up to 24 hours for processing. Results and statuses will appear in the **Cohorts and Metadata** section.
> [!WARNING]
>
> Occasionally a sample will fail to upload. Here are a number of possible causes:
>
> * Poor internet connection
> * Internet connection interruption
> * Browser closed while uploading
> * Incorrect primer pairs
> * Corrupted or low quality data files
Other notes:
* If a sample fails to upload, you can retry it
* If a sample is not in the proper format or fails to run for another reason, the status will show “failed” and you will not be charged credits.
* If you have problems uploading or with a failed sample, [please submit a help ticket](www.cosmos-hub.com/support) or email us at [help@cosmos-hub.com](mailto:help@cosmos-hub.com).
# Setting up your account
Source: https://docs.cosmosid.com/docs/setting-up-your-account
Account settings can be accessed from any page within the Cosmos-Hub by clicking the icon in the top right hand corner.
There are 2 tabs for account detail access:
> [tab] 1. Profile
>
> tab will enable editing of account details (such as name, address, and company/title) and changing passwords. Here are a few common tasks on this page:
>
> > [accordion] Reset Password
> >
> > Enter and confirm your new password to reset directly from the accounts setting page. You can also reset it via email by clicking "Forgot Password" at [app.cosmosid.com](http://app.cosmosid.com).
>
> > [accordion] Set up Multi Factor Authentication
> >
> > > [!TIP]
> > >
> > > **MFA Code is Required for All Logins**
> > >
> > > When logging into the Cosmos-Hub after MFA setup, you will be prompted to enter an MFA code. You can get this code by launching the Google Authenticator app, which will provide a one-time login code for you to enter into the login portal.
> >
> > **1. Download the Google Authenticator mobile app**
> >
> > The Cosmos-Hub utilizes the Google Authenticator mobile app, which is required for MFA setup and access. Find the apps linked below, which are also linked within the Account Settings 👤 page.
> >
> > > [card] [Google Authenticator for Android](https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2\&pli=1)
> >
> > > [card] [Google Authenticator for iOS](https://apps.apple.com/us/app/google-authenticator/id388497605)
> >
> > **2. Navigate to the account settings page and click "Generate MFA"**
> >
> > Once you have successfully downloaded the Google Authenticator App, click "Generate MFA" to generate a secret key in text or QR-Code format to be input into the Google Authenticator App
> >
> > **3. Use the authenticator app to scan the QR code provided in your account to complete setup**
> >
> > Alternatively, you can type in the secret key into the authenticator app.
>
> > [accordion] Generate API Key for Command Line Integration
> >
> > A unique API key is required to link your account to the Cosmos-Hub API. [Read more details at our API here](/docs/api-reference/api-documentation).
>
> > [accordion] Select your preferred locale for date/time formatting
> >
> > Select your preferred locale for date and time formats. This will affect how date and time will be displayed across the application and in metadata CSV templates.
> [tab] 2. Transactions
>
> The "Transactions" tab will give a full log of all sample analysis credit charges, credit rollbacks (which are initiated when a sample fails analysis), and any expiring bonuses (i.e., free trial credits)
# Stacked Bar Graph
Source: https://docs.cosmosid.com/docs/stacked-bar
## Stacked bar graph overview
The stacked bar graph allows you to visualizr the taxonomic breakdown of your samples side by side. Different organisms or taxa are given the same color across the sample bars so you can quickly see how the samples compare.
## Why use stacked bar graphs?
Stacked bar graphs are great for looking at the distribution of different organisms or taxa across all of your samples at the same time. Using the taxonomic switcher to switch between different taxonomic levels allows you to get a feel for the composition of the samples. For example, if you are interested in a particular genus and the variation in its abundance among the samples you can easily view it in the stacked bar graph.

## Options for viewing stacked bar graphs
**Use Random Colors** - You can select the "Use Random Colors" toggle to change the stacked bar graph to random colors. By default, the colors map based on taxonomy - so that different species that belong to the same genus appear within the same color but with different shades, for example. Selecting "Use Random Colors" can provide better discrimination between organisms.
**Most Abundant** - You can adjust "Most Abundant" to visualize the most abundant N organisms per individual samples
**% others** - you can adjust "% others" to exclude the bottom results. For example, if I enter 5 into the "% others" field, the bottom 5% of calls will not be shown in the heat map.
**Mouse hover** - if you hover your mouse over the stacked bar graph it will show the organism called in that cell, the actual value represented in the graph, and the label that the sample belongs to, if applicable.
**Export** - to download the stacked bar graph, click "Export" in the top right corner and select PNG, SVG or PDF.
**Change taxonomy**: To change taxonomic levels for organism databases, you can click on the different taxonomic levels on the top bar:
**Order By** You can order the features in the stacked bar chart by Phylum, Alphabetically, Overall Average Score (highest to lowest, lowest to highest) and Cohort Average Score ( Cohort wise highest to lowest, Cohort wise lowest to highest)
**Logscale**: Sometimes it is difficult to discriminate low abundance calls if you have some results that are at a very low abundance and some that are high abundance. In order to better distinguish between low abundance calls, we provide an option to view the log scale version of your data. To view the log base 2 version of your heat map you can do so by selecting "Yes" next to Logscale in the upper menu bar.

# Stacked Bar Graph
Source: https://docs.cosmosid.com/docs/stacked-bar-graph
## What is a stacked bar graph?
A stacked bar graph allows you to view all of the organisms identified in your sample, shown one taxonomic level at a time.

## Why use it?
A stacked bar graph is useful for visualizing the relative amounts of each organism in your sample
## How to use it
**Relative Abundance** - Click on “relative abundance” to use relative abundance for the stacked bar visualization. **Abundance Score** - Click on “abundance score” to use abundance score for the stacked bar visualization. **% Others** - Enter a number in front of %others to group more or fewer organisms into the “others” category. This is useful if you have many lower abundance organisms and you would like to get a better view of the higher level calls.
Use the taxonomic switcher in the top menu bar to switch between levels.
## Exporting
To export the stacked bar graph, click "Export" at the top right corner of your browser and select "PNG" or "SVG".
# Sunburst
Source: https://docs.cosmosid.com/docs/sunburst
## What is a sunburst?
A sunburst diagram uses rings to show hierarchy with a slice through them for category nodes. A sunburst is a good way to look at the composition of your sample with the flexibility to zoom in on taxonomic levels of interest.
## Details for a taxonomic sunburst
For our sunburst, each ring corresponds to a taxonomic level, with the central circle representing the highest taxonomic level, such as bacteria, and each taxonomic level below it moving outwards from the circle. The circles are divided based on their hierarchical relationship to the parent slice based on relative abundance. The colors are used to represent the different taxonomic levels. The visualization is dynamic and you can click on different levels to zoom in or out.
## Collapsing
* Collapsing - Click on or off to aggregate calls in divided rings.

## Maximum depth
Maximum depth is the number of nodes along the longest path from the root down to the farthest leaf.

## Mouse Over
Mouse Over - Hover your mouse over any segment of the sunburst to see details such as the node name, relative abundance, and percentage of the taxonomic levels above the node you are hovering on.
[https://p-AeFvB6.t2.n0.cdn.getcloudapp.com/items/JruDdrbe/5e4808b0-915c-485c-9810-f283b54f2b36.mp4](https://p-AeFvB6.t2.n0.cdn.getcloudapp.com/items/JruDdrbe/5e4808b0-915c-485c-9810-f283b54f2b36.mp4)
## Switching taxonomic levels
Switching taxonomic levels with bar at top - as you switch taxonomic levels with the top bar the lowest (outermost) level of the sunburst will show the taxonomic level chosen.
[https://p-AeFvB6.t2.n0.cdn.getcloudapp.com/items/4gulw2p0/b07bdf1c-abd8-4f76-b54a-5aa1e962985c.mp4](https://p-AeFvB6.t2.n0.cdn.getcloudapp.com/items/4gulw2p0/b07bdf1c-abd8-4f76-b54a-5aa1e962985c.mp4)
# Sample Tags
Source: https://docs.cosmosid.com/docs/tags
Tags provide a flexible alternative to metadata fields or folder-based organization .
## Accessing the Tags Feature
To access the tags functionality, navigate to the **Samples Menu** from your Cosmos-Hub dashboard. This menu serves as the central hub for managing sample organization and provides multiple capabilities including filtering your dashboard view, adding tags, managing metadata fields, and generating comparative analyses .
[YouTube video player](https://www.youtube.com/embed/rWfF4-i9rPg)
## Adding Custom Tags
Custom tags can be added to individual samples or groups of samples directly from the **Samples** menu. Different cohorts within a project can be defined by assigning unique custom tags to samples belonging to each cohort.
## Filtering with Tags
Once tags have been applied to your samples, you can use them to filter your dashboard view. This filtering capability allows you to quickly focus on specific subsets of samples without having to manually search through your entire dataset.
## Creating Comparative Analyses with Tags
One of the primary applications of tags is in creating comparative analyses. After adding custom tags to your samples, you can use those tags to automatically define cohorts when setting up a new comparative analysis. This eliminates the need to manually select individual samples for each cohort, significantly streamlining the analysis setup process.
> [!NOTE]
>
> After launching the Create CA menu, click "Reset Cohorts" to populate options for the tags section.
When creating a comparative analysis using custom tags, the system allows you to define cohorts based on the tags you’ve previously assigned. For example, if you’ve tagged samples with “Treatment\_A” and “Treatment\_B,” you can use these tags to automatically split your samples into two cohorts for comparison.
# Available Example Datasets
Source: https://docs.cosmosid.com/docs/technical-appendix/available-example-datasets
These datasets can be deposited into your account upon request for demo purposes
## Shotgun Metagenomic Data
### Human (CHAMP)
#### Stool
1. Human stool by antibiotic treatment - Wilmann et al 2019
2. Preterm Infant Probiotic Supplementation - Nguyen et al 2021 - PRJNA630999
3. Infant stool by time points - Backhed et al 2015
4. Infant stool by time points - Matharu et al 2022
5. Clostridioides difficile-colonized patients - Fishbein et al 2022 - PRJNA748262
6. HIV InfectionStatus Fecal WGS - Noguera-Julian et al 2016 - PRJNA307231
7. Hazda Hunter Gatherer v Italy Gut Biome WGS - Rampelli et al 2015 - PRJNA278393
8. Infant Probiotic Supplementation - Henrick et al 2021 - PRJNA390646
> [!NOTE]
>
> Read our Cosmos-Hub poster on our meta-analysis of 1000+ IBD samples
>
> 
#### Skin
1. Skin Microbiome by Antibiotics - Jo et al 2021
2. Skin Microbiome in Cutaneous Lymphoma - Salava et al 2020 - PRJEB36953
3. Skin Biopsy Metatranscriptomics - Leishmaniasis Cohort - Christensen et al 2016 - PRJNA307599
#### Oral
1. Oral Disease Cohort - healthy vs mucositis vs peri-implantitis - Bazzani et al 2024 - PRJNA547717
2. Healthy Saliva WGS - PMC8727345
3. Human Oral Microbiome - Caselli et al 2020 - PRJEB36291
#### Vaginal
1. Healthy Vaginal MetaAnalysis
#### Urine
1. Urinary Tract Infection Microbiome - Neugent et al 2022 - PRJNA801448
#### Cerebral Spinal Fluid
1. CLIMB CSF Shunt Infection Microbiome - Hodor et al 2021 - PRJNA707514
#### Eye
1. Ocular Surface Microbiome in Dry Eyes - Tong et al 2022 - PRJNA886972
#### Milk
1. Human and Bovine Milk - Yap et al 2020 - PRJEB38099
#### Tumor
1. GI Tumor Microenvironment - WGS - Roelands et al 2023 - PRJNA941834
### Non-Human (Kepler)
#### Environmental
1. Aral Sea Desiccation Study - Wicaksono et al 2022 - PRJEB51329
2. Honey Microbiome - Bovo et al 2020 - PRJEB36075
3. Citrus Rhizosphere and Soil - Xu et al 2018 - PRJNA362455
4. Global Wastewater Microbiome Consortium - Wu et al 2019 - PRJNA509305
#### Food
1. Ground Beef by Antibiotic Treatment - Doster et al 2020 - PRJNA608954
2. Food Microbiota WGS - Bloomfield et al 2023 - PRJNA849983
#### Wastewater
1. Global Wastewater Microbiome Consortium - Wu et al 2019 - PRJNA509305
#### Monkey
1. Rhesus Monkey Gut Microbiome in Parkinsons Disease - Yan et al 2021 - PRJNA574851
#### Mouse
1. Mouse Gut (High vs. Low Fiber Diet) - PRJEB37383
#### Fish
1. Fish Microbiome by Longitudinal Antibiotic Treatment - Kayani et al 2022 - PRJNA781418
#### Horse
1. Horse by breed-conservation status (*Equus przewalskii* vs. *Equus hemionus hemionus* - Tang et al 2022 - PRJNA814825
#### Dog
1. Dog Gut Microbiome by breed (Labrador vs. Beagle) - Coelho et al 2018 - PRJEB20308
#### Pig
1. Pig Gut Longitudinal Fecal by Post-Weaning Diarrhea Treatment - [Guitart-Matas 2024](https://doi.org/10.1186/s42523-024-00307-6) - PRJNA1010706
1. Groups: amoxicillin, colistin, gentamicin, trimethoprim/sulfamethoxazole, oral vaccine, control, no\_treatment\_control\_with\_acidified\_water
2. Pig Stool by Drug Treatment - Sanjuan et al 2024a - PRJNA984595
3. Pig Lung Metagenomics (healthy vs. severe lesions) - Li et al 2023 - PRJNA732170
4. Weaning Piglet Gut Microbiome - Holman et al 2021 - PRJNA629856
#### Cat
1. Feline Gut (Obese vs. Healthy) - Ma et al 2022 - PRJNA758898
#### Poultry
1. Gnotobiotic chick cecum dynamics post-inoculation - Thomas et al 2019 - PRJNA415593
2. Chicken Gut Sampling - Kang et al 2021 - PRJNA658643
3. Chicken Cecal Microbiome during Salmonella Infection - Bogomolnaya et al 2022 - PRJNA906507
#### Bovine
1. Cow Rumen Microbiome by Breed - Sandri et al 2018 - PRJNA381851
#### Other
1. Microbiota of Domestic Kitchen Sponges - Brandau et al 2022 - PRJEB49259
# Amplicon Data
1. Gut Decontamination for Stem Cell Transfer Patients - 16S V4 - Bekker et al 2019 - PRJEB28845
2. Antarctic Snow Algae Mycobiome - ITS - Davey et al 2019 - PRJEB23732
3. Antarctic Snow Algae Microbiome - 16S V4 - Davey et al 2019 - PRJEB23732
4. Anaerobic Food Waste Digesters - 16S V4 - Svensson et al 2019 - PRJNA430711
5. Mice on SPF or GF Diet - 16S V3\_4 - Wu et al 2022 - PRJNA768608
6. Umbilical Cord Serum Microbiome - 16S V1\_3 - Turturice et al 2019 - PRJNA473573
# Bacteria And Fungi Database Updates
Source: https://docs.cosmosid.com/docs/technical-appendix/bacteria-and-fungi-database-updates
We have updated our Bacteria and Fungi databases.
We are excited to release updated bacterial and fungal databases with > 15,000 new curated genomes, bringing our total to more than 170,000 microbial genomes and gene sequences representing bacteria, viruses, protists, and fungi, as well as antibiotic resistant and virulence associated genes. With thousands of new strains and species, we are now able to characterize complex microbiome communities with increased sensitivity and specificity.
The Cosmos-Hub databases are organized phylogenetically and contain hundreds of millions of marker gene sequences. The markers represent both coding and non-coding sequences uniquely identified by taxon and/or distinct nodes of phylogenetic trees. This means that the tree structure was created based on genomic relatedness of organisms rather than predetermined taxonomy based on phenotype. This allows Cosmos-Hub to have a high degree of accuracy in identifying microorganisms based on their DNA in metagenomic samples. It also helps identify the closest match to genomes that do not have strain level references in the database (if, for example, they have never been sequenced before).
What does this mean for you? Here are some frequently asked questions:
**1. I have samples I ran previously on the app and I would like to rerun them on the new databases, how do I do that?** Please [submit a help ticket](https://cosmos-hub.com/support) or contact us at [help@cosmos-hub.com](mailto:help@cosmos-hub.com) for more information
**2. I have new samples to run, will I automatically get the new databases?** Yes, when you upload new samples they will be analyzed using the new databases.
**3. Will my results change with the new databases?** If your samples are rerun on the new databases, it is possible that new species or strains will be identified in your samples that were not previously in the database and this may shift the abundance estimates for your previous results.
The latest Cosmos-Hub database
> 15,000 new curated genomes, bringing our total to more than 170,000 microbial genomes and gene sequences representing bacteria, viruses, protists, and fungi, as well as antibiotic resistant and virulence associated genes. Enables characterization of complex and exotic microbiomes with increased sensitivity and better taxonomic abundance estimation
# EU GDPR Clause
Source: https://docs.cosmosid.com/docs/technical-appendix/eu-gdpr
Description of your new file.
## In addition to our standard terms and conditions, Cosmos-Hub users in Europe are required to agree to our Data Processing Agreement between their organization and Clinical Microbiomics, Inc. (the “Data Processor”).
## **WHEREAS**
* **(A)** The Customer acts as a Data Controller.
* **(B)** The Customer wishes to subcontract certain Services, which imply the processing of personal data, to the Data Processor.
* **(C)** The Parties seek to implement a data processing agreement that complies with the requirements of the current legal framework in relation to data processing and with the Regulation (EU) 2016/679 of the European Parliament and of the Council of 27 April 2016 on the protection of natural persons with regard to the processing of personal data and on the free movement of such data, and repealing Directive 95/46/EC (General Data Protection Regulation).
* **(D)** The Parties wish to lay down their rights and obligations.
## **IT IS AGREED AS FOLLOWS:**
## **1. Definitions and Interpretation**
**1.1** Unless otherwise defined herein, capitalized terms and expressions used in this Agreement shall have the following meaning:
* **1.1.1** “Agreement” means this Data Processing Agreement and all Schedules;
* **1.1.2** “Customer Personal Data” means any Personal Data Processed by a Contracted Processor on behalf of Customer pursuant to or in connection with the Software Agreement;
* **1.1.3** “Contracted Processor” means a Subprocessor;
* **1.1.4** “Data Protection Laws” means EU Data Protection Laws and, to the extent applicable, the data protection or privacy laws of any other country;
* **1.1.5** “EEA” means the European Economic Area;
* **1.1.6** “EU Data Protection Laws” means EU Directive 95/46/EC, as transposed into domestic legislation of each Member State and as amended, replaced or superseded from time to time, including by the GDPR and laws implementing or supplementing the GDPR;
* **1.1.7** “GDPR” means EU General Data Protection Regulation 2016/679;
* **1.1.8** “Data Transfer” means:
* **1.1.8.1** a transfer of Customer Personal Data from the Customer to a Contracted Processor; or
* **1.1.8.2** an onward transfer of Customer Personal Data from a Contracted Processor to a Subcontracted Processor, or between two establishments of a Contracted Processor, in each case, where such transfer would be prohibited by Data Protection Laws (or by the terms of data transfer agreements put in place to address the data transfer restrictions of Data Protection Laws);
* **1.1.9** “Services” means the bioinformatics services Clinical Microbiomics provides.
* **1.1.10** “Subprocessor” means any person appointed by or on behalf of Processor to process Personal Data on behalf of the Customer in connection with the Agreement.
**1.2** The terms “Commission”, “Controller”, “Data Subject”, “Member State”, “Personal Data”, “Personal Data Breach”, “Processing” and “Supervisory Authority” shall have the same meaning as in the GDPR, and their cognate terms shall be construed accordingly.
## **2. Processing of Customer Personal Data**
**2.1** Processor shall:
* **2.1.1** comply with all applicable Data Protection Laws in the Processing of Customer Personal Data; and
* **2.1.2** not Process Customer Personal Data other than on the relevant processing capabilities of the software.
**2.2** The Customer instructs Processor to process Customer Personal Data.
## **3. Processor Personnel**
\*\*3.1 \*\*Processor shall take reasonable steps to ensure the reliability of any employee, agent, or contractor of any Contracted Processor who may have access to the Customer Personal Data, ensuring in each case that access is strictly limited to those individuals who need to know/access the relevant Customer Personal Data, as strictly necessary for the purposes of the Software Agreement, and to comply with Applicable Laws in the context of that individual’s duties to the Contracted Processor, ensuring that all such individuals are subject to confidentiality undertakings or professional or statutory obligations of confidentiality.
## **4. Security**
**4.1** Taking into account the state of the art, the costs of implementation and the nature, scope, context and purposes of Processing as well as the risk of varying likelihood and severity for the rights and freedoms of natural persons, Processor shall in relation to the Customer Personal Data implement appropriate technical and organizational measures to ensure a level of security appropriate to that risk, including, as appropriate, the measures referred to in Article 32(1) of the GDPR.
**4.2** In assessing the appropriate level of security, Processor shall take account in particular of the risks that are presented by Processing, in particular from a Personal Data Breach.
## **5. Subprocessing**
**5.1** Processor shall not appoint (or disclose any Customer Personal Data to) any Subprocessor unless required or authorized by the Customer.
## **6. Data Subject Rights**
\*\*6.1 \*\*Taking into account the nature of the Processing, Processor shall assist the Customer by implementing appropriate technical and organisational measures, insofar as this is possible, for the fulfilment of the Customer’s obligations, as reasonably understood by Customer, to respond to requests to exercise Data Subject rights under the Data Protection Laws.
**6.2** Processor shall:
* **6.2.1** promptly notify Customer if it receives a request from a Data Subject under any Data Protection Law in respect of Customer Personal Data; and
* **6.2.2** ensure that it does not respond to that request except on the documented instructions of Customer or as required by Applicable Laws to which the Processor is subject, in which case Processor shall to the extent permitted by Applicable Laws inform Customer of that legal requirement before the Contracted Processor responds to the request.
## **7. Personal Data Breach**
**7.1** Processor shall notify Customer without undue delay upon Processor becoming aware of a Personal Data Breach affecting Customer Personal Data, providing Customer with sufficient information to allow the Customer to meet any obligations to report or inform Data Subjects of the Personal Data Breach under the Data Protection Laws.
**7.2** Processor shall co-operate with the Customer and take reasonable commercial steps as are directed by Customer to assist in the investigation, mitigation and remediation of each such Personal Data Breach.
## **8. Data Protection Impact Assessment and Prior Consultation**
\*\*8.1 \*\*Processor shall provide reasonable assistance to the Customer with any data protection impact assessments, and prior consultations with Supervising Authorities or other competent data privacy authorities, which Customer reasonably considers to be required by Article 35 or 36 of the GDPR or equivalent provisions of any other Data Protection Law, in each case solely in relation to Processing of Customer Personal Data by, and taking into account the nature of the Processing and information available to, the Contracted Processors.
## **9. Deletion or Return of Customer Personal Data**
**9.1** Subject to this section 9, Processor shall promptly and in any event within 10 business days of the date of cessation of any Services involving the Processing of Customer Personal Data (the “Cessation Date”), delete and procure the deletion of all copies of those Customer Personal Data.
## **10. Audit Rights**
**10.1** Subject to this section 10, Processor shall make available to the Customer on request all information necessary to demonstrate compliance with this Agreement, and shall allow for and contribute to audits, including inspections, by the Customer or an auditor mandated by the Customer in relation to the Processing of the Customer Personal Data by the Contracted Processors.
**10.2** Information and audit rights of the Customer only arise under section 10.1 to the extent that the Agreement does not otherwise give them information and audit rights meeting the relevant requirements of Data Protection Law.
## **11. Data Transfer**
**11.1** The Processor may not further transfer or authorize the further transfer of Data to countries outside the EU and/or the European Economic Area (EEA) without the prior written consent of the Customer. If personal data processed under this Agreement is transferred from a country within the European Economic Area to a country outside the European Economic Area, the Parties shall ensure that the personal data are adequately protected. To achieve this, the Parties shall, unless agreed otherwise, rely on EU approved standard contractual clauses for the transfer of personal data.
## **12. General Terms**
**12.1 Confidentiality.** Each Party must keep this Agreement and information it receives about the other Party and its business in connection with this Agreement (“Confidential Information”) confidential and must not use or disclose that Confidential Information without the prior written consent of the other Party except to the extent that:
* (a) disclosure is required by law; or
* (b) the relevant information is already in the public domain.
**12.2 Notices.** All notices and communications given under this Agreement must be in writing and will be delivered personally, sent by post or sent by email to the address or email address set out in the heading of this Agreement or at such other address as notified from time to time by the Parties changing address.
## **13. Governing Law and Jurisdiction**
**13.1** This Data Agreement is governed by the laws of Denmark.
**13.2** Any dispute arising in connection with this Agreement, which the Parties will not be able to resolve amicably, will be submitted to the exclusive jurisdiction of the courts of Denmark, subject to possible appeal to Denmark.
# FAQ
Source: https://docs.cosmosid.com/docs/technical-appendix/faq
## Sequencing
> [accordion] Do you offer metagenomics and metatranscriptomics sequencing services?
>
> Yes, we offer a full range of services in our CLIA certified lab including DNA extraction, library preparation, and sequencing. You can find more information at [cmbio.io](cmbio.io).
> [accordion] How much does it cost?
>
> For DNA sequencing and other services, please contact us at [info@cmbio.io](mailto:info@cmbio.io) as pricing is dependent on sequencing depth, number of samples, etc.
## Metagenomic Analysis
> [accordion] How should I name my paired end files?
>
> Paired end files must be named with "\_R1" or "\_R2" followed by either "\_001", "\_002", etc. followed by the sequencing suffix (.fastq, .fasta, etc.).
>
> Examples of acceptable paired end names: Seqrun1\_L001\_R1.fastq.gz Seqrun1\_L001\_R2.fastq.gz
>
> Seqrun1\_R1\_001.fastq.gz Seqrun1\_R2\_001.fastq.gz
> [accordion] Can I upload bam files? What about .gz files?
>
> Yes, we accept bam files and all of the following file extensions: fasta, .fna, .fasta.gz, .fastq, .fq, .fastq.gz, bam, bam.gz, sra, sra.gz
> [accordion] If I have a lot of host DNA in my samples will you be able to identify microbes?
>
> Yes! Our algorithms only evaluate the microbial DNA in your samples and ignore host DNA based on your host-selection during the upload step.
> [accordion] What’s the difference between 16S and wgs or shotgun metagenomics?
>
> **shotgun metagenomics** - using whole genome shotgun sequencing, the Cosmos-Hub algorithms identify microorganisms based on the entire genomes of the organisms.
>
> **amplicon/16S/ITS** - unlike shotgun metagenomics, amplicon (or 16S/ITS) analysis looks only at the relevant ribosomal RNA gene or genes, not the entire genome for identification.
>
> There are advantages and disadvantages to each method.
>
> Shotgun Metagenomics provides more sensitivity, higher resolution, and more detailed information with sub-species or strain level identification. With shotgun metagenomics we are able to provide results from multiple kingdoms (bacteria, viruses, protista, and fungi) and we can identify antibiotic resistance genes and virulence factors. The main disadvantage is that the wgs sequencing is usually more expensive per sample than amplicon sequencing.
>
> Amplicon/16S/ITS has limitations in its ability to identify organisms to taxonomic levels lower than species; it often can only classify organisms at the genus level or higher. The sequencing for amplicon analysis is generally less expensive than shotgun metagenomic sequencing.
## Cosmos-Hub Usage
> [accordion] When would I use frequency?
>
> Frequency is useful when you want to see the raw number of kmer hits to unique regions in a genome rather than the normalized representation you see with relative abundance. For example, perhaps your sample has a low relative abundance of Salmonella enterica, such as 0.1%. But you want to understand exactly how many unique kmers are matching that genome. Frequency will tell you that. There are two other important things to understand though. 1) Frequency is only a count of unique kmers. If there are kmers that match that are shared with other genomes they are not reported here. 2) The kmers that are counted for frequency can be redundant, in other words they could come from multiple reads that cover the exact same region of the genome. They also could come from repetitive regions in the genome (ie identical kmers read could have originated from multiple locations in the genome).
>
> You also can use frequency as a parameter for comparative analysis. If you do this you will see absolute numbers for your stacked bar graph (with the ability to switch to relative numbers). Your other comparative analyses will be slightly different with this different input.
> [accordion] What is unique matches?
>
> UNIQUE matches is the amount of unique kmers that were found in your sample for an organism out of the total possible number of kmers in our database that are unique to that organism. If unique matches are very low for an organism it could mean a couple of things.
>
> 1. For strains, this could indicate that the exact strain in our reference database is not a perfect match to the strain in the sample. However, if you also see high TOTAL matches for this same strain, this is a good indication that a near taxonomic neighbor of the reference strain is in your sample.
> 2. For some organisms that have high representation in sequencing space (E. coli, for example), there may not be many unique areas in the genome available for strain level identification. As more and more similar genomes are added to the database, we lose the ability to discriminate between them as they are so highly similar to each other. This will cause the unique matches to be low.
> [accordion] What is total matches and when would I use it?
>
> TOTAL matches is the total amount of shared + unique kmers found in your sample for an organism out of the total possible number of shared + unique kmers in our database that have been calculated for that reference organism. Shared kmers are shared with other similar organisms as they go up the phylogenetic tree.
>
> A common use of percent matches is for comparing antibiotic resistance genes or virulence factors. When you do a comparative analysis for these databases you will notice that this is the default value used for the comparison. Since these databases are gene-based rather than organism-based, looking at the number of total kmers identified out of those possible is meaningful in understanding how much of the gene has been represented in the sample.
> [accordion] How do you calculate relative abundance?
>
> Relative abundance is calculated based on the reference genome size, the number of organism specific kmers, and their observed frequency in the sample and then normalized to represent the abundance of each organism so that it is shown as a percentage.
> [accordion] Can you identify novel strains?
>
> If you have genomes in your sample that are considered novel – where they have never been sequenced before – we will identify them to the closest taxonomic level possible. The ability to discriminate at a low taxonomic level depends on how different the organism is from its nearest neighbors that have been sequenced.
> [accordion] How secure is my data?
>
> Your data is very secure. Cosmos-Hub follows industry-standard security best practices for account management, access and encryption. We have invested in the strongest SSL certificates that utilize sha2 encryption. The EV certificate is designed to strengthen security and combat phishing attacks to make EV SSL the most complete SSL certificate available.
>
> All communications between our servers and your machine are served exclusively over HTTPS, the data is hosted on Amazon Web Services (AWS) and we use proper Identity and Access Management (IAM) controls on S3 which are critical for preventing information leakage.
> [accordion] My sample is really large and it won’t upload, what do I do?
>
> ### My sample is really large and it won’t upload, what do I do?
>
> If your samples are failing to load, please [submit a help ticket](https://cosmos-hub.com/support) or email us at [help@cosmos-hub.com](mailto:help@cosmos-hub.com). We will be glad to help you out.
> [accordion] Is there a maximum file size for upload and analysis?
>
> We support file sizes up to 50GB shotgun (gzipped or unzipped) and up to 1GB ITS/16S (250MB .gz). If your data is larger than our file size limit, we recommend using reformat.sh script from BBTools package [https://jgi.doe.gov/data-and-tools/bbtools/bb-tools-user-guide/reformat-guide/](https://jgi.doe.gov/data-and-tools/bbtools/bb-tools-user-guide/reformat-guide/) to downsample the data to a lower read depth and then upload. If you need our assistance downsampling the data to a lower read depth, please contact [sales@cosmosid.com](mailto:sales@cosmosid.com).
> [accordion] What is the difference between alpha diversity and beta diversity?
>
> Alpha diversity is how many different taxa are detected in each sample. Beta diversity is the difference in microbial composition between samples. Alpha diversity looks at each sample and asks how many. Beta diversity compares samples and asks what are the differences in microbial composition between the samples.
> [accordion] What does the presence of 'u\_s' and 'u\_t' in a taxa name refer to in the taxonomy results view?
>
> Reads can be assigned to taxa that may not make it down to species or strain level. When we do not observe a strong enough signal to an individual species/strain, a "Branch" call at a higher phylogenetic level will instead be made. These would be calls such as "Escherichia" or "Enterobacteriaceae" if you were looking at an individual sample result on the app with the "strain-level statistics" view. These are considered in aggregation values. If aggregating upwards (towards phylum) they will be included. If aggregating downward (towards strain) they will be named as "Escherichia\_u\_s" (at species level) or "Escherichia\_u\_t" (at strain level) in the taxonomy switcher view.
> [accordion] Why do our Taxa and AMR and Virulence workflow not require neither quality trimming nor adapter removal from sequencing reads?
>
> Our algorithm looks for exact matches of K-mer to our database of taxonomic K-mer biomarkers. If there are any ambiguous/wrong bases in the K-mer, the query K-mer will not have exact matches to our taxonomic relevant biomarkers and automatically be discarded and not considered for the analysis.
> [accordion] Why is rarefaction analysis not included in Cosmos-Hub?
>
> There are several limitations in performing rarefaction analysis with shotgun metagenomics data. Some of the limitations with rarefaction analysis are mentioned below.
>
> 1. Loss of information: Rarefaction discards a significant amount of data by subsampling, which could lead to the loss of rare or low-abundance taxa. This may skew the diversity estimates and might not accurately represent the true microbial diversity in the samples.
> 2. Sensitivity to sequencing depth: The results of rarefaction analysis can be highly sensitive to the chosen sequencing depth. Different depths can lead to different diversity estimates, making it difficult to determine the optimal depth for meaningful comparisons.
> 3. Inefficiency: Rarefaction analysis can be computationally intensive, especially for large datasets with millions of reads or sequences. This can make the process time-consuming and resource-demanding.
> 4. Biases in the estimation of diversity: The randomness of subsampling can introduce biases in the estimation of diversity indices, leading to inaccurate or misleading conclusions about the community structure and composition.
> 5. Limited applicability to shotgun metagenomics data: Rarefaction analysis is primarily designed for amplicon sequencing data (e.g., 16S rRNA gene sequencing) and may not be as applicable or informative for shotgun metagenomics data. Shotgun metagenomics also provides information about the functional potential of the microbial community, which cannot be adequately captured by rarefaction analysis.
> 6. Inability to account for differences in genome size: In shotgun metagenomics data, the genome size of different organisms can impact the abundance of taxa as well as individual genes. Rarefaction analysis does not account for these differences, which could lead to biased estimates of both taxa and gene abundance and diversity.
> 7. Inability to capture functional redundancy: Rarefaction analysis is not well-suited to capture functional redundancy in shotgun metagenomics data, where multiple organisms may have similar genes or pathways. This limitation can lead to underestimation of the functional diversity and resilience of microbial communities.
> [accordion] How can you open TSV files in excel?
>
> For both Windows and Mac, you need to right click on the file and then click on "open with" For Mac, Excel automatically comes in the list of recommended apps. For Windows, you need to choose the option to select more apps and then choose Excel.
> [accordion] I have samples I ran previously on the app and I would like to rerun them on the new databases, how do I do that?
>
> Please [submit a help ticket](https://cosmos-hub.com/support) or email us at [help@cosmos-hub.com](mailto:help@cosmos-hub.com).
> [accordion] I have new samples to run, will I automatically get the new databases?
>
> Yes, when you upload new samples they will be analyzed using the new databases unless requested otherwise.
> [accordion] Will my results change with the new databases?
>
> If your samples are rerun on the new databases, it is possible that new species or strains will be identified in your samples that were not previously in the database and this may shift the abundance estimates for your previous results.
# GTDB vs. NCBI Taxonomic Nomenclature
Source: https://docs.cosmosid.com/docs/technical-appendix/gtdb-and-ncbi-taxonomy-comparison
The Cosmos-Hub utilizes GTDB-based nomenclature for taxonomic assessment.
Classifying bacteria is crucial for understanding their ecology, evolution, and potential roles in health and disease. Two prominent systems for bacterial taxonomy are the National Center for Biotechnology Information (NCBI) taxonomy and the Genome Taxonomy Database (GTDB). While both aim to categorize bacteria, they differ in their underlying philosophies and methodologies, leading to discrepancies in classification.
The NCBI taxonomy, a long-standing system, curates classifications based on a combination of phenotypic and genotypic data \[1]. However, in recent years, researchers highlighted inconsistencies arising from historical practices and the subjective nature of phenotypic traits \[2]. Additionally, the NCBI taxonomy is not strictly rank-normalized, meaning equivalent evolutionary distances can be assigned different taxonomic ranks \[1].
GTDB, a newer system, focuses on a phylogenetically consistent and rank-normalized classification based on whole-genome sequences. It utilizes Average Nucleotide Identity (ANI) to delineate species boundaries and Relative Evolutionary Divergence (RED) to define higher taxonomic ranks \[2]. This approach aims to provide a more objective and evolutionarily informative classification scheme leading to GTDB often recognizing finer taxonomic levels and proposing novel lineages not present in the NCBI taxonomy . Here's a breakdown of the key differences between GTDB and NCBI taxonomies:
* Philosophy: NCBI - Curator-driven, phenotypic and genotypic data; GTDB - Genome-based, phylogenetically consistent.
* Data source: NCBI Refseq and Genbank; GTDB - NCBI Refseq and Genbank
* Species definition: NCBI - Less stringent, often based on 16S rRNA gene sequence similarity \[1]; GTDB - Stricter, based on ANI values (>95% for bacteria) \[2].
* Higher-rank classification: NCBI - Traditional Linnaean ranks (phylum, class, order, etc.); GTDB - Ranks are normalized based on evolutionary divergence (phylum level for Bacillota can be Bacillota, Bacillota\_A, Bacillota\_B; ) \[2].
Few notable reclassifications compared to NCBI taxonomy are mentioned below with relevant links justifying the reclassification. Shigella -> Escherichia genus [https://www.biorxiv.org/content/10.1101/2021.09.22.461432v1](https://www.biorxiv.org/content/10.1101/2021.09.22.461432v1) Gardenerella genus -> Bifidobacterium genus [https://www.atcc.org/resources/posters/2019-posters/reclassification-of-the-bifidobacterium-and-gardnerella-genera](https://www.atcc.org/resources/posters/2019-posters/reclassification-of-the-bifidobacterium-and-gardnerella-genera)
In conclusion, GTDB taxonomy offers a more objective and phylogenetically consistent framework which matches with Kepler’s philosophy of phylogenetic profiling. Hence, GTDB was chosen to be the taxonomic engine behind Kepler. To learn more about GTDB, please visit [https://gtdb.ecogenomic.org/](https://gtdb.ecogenomic.org/). Thank you for being a valued member of the Cosmos-Hub community. Your research journey is important to us, and we’re committed to ensuring it’s as impactful as possible. Here’s to exploring new frontiers together!
References:
1. Schoch, C.L., Ciufo, S., Domrachev, M., Hotton, C.L., Kannan, S., Khovanskaya, R., Leipe, D., McVeigh, R., O’Neill, K., Robbertse, B., Sharma, S., Soussov, V., Sullivan, J.P., Sun, L., Turner, S. and Karsch-Mizrachi, I., 2020. NCBI Taxonomy: a comprehensive update on curation, resources and tools. Database, 2020, baaa062.
2. Parks, D.H., Chuvochina, M., Waite, D.W., Rinke, C., Skarshewski, A., Chaumeil, P.-A., and Hugenholtz, P., 2018. A standardized bacterial taxonomy based on genome phylogeny substantially revises the tree of life. Nature Biotechnology, 36(10), pp.996-1004
# Methods for Manuscripts
Source: https://docs.cosmosid.com/docs/technical-appendix/methods
How to Cite Cosmos-Hub
## Reference for publications:
Cosmos-Hub, [www.cosmos-hub.com](www.cosmos-hub.com)
## Formatted Methods:
> [accordion] CHAMP Human Taxonomic Profiling Methods
>
> \*\*How To Cite: \*\*
>
> * Cosmos-Hub ([www.cosmos-hub.com](http://www.cosmos-hub.com))
> * Pita S, Myers PN, Johansen J, Russel J, Nielsen MC, Eklund AC and Nielsen HB (2024) CHAMP delivers accurate taxonomic profiles of the prokaryotes, eukaryotes, and bacteriophages in the human microbiome. Front. Microbiol. 15:1425489. doi: 10.3389/fmicb.2024.1425489
>
> **Manuscript example (may copy and paste):** Taxonomic profiling of the human microbiome samples was performed using the Clinical Microbiomics Human Microbiome Profiler (CHAMP) version 1.01 \[1] within the Cosmos-Hub ([www.cosmos-hub.com](http://www.cosmos-hub.com)). CHAMP employs a marker gene-based approach synergized with metagenome-assembled genome database for the profiling of prokaryotes, eukaryotes, and viruses from short-read sequencing data. CHAMP utilizes an internal reference database of 6,567 prokaryotic species (6,546 bacterial and 21 archaeal, GTDB-based taxonomy) and 244 eukaryotic species. It was derived from 30,382 human microbiome samples collected across nine distinct human body sites, including gut, small intestinal biopsies, oral, skin, urine, nasopharyngeal, vaginal, airway, and milk samples. Raw sequencing reads were preprocessed using AdapterRemoval (v. 2.3.1) \[2] to remove adapters and low-quality bases (Phred score \< 30). Host contamination was removed by discarding read pairs mapping to the human reference genome GRCh38 using Bowtie2 v. 2.4.2 \[3]. High-quality non-host reads with a minimum length of 100 bp were retained and mapped to the CHAMP database using BWA mem v. 0.7.17 \[4]. Species abundances were calculated using a negative binomial distribution model for signature gene read counts, with normalization for effective gene length. Species with insufficient signature gene coverage or read counts were filtered out. Detection criteria included a minimum of 5 aligned paired-end reads and either ≥99% nucleotide identity with ≥5% genome coverage, or ≥95% nucleotide identity with ≥30% genome coverage. CHAMP provided taxonomic profiles including relative abundances present in each sample, normalized to sum to 100% for each sample.
>
> CHAMP also incorporates functional annotation and profiling to provide insights into the metabolic potential of the microbiome. EggNOG-mapper (v. 2.1.7, Diamond mode) \[5] was used to map prokaryotic genes in the gene catalog to the EggNOG orthologous groups database (v. 5.0) \[6] and Kyoto Encyclopedia of Genes and Genomes (KEGG) Orthology (KO) database \[7]. For eukaryotic genes, KofamScan was employed for annotation \[8]. CHAMP also utilizes several types of functional modules to provide a comprehensive understanding of the microbiome's metabolic potential. Functional potential profiles were generated from the species profiles and reported as cellular abundance, which accounts for species associations when a function is included at least 2/3 of the genes needed to complete the module's functionality. KEGG modules (v. 78.2) \[7] are defined as sets of KOs that enable specific functions or pathways, and KOs were calculated as the proportion of the total gene abundance that mapped to a given KO. Gut-Brain Modules (GBMs), a set of 56 microbial pathways for metabolizing neuroactive compounds, were also incorporated. Each GBM corresponds to a single neuroactive compound synthesis or degradation process. Additionally, Gut Metabolic Modules (GMMs), a set of 103 conserved human gut metabolic pathways, were included. For both GBMs and GMMs, a species was considered to contain a given module if it included genes annotated to at least 2/3 of the steps needed to complete the module's functionality.
>
> References:
>
> 1. Pita S, Myers PN, Johansen J, Russel J, Nielsen MC, Eklund AC and Nielsen HB (2024) CHAMP delivers accurate taxonomic profiles of the prokaryotes, eukaryotes, and bacteriophages in the human microbiome. Front. Microbiol. 15:1425489. doi: 10.3389/fmicb.2024.1425489
> 2. Schubert, M., Lindgreen, S., & Orlando, L. (2016). AdapterRemoval v2: rapid adapter trimming, identification, and read merging. BMC Research Notes, 9, 88. [https://doi.org/10.1186/s13104-016-1900-2](https://doi.org/10.1186/s13104-016-1900-2)
> 3. Langmead, B., & Salzberg, S. L. (2012). Fast gapped-read alignment with Bowtie 2. Nature Methods, 9(4), 357–359. [https://doi.org/10.1038/nmeth.1923](https://doi.org/10.1038/nmeth.1923)
> 4. Li, H., & Durbin, R. (2009). Fast and accurate short read alignment with Burrows-Wheeler transform. Bioinformatics, 25(14), 1754–1760. [https://doi.org/10.1093/bioinformatics/btp324](https://doi.org/10.1093/bioinformatics/btp324)
> 5. Cantalapiedra, C. P., Hernández-Plaza, A., Letunic, I., Bork, P., & Huerta-Cepas, J. (2021). eggNOG-mapper v2: Functional annotation, orthology assignments, and domain prediction at the metagenomic scale. Molecular Biology and Evolution, 38(12), 5825–5829. [https://doi.org/10.109](https://doi.org/10.109)
> 6. Cantalapiedra, C. P., Hernández-Plaza, A., Letunic, I., Bork, P., & Huerta-Cepas, J. (2021). eggNOG-mapper v2: Functional annotation, orthology assignments, and domain prediction at the metagenomic scale. Molecular Biology and Evolution, 38(12), 5825–5829. [https://doi.org/10.1093/molbev/msab293](https://doi.org/10.1093/molbev/msab293)
> 7. Kanehisa, M., Furumichi, M., Sato, Y., Kawashima, M., & Ishiguro-Watanabe, M. (2023). KEGG for taxonomy-based analysis of pathways and genomes. Nucleic Acids Research, 51(D1), D587–D592. [https://doi.org/10.1093/nar/gkac963](https://doi.org/10.1093/nar/gkac963)
> 8. Beghini, F., McIver, L. J., Blanco-Míguez, A., Dubois, L., Asnicar, F., Maharjan, S., Mailyan, A., Manghi, P., Scholz, M., Thomas, A. M., Valles-Colomer, M., Weingart, G., Zhang, Y., Zolfo, M., Huttenhower, C., Franzosa, E. A., & Tett, A. (2019). Integrating taxonomic, functional, and strain-level profiling of diverse microbial communities with bioBakery 3. Bioinformatics, 37(8), 104–110. [https://doi.org/10.1093/bioinformatics/btz859](https://doi.org/10.1093/bioinformatics/btz859)
> [accordion] KEPLER Host-Agnostic Taxonomic Profiling Methods:
>
> \*\*How To Cite: \*\*
>
> * Kepler v.1.1.0 (accessed via Cosmos-Hub, [www.cosmos-hub.com](http://www.cosmos-hub.com))
>
> **Manuscript Example (may copy and paste)**: Kepler v1.1.0 (accessed via Cosmos-Hub, [www.cosmos-hub.com](http://www.cosmos-hub.com)) utilizes a high performance data-mining k-mer algorithm that rapidly disambiguates millions of short sequence reads into the discrete genomes engendering the particular sequences. The pipeline has two separable comparators: the first consists of a pre-computation phase for reference databases and the second is a per-sample computation. The input to the pre-computation phase is a database of >150,000 GTDB-based reference genomes and genes that are continuously curated by Cmbio scientists. The output of the pre-computational phase is a phylogeny tree of microbes, together with sets of variable length k-mer fingerprints (biomarkers) uniquely associated with distinct branches and leaves of the tree. The second per-sample computational phase searches the hundreds of millions of short sequence reads, or alternatively contigs from draft de novo assemblies, against the fingerprint sets. This query enables the sensitive yet highly precise detection and taxonomic classification of microbial NGS reads. The resulting statistics are analyzed to return the strain-resoultion taxonomic and relative abundance estimates for the microbial NGS datasets.
>
> \_If filtered dataset is used: \_To exclude false positive identifications, the results are filtered using a filtering threshold derived based on internal statistical scores that are determined by analyzing a large number of diverse metagenomes. The same approach is applied to enable the sensitive and accurate detection of genetic markers for virulence and for resistance to antibiotics.
>
> ### Example Citations
>
> The papers mentioned below have previously cited the Cosmos-Hub for referencing to our taxonomic profiling method.
>
> 1. [https://www.science.org/doi/10.1126/science.adj3502](https://www.science.org/doi/10.1126/science.adj3502)
> 2. [https://www.frontiersin.org/journals/medicine/articles/10.3389/fmed.2023.1165980/full](https://www.frontiersin.org/journals/medicine/articles/10.3389/fmed.2023.1165980/full)
> 3. [https://www.cell.com/cell-host-microbe/pdfExtended/S1931-3128(19)30158-1](https://www.cell.com/cell-host-microbe/pdfExtended/S1931-3128\(19\)30158-1)
> 4. [https://www.nature.com/articles/s41598-022-14118-9#Sec2](https://www.nature.com/articles/s41598-022-14118-9#Sec2)
> 5. [https://journals.asm.org/doi/full/10.1128/mbio.00591-22](https://journals.asm.org/doi/full/10.1128/mbio.00591-22).
> [accordion] FUNCTIONAL Host-Agnostic Profiling Methods:
>
> Functional profilng was performed using the Cosmos-Hub microbiome platform ([www.cosmos-hub.com](http://www.cosmos-hub.com)). Initial QC, adapter trimming and preprocessing of metagenomic sequencing reads are done using BBduk (1). The quality controlled reads are then subjected to a translated search against a comprehensive and non-redundant protein sequence database, UniRef 90. The UniRef90 database, provided by UniProt (2), represents a clustering of all non-redundant protein sequences in UniProt, such that each sequence in a cluster aligns with 90% identity and 80% coverage of the longest sequence in the cluster. The mapping of metagenomic reads to gene sequences are weighted by mapping quality, coverage and gene sequence length to estimate community wide weighted gene family abundances as described by Franzosa et al (3). Gene families are then annotated to MetaCyc (4) reactions (Metabolic Enzymes) to reconstruct and quantify MetaCyc (4) metabolic pathways in the community as described by Franzosa et al (3). Furthermore, the UniRef\_90 gene families are also regrouped to GO terms (5) in order to get an overview of GO functions in the community. Lastly, to facilitate comparisons across multiple samples with different sequencing depths, the abundance values are normalized using Total-sum scaling (TSS) normalization to produce "Copies per million" (analogous to TPMs in RNA-Seq) units.
>
> ### References:
>
> 1. Bushnell, B. (2021). BBDuk Guide - DOE Joint Genome Institute. Retrieved 1 August 2021, from [https://jgi.doe.gov/data-and-tools/bbtools/bb-tools-user-guide/bbduk-guide/](https://jgi.doe.gov/data-and-tools/bbtools/bb-tools-user-guide/bbduk-guide/)
> 2. UniProt: the universal protein knowledgebase. (2016). Nucleic Acids Research, 45(D1), D158-D169. doi: 10.1093/nar/gkw1099
> 3. Franzosa, E., McIver, L., Rahnavard, G., Thompson, L., Schirmer, M., & Weingart, G. et al. (2018). Species-level functional profiling of metagenomes and metatranscriptomes. Nature Methods, 15(11), 962-968. doi: 10.1038/s41592-018-0176-y
> 4. Caspi, R., Foerster, H., Fulcher, C., Kaipa, P., Krummenacker, M., & Latendresse, M. et al. (2007). The MetaCyc Database of metabolic pathways and enzymes and the BioCyc collection of Pathway/Genome Databases. Nucleic Acids Research, 36(Database), D623-D631. doi: 10.1093/nar/gkm900
> 5. Carbon, S., Ireland, A., Mungall, C., Shu, S., Marshall, B., & Lewis, S. (2008). AmiGO: online access to ontology and annotation data. Bioinformatics, 25(2), 288-289. doi: 10.1093/bioinformatics/btn615
> [accordion] KEPLER-AMR/VF Methods:
>
> Antimicrobial resistance genes (AMR) and virulence factors (VF) were classified using the **Resfinder** \[1] AMR database, the VFDB \[2] VF database, and the KEPLER-AMR/VF Profiler the within the Cosmos-Hub \[3]. This pipeline utilizes a pre-computed database of curated nucleotide sequences, split into n-mers and organized into a hierarchical tree-like structure based on shared biomarker attributes (homologous shared/overlap sequences among AMR genes as the tree backbone) and unique biomarker attributes (unique sequence for respective genes as the tree leaves). Metagenomic sequencing reads were divided into k-mer sets and queried against this database for exact matches. Abundance is calculated using fine-grain composite k-mer statistics and coverage depth estimation, resulting in a weighted biomarker score (abundance score) that is translated to relative abundance.
>
> References:
>
> 1. Ferrer Florensa, A., Kaas, R. S., Clausen, P. T. L. C., Aytan-Aktug, D., & Aarestrup, F. M. (2022). ResFinder – an open online resource for identification of antimicrobial resistance genes in next-generation sequencing data and prediction of phenotypes from genotypes. Microbial Genomics, 8(1), 000748. [https://doi.org/10.1099/mgen.0.000748](https://doi.org/10.1099/mgen.0.000748)
> 2. Liu, B., Zheng, D., Zhou, S., Chen, L., & Yang, J. (2021). VFDB 2022: A general classification scheme for bacterial virulence factors. Nucleic Acids Research, 50(D1), D912–D917. [https://doi.org/10.1093/nar/gkab1107](https://doi.org/10.1093/nar/gkab1107)
> 3. Cosmos-Hub, [www.cosmos-hub.com](http://www.cosmos-hub.com)
> [accordion] 16S ASV-based Profiling Methods
>
> The Cosmos-Hub ([www.cosmos-hub.com](http://www.cosmos-hub.com)) was utilized for 16S rRNA data anlysis by implementing the DADA2 algorithm(3) as its core engine along with the Nextflow ampliseq pipeline(1) definitions to run it on our cloud infrastructure. Briefly, primer removal is done with Cutadapt (4), and quality trimming parameters are passed to DADA2 to ensure that the median quality score over the length of the read exceeds a certain Phred score threshold. Within DADA2, forward and reverse reads are each trimmed to a uniform length based on the quality of reads in the sample—higher quality data will generally result in longer reads. DADA2 uses machine learning with a parametric error model to learn the error rates for the forward and reverse reads, based on the premise that correct sequences should be more common than any particular error-variant. DADA2 then applies its core sample inference algorithm to the filtered and trimmed data, applying these learned error models. Paired-end reads are then merged if they have at least 12 bases of overlap and are identical across the entire overlap.
>
> The resulting table of sequences and observed frequencies is filtered to remove chimeric sequences (those that exactly match a combination of more-prevalent “parent” sequences). Taxonomy and species-level identification (where possible) are conducted with DADA2’s naive Bayesian classifier, using the Silva version 138 database.
>
> Lastly, the predicted functional potential of the community was profiled using PICRUST2 (5)(6)(7)(8)(9). Briefly, PICRUSt2 (**Phylogenetic Investigation of Communities by Reconstruction of Unobserved States**) is a tool that predicts functional capabilities and abundances of a microbial community based on the observed amplicon (marker gene) content. Functional capabilities are given by EC classifiers, or MetaCyc ontologies, and these can be aggregated to predict pathways that are likely present in a given sample.
>
> ### References:
>
> 1. Straub, D. *et al.* Interpretations of Environmental Microbial Community Studies Are Biased by the Selected 16S rRNA (Gene) Amplicon Sequencing Pipeline. *Front. Microbiol.* **11**, 1–18 (2020).
> 2. Callahan, B. J., McMurdie, P. J. & Holmes, S. P. Exact sequence variants should replace operational taxonomic units in marker-gene data analysis. *ISME J.* **11**, 2639–2643 (2017).
> 3. Callahan, B. J. *et al.* DADA2: High-resolution sample inference from Illumina amplicon data. *Nat. Methods* **13**, 581–583 (2016).
> 4. Martin, M. Cutadapt removes adapter sequences from high-throughput sequencing reads. *EMBnet.journal* **17**, 10 (2011).
> 5. Douglas, G. M. *et al.* PICRUSt2 for prediction of metagenome functions. *Nat. Biotechnol.* **38**, 685–688 (2020).
> 6. Barbera, P. *et al.* EPA-ng: Massively Parallel Evolutionary Placement of Genetic Sequences. *Syst. Biol.* **68**, 365–369 (2019).
> 7. Czech, L., Barbera, P. & Stamatakis, A. Genesis and Gappa: processing, analyzing and visualizing phylogenetic (placement) data. *Bioinformatics* **36**, 3263–3265 (2020).
> 8. MIRARAB, S., NGUYEN, N. & WARNOW, T. SEPP: SATé-Enabled Phylogenetic Placement. in *Biocomputing 2012* 247–258 (WORLD SCIENTIFIC, 2011). doi:10.1142/9789814366496\_0024.
> 9. Louca, S. & Doebeli, M. Efficient comparative phylogenetics on large trees. *Bioinformatics* **34**, 1053–1055 (2018).
> 10. Ye, Y. & Doak, T. G. A Parsimony Approach to Biological Pathway Reconstruction/Inference for Genomes and Metagenomes. *PLoS Comput. Biol.* **5**, e1000465 (2009).
> 11. Chiarello, M., McCauley, M., Villéger, S. & Jackson, C. R. Ranking the biases: The choice of OTUs vs. ASVs in 16S rRNA amplicon data analysis has stronger effects on diversity measures than rarefaction and OTU identity threshold. *PLoS One* **17**, 1–19 (2022).
> [accordion] 16S OTU-based Profiling Methods:
>
> For taxonomic profiling based of amplicon data, the Cosmos-Hub ([www.cosmos-hub.com](http://www.cosmos-hub.com)) 16S data analysis pipeline starts with preprocessing of the raw reads from either paired-end or single-end Fastq files through read-trimming to remove adapters as well as reads and bases of low quality. If the reads are in a paired-end format, the forward and reverse overlapping pairs are joined together; the unjoined R1 and R2 reads are then added to the end of the file. The file is then converted to Fasta format and used as input for OTU picking. OTUs are identified against the Silva v138 database using a closed-reference OTU picker and 97% sequence similarity through the QIIME framework. The final results are then presented in tabular format with the taxonomic names, OTU IDs, frequency, and relative abundance.
> [accordion] Alpha Diversity
>
> Alpha diversity metrics are calculated using known indicies:
>
> **Chao1 Index** (Chao, A. (1987). “Estimating the population size for capture-recapture data with unequal catchability.” Biometrics 43(4): 783–791.+
>
> **Shannon-Weaver Index** (Shannon, C. E. (1948). “A mathematical theory of communication.” Bell System Technical Journal, 27, 379–423 & 623–656.)
>
> **Simpson Index** (Simpson, E. H. (1949). “Measurement of diversity.” Nature, 163(4148), 688.)
>
> **Statistics** - Kruskal-Wallis Test
> [accordion] Beta Diversity
>
> Beta diversity metrics are calculated using known indicies:
>
> **Jaccard Index** (Jaccard, Paul (1901). “Étude comparative de la distribution florale dans une portion des Alpes et des Jura.” Bulletin de la Société vaudoise des sciences naturelles (in French). 37 (142): 547–579.; Jaccard, Paul (February 1912). “The Distribution of the Flora in the Alpine Zone. 1.” New Phytologist. 11 (2): 37–50. doi:10.1111/j.1469-8137.1912.tb05611.x.)
>
> **Bray-Curtis Dissimilarity** (Bray, J. R. & Curtis, J. T. (1957). “An ordination of the upland forest communities of southern Wisconsin.” Ecological Monographs, 27, 325–349.)
>
> **Statistics** - PERMANOVA
> [accordion] Differential Abundance (LEfSe, MaAsLin)
>
> **LEfSe:**
>
> > Segata, N., Izard, J., Waldron, L. *et al.* Metagenomic biomarker discovery and explanation. *Genome Biol* **12**, R60 (2011). [https://doi.org/10.1186/gb-2011-12-6-r60](https://doi.org/10.1186/gb-2011-12-6-r60)
>
> **MaAsLin2:**
>
> > Mallick H, Rahnavard A, McIver LJ, Ma S, Zhang Y, Nguyen LH, Tickle TL, Weingart G, Ren B, Schwager EH, Chatterjee S, Thompson KN, Wilkinson JE, Subramanian A, Lu Y, Waldron L, Paulson JN, Franzosa EA, Bravo HC, Huttenhower C (2021). Multivariable Association Discovery in Population-scale Meta-omics Studies. PLoS Computational Biology, 17(11):e1009442. [https://doi.org/10.1371/journal.pcbi.1009442](https://doi.org/10.1371/journal.pcbi.1009442)
>
> **MaAsLin3**
>
> > Nickols WA, Kuntz T, Shen J, Maharjan S, Mallick H, Franzosa EA, Thompson KN, Nearing JT, Huttenhower C. MaAsLin 3: Refining and extending generalized multivariable linear models for meta-omic association discovery. bioRxiv, 2024.12.13.628459; doi: [https://doi.org/10.1101/2024.12.13.628459](https://doi.org/10.1101/2024.12.13.628459)
> [accordion] EMU Long Read Amplicon Profiling
>
> Long-read amplicon profiling was performed using the EMU profiler (Curry et al, 2022) in the Cosmos-Hub microbiome platform ([www.cosmos-hub.com](http://www.cosmos-hub.com)), enabling high-resolution, probabilistic taxonomic classification based on full-length rRNA gene amplicons. The EMU workflow employs an expectation-maximization algorithm which iteratively refines abundance estimates by mapping long reads to curated and domain-specific reference databases, thereby providing species-level assignments with improved phylogenetic resolution compared to conventional short-read approaches.
>
> Sequencing data was generated using platforms capable of producing extended amplicon reads (e.g., Oxford Nanopore, PacBio), targeting regions such as 16S, 18S, ITS, or the complete rRNA operon. All input reads underwent preprocessing, with minimum length and Phred score cutoffs set according to workflow requirements and sample type; these parameters must be specified by the user for each experiment and are integral to downstream performance. During analysis, quality-filtered reads were aligned against user-selected reference databases (options include GTDB, SILVA, Greengenes2, HOMD, MiDAS, and combinations thereof) selected to reflect the ecology and biological focus of the study ***\[edit accordingly for database selection].*** Database choice serves as a principal determinant of sensitivity and specificity, and must be indicated in the methods for reproducibility and benchmarking purposes.
>
> Parameter selection within the EMU workflow is user-configurable and encompasses settings such as maximum EM iteration count (typically 20–25), taxonomic assignment probability threshold (commonly 0.9–0.95), and minimum thresholds for read quality and length based on sequencing chemistry and sample diversity. The EMU profiler permits rapid analysis via platform defaults, but advanced users may optimize these settings to improve detection for rare or closely related taxa. For all analyses, the selected parameters and databases must be declared, as they represent a critical component of methodological transparency and facilitate future meta-analysis.
>
> Taxonomic profiles were generated to the species or strain level, offering robust analytical sensitivity for complex or low-biomass samples. The methodology supports both standardized and bespoke workflows for clinical, environmental, or agricultural microbiome studies. In summary, researchers are required to carefully document their database selections and parameter configurations within Cosmos-Hub to ensure reproducibility, facilitate comparisons across studies, and support rigorous microbiome research.
>
> > Curry, K.D., Wang, Q., Nute, M.G. *et al.* Emu: species-level microbial community profiling of full-length 16S rRNA Oxford Nanopore sequencing data. *Nat Methods* **19**, 845–853 (2022). [https://doi.org/10.1038/s41592-022-01520-4](https://doi.org/10.1038/s41592-022-01520-4)
# Security and IT Documentation
Source: https://docs.cosmosid.com/docs/technical-appendix/security-it
Cosmos-Hub remains committed to maintaining the highest standards in security, compliance, and IT operations.
Our platform ensures your microbiome data is secure, reliable, and readily accessible, empowering your research with confidence and precision.
This document outlines the IT security policies for the Cosmos-Hub Portal hosted on AWS. The goal is to ensure the confidentiality, integrity, and availability of user data, especially sensitive Next-Generation Sequencing (NGS) data, and to comply with relevant legal and regulatory standards.
## Infrastructure and Data Protection
* **Cloud Provider**: Cosmos-Hub uses Amazon Web Services (AWS) for cloud infrastructure, benefiting from AWS’s industry-leading security and scalability.
* **Data Encryption**: All user data, including Next-Generation Sequencing (NGS) data, is encrypted both in transit and at rest.
* **Data in Transit**: Secure Socket Layer (SSL) or Transport Layer Security (TLS) encryption is required for all data transmissions between users and the platform.
* **Data at Rest**: All stored data must be encrypted using AES-256 encryption within AWS’s storage services (e.g., Amazon S3, RDS).
* **Data Storage**: Data is stored in Amazon S3 buckets with 99.999999999% durability across multiple availability zones.
* **Database Security**: User data is managed through Amazon RDS (PostgreSQL), which includes encryption, daily backups, and cross-region replication for added resilience.
* **Data Retention**: NGS data will be retained at the Cosmos-Hub Amazon S3 cloud storage according to the platform’s data retention policy. Users can request data deletion via a written notice. Logs and metadata will be retained for a minimum of 90 days for auditing purposes, unless otherwise specified by law.
## Access Control and Authentication
* **Role-Based Access Control (RBAC)**: Access to sensitive data is managed through RBAC policies, ensuring only authorized personnel can access critical systems.
* **Multi-Factor Authentication (MFA)**: MFA is required for system administrators and encouraged for all users to prevent unauthorized access.
* **Network Security**: All public-facing endpoints are beind a virtual firewall with intrusion detection systems (e.g., AWS GuardDuty) and network segmentation to protect the platform against unauthorized access.
## Software Development and Maintenance
* **System Patching and Updates**: All system components, including the operating system, libraries, and platform software, must be regularly patched. Critical security updates should be applied within 24 hours of release, while general patches should be applied monthly.
* **Agile Development**: Cosmos-Hub employs Agile methodologies, allowing rapid iterations, continuous improvement, and sprint-based development cycles.
* **Version Control**: Azure DevOps Git is used for code versioning and change management.
* **CI/CD Pipelines**: Automated Jenkins pipelines facilitate continuous integration, testing, and deployment of software updates.
* **Quality Assurance**: Rigorous testing processes, including unit tests, end-to-end tests, and user acceptance testing (UAT), are conducted before any release. All release summaries and validation checklists are documented in MediaLab for quality and document management.
## Incident Response Plan
* **Incident Identification**: Incidents may be detected through automated monitoring systems (e.g., AWS CloudWatch, GuardDuty), user reports, or third-party security audits.
* **Incident Response Process**
* *Initial Assessment*: Within 12 hour of identifying an incident, the security team must assess the situation and determine the severity of the breach.
* *Containment*: Immediate steps must be taken to contain the incident, such as blocking affected IP addresses or disabling compromised user accounts.
* *Eradication*: Once the incident is contained, any malicious elements or vulnerabilities must be removed from the system.
* *Recovery*: Data restoration and system recovery efforts must follow a predefined recovery plan.
* *Post-Incident Review*: A review must be conducted to document the incident and update the security policies to prevent future occurrences.
## Disaster Recovery and Business Continuity
* **Backup Strategy**: Daily backups of critical data and system configurations are performed, with backup data replicated across multiple AWS regions. Disaster recovery testing should occur biannually to ensure all backup and restoration processes function as expected.
* **Disaster Recovery Plan**: In the event of a major incident (e.g., system failure, natural disaster), the following steps must be followed:
* *Recovery Time Objective (RTO)*: Critical services are restored within 4 hours during an outage or disaster scenario.
* *Recovery Point Objective (RPO)*: Data loss is minimized to 8 hours at most during a disaster.
## User Responsibilities
* **Password Security**: Users must create strong passwords and update them regularly. Sharing passwords or account details is strictly prohibited.
* **Phishing and Social Engineering Awareness**: Users should be aware of phishing emails and other forms of social engineering attacks. Do not click on links or download attachments from untrusted sources. Report suspicious emails to [help@cosmos-hub.com](mailto:help@cosmos-hub.com).
## Compliance and Auditing
* **Regular Audits**: Internal audits are conducted quarterly, with annual external audits to ensure compliance with security standards.
* **Penetration Testing**: Annual penetration tests evaluate the security posture of the platform. Recent testing revealed no major vulnerabilities, affirming the system's resilience.
* **Monitoring Tools**: AWS CloudWatch and GuardDuty are used for real-time monitoring of system performance and potential security incidents.
## Ongoing Monitoring and Maintenance
* **System Monitoring**: Datadog monitors real-time system performance, while AWS CloudWatch tracks security incidents and operational metrics.
* **Regular Maintenance**: Monthly maintenance includes deploying software updates, restarting services, and conducting performance checks to ensure stability.
## FAQ
> [accordion] What is your inactivity timer configured to? Can this be configured as needed?
>
> * 12 hours. Yes, it can be configured as needed.
> [accordion] Is your AWS hosting in multiple regions and what regions are they hosted in?
>
> * No. The CosmosID-Hub is hosted at us-east-1 with multiple AZs
> [accordion] What tools are you using for remote connections and remote support?
>
> * We set up an AWS vpn connection and use ssh for remote access if needed.
> [accordion] Can you provide me with a list of the services you are using in your AWS environment?
>
> * EC2, S3, RDS, ECR, ECS, MQ, VPC, WAF, Key Management, IAM, Route 53, Directory Service, Secrets Manager, Elastic Load Balancing
> [accordion] What endpoint protection are you using?
>
> * WAF, Symantec Endpoint Protection.
> [accordion] What is your patching cadence?
>
> * Our DevOps engineer applies critical patches immediately and monthly for non-critical updates.
> [accordion] What are your remediation timelines for critical and high vulnerabilities?
>
> * 72 hours for critical and 7 days for high vulnerabilities.
> [accordion] What is your vulnerability scanning cadence?
>
> * Monthly
# Update Log
Source: https://docs.cosmosid.com/docs/updates
**12/22/2025**
Metadata Upload Improvements
# **Metadata Upload Enhancements**
We have made several improvements to the metadata upload process in Cosmos-Hub:
* **Transposed Metadata Sheet Support:** The platform now accepts both long format (default) and short format (transposed) metadata templates, giving you flexibility in how you organize your data. See the [Uploading Metadata](/docs/metadata-and-cohorts) page for details on both formats.
* **Improved Error Handling:** Enhanced error messages provide clearer guidance when metadata uploads encounter issues, helping you quickly identify and resolve problems with your files.
* **Better User Experience:** Streamlined upload workflow with more intuitive feedback throughout the metadata import process.
**07/01/2025**
RITA
# **Annoucing RITA, your AI Microbiome Assistant**
We are excited to introduce and expand RITA (Revealing Insight Through Ai), our intelligent AI assistant for microbiome data interpretation. RITA is built to enhance and accelerate the research experience for Cosmos-Hub users with these capabilities:
* **Comprehensive Literature Integration:** curated database of microbiome/microbiology scientific literature, public databases, and Cosmos-Hub’s proprietary knowledge base
* **Natural Language Query Support:** Users can ask RITA a wide range of questions, from details about microbial taxa, gene functions, and biological pathways to disease associations. RITA can also analyze and interpret uploaded datasets, offering insight directly from study results.
* **User-Friendly Access:** RITA is accessible via a [dedicated web chat](rita.cosmosid.com), designed for both simple and complex inquiry. Account setup is quick with self-service registration and activation support.
* **Research-Only Guidance:** RITA is intended for research and informational purposes, supporting R\&D and knowledge generation. For clinical use cases, users are reminded to consult qualified professionals.
* **Continuous Improvements:** The RITA knowledge base is regularly updated, ensuring access to the latest research findings and microbiome data interpretation capabilities.
To get started, create or activate your RITA account through the Cosmos-Hub "RITA" menu icon and explore advanced literature-based microbiome insights.
**06/02/2025**
Data Sharing
# **Data Sharing Updates**
We are pleased to announce enhancements to our Data Sharing feature, empowering collaboration across teams and organizations:
* **Team Access for Annual Subscribers:** Data sharing is now available for users with active annual subscriptions. This feature enables secure sharing of data and results between multiple accounts, typically within a research team or organization.
* **Streamlined User Management:** To add additional users or teammates to your sharing network, customers can contact Cosmos-Hub support for prompt activation and help configuring access.
* **Study Dashboard Integration:** Shared data, including raw sequencing files, profiling results, and metadata, are linked seamlessly within the Cosmos-Hub study dashboards. Users benefit from integrated cloud storage, making multi-user collaboration and secure data access effortless.
* **Security and Privacy:** Data sharing operates on secure AWS infrastructure, with institutional account management, unique credentials, and multi-factor authentication to protect sensitive research data.
* **Support and Onboarding:** For setup help or troubleshooting, Cosmos-Hub support is available to ensure teams can maximize the value of shared resources.
Note: Data sharing is restricted to users with annual subscriptions. For further details or to extend sharing rights to additional collaborators, please reach out to Cosmos-Hub support or your account manager.
**09/26/2024**
Module Release: Advanced Statistics
# Advanced Statistics Module now available
We are thrilled to introduce the Advanced Statistics Module to CosmosID-HUB, offering even greater analytical power for your microbiome research! This exciting feature is built on the robust MaAsLin2 framework and includes early access to MaAsLin3 (Beta), taking your data analysis to the next level.
This exciting new module will enable users to leverage their study metadata even further and run more complex statistics with their microbiome profiles.
### The Advanced Statistics Module enables users to:
* Leverage continuous variables for correlative microbiome analysis
* Use multivariate statistics to control for potential confounders
* Use time series data to perform longitudinal analysis
* Customize their statistical analysis with various parameters and metrics
* Generate new and dedicated visualizations
For a full overview of the Advanced Statistics Module and its MAASLIN2/MAASLIN3 capabilities, visit the [MaAsLin documentation page](/docs/maaslin) or [book a demo](https://cosmosidhub.com/book-a-demo/).
**06/05/2024**
Pipeline Release: CHAMP™ Human Microbiome Profiler
# CHAMP Human Microbiome Profiler is now available in the CosmosID-HUB
* CHAMP offers high-resolution taxonomic and functional profiling that is unparalleled in accuracy, precision, and coverage to maximize insights from human microbiome studies.
* CHAMP™ employs over 400,000 metagenome-assembled genomes (MAGs), created from a collection of more than 30,000 human microbiome samples across 9 different body sites from individuals across the world.
* Enables detection of nearly 7000 bacteria, archaea, and eukaryote species, including many of which are newly discovered.
* Functional characterization via Gut Metabolomic Module (GMM), Gut Brain Module (GBM), KEGG Modules & Orthologs (requires license)
### Why CHAMP™?
* Improved Sensitivity and reduced risk of missing important species
* Reduced false signal and increased confidence in detection
* Higher resolution and fewer unknown species via GTDB nomenclature
### Read the paper and benchmarking stats in [Frontiers of Microbiology (Pita et al, 2024)](https://www.frontiersin.org/journals/microbiology/articles/10.3389/fmicb.2024.1425489/full)
**05/02/2024**
New Subscription Model for the CosmosID-HUB
# CosmosID-HUB is now subscription based
The CosmosID-HUB is moving to a more traditional ‘Software-as-a-Service’ (SaaS) model based on an annual license/subscription. With this change, HUB users will benefit from:
* Decreased sequencing pricing, effective as of today.
* More inclusive profiling - shotgun profiling will now include taxonomy and function together, as standard, giving you access to over 10 different databases with a HUB subscription.
* Access to licensable databases such as KEGG, VFDB, CARD etc.
### When will it change?
For our existing customers who wish to continue to use the software, we are aiming to have everyone transitioned over by July 1st, 2024.
### What if I don’t want to enter into a HUB subscription?
Whilst we’d hate to see you go, you are of course entitled to all of your profiling data, which we’d ask you to go ahead and download for your records before July 1st, 2024.
### Why is this changing?
Ultimately, your investment into the HUB software enables us to accelerate its development and take your research even further. Some tools and functionalities that we're working on include:
* CHAMP - our next-generation human microbiome profiler
* An updated Virulence Factor database
* A KEGG module, including licensing access
* Advanced Statistics
* An Improved User Interface
* Visualizing data from external pipelines
* A Metabolomics module
### What do I do now?
This change in service means that we will be able to offer you an even wider range of functionalities and tools that benefit your projects. [Would you like a demo of the latest capabilities of the platform or have any questions?](https://cosmosidhub.com/book-a-demo/) Our team is ready to assist. Your research journey is important to us, and we’re committed to ensuring it’s as impactful as possible.
**02/15/2024**
Database Release: Bacterial/Fungal
# Bacterial/Fungal Database Update
We are excited to release updated bacterial and fungal databases with > 15,000 new curated genomes, bringing our total to more than 170,000 microbial genomes and gene sequences representing bacteria, viruses, protists, and fungi, as well as antibiotic resistant and virulence associated genes. With thousands of new strains and species, we are now able to characterize complex microbiome communities with increased sensitivity and specificity.
The CosmosID databases are organized phylogenetically and contain hundreds of millions of marker gene sequences. The markers represent both coding and non-coding sequences uniquely identified by taxon and/or distinct nodes of phylogenetic trees. This means that the tree structure was created based on genomic relatedness of organisms rather than predetermined taxonomy based on phenotype. This allows CosmosID to have a high degree of accuracy in identifying microorganisms based on their DNA in metagenomic samples. It also helps identify the closest match to genomes that do not have strain level references in the database (if, for example, they have never been sequenced before).
## We have now switched from NCBI- to GTDB-based nomenclature.
Classifying bacteria is crucial for understanding their ecology, evolution, and potential roles in health and disease. Two prominent systems for bacterial taxonomy are the National Center for Biotechnology Information (NCBI) taxonomy and the Genome Taxonomy Database (GTDB). While both aim to categorize bacteria, they differ in their underlying philosophies and methodologies, leading to discrepancies in classification.
The NCBI taxonomy, a long-standing system, curates classifications based on a combination of phenotypic and genotypic data \[1]. However, in recent years, researchers highlighted inconsistencies arising from historical practices and the subjective nature of phenotypic traits \[2]. Additionally, the NCBI taxonomy is not strictly rank-normalized, meaning equivalent evolutionary distances can be assigned different taxonomic ranks \[1].
GTDB, a newer system, focuses on a phylogenetically consistent and rank-normalized classification based on whole-genome sequences. It utilizes Average Nucleotide Identity (ANI) to delineate species boundaries and Relative Evolutionary Divergence (RED) to define higher taxonomic ranks \[2]. This approach aims to provide a more objective and evolutionarily informative classification scheme leading to GTDB often recognizing finer taxonomic levels and proposing novel lineages not present in the NCBI taxonomy . Here's a breakdown of the key differences between GTDB and NCBI taxonomies:
* Philosophy: NCBI - Curator-driven, phenotypic and genotypic data; GTDB - Genome-based, phylogenetically consistent.
* Data source: NCBI Refseq and Genbank; GTDB - NCBI Refseq and Genbank
* Species definition: NCBI - Less stringent, often based on 16S rRNA gene sequence similarity \[1]; GTDB - Stricter, based on ANI values (>95% for bacteria) \[2].
* Higher-rank classification: NCBI - Traditional Linnaean ranks (phylum, class, order, etc.); GTDB - Ranks are normalized based on evolutionary divergence (phylum level for Bacillota can be Bacillota, Bacillota\_A, Bacillota\_B; ) \[2].
Few notable reclassifications compared to NCBI taxonomy are mentioned below with relevant links justifying the reclassification. Shigella -> Escherichia genus [https://www.biorxiv.org/content/10.1101/2021.09.22.461432v1](https://www.biorxiv.org/content/10.1101/2021.09.22.461432v1) Gardenerella genus -> Bifidobacterium genus [https://www.atcc.org/resources/posters/2019-posters/reclassification-of-the-bifidobacterium-and-gardnerella-genera](https://www.atcc.org/resources/posters/2019-posters/reclassification-of-the-bifidobacterium-and-gardnerella-genera)
In conclusion, GTDB taxonomy offers a more objective and phylogenetically consistent framework which matches with Kepler’s philosophy of phylogenetic profiling. Hence, GTDB was chosen to be the taxonomic engine behind Kepler. To learn more about GTDB, please visit [https://gtdb.ecogenomic.org/](https://gtdb.ecogenomic.org/).
Thank you for being a valued member of the CosmosID-HUB community. Your research journey is important to us, and we’re committed to ensuring it’s as impactful as possible.
Here’s to exploring new frontiers together!
References:
1. Schoch, C.L., Ciufo, S., Domrachev, M., Hotton, C.L., Kannan, S., Khovanskaya, R., Leipe, D., McVeigh, R., O’Neill, K., Robbertse, B., Sharma, S., Soussov, V., Sullivan, J.P., Sun, L., Turner, S. and Karsch-Mizrachi, I., 2020. NCBI Taxonomy: a comprehensive update on curation, resources and tools. Database, 2020, baaa062.
2. Parks, D.H., Chuvochina, M., Waite, D.W., Rinke, C., Skarshewski, A., Chaumeil, P.-A., and Hugenholtz, P., 2018. A standardized bacterial taxonomy based on genome phylogeny substantially revises the tree of life. Nature Biotechnology, 36(10), pp.996-1004
**02/15/2024**
Pipeline Release: Kepler Host-Agnostic Microbiome Profiler
# Kepler™ Host-Agnostic Microbiome Profiler
Kepler™ uses a host-agnostic curated database to process samples beyond the human host including but not limited to environmental, animal, soil, food samples and many others.
Kepler extracts optimal value from metagenomic data by combining the precision of K-mer exact-matching and the versatility of probabilistic alignment. Through this method, Kepler achieves robust identification and enumeration of bacteria, viruses, fungi, and protists by leveraging a meticulously curated biomarker database, where over 30,000 species are arranged in a phylogenetic tree-like structure.
The core of Kepler's technology is patented in both the US Patent office (US10108778B2, US20200294628A1) and European Patent Office (ES2899879T3).
Most notably, Kepler marks a transition from NCBI-based nomenclature to GTDB-based nomenclature. Read more about \[the NCBI vs. GTDB transition]\(GTDB vs. NCBI Taxonomic Nomenclature).
> [!NOTE]
>
> [Download the Benchmark Whitepaper](https://cosmosidhub.com/wp-content/uploads/2024/11/Kepler-Benchmark-Whitepaper-2024-11-25.pdf)
### Kepler Advantages

### How does Kepler work?

The Kepler multi-kingdom taxonomic profiler is divided into three parts:
#### 1. Leveraging a Curated Database of Microbial Genomes
The Kepler database of high quality microbial genomes is based on high completeness:low contamination ratio, genome assembly quality and prioritizing intra-species diversity whilst limiting phylogenetic redundancy. The genome assemblies are then scrubbed clean of low complexity sequences, prophages, plasmids and host-contaminated regions to maximize the taxonomic signal-to-noise ratio. The final database encompasses multiple microbial kingdoms and >30,000 species.
#### 2. Identifying Relevant Biomarkers
With the genomes curated and cleaned, they undergo a pre-computation phase where they’re split into n-mers of variable length. The n-mers are then categorized as either shared or unique biomarkers across individual genomes, which is facilitated by a phylogenetic tree-like data structure. The tree backbone represents shared genomic biomarkers between different taxa, while the tree leaves are individual microbial genomes with unique biomarkers.
#### 3. Searching the Biomarker Database
The second per-sample, computational phase searches the millions of short sequence reads or contigs in your data against the phylogenetic tree-like database build:
* The first comparator splits the sequencing reads into k-mer sets that are then queried across the different branches and leaves of the phylogenetic tree to identify the different taxa present in the query kmer-sets. The first comparator splits the sequencing reads into k-mer sets that are then queried across the different branches and leaves of the phylogenetic tree to identify the different taxa present in the query kmer-sets. The first comparator looks for exact matches between query k-mers and reference bio-markers and classification sensitivity and accuracy is maintained through composite k-mer/biomarker aggregation statistics and coverage depth estimation.
* The second comparator uses an edit distance-scoring based probabilistic Smith-Waterman algorithm to compare sequencing reads with a reference set of identified microbial taxa using the first comparator. In conclusion, overall abundance precision and classification accuracy is achieved by running the comparators in sequence, scoring the entire read probabilistically against the reference set, and a final deconvolution step to distinguish homologous regions.
### Evaluation of Kepler with Biological Community Standards
To benchmark Kepler, real-world community standards were utilized to compare its efficacy against leading profilers such as Kraken2/Bracken and MetaPhlAn4. For these comparisons, 5 different community standards were employed with both even and staggered (log distribution), from ATCC and Zymo.
Kepler distinguished itself not only by achieving a superior F1-Score (a balanced measure of precision and sensitivity) but also by its exceptional ability to detect low-abundance taxa (Bacteria and Fungi) as well as its precision in differentiating closely related taxa at the sub-species level, for example, *Bifidobacterium longum* subsp. *longum* and *Bifidobacterium longum* subsp. *infantis*.

Figure 1: This figure illustrates the sensitivity of Kepler in comparison to other methods when applied to staggered community standards and fungal biological dataset. Kepler significantly outperforms in detecting both Bacteria and Fungi within these staggered standards, showcasing its superior sensitivity.
**11/05/2023**
Pipeline Release: Host-Agnostic Functional Workflow
# Host-Agnostic Functional Workflow
This year, we are pleased to announce two major updates to our functional profiling workflow (Functional v1.0 → 2.0). One of the primary focuses of this latest release was to improve the functional characterization of the microbiome by expanding our catalog of gene families from Uniref90. The update to the Uniref90 gene family database has substantially increased our detection of gene functions in the microbiome community, which can be seen in **Figure 1** with an increase in the number of GO Terms detected in both human stool and mouse gastrointestinal tract specimens.

Furthermore, alongside MetaCyc Pathways and GO Terms database, CosmosID-HUB users will have access to 3 more additional functional databases as well. The three additional databases are:
1. **Enzyme Commission Database**: a database of the numerical classification of enzymes based on the reactions they catalyze
2. **Pfam Database**: a database of protein families generated using hidden Markov models
3. **CAZy Database**: a database of structurally related catalytic and carbohydrate-binding modules of enzymes that degrade, modify, or create glycosidic bonds
The addition of these three new databases will give scientists greater insights into the functional potential of their microbial communities at the gene/protein level within minutes of uploading their raw FASTQ files to the HUB.
The release of the Host-Agnostic Functional Workflow is part of CosmosID’s microbial genomics platform, CosmosID-HUB Microbiome, which is continually expanding with various features and workflows for analyzing microbial communities and for inferring translational and actionable microbiome insights.
# Cosmos-Hub Video Tutorials
Source: https://docs.cosmosid.com/docs/video-library
Description of your new file.
[YouTube video player](https://www.youtube.com/embed/WilR6OjqDIQ?si=I_UcUKNsIgOqq9Ax\&fs=1)
[YouTube video player](https://www.youtube.com/embed/uTHBlrf4zn4?si=S38FJe4UWmApgxyC\&fs=1)
[YouTube video player](https://www.youtube.com/embed/VomAmmmAFDs?si=Szci7hlaG-j40sMS\&fs=1)
[YouTube video player](https://www.youtube.com/embed/fAu4eIAazuU?si=hWImeAJquvPAwx-J\&fs=1)
[YouTube video player](https://www.youtube.com/embed/f_OIvfVKxX4?si=g0--kGx7kYuaYxiT\&fs=1)
[YouTube video player](https://www.youtube.com/embed/IkVrZ2FbMDo?si=bzJe3V5qBIkYHVGZ\&fs=1)
[YouTube video player](https://www.youtube.com/embed/vSxHjf8QC40?si=Qzm6jYLF0r8l3Q04\&fs=1)
[YouTube video player](https://www.youtube.com/embed/QOpRLdqmEQc?si=6teXPXJHj9QkFytG\&fs=1)
[YouTube video player](https://www.youtube.com/embed/jK0jnAN8bPU)
[YouTube video player](https://www.youtube.com/embed/rWfF4-i9rPg)
[YouTube video player](https://www.youtube.com/embed/2HubzRF21CE)
# Viewing Single Sample Profiling Data
Source: https://docs.cosmosid.com/docs/view-sample-results
## Viewing Sample Results
From the **Samples** menu, click on a sample name. You will see sample information, navigation controls at the top, and a table with microbial results.

### Number of Total # Reads in Sample
The top navigation bar provides sample details, database navigation, filtered vs. unfiltered views, and taxonomy level controls.

### Number of Organisms/Genes Found
To see how many organisms or genes (depending on the database being viewed) were identified for your sample, look at the number **features found**, as circled below.

### % Reads assigned to taxonomy/genes
The number of taxonomically significant hits that were found in your sample and used to make identifications are listed as a number followed by **Reads Hit**.

### Switching Databases

Click the drop down menu to select the database results to view:
* Bacteria
* Fungi
* Protists
* Antibiotic Resistance
* Virulence Factors
* MetaCyc
* Pfam
* EnzymeCommission
* CAZy
* GO Terms
* CHAMP-Taxa
* Gut-Metaboloic Module
* Gut-Brain Module
* KEGG Terms
* KEGG Ontology
* FASTQ
### Filtered versus total results
You are able to view both filtered and unfiltered (total) results for your sample. Filtered results contain the calls that have met the threshold for high confidence that the organism called is in the sample. Unfiltered results contain additional calls that are below the filtering threshold and may need further validation to determine if they are truly present in the sample.

### When to use filtered results
You would typically use filtered results when you are looking at data where you want high confidence in your calls, like when working with clinical data. Many people use unfiltered (total) results when looking at environmental samples where there may be organisms whose genomes are more novel or diverge from most reference genomes.
### How filtering works
The filtering threshold which determines if results are considered significant is based on internal statistical scores determined by analyzing a large number of diverse metagenomes. Organisms listed in the filtered results are likely to be present in the sample. Unfiltered (total) results include those in the filtered results and usually additional organisms. Organisms listed in the unfiltered (total) results but not in the filtered results need further validation to determine if they are actually present in the sample - either by deeper sequencing of the sample followed by re-analysis or by orthogonal validation using targeted PCR or other methods.
### Taxonomy Switcher
The taxonomy switcher button allows you to select the taxonomic level results to view for both the sample dashboard table and the sample visualizations.

### Sample and Visualization Export

You can download your results as tab-separated files (which can be opened in Excel) or as PDFs. Click on "Export" and select the type of file you would like to download. Download should begin immediately. To download visualizations, navigate to the one of interest and click Export.
# Running Data Workflows
Source: https://docs.cosmosid.com/docs/workflows
This page describes each of the workflows available in the Cosmos-Hub.
> [!TIP]
>
> The Cosmos-Hub accepts raw sequencing data produced by Illumina, MGI, Element, Oxford Nanopore, PacBio technologies.
# Cosmos-Hub Bioinformatic Pipelines
Select from the options of pipelines available for shotgun metagenomics, short-read 16S, short-read ITS, and Long-read Amplicon:
> [accordion] CHAMP™ | Human Microbiome Profiler
>
> Tailored for human-associated microbiome analysis with a proprietary phylogenetic marker-based algorithm to minimize false positives/negatives.
>
> Provides multi-kingdom taxonomic profiling informed from real-world human microbiome data, along with functional modules like Gut-Brain/Gut-Metabolic Modules and KEGG pathway outputs.
>
> Pita et al. [**CHAMP delivers accurate taxonomic profiles of the prokaryotes, eukaryotes, and bacteriophages in the human microbiome**](https://doi.org/10.3389/fmicb.2024.1425489). Frontiers in Microbiology, 2024.
> [accordion] Kepler™ | Host-Agnostic Microbiome Profiler
>
> Suitable for any sample type, including environmental, agricultural, and animal microbiomes. Using a high-precision k-mer-based identification approach, Kepler supports taxonomic profiling across bacteria, fungi, viruses, and protists, leveraging a database of 150,000 genomes and genes encompassing >30,000 species.
>
> Read our whitepaper here: [Kepler Benchmarking Whitepaper](https://hubs.ly/Q03cpmlN0)
> [accordion] Functional | Host-Agnostic Functional Profiling
>
> Employs an optimized humann3 framework, which can be used for metagenomic and metatranscriptomic data.
>
> Outputs include functional annotations from [MetaCyc](https://metacyc.org/), [GeneOntology (GO)](https://geneontology.org/), [Pfam](http://pfam.xfam.org/), [CAZy](https://www.cazy.org/), and [EnzymeCommission](https://enzyme.expasy.org/) databases, enabling comprehensive functional analyses across diverse microbial environments.
> [accordion] Kepler AMR/VF | Resistome and Virulome Profiler
>
> Characterize antimicrobial resistance genes and virulence factors with trusted databases like ResFinder and VFDB.
> [accordion] EMU | Long-Read Amplicon Profiling
>
> Profile long-read 16S/18S/ITS data generated by PacBio or Oxford Nanopore using our customizable EMU pipeline with multi-database support
> [accordion] DADA2 | 16S rRNA ASV Pipeline
>
> High-resolution bacterial community profiling using the DADA2 ASV algorithm and the SILVA 138 database, providing both taxonomic and predicted functional insights.
> [accordion] QIIME | 16S rRNA OTU Pipeline
>
> Utilizes the QIIME2 framework for clustering sequences based on 97% similarity threshold into Operational Taxonomic Units (OTUs) for taxonomic identification based on the SILVA v138 Database.
> [accordion] QIIME | ITS OTU Pipeline
>
> Focuses on fungal communities using Internal Transcribed Spacer (ITS) sequencing with the UNITE database for accurate classification.
> [accordion] Comparative Analysis Visualization & Reporting Module
>
> Integrates alpha/beta diversity analyses, differential abundance analyses, and configurable visualizations such as heatmaps, stacked bar charts, PCA, and more, enabling user-friendly interpretation and publication-ready results.
## How to Rerun Samples
From the main dashboard, select your sample(s) and press "Run More" in the upper right-hand corner. You will have the option to choose any remaining workflows that have not already been run.
> [!WARNING]
>
> **Any raw data after 14 days from upload will be archived in cold storage**
>
> New workflows can be run on any samples, but the raw data files required for new workflows will be archived 14 days after the initial upload date. If you are trying to run new workflows on files older than 14 days, please request a data unarchiving and new workflow request by emailing the name of your samples/folders to [help@cosmos-hub.com](mailto:help@cosmos-hub.com).
>
> Credits are required to run new workflows on all samples.
# The Study Dashboard
Source: https://docs.cosmosid.com/untitled-page
How to navigate all resources and tools inside a study: Analysis Projects, Data Tables, sample metadata, files and running jobs.
Opening a Study leads to the Study Dashboard. The Study Dashboard gives access to the Analysis Projects, the Feature Data Tables and sample metadata, the Study storage drive, and the status of the analyses and data imports running in the Study.
## Analysis Projects

This section lists all Analysis Projects (AP) that have been created for the current study. Each Study (your research project) can hold any number of Analysis Projects, usually one for each relevant research question you want to answer with the data you have. Click **Open** to enter the Analysis Studio of an AP.
To learn more, visit [Analysis Projects (AP)](https://docs.cosmosid.com/DAP_docs/analysis-project-AP).
## Data Tables
This section lists the Data Tables available in the current Study, including every Data Table imported into it. Each Study can hold any number of Data Tables.

A Data Table describes the feature profile of a set of microbiome samples, reporting the abundance of each feature in each sample.A feature is the biological unit quantified by the profile: a microbial species in a taxonomic profile, a GO term or enzyme class in a functional profile, or a metabolite in a metabolomics profile. You can picture it as a matrix with the samples along one side, the features along the other, and feature abundance values (e.g: relative abundances, counts, presence/absence) in the cells.

How a Taxonomic Data Table of CHAMP profiles looks like
Data Tables imported into a Study are also added to the Workspace data lake, from which the Query Builder selects samples to build cohorts. (visit [Importing Data Into a Study](https://docs.cosmosid.com/DAP_docs/importing-data-in-studies))
## Metadata \[*in active development*]

A metadata table holds the descriptive information about each sample in a Study. Each row is a sample and each column is a variable, such as the body site sampled, the subject’s age group or the collection site. The metadata table is mapped to the Data Tables through the sample IDs.
| Sample ID | Subject ID | Body site | Timepoint | Collection site |
| - | - | - | - | - |
| SRR13774420 | P01 | Gut | 1 | Site A |
| SRR13774422 | P01 | Gut | 2 | Site A |
| SRR13774423 | P02 | Skin | 1 | Site B |
| SRR13774426 | P03 | Skin | 1 | Site B |
> [!NOTE]
>
> Samples imported from a Cosmos-Hub account bring their sample metadata with them. The metadata is not displayed in the interface yet, but it is stored together with the imported samples.
## File Browser
The File Browser is the storage drive of the Study. Use it for project material that is not a Data Table, for example protocols, lab notes, raw sequencing files, supplementary files and Analysis Project outputs.

## Jobs
Data imports and Analysis Projects can take some time to complete. The Jobs section lists these operations and their progress, so you can check that an import has finished or that an analysis is ready before you open it.

Each row shows the job **Name**, its **Status**, a short **Details** message about the outcome, and the **Started** and **Last Updated** times. You can sort by any column or search for a job by name.
## Next step: bring in your data
> [card] [Importing data into a Study](/importing-data/into-a-study)
>
> The available import routes and how to use each one.
# Filtering Samples by Metadata
Source: https://docs.cosmosid.com/v2-0/documentation/guides/navigating-the-sample-dashboard/filtering-samples-by-metadata
# The Filter Panel enables you to customized your Sample View based on custom metadata fields.
Cosmos-Hub allows you to filter your dashboard view on the Samples menu by using your uploaded custom metadata fields.
> [!NOTE]
>
> Metadata filters are global across all samples and datasets. To limit the filters to a particular dataset or folder, use the "Folder Path" filter.

#
# Troubleshooting Common Metadata Upload Errors
Source: https://docs.cosmosid.com/v2-0/documentation/technical-appendix/technical-appendix/metadata-errors
**If you encounter errors during metadata upload, please check for the following issues:**
* **Duplicate Column Names:** All column headers must be unique. For example, do not include the same field (such as "Visit Date") more than once. Duplicate headers will block uploads.
* **Datetime Format Requirements:** Date fields must use ISO 8601 format (`YYYY-MM-DD`), unless otherwise specified. Spreadsheet editors (like Excel) often auto-format dates; double-check and reformat as needed. For best results, use Numbers or CSV tools that preserve formatting.
* **Character Limits:** Text field values must not exceed 32 characters.
* **No Special Characters or Spaces in Field Labels:** For custom fields, avoid all special characters and spaces in labels.
* **File Encoding:** Save your metadata as UTF-8 encoded CSV to prevent issues with hidden or non-printable characters.
## Error messages reference
Below are the specific error messages you may encounter and how to resolve them:
### Label and uniqueness errors
| Error | Resolution |
| :- | :- |
| **Duplicate label detected:** "label" conflicts with an existing metadata label. | Rename the label so all metadata labels are unique. |
| **Missing metadata label:** Each metadata field must have a label name. | Add a Metadata label and try again. |
| **Invalid label:** "label" cannot be empty or contain only spaces. | Enter a meaningful metadata label. |
### System metadata errors
| Error | Resolution |
| :- | :- |
| **System metadata is read-only:** "label" cannot be edited. | Revert it to its original value. System metadata fields are protected and cannot be modified. |
### Metadata type errors
| Error | Resolution |
| :- | :- |
| **Metadata type mismatch:** "label" expects type X, but the uploaded value is Y. | Update the values or change the metadata label type to match. |
| **Missing metadata type:** Each metadata field must specify a type (e.g., text, decimal, datetime). | Define the type and try again. |
### Template integrity errors
| Error | Resolution |
| :- | :- |
| **Template error detected:** The metadata template appears to be corrupted or modified incorrectly. | Download a fresh template and re-enter your metadata. |
| **Invalid template format:** This file does not match the required Cosmos-Hub metadata template. | Download the latest template and upload it without modifying its structure. |
### Numeric value errors
| Error | Resolution |
| :- | :- |
| **Invalid Values:** "label" must contain a numeric value. | Remove non-numeric characters and try again. |
| **Invalid number format:** "label" expects a numeric value, but received "input". | Enter a valid number (e.g., 3, 3.14). |
### Date value errors
| Error | Resolution |
| :- | :- |
| **Invalid date:** "label" must be a valid date. | Use one of the supported date formats. |
| **Invalid date format:** "label" must be a valid date using a supported format. | Use ISO 8601 format (`YYYY-MM-DD`) or another supported format. |
### Sample matching errors
| Error | Resolution |
| :- | :- |
| **No matching samples found:** The sample IDs in your metadata file do not match any of the selected samples. | Verify that sample names are spelled correctly and match existing sample IDs exactly. |
If you have followed all of the above and continue to have issues, please contact support with your metadata file attached for further assistance.
# ML Classification on Cosmos-Hub 2.0
Source: https://docs.cosmosid.com/DAP_docs/ml-classification
Once you have built and trained an ML classification model, Cosmos-Hub 2.0 provides ways to evaluate its predictive performance and find which microbial features contributed mostly to the prediction.
# Module output and interpretation
The classification module produces four types of plots:
* **Feature importance barplot:** which microbial features the model relied on most to make its predictions.
* **Confusion Matrix:** for each real group, how often the model predicted the right group and which wrong groups it confused it with.
* **ROC curve:** how well the model separates one group from another across all decision cut-offs.
* **Precision-Recall Curve:** how well the model identifies the group of interest, the more informative view when that group is rare.
## Feature importance

Top microbial features ranked by their contribution to the best-performing model's predictions. Longer bars mean higher relative importance within this run. Importance is for ranking, not effect size, direction, or causality.
This plot answers *"which microbial features helped the model predict?"* Each bar is one feature used by the best-performing model, ranked from most to least important; longer bars indicate a stronger influence on predictions. The number shown is set by [Top features (N)](#top-features-n).
Feature importance is informative only once the model is shown to predict well. When it does, the features it relied on point to the drivers of the classes, and give candidates for validation or follow-up.
A high importance means the feature was useful for prediction. It does not say whether the feature is higher or lower in a given group, how large its effect is, or that it causes the outcome. To read direction and magnitude, inspect the taxa abundance across groups separately.
### Why is this plot useful?
* **Identifies the features driving predictions:** ranks taxa or functions by their contribution, reducing thousands of features to the few most relevant to the target, for validation or follow-up.
* **Supports interpretability:** explains the *basis* of the model's predictions, not just its accuracy.
* **Highlights candidate features for hypotheses:** flags the features most associated with the target as starting points for investigation.
> [!WARNING]
>
> Importance scores are model-specific:\
> Different models (random forest, gradient boosting, linear, permutation-based) compute importance with different criteria, so compare scores **within the same model and run**, never across model types. A feature ranked highly by one model may rank differently in another.
> [!WARNING]
>
> **Check Model Performance before interpreting Feature Importance**
>
> A high Feature Importance value means the fitted model relied on that feature for making predictions, but it doesn't imply how well it made those predictions. A model performing near chance will still assign high importance to some features. First, confirm the classification model is predictive by checking the ROC AUC, PR AUC, and confusion matrix. Then use feature importance to understand which features drove that prediction.
>
> Performance metrics and feature importance are computed on two different things:
>
> * **Performance metrics** refer to cross-validated, out-of-fold predictions.
> * **Feature importance** values refer to the features that contributed most to the best model—the one with optimized hyperparameters—after it is refit on the full dataset.
## Confusion Matrix

Confusion matrix for a binary classifier predicting healthy vs. disease status, with values normalized by true class. The model correctly identifies 90% of healthy cases and 80% of disease cases (true positive rate/recall). It misclassifies 10% of healthy patients as diseased (false positives) and, more critically, misses 20% of actual disease cases (false negatives), the error with the highest clinical cost in this setting.
After training a machine-learning classifier, we need to check how well it performs on labelled data that was not used to train the model. The model's predictions are compared with the known class of each sample, and the results are summarized in a **confusion matrix**.
In a confusion matrix, each row represents the true class and each column represents the class predicted by the model. Reading across a row shows how samples from that true class were classified. Correct predictions appear on the diagonal, from the top-left to the bottom-right. Values outside the diagonal represent classification errors.
In the example above, the model predicts disease status from microbial profiles. Diseased samples are treated as the **positive class**, while healthy samples are treated as the **negative class**. This is only a naming convention, but it defines the four possible outcomes:
* **True negative** (top-left, 0.90): a healthy sample correctly predicted as healthy.
* **False positive** (top-right, 0.10): a healthy sample incorrectly predicted as diseased, a false alarm.
* **False negative** (bottom-left, 0.20): a diseased sample incorrectly predicted as healthy, a missed case.
* **True positive** (bottom-right, 0.80): a diseased sample correctly predicted as diseased.
Because the values are normalized within each true class, every row sums to 1. The first row therefore means that 90% of healthy samples were correctly classified as healthy, while 10% were classified as diseased. The second row means that 80% of diseased samples were correctly identified, while 20% were missed.
This distinction matters because false positives and false negatives may have very different consequences. In a clinical screening setting, for example, missing a diseased sample may be more serious than flagging a healthy sample for further testing. The confusion matrix makes both types of error visible, helping you judge whether the model's performance is appropriate for the intended use.
> [!NOTE]
>
> **How the confusion matrix values are calculated**
>
> The confusion matrix is based on **out-of-fold predictions from stratified k-fold cross-validation**. In each fold, the model is trained on the other folds and used to predict the class of the held-out samples. This means that every sample receives one prediction from a model that was not trained on that sample.
>
> The predicted labels are then compared with the true labels to count how often samples from each true class were assigned to each predicted class.
>
> By default, the matrix is normalized by true class (`normalize="true"`), so each cell is calculated as:
>
> $$
> \text{Matrix value}_{i,j} = \frac{\text{samples truly in class } i \text{ predicted as class } j}{\text{all samples truly in class } i}
> $$
>
> Each row therefore sums to `1`. For example, a value of `0.20` means that 20% of the samples belonging to that row's true class were assigned to the corresponding predicted class.
**Why it's useful**
* **Exposes per-class performance:** shows whether the model handles both classes well or leans toward one, which a single accuracy score cannot reveal.
* **Separates the two error types:** distinguishes false positives from false negatives, so you can weigh them against the real-world cost of each in your study.
* **Grounds the other metrics:** the ROC and precision-recall curves below are derived from these same outcomes, so the matrix is the plain-numbers view that makes them easier to interpret.
## Receiver Operating Characteristic (ROC) Curve

ROC curve for a binary classifier on an imbalanced dataset (10% positive class), plotting true positive rate against false positive rate across thresholds. AUC is 0.72, well above the 0.50 chance line. Despite this solid-looking AUC, precision remains low in practice (see the companion PR curve), since ROC can overstate performance when positives are rare.
### What does the ROC curve represent about the ML classifier?
A ROC curve measures how well a classifier separates two (for example healthy vs disease, male vs female) or more classes (for example different disease stages, body sites, ethnicity) of your **Target Variable**.
When a classifier predicts the target, it does not return a fixed label. It assigns each sample a probability of belonging to the positive class (for example, 0.80 for disease and 0.20 for healthy), and a threshold converts that probability into a label: above the threshold the sample is called positive, below it negative.
Where the threshold is set changes the prediction, and it trades off two kinds of error:
* A **low threshold** labels more samples positive. It catches more **true positives** (real disease cases correctly flagged) but also produces more **false positives** (healthy samples wrongly flagged).
* A **high threshold** does the opposite: fewer false positives, but some real cases are missed.
Which error matters more depends on the application. A screening test may tolerate more false positives to avoid missing cases, while a test that triggers an invasive follow-up may keep false positives low.
The ROC curve displays this trade-off across all possible threshold values. It plots the **true positive rate** (the fraction of actual positives correctly identified) against the **false positive rate** (the fraction of actual negatives wrongly flagged). Each point on the blue curve (1) corresponds to one threshold.
#### Area under the curve (AUC)
The **area under the curve (AUC)** is a single value that summarizes the whole ROC curve, between 0 and 1. It can be read as the probability that the model assigns a higher positive-class score to a randomly chosen positive sample than to a randomly chosen negative one. An AUC of 0.85, for example, means that in about 85% of positive-negative sample pairs the positive sample is ranked higher.
The shape of the curve reflects the same thing:
* **Good classifier**: the ROC bends sharply toward the top-left corner, reaching a high true positive rate while the false positive rate is still low. Its AUC approaches `1.0`.
* **Bad classifier**: when the ROC curve is close to the diagonal, the AUC approaches `0.50`. As the threshold moves, the two rates rise together and the model separates the classes no better than chance.
> [!WARNING]
>
> **Too good to be true**
>
> An AUC close to `1.0` on microbiome data means the microbial profiles separate the classes almost perfectly. Near-perfect separation is uncommon in microbiome studies, so it should prompt a check for technical confounders, such as batch effects, differences in sequencing depth between groups, or leakage between the training and test sets, before it is interpreted as biology. Known background factors can be adjusted for with [Covariates](/analysis/machine-learning/training-an-ml-model#correct-for-confounding-variables-covariates).
> [!WARNING]
>
> **Why ROC can look good on imbalanced data**
>
> When the positive class is rare, a model can reach a high ROC AUC while still flagging many negatives for each true positive it finds, so precision can stay low. For example, in a cohort of 100 samples with only 10 diseased, a model might correctly flag 9 of the 10 cases but also wrongly flag 18 of the 90 healthy samples. The false positive rate stays low (18 of 90 = 20%), so the ROC curve still looks strong. Yet of the 27 samples flagged as diseased, only 9 are truly positive, a precision of just 33%.
>
> The precision-recall curve, described next, makes this visible.
### Why is this plot useful?
* It evaluates the classifier across every threshold at once, which measures how well the model ranks samples without committing to a specific cut-off.
* It provides a single comparable number, the AUC, for ranking different models trained on the same data.
* It shows the trade-off directly, making it possible to read the false positive rate incurred to reach a given recall.
## Precision-Recall (PR) Curve

Precision-recall curve for the same classifier and imbalanced dataset (10% positive class) as the ROC curve above, plotting precision against recall across thresholds. The dashed line marks the 0.10 baseline set by the positive class prevalence, the precision a no-skill model would reach. Read the PR AUC against this baseline, not against 0.50.
### What does the PR curve represent about the ML classifier?
Like the [ROC curve](#receiver-operating-characteristic-roc-curve), the PR curve summarizes performance across all probability thresholds.
Instead of the true and false positive rates, the axes represent **Precision** (y-axis) and **Recall (x-axis)**, two measures that emphasize the model predictive performances on the positive class:
> [card] Precision
>
> Of the samples the model predicts positive, the fraction that are truly positive. When the model calls a sample diseased, how often is it right?
>
> $$
> \text{Precision} = \frac{TP}{TP + FP}
> $$
> [card] Recall
>
> Of the actual positive samples, the fraction the model correctly identifies. Of all the real disease cases, how many did the model find?
>
> $$
> \text{Recall} = \frac{TP}{TP + FN}
> $$
Precision and recall trade off against each other. Lowering the threshold labels more samples positive, which raises recall but usually lowers precision, since more of the flagged samples turn out to be false positives. Raising the threshold does the opposite. The PR curve in blue displays this trade-off.
#### PR AUC (Average Precision)
Similarly to the AUC, also the PR curve is summarized as a single number between 0 and 1: the area under the curve, or **PR AUC**. On Cosmos-Hub 2.0 this is computed as the **Average Precision (AP)**, the mean precision across thresholds weighted by the gain in recall at each step, rather than by geometric integration of the curve.
The shape of the curve reflects the same thing:
* A **good** classifier keeps precision high as recall increases, so the curve stays near the top and bends toward the top-right corner. Its PR AUC approaches `1.0`.
* A **poor** classifier loses precision quickly as recall rises, so the curve drops toward the baseline. Its PR AUC approaches the baseline value.
> [!WARNING]
>
> **Read PR AUC against the class prevalence, not 0.50.** Unlike the ROC diagonal, which always sits at `0.50`, the 'no-skill' baseline of a PR curve equals the prevalence of the positive class, the fraction of samples that are positive.
>
> For a dataset with 10% positives, the baseline is `0.10` (the dashed line) so a PR AUC near `0.10` means no skill and only values well above it indicate real signal. This is why the PR curve is more informative than the ROC curve when the positive class is rare.
### Why is this plot useful?
* It focuses on the positive class, so it reflects performance where positives are rare and the ROC curve can look overly optimistic.
* It shows the precision you can expect at a given recall, which maps directly to a decision: how many flagged positives are real if you want to catch a given fraction of the cases.
* It provides a single comparable number, the PR AUC, for ranking models trained on the same data, read relative to the class prevalence.
> [!NOTE]
>
> **Under the hood: how the ROC and PR curves are calculated on Cosmos-Hub 2.0**
>
> Both the ROC and the PR curves are based on **out-of-fold predicted probabilities from stratified k-fold cross-validation**.
>
> In each fold, the model is trained on the other folds and estimates class probabilities for the held-out samples. Every sample therefore receives one probability estimate from a model that was not trained on that sample.
>
> For **binary classification** (eg.: healthy vs diseased), each curve is traced by sweeping a threshold across the positive-class probabilities and recording the relevant pair of metrics at each step: the true positive rate and false positive rate for the ROC curve, and precision and recall for the PR curve. The ROC AUC is computed from these points, and the PR AUC as the Average Precision (the recall-weighted mean of precision).
>
> For multiclass classification (e.g: Stage I vs Stage II vs Stage III), the same calculation is performed one-vs-rest for each class, treating one class as positive and all others as negative in turn.
## Exporting the results
Exporting the ML Classification module output downloads all plots, ML performance summary tables, and the input/output metadata and data tables for the analyzed cohort.
#### Machine Learning Module Results (ml\_results.csv)
### `ml_results.csv`
Cross-validated performance metrics for the selected classification model. Metrics are calculated from out-of-fold predictions, so each sample is evaluated by a model that was not trained on that sample.
| Column | Description |
| :- | :- |
| `accuracy` | Proportion of samples assigned to the correct class. Higher is better. |
| `precision` | Weighted-average proportion of predicted class assignments that are correct. Higher values mean fewer false positives. |
| `recall` | Weighted-average proportion of true class members correctly identified. Higher values mean fewer false negatives. |
| `f1_score` | Weighted average of the balance between precision and recall. Higher is better. |
| `support` | Total number of samples evaluated. |
| `roc_auc` | Area under the ROC curve: how well the model distinguishes the true class from other classes across thresholds. Higher is better; `1` is perfect and `0.5` is random ranking. |
| `pr_auc` | Area under the precision–recall curve. Higher values indicate a better balance between precision and recall across thresholds. |
| `macro_auc` | Average ROC AUC across classes, giving every class equal weight. |
| `micro_auc` | ROC AUC calculated across all samples and classes together, giving more weight to common classes. |
| `classification_report` | Per-class precision, recall, F1 score, and support, plus macro and weighted averages. |
#### Feature Importance (ml\_feature\_importance.csv)
Ranked list of the input features that contributed to predictions made by the selected regression model. Each row represents one feature, ordered from highest to lowest importance.
### Input and processed data
The module also exports the run parameters and the data tables used, so a run can be reproduced or audited:
| File | Contents |
| :- | :- |
| `parameters.txt` | The parameter settings used for the run. |
| `input_features.csv` | The feature table before pre-processing. |
| `input_metadata.csv` | The sample metadata before pre-processing. |
| `transformed_features.csv` | The feature table after pre-processing, as used for training. |
| `transformed_metadata.csv` | The sample metadata after pre-processing. |
# ML Regression on Cosmos-Hub 2.0
Source: https://docs.cosmosid.com/DAP_docs/ml-regression
Once you have built and trained an ML regression model, Cosmos-Hub 2.0 provides ways to evaluate its predictive performance and find which microbial features contributed mostly to the prediction.
# Module output and interpretation
The regression module produces five plots, four that measure how well the model predicts and one that reports which features it used.
* **Feature importance barplot:** which microbial features the model relied on most to make its predictions.
* **Prediction plot:** how close the predicted values are to the true values overall.
* **Residual plot:** where the model's errors fall, and whether they depend on the predicted value.
* **Relative error plot:** whether errors are proportionally larger at low or high true values.
* **Q-Q plot of residuals:** whether the errors follow the expected pattern, or whether some samples are predicted far worse than others.
Read the prediction plot and the diagnostic plots first (the prediction plot, then the residual, relative error, and Q-Q plots) to confirm the model predicts well, and read the feature importance last.
## Feature importance

Top microbial features ranked by their contribution to the best-performing model's predictions. Longer bars mean higher relative importance within this run. Importance is for ranking, not effect size, direction, or causality.
This plot answers *"which microbial features helped the model predict the target?"* Each bar is one feature used by the best-performing model, ranked from most to least important; longer bars indicate a stronger influence on predictions.
To decide how many features should be displayed, in decreasing order of feature importance set [Top features (N)](#top-features-n) parameter.
A high importance means the feature was useful for prediction. It does not say whether higher abundance pushes the predicted value up or down, how large the effect is, or that the feature causes the outcome. To read direction and magnitude, plot the feature's abundance against the target separately.
Feature importance is informative only once the model is shown to predict well. When it does, the top features are the taxa or functions whose abundance best tracked the target value, and they give candidates for validation or follow-up. In the example above, predicting age, the top features are skin-associated taxa such as *Staphylococcus*, *Cutibacterium acnes*, and *Malassezia*, consistent with a skin microbiome dataset.
### Why is this plot useful?
* **Identifies the features driving predictions:** ranks taxa or functions by their contribution, reducing thousands of features to the few most relevant to the target, for validation or follow-up.
* **Supports interpretability:** explains the *basis* of the model's predictions, not just its accuracy.
* **Highlights candidate features for hypotheses:** flags the features most associated with the target as starting points for investigation.
> [!WARNING]
>
> Importance scores are model-specific:\
> \
> Different models (random forest, gradient boosting, linear, permutation-based) compute importance with different criteria, so compare scores **within the same model and run**, never across model types. A feature ranked highly by one model may rank differently in another.
> [!WARNING]
>
> **Check performance before reading importance:**
>
> A high importance means the fitted model relied on that feature, not that the model predicts well. A model performing near chance still assigns high importance to some features. Confirm the model is predictive first, using the prediction plot and the residual diagnostics, then use feature importance to understand which features drove that prediction.
>
> The two are computed on different objects: the performance is measured from cross-validated out-of-fold predictions, while importance is computed after the selected model is refit on the full dataset. Importance therefore describes the final model, not its held-out generalization, which is another reason to read it together with the diagnostic plots rather than on its own.
## Prediction plot

Prediction plot for a model predicting age (age\_decimal). Each point is a sample, with the true value on the x-axis and the model's predicted value on the y-axis; the dashed red line marks perfect prediction. In this example the points form a shallower slope than the line: low ages are over-predicted and high ages under-predicted, so the model pulls its predictions toward the middle of the range.
The prediction plot is the first check of how well the model predicts. Each point is a sample: the x-axis is its true value and the y-axis the value the model predicted. The dashed red line is perfect prediction, where predicted equals true.
* Points **on** the line were predicted exactly.
* Points **above** the line were over-predicted; points **below** were under-predicted.
The tighter the points cluster around the line, the more accurate the model. A common pattern, visible in the example above, is that the points form a shallower slope than the line: low true values are over-predicted and high true values are under-predicted. This means the model pulls its predictions toward the average, a sign it captures only part of the signal.
The exact error metrics that quantify this scatter, mean squared error (MSE), mean absolute error (MAE), and the coefficient of determination (R²), are reported in the exported results file (see [Exporting the results](#exporting-the-results)).
### Why is this plot useful?
* **Gives an immediate sense of accuracy:** shows how far, and in which direction, predictions fall from the truth.
* **Reveals systematic bias:** for example predictions pulled toward the mean, or a consistent over- or under-prediction.
* **Shows where the model works:** the range of the target it predicts well versus poorly.
## Residual plot

Residual plot for the age model. Each point is a sample: the x-axis is the predicted value and the y-axis the residual (true minus predicted), with the dashed line at zero marking perfect prediction. Point colour shows the relative residual (the error as a fraction of the true value), and the boxplot on the right summarizes the spread of residuals.
The residual plot shows where the model's errors fall. The x-axis is the value the model predicted, and the y-axis is the **residual**, the true value minus the predicted value. The dashed line at zero marks perfect prediction.
* Points **above** the line have a positive residual: the model **under-predicted** them.
* Points **below** the line have a negative residual: the model **over-predicted** them.
Point colour encodes the **relative residual**, the size of the error relative to the true value, so a fixed error counts as larger when the true value is small. The boxplot on the right summarizes the spread of residuals across all samples.
Read it to check that errors are centered on zero with no trend across the range of predicted values, and to spot samples with unusually large errors.
> [!NOTE]
>
> **How the residuals are calculated**
>
> Residuals are computed from **out-of-fold predictions from k-fold cross-validation**: each sample's predicted value comes from a model that was not trained on that sample. The residual is the true value minus this predicted value. The prediction, relative error, and Q-Q plots are built from the same out-of-fold predictions.
### Why is this plot useful?
* **Shows whether errors are unbiased:** if the points scatter evenly around zero, the model is not systematically over- or under-predicting.
* **Reveals range-dependent accuracy:** a trend across the x-axis means the model is more accurate for some predicted values than others.
* **Flags individual samples:** points far from the line, or coloured for a high relative residual, are candidates to inspect separately.
## Relative error plot

Relative error plot for the age model. The x-axis is the true value and the y-axis the relative residual, so each error is expressed as a fraction of the true value. In this example, low ages carry large negative relative residuals (strong over-prediction) and high ages positive ones (under-prediction), the magnitude bias expected when a model pulls predictions toward the mean.
The relative error plot shows the same errors as a fraction of the true value, rather than in absolute units. The x-axis is the true value; the y-axis is the **relative residual**, `1 − predicted / true`, which equals the residual divided by the true value.
This matters because a fixed error means different things at different scales: being off by 2 years is minor at age 45 but large at age 5. The relative error plot makes this scale-dependence explicit.
* A **positive** relative residual means the sample was under-predicted; a **negative** one means it was over-predicted.
* A trend across the x-axis reveals **magnitude bias**. In the example, low true values carry large negative relative residuals (over-prediction) and high true values positive ones (under-prediction), so the largest relative errors sit at the low end of the range.
### Why is this plot useful?
* **Puts errors on a comparable scale:** a 2-unit error is judged relative to the true value, not in absolute terms.
* **Exposes bias at the extremes:** shows whether the model is proportionally worse for small or large targets.
* **Complements the residual plot:** the residual plot shows absolute error, this one shows error relative to size.
## Q-Q plot of residuals

Q-Q plot of the residuals for the age model. Sample residual quantiles (y-axis) are plotted against the quantiles expected from a normal distribution (x-axis), with the red reference line for perfectly normal residuals. The points track the line closely, indicating the residuals are approximately normal.
The Q–Q (quantile–quantile) plot compares the distribution of the model's residuals with a normal distribution.
Use it as a diagnostic for the **shape of the error distribution**. Points close to the reference line indicate that residuals are approximately symmetric and normally distributed. Departures from the line can reveal skewed errors, heavy tails, or individual samples with unusually large prediction errors.

The four patterns a residual Q-Q plot can show.
| Pattern | What it means |
| :- | :- |
| **Points on the line** | Residuals follow the expected pattern: errors are balanced, with no strong outliers or skew. |
| **Curve / S-shape** | Residuals deviate systematically: errors are skewed, or the model performs differently across the range of target values. |
| **Heavy tails** | Points sit near the line in the centre but far from it at the ends. Most predictions behave normally, but some samples have larger errors than expected. |
| **Isolated point** | One point sits far from the line: a sample with an unusually large error, worth checking separately. |
Use these patterns to flag poorly predicted samples, spot biological outliers, and decide whether the model or the data needs revisiting.
## Exporting the results
Exporting the ML Classification module output downloads all plots, ML performance summary tables, and the input/output metadata and data tables for the analyzed cohort.
#### Machine Learning Module Results (ml\_results.csv)
Cross-validated performance metrics for the selected regression model.
Each metric is calculated from **out-of-fold predictions**: every sample is predicted by a model that was not trained on that sample. This provides a more realistic estimate of how the model may perform on new data.
| Performance indicator | Description |
| :- | :- |
| **Mean squared error (MSE)** | The average squared difference between predicted and observed target values. Lower values indicate better predictive accuracy. Squaring gives greater influence to large errors, making MSE particularly sensitive to poorly predicted samples. MSE is expressed in squared target units and is most suitable for comparing models evaluated on the same target. |
| **Mean absolute error (MAE)** | The average absolute difference between predicted and observed target values. Lower values indicate better predictive accuracy. MAE is expressed in the original units of the target, so it represents the typical size of a prediction error. |
| **Coefficient of determination (R²)** | The proportion of variation in the observed target values explained by the model’s predictions, relative to predicting the mean target value for every sample. Higher values indicate better predictive performance. An R² of `1` indicates perfect prediction, `0` indicates no improvement over the mean-prediction baseline, and negative values indicate worse performance than that baseline. |
#### Feature Importance (ml\_feature\_importance.csv)
Ranked list of the input features that contributed to predictions made by the selected regression model. Each row represents one feature, ordered from highest to lowest importance.