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

# Import custom data

> Import feature tables and sample metadata produced outside Cosmos-Hub into a study, as CSV or TSV files.

Use **Import Custom Data** to bring profiles generated outside Cosmos-Hub into a study, for example a table of taxonomic relative abundances produced by an in-house pipeline. For the other ways to add data to a study, see [Importing data into a study](https://docs.cosmosid.com/DAP_docs/importing-data-in-studies.md).

Each custom import is made of sample metadata and one or more feature tables.

* **Sample metadata** is the table of variables that describe each sample, for example the body site, the age of the participant or the sampling time point.
* A **Feature Table** holds the abundance of each feature across your samples. A feature is the unit that the profile measures, such as a taxon, a gene function or a metabolite.

## Before you start

* [Create](https://docs.cosmosid.com/DAP_docs/studies.md#create-a-new-study) or [join](https://docs.cosmosid.com/DAP_docs/studies.md#access-a-study) the study that will receive the data.
* Save your feature tables as CSV or TSV files.
* Check whether your samples already have metadata in Cosmos-Hub. If they do, you can reuse it instead of uploading a metadata file (step 3).

## Import custom data into a study

**1. Open Import Custom Data**

In the [Study Dashboard](https://docs.cosmosid.com/DAP_docs/study-dashboard.md), click **+ Import Data** to open the import menu, then click **Import Custom Data**.

![Import options of an empty study, with Import Custom Data among the four import routes](https://mintcdn.com/cmbio/ZT3Tn30cNzSqdqeo/images/import-custom-data-entry.png?fit=max\&auto=format\&n=ZT3Tn30cNzSqdqeo\&q=85\&s=4e782dabfcce2e2203ffce66ba51fdea)

**2. Feature table template selection**

![Select Template page with the three available templates](https://mintcdn.com/cmbio/ZT3Tn30cNzSqdqeo/images/import-custom-data-select-template.png?fit=max\&auto=format\&n=ZT3Tn30cNzSqdqeo\&q=85\&s=8bb14cc12839f481c9c54862320abc48)

Choose the template that matches the type of 'omics data you need to upload. Cosmos-Hub 2.0 currently supports three templates, each with its own set of feature tables.

> [tab] Metabolomics (MBS)
>
> The **Metabolomics Study Template (MBS)** covers untargeted and targeted compound analysis, with three feature tables.
>
> * **Untargeted Peak Values**, peak intensities of untargeted compounds, as decimal values or \<LOD (below the limit of detection)
> * **Targeted Peak Values**, peak measurements and quality metrics of targeted compounds
> * **Targeted Counts**, counts and quality metrics of targeted compounds

> [tab] WGS Taxonomy
>
> The **WGS Taxonomy Template** covers taxonomic profiles from shotgun metagenomics, at any rank from domain to strain, with two feature tables.
>
> * **Relative Abundance**, taxonomic profile as relative abundances
> * **Counts**, taxonomic profile as read counts

> [tab] WGS Functional
>
> The **WGS Functional Template** covers functional profiles from shotgun metagenomics, with two feature tables.
>
> * **Relative Abundance**, functional profile as relative abundances
> * **Counts**, functional profile as read counts

**3. Add the sample metadata**

The platform validates the feature tables against the sample metadata, so the metadata must describe every sample that appears in the feature tables. Under **Choose Metadata Source**, select the option that matches what you are importing.

> [card] Upload Metadata File
>
> Use this option when:
>
> * The samples in your Feature Table have no metadata in Cosmos-Hub yet, for example when you import a completely new data table.
> * You add new samples to an existing data table.

> [card] Use Existing System Metadata
>
> Use this option when:
>
> * The samples in your Feature Table already have metadata in Cosmos-Hub through another data table, for example when you add a new 'omics data type for the same samples.

> [tab] Upload Metadata File
>
> 1. Open the **Sample** menu at the top right of the **Metadata** panel and download the metadata template.
>
> 2. Fill in the template with your samples and metadata variables in a spreadsheet editor.
>
> 3. Save the file as CSV or TSV.
>
> 4. Drag the file onto **Drop File Here**, or click **Browse** and select it.
>
> 5. Check that the file has the status **Valid** and that its number of rows matches the number of samples.
>
> > [!NOTE]
> >
> > The metadata file must follow the structure of the metadata template. For instructions on how to fill in the template, see [Uploading Metadata](https://docs.cosmosid.com/docs/metadata-and-cohorts.md). If your file doesn't pass the metadata validation framework, download the import report to find the errors (see **Check the import report** below).
>
> 6. Click **Continue**.
>
>    ![Metadata stage with Upload Metadata File selected and an empty drop area](https://mintcdn.com/cmbio/ZT3Tn30cNzSqdqeo/images/import-custom-data-upload-metadata.png?fit=max\&auto=format\&n=ZT3Tn30cNzSqdqeo\&q=85\&s=ebb68a0fab2c23d10876806ea49ad1f9)
>
> To replace the file, click **Delete** and upload the new one.

> [tab] Use Existing System Metadata
>
> Cosmos-Hub links the new feature tables to the metadata already mapped to those samples. Click **Continue** to move to the next stage.
>
> ![Metadata stage with Use Existing System Metadata selected](https://mintcdn.com/cmbio/ZT3Tn30cNzSqdqeo/images/import-custom-data-existing-metadata.png?fit=max\&auto=format\&n=ZT3Tn30cNzSqdqeo\&q=85\&s=7045a8188eb1d90db3e374c24b720932)

**4. Upload the feature tables**

Upload the feature tables that describe the abundance of each feature across your samples.

To upload a table:

1. Drag the Feature Table file onto **Drop File Here** in the matching panel, or click **Browse** and select it.
2. Under **Import Into**, choose where the data of the file goes. Select **Existing Table** and pick a table from **Select Existing Table** to add the samples to a data table already in the study, or select **Create New Table** and type a name in **Table Name**.

   ![Flow of a feature table upload. Drop the file in its panel, then choose Existing Table or Create New Table under Import Into.](https://mintcdn.com/cmbio/ZT3Tn30cNzSqdqeo/images/import-custom-data-import-into.png?fit=max\&auto=format\&n=ZT3Tn30cNzSqdqeo\&q=85\&s=a545ecdd78fe44fc567f6360fb9cd2b4)

Add the samples to an existing data table when they extend it, for example a second sequencing batch of the same study, profiled with the same method.

> [!TIP]
>
> To see how a feature table must be structured and filled in, download the example file from the **Sample** menu of its panel.

**5. Check the import report**

Click **Download Import Report**, the download icon at the top of the page, to get an HTML summary of the validation of each uploaded file. The report is available as soon as you upload a metadata file.

Check the report before you complete the import. Its summary counts the files with errors and the total number of errors, and its file list gives the validation status of each file. If a file has errors, correct it, remove it with **Delete** and upload the corrected version.

![Download Import Report button next to the metadata summary](https://mintcdn.com/cmbio/ZT3Tn30cNzSqdqeo/images/import-custom-data-report-button.png?fit=max\&auto=format\&n=ZT3Tn30cNzSqdqeo\&q=85\&s=c2650a7343fadf7f150d3ec1b4919c50)

![Import report for the WGS Taxonomy Template, with the metadata file marked as Valid](https://mintcdn.com/cmbio/ZT3Tn30cNzSqdqeo/images/import-custom-data-import-report.png?fit=max\&auto=format\&n=ZT3Tn30cNzSqdqeo\&q=85\&s=006ecfd9fbfbcaa85d37b568a16f4880)

**6. Complete the import**

Click **Continue** to import the data. The new data table appears in the **Data Tables** section of the [Study Dashboard](https://docs.cosmosid.com/DAP_docs/study-dashboard.md), ready for cohort building with the [Query Builder](https://docs.cosmosid.com/DAP_docs/query-builder.md). If you added the samples to an existing data table, they will become available when querying data from there.

## Next steps

> [card] [AI Query Builder](https://docs.cosmosid.com/DAP_docs/query-builder.md)
>
> Build a cohort from the imported data tables.

> [card] [Importing data into a study](https://docs.cosmosid.com/DAP_docs/importing-data-in-studies.md)
>
> See the other routes to add data to a study.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.