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

# 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:** what fraction of the table is zeros?
  * **Rare features:** how many features occur in only a few samples?
</Tip>

Pre-processing is a trade-off:

<Check>
  **Done well:** more robust, easier-to-interpret results.
</Check>

<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).
</Warning>

## 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.\[cite:53]\[cite:71] |
| **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.
