> For the complete documentation index, see [llms.txt](https://knowledge.illumina.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledge.illumina.com/software/general/software-general-reference_material-list/000007021.md).

# How to realign a CRAM file to a new reference with DRAGEN

CRAM is a reference-based compression format that offers better compression than BAM and SAM. The **reference** used for compression is crucial to decompress the CRAM file.

In software versions **prior to DRAGEN v4.0.3**, in order to re-align a CRAM file to a different reference, a **two-step process** must be followed.

1. CRAM to BAM: use the **original reference** to convert the **CRAM file to BAM file**; Relevant flags:
   * '`--cram-input &lt;cram&gt; --enable-map-align true --enable-map-align-output true --output-format BAM --enable-bam-indexing true --ref-dir &lt;Path to original reference's hash table&gt;...`.'
2. BAM to CRAM with new reference: relevant flags:
   * '`-b &lt;bam&gt; --enable-map-align true --enable-map-align-output true --output-format CRAM --ref-dir &lt;Path to new reference's hash table&gt;....`'

With **DRAGEN v4.0.3**, a **single step** is used by including the flag:

* `--cram-reference flag -`
* Relevant flags:
  * `-r &lt;Path to new reference's hash table&gt; --cram-input &lt;cram&gt; --output-directory &lt;out_dir&gt; --output-file-prefix &lt;out_prefix&gt; --cram-reference &lt;Path to original reference's hash table or original reference FASTA file (and FAI file)&gt;`

See the [DRAGEN v4.0.3 user guide](https://support-docs.illumina.com/SW/DRAGEN_v40/Content/SW/DRAGEN/Inputfiles_fDG.htm) for more information.

\
\
\ <br>

|                                                                                                                                                                                                                                                                                                                                                                 |
| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| *For any feedback or questions regarding this article (Illumina Knowledge Article #7021), contact Illumina Technical Support* [*techsupport@illumina.com*](mailto:techsupport@illumina.com?subject=Question%2FFeedback%20Regarding%20Illumina%20Knowledge%20Article%20#000007021%20-%20Software%20\&body=Dear%20Illumina%20Technical%20Support,%0D%0A%0D%0A)*.* |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://knowledge.illumina.com/software/general/software-general-reference_material-list/000007021.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
