Spliced Read Alignment to Complex Plant Genomes with HISAT2 & TopHat2
Spliced Read Alignment to Complex Plant Genomes with HISAT2 & TopHat2
Building plant genome indexes, handling non-canonical plant introns and alternative splicing, executing HISAT2/TopHat2 alignments, and generating sorted, indexed BAM files with Samtools.
Key Learning Deliverables & Competencies
- Extracting splice sites and exons from plant GTF/GFF3 for index building
- Running HISAT2 with plant-specific parameters (--dta, --pen-noncansplice)
- SAM to BAM conversion, sorting by coordinate, and index generation with Samtools
- BAM quality diagnostics: alignment rates, duplicate rates, and mapping flag statistics
1. Spliced Read Alignment to Reference Plant Genomes
Eukaryotic RNA-Seq reads derived from mature mRNA span spliced exon-exon junctions. Standard genomic aligners (e.g. BWA-MEM, Bowtie2) cannot map junction reads without introducing massive mismatch penalties. We utilize HISAT2 (Hierarchical Indexing for Spliced Alignment of Transcripts) or STAR, incorporating known gene models from GFF3/GTF files.
2. Building the HISAT2 Plant Splice-Site Aware Index
#!/usr/bin/env bash
# Extract splice sites and exons from Solanum tuberosum GFF3/GTF
hisat2_extract_splice_sites.py Solanum_tuberosum.DM_v6.1.gtf > potato_splicesites.txt
hisat2_extract_exons.py Solanum_tuberosum.DM_v6.1.gtf > potato_exons.txt
# Build indexed reference (incorporating splice sites and exons into Graph FM-index)
hisat2-build -p 16 \
--ss potato_splicesites.txt \
--exon potato_exons.txt \
Solanum_tuberosum.DM_v6.1.dna.toplevel.fa \
hisat2_index/potato_v6_index3. Executing Spliced Alignments with Downstream Transcript Assembly Flags
Crucially, when running HISAT2 for transcriptome quantification, the --dta (Downstream Transcript Assembly) flag must be specified to tailor alignment scoring for tools like featureCounts, HTSeq, and StringTie.
#!/usr/bin/env bash
mkdir -p bam_alignments
# Align paired-end reads and generate coordinate-sorted BAM files
for R1 in trimmed_fastq/*_clean_R1.fastq.gz; do
R2="${R1/_clean_R1.fastq.gz/_clean_R2.fastq.gz}"
SAMPLE=$(basename "$R1" _clean_R1.fastq.gz)
echo "Aligning ${SAMPLE} to Solanum tuberosum DM1-3 v6.1..."
hisat2 -p 12 \
--dta \
-x hisat2_index/potato_v6_index \
-1 "$R1" \
-2 "$R2" \
--summary-file "bam_alignments/${SAMPLE}_summary.txt" | \
samtools view -@ 4 -bS - | \
samtools sort -@ 4 -o "bam_alignments/${SAMPLE}.sorted.bam" -
# Generate index (.bai)
samtools index "bam_alignments/${SAMPLE}.sorted.bam"
doneCommon Pitfalls & Troubleshooting Checklist
- Java Heap Exhaustion (GATK / Picard): If processes terminate with
java.lang.OutOfMemoryError, set your environment variable explicitly:export _JAVA_OPTIONS="-Xmx16g -Djava.io.tmpdir=/tmp". - Index Timestamp Mismatch: If tools complain that a BAM index is missing or out of date, regenerate with
samtools index -@ 4 sample.bam. - Conda Channel Conflicts: Avoid ABI incompatibilities between bioconda and conda-forge by setting strict priority:
conda config --set channel_priority strict. - Chromosome Naming Contamination: Always verify whether reference FASTA headers use
chr1or1; divergent naming causes silent alignment drops.