# Pipeline Logic

<figure><img src="/files/QR2dUNaR15SrUNRYxz9l" alt=""><figcaption><p>Control and data flow diagram for the DRAGEN Microbial Amplicon app. Not all steps shown may be run depending on user inputs and pipeline outcome</p></figcaption></figure>

## Steps

| Step                                        | Module/Script | Run                                                                      |
| ------------------------------------------- | ------------- | ------------------------------------------------------------------------ |
| QC                                          | trimmomatic   | Always                                                                   |
| Primer trimming (on FASTQ)                  | trimmomatic   | If assembly is to run                                                    |
| Remove off-target reads                     | DRAGEN        | If checked in Input Form                                                 |
| Assembly                                    | MEGAHIT       | If reference FASTA and BED files imply more than one genome as reference |
| Contig clustering                           | CD-HIT        | If assembly ran                                                          |
| Reference selection                         | custom script | If assembly ran, otherwise input reference database is used as is        |
| Map/Align                                   | DRAGEN        | If at least one reference sequence is generated                          |
| Post-facto primer trimming (on BAM)         | custom script | If Map/Align ran and primer set exists                                   |
| Sample filtering based on amplicon coverage | custom script | If Map/Align ran and primer set exists                                   |
| Variant calling                             | DRAGEN        | If Map/Align ran and sample passed filter above                          |
| Consensus sequence generation               | custom script | If Map/Align ran and sample passed filter above                          |

## Outcomes

<table><thead><tr><th width="328">Status</th><th width="92">Level</th><th>Outcome</th></tr></thead><tbody><tr><td>Completed successfully</td><td>Pipeline</td><td>Exit with all applicable output files</td></tr><tr><td>Custom files are not formatted correctly</td><td>Pipeline</td><td>Exit early with error</td></tr><tr><td>No remaining reads after preprocessing</td><td>Sample</td><td>Exit early with a report of read counts</td></tr><tr><td>No contig generated</td><td>Sample</td><td>Exit early with a report of read counts</td></tr><tr><td>No reference found after assembly</td><td>Sample</td><td>Exit early with a report of read counts and contig FASTA</td></tr><tr><td>None of the primers provided in custom primer definition file align to selected reference sequences</td><td>Sample</td><td>Skip post-factor primer trimming and sample filtering based on amplicon coverage for this sample</td></tr><tr><td>Insufficient amplicon coverage</td><td>Sample</td><td>Exit early before variant calling and consensus sequence generation</td></tr></tbody></table>


---

# 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/infectious-disease/dragen-microbial-amplicon/dragen-microbial-amplicon/pipeline.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.
