# 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 --enable-map-align true --enable-map-align-output true --output-format BAM --enable-bam-indexing true --ref-dir \<Path to original reference's hash table>....'

2. BAM to CRAM with new reference: relevant flags:

* '-b --enable-map-align true --enable-map-align-output true --output-format CRAM --ref-dir \<Path to new reference's hash table>....'

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

* **--cram-reference** flag -
* Relevant flags:
  * -r \<Path to new reference's hash table> --cram-input --output-directory \<out\_dir> --output-file-prefix \<out\_prefix> --cram-reference \<Path to original reference's hash table or original reference FASTA file (and FAI file)>

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)*.* |
