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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.microbiomestat.wiki/setting-up-microbiomestat-installation-and-data-preparation/laying-the-foundation-creating-the-microbiomestat-data-object/incorporating-deseqdataset-into-microbiomestat.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
