> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/clara/parabricks/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/clara/parabricks/_mcp/server.

# rna_fq2bam

This tool is the equivalent of fq2bam for RNA-Seq samples, receiving inputs in
FASTQ format, performing alignment with the splice-aware STAR algorithm,
optionally marking of duplicate reads, and outputting an aligned BAM file ready
for variant and fusion calling.

Refer to the [rna\_fq2bam Reference](#options) section for a detailed listing of all available options.

## Quick Start

```sh
# This command assumes all the inputs are in the current working directory and all the outputs go to the same place.
docker run --rm --gpus all --volume $(pwd):/workdir --volume $(pwd):/outputdir \
    --workdir /workdir \
    nvcr.io/nvidia/clara/clara-parabricks:4.7.1-1 \
    pbrun rna_fq2bam \
    --in-fq /workdir/${INPUT_FASTQ_1} /workdir/${INPUT_FASTQ_2} \
    --genome-lib-dir /workdir/${PATH_TO_GENOME_LIBRARY}/ \
    --output-dir /outputdir/${PATH_TO_OUTPUT_DIRECTORY} \
    --ref /workdir/${REFERENCE_FILE} \
    --out-bam /outputdir/${OUTPUT_BAM} \
    --read-files-command zcat
```

## Compatible CPU Command

The output from these commands will be identical to the output from the above command.
Refer to the [Output Comparison](/about-parabricks/comparison-with-baseline-tools) page for comparing the
results.

```sh
# STAR Alignment
$ ./STAR \
      --genomeDir <INPUT_DIR>/${PATH_TO_GENOME_LIBRARY} \
      --readFilesIn <INPUT_DIR>/${INPUT_FASTQ_1} <INPUT_DIR>/${INPUT_FASTQ_2} \
      --outFileNamePrefix <OUTPUT_DIR>/${PATH_TO_OUTPUT_DIRECTORY}/ \
      --outSAMtype BAM SortedByCoordinate \
      --readFilesCommand zcat

# Mark Duplicates
$ gatk MarkDuplicates \
    --java-options -Xmx30g \
    -I Aligned.sortedByCoord.out.bam \ # This filename is determined by STAR.
    -O <OUTPUT_DIR>/${NAME_OF_OUTPUT_BAM_FILE} \
    -M metrics.txt
```

Make sure you have the same version of STAR installed that was used to build the genome index.

The Parabricks version of STAR is compatible with the 2.7.2a CPU-only version of STAR.

**Deterministic Primary Alignment Selection in quantMode TranscriptomeSAM**

Parabricks uses a deterministic approach for selecting primary alignments (which affects the `samFlag` in the BAM record) among alignments in the `Aligned.toTranscriptome.bam` file during the `quantMode TranscriptomeSAM` mode.

To compare the Parabricks version with the baseline STAR, the following modification is required in the baseline STAR code:

```sh
# Add this line in ReadAlign::quantTranscriptome() function in ReadAlign_quantTranscriptome.cpp
rngMultOrder.seed(777);
# Add it right before:
alignT[int(rngUniformReal0to1(rngMultOrder)*nAlignT)].primaryFlag=true;
```

**Known Issue with Linux Kernel 6.11.0**: There is a known issue with pinned memory allocation in Linux kernel 6.11.0 that may cause problems with this tool. For more details, refer to the [NVIDIA Developer Forums discussion](https://forums.developer.nvidia.com/t/memory-leak-on-kernel-6-11-0-when-using-cudamallochost/308691). It is recommended to avoid using kernel version 6.11.0.

## Options

The *--in-fq* option takes the names of two FASTQ files, optionally followed by a
quoted read group.  The FASTQ filenames must not start with a hyphen.