# Importing Data from BIOM into MicrobiomeStat

Follow the instructions below to convert your BIOM data into a format suitable for MicrobiomeStat.

{% file src="/files/NPcN1gJ5lkm1STQUF9Gk" %}
BIOM file containing biological observation matrix and associated metadata.
{% endfile %}

{% file src="/files/7l4CyPkzQtmyHzbdXoRa" %}
Phylogenetic tree file representing evolutionary relationships among observed species.
{% endfile %}

{% code fullWidth="true" %}

```r
# Example code

# Specify the path to your BIOM data. Replace the placeholder with the correct path on your system.
rich_dense_biom <- "rich_dense_otu_table.biom"
# Reminder: Ensure that you replace the above path with the actual location of your BIOM file.

# Specify the path to your phylogenetic tree. Again, replace the placeholder with the correct path on your system.
treefilename <- "biom-tree.phy"
# Reminder: Ensure that you replace the above path with the actual location of your phylogenetic tree file.

# Convert the BIOM data and associated phylogenetic tree (if provided) 
# into a format suitable for MicrobiomeStat using the mStat_import_biom_as_data_obj function.
data.obj <- mStat_import_biom_as_data_obj(BIOMfilename = rich_dense_biom, treefilename = treefilename)

# The resulting 'data.obj' is now a MicrobiomeStat data object that you can use for further analyses.
```

{% endcode %}

<figure><img src="/files/U1RoobP855fdXTIoaPBt" alt=""><figcaption><p>Structure of the MicrobiomeStat data object created from BIOM data.</p></figcaption></figure>

By employing the `mStat_import_biom_as_data_obj` function, the BIOM data, along with optional phylogenetic tree data, can be integrated into the MicrobiomeStat framework. Here's a brief overview of the function's parameters:

* **BIOMfilename**: The file path to your BIOM data.
* **treefilename** (Optional): The file path to your phylogenetic tree.
* **parseFunction** (Optional): A user-defined function to interpret the taxonomy from the BIOM file metadata.


---

# 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/transferring-data-from-biom-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.
