Align RNA-seq reads with HISAT2
Build a HISAT2 splice-aware index and align paired RNA-seq reads to a genome, piping straight into samtools for a sorted BAM.
Prerequisites
- HISAT2 installed (`hisat2`, `hisat2-build`)
- samtools installed
- A reference genome FASTA file
- Paired-end RNA-seq FASTQ files (R1 and R2)
1Build the HISAT2 index
Index your genome FASTA once per reference. This writes eight binary files (ref_index.1.ht2 through ref_index.8.ht2) that every later alignment reuses, so you never rebuild it for subsequent samples.
hisat2-build reference.fasta ref_indexExpected output
Settings:
Output files: "ref_index.*.ht2"
Line rate: 6 (line is 64 bytes)
Lines per side: 1 (side is 64 bytes)
Offset rate: 4 (one in 16)
FTable chars: 10
Strings: unpacked
Local offset rate: 3 (one in 8)
Local fTable chars: 6
Endianness: little
Actual local endianness: little
Sanity checking: disabled
Assertions: disabled
Random seed: 0
Reading reference sizes
Time reading reference sizes: 00:00:06
Calculating joined length
Writing header
Reserving space for joined string
Joining reference sequences
Time to join reference sequences: 00:00:03
Total time for constructing forward index: 00:02:28
Total time for call to driver() for forward index: 00:03:122Align and sort into a BAM
Align both mates against the index and stream the output straight into samtools sort, so no intermediate SAM ever touches disk. For a stranded dUTP/Illumina library, add the strandness flag before -x so read orientation is recorded: `hisat2 -p 4 --rna-strandness RF -x ref_index -1 R1.fastq.gz -2 R2.fastq.gz | samtools sort -@ 4 -o rna.sorted.bam -`.
hisat2 -p 4 -x ref_index -1 R1.fastq.gz -2 R2.fastq.gz | samtools sort -@ 4 -o rna.sorted.bam -Expected output
24500000 reads; of these:
24500000 (100.00%) were paired; of these:
2200000 (8.98%) aligned concordantly 0 times
19800000 (80.82%) aligned concordantly exactly 1 time
2500000 (10.20%) aligned concordantly >1 times
----
2200000 pairs aligned concordantly 0 times; of these:
500000 (22.73%) aligned discordantly 1 time
----
1700000 pairs aligned 0 times concordantly or discordantly; of these:
3400000 mates make up the pairs; of these:
2783200 (81.86%) aligned 0 times
400000 (11.76%) aligned exactly 1 time
216800 (6.38%) aligned >1 times
94.32% overall alignment rateTroubleshooting
Low overall alignment rate (well under 70%) on eukaryotic RNA-seq
Confirm you are aligning with HISAT2 (splice-aware), not a DNA aligner like BWA, and that the index was built from the genome FASTA, not a transcriptome. Reads spanning exon-exon junctions only map when both the aligner and the index are splice-aware.
Strand information looks wrong in downstream featureCounts/htseq counts
Set `--rna-strandness RF` for dUTP/Illumina stranded libraries, or `FR` for the opposite orientation. The default is unstranded, which mislabels strand for stranded protocols and skews per-gene counts.