> For the complete documentation index, see [llms.txt](https://www.microbiomestat.wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.microbiomestat.wiki/setting-up-microbiomestat-installation-and-data-preparation/laying-the-foundation-creating-the-microbiomestat-data-object/incorporating-deseqdataset-into-microbiomestat.md).

# Converting DESeqDataSet into MicrobiomeStat

This guide provides the recipe for converting the DESeqDataSet format to MicrobiomeStat format.

To begin, let's inspect the initial structure of our DESeqDataSet data:

<figure><img src="/files/sAYk2GDZYIbo9WJhx1Ur" alt=""><figcaption><p>Initial structure of the DESeqDataSet data.</p></figcaption></figure>

Proceed with the steps below to conduct the conversion:

```r
# Example Code (replace with your real dataset!)
# Load necessary packages
 library(airway)
 library(DESeq2)

# Load dataset
 data("airway")
 dds <- DESeqDataSet(airway, design = ~ cell + dex)

# Convert DESeqDataSet to MicrobiomeStat data object
 data.obj <- mStat_convert_DESeqDataSet_to_data_obj(dds)
```

Upon conversion, the data structure will be transformed as follows:

<figure><img src="/files/GBwZfaVk4hYbjrvUKyot" alt=""><figcaption><p>Structure of the MicrobiomeStat data object after importing DESeqDataSet data.</p></figcaption></figure>

The `mStat_convert_DESeqDataSet_to_data_obj` function facilitates the transition:

* **dds.obj**: The DESeqDataSet object slated for conversion.

After the conversion, the **MicrobiomeStat data object** consists of:

* **feature.tab**: A matrix containing count data.
* **meta.dat**: A data frame detailing the sample information.
* **feature.ann**: A matrix presenting feature annotations.

For data integrity and relevance, the function ensures only features with a sum > 0 from the counts data are retained.
