# Automatic Data Aggregation

When launching apps using biosamples as inputs, BaseSpace Sequence Hub automatically aggregates all of the valid (QC Passed) biosample FASTQ data associated with the same default biosamples. You can control which data are used in analyses by setting the QC status of a resource as QC Passed or QC Failed.

{% hint style="info" %}
Aggregated FASTQ data can be produced from multiple libraries, lanes, or flow cells, and can contain data with different read lengths from the same biosample.
{% endhint %}

To prevent unintended aggregation, biosamples are locked if the biosample was converted from a sample and has data produced by two or more runs. The data cannot be used in analysis until the biosample has been reviewed and unlocked, however you can use samples to launch analysis without aggregation. For information about unlocking biosamples to make them available for analysis, see [Unlock Biosamples](https://help.connected.illumina.com/basespace/automate/automatic-data-aggregation/unlock-biosamples).

{% hint style="info" %}
Samples contain data from a single sequencing run only, and therefore do not support data aggregation.
{% endhint %}

![Automatic Data Aggregation](https://330234082-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg3bE5PSqw4Kkyc9yUsgB%2Fuploads%2Fgit-blob-fbe3890cd91dc6d86ebc980d72b54dc98432a4a5%2Fauto-data-aggregation.png?alt=media\&token=707ad60c-394f-45ca-8806-6f7922b44e72)

When BaseSpace Sequence Hub collects data for an app launch, it automatically excludes QC-failed lanes, libraries, pools, and any downstream data they produced. For example, if you fail a flow cell lane, all FASTQ data sets produced from that lane are excluded when aggregating data for the biosamples and libraries put on those lanes. If you fail a FASTQ dataset, only that FASTQ dataset is excluded.

![QC Failed Datasets Excluded](https://330234082-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg3bE5PSqw4Kkyc9yUsgB%2Fuploads%2Fgit-blob-c4174245e09dd57beaa827c4798bf300fc45cbec%2Fqc-failed-aggregation.png?alt=media)

If a FASTQ dataset has been copied, BaseSpace Sequence Hub uses the original FASTQ dataset, or the most recent copy if the original is not available. To use a different copy, mark the other copies as QC Failed before starting the analysis.

The following resources can be excluded from data aggregation:

* Lanes—Fail lanes using Automatic Lane QC, BaseSpace Sequence Hub API, or manually in BaseSpace Sequence Hub.
* Libraries—Fail libraries using the BaseSpace Sequence Hub API.
* Pools—Fail pools using the BaseSpace Sequence Hub API.
* FASTQ Datasets—Fail FASTQ data sets using the BaseSpace Sequence Hub API, or manually in BaseSpace Sequence Hub.

{% hint style="info" %}
When using apps that have not been updated to use biosamples or data sets as inputs, BaseSpace Sequence Hub automatically converts the FASTQ data sets into samples before launching the app.
{% endhint %}

If you specify a library prep kit when selecting a biosample for analysis, the analysis launches using only FASTQ datasets from libraries of the specified prep kit. In the following example, Prep Kit B is selected as input and the FASTQ files from Prep Kit A are excluded.

![Prep Kit Data included in App Launch](https://330234082-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg3bE5PSqw4Kkyc9yUsgB%2Fuploads%2Fgit-blob-dc25b730a6c3bfb415f7b4953fba22f522275868%2Fprep-kit-app-launch-data-aggregation.png?alt=media\&token=46aea134-3546-4665-93e2-2fa1a2308c88)


---

# 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://help.connected.illumina.com/basespace/automate/automatic-data-aggregation.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.
