agentleFS
pradyumnasagarpradyumnasagar/open-research-skills/skills/bioinformatics-sequence/hisat2-alignment/SKILL.md

hisat2-alignment

Skill8 starsChanged 5 months agoMITView on GitHub

Splice-aware RNA-seq alignment with HISAT2 — fast, memory-efficient, and the default in many bulk RNA-seq pipelines alongside STAR.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No fabricated citations: Every cited work must resolve to a verifiable

    line 20
  2. Distinctive:

    No claim without provenance: Every quantitative or factual claim

    line 21
  3. Distinctive:

    No silent failure: Every script invocation, API call, or tool use must declare its exit status and what to do on non-zero.

    line 22

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- metadata: category: bioinformatics-sequence oversight: low version: 1.0.0 author: Pradyumna Jayaram tags: [bioinformatics-sequence, research] difficulty: intermediate -->

HISAT2 RNA-seq Alignment

Hard rules

  1. No fabricated citations. Every cited work must resolve to a verifiable
  2. No claim without provenance. Every quantitative or factual claim
  3. No silent failure. Every script invocation, API call, or tool use must declare its exit status and what to do on non-zero. A skill that silently swallows errors is a violation.

When to use

  • Bulk RNA-seq alignment to a reference transcriptome/genome.
  • Small-genome RNA-seq where STAR's index cost is too high.
  • 3' tag-seq (e.g., Lexogen QuantSeq) with appropriate flag settings.
  • Long RNA-seq (>250 bp reads, e.g., ONT cDNA).

When NOT to use

  • De novo transcript assembly → use STAR (better novel junction discovery).
  • DNA-seq variant calling → use bwa-mem or bwa-mem2.
  • Long reads → use minimap2 with -ax splice.

Prerequisites

  • hisat2 ≥ 2.2
  • samtools ≥ 1.19
  • Reference FASTA + HISAT2 index
  • For best sensitivity: known splice sites from a GTF file

Core workflow

  1. Extract splice sites and exons from a GTF to build a sensitive index.
  2. Build the HISAT2 index (hisat2-build or hisat2-build-s with known splice sites).
  3. Align with hisat2 --dta for downstream transcriptome assembly (StringTie / Cufflinks) or --no-spliced-alignment for general use.
  4. Sort and index the BAM with samtools.

Code patterns

Extract splice sites and exons from a GTF

hisat2_extract_splice_sites.py genes.gtf > splice_sites.txt
hisat2_extract_exons.py genes.gtf > exons.txt

Build a sensitive index (with known splice sites)

hisat2-build -p 16 --ss splice_sites.txt --exon exons.txt reference/genome.fa genome_hs2

Build a basic index (no annotation, faster)

hisat2-build -p 16 reference/genome.fa genome_hs2

Paired-end alignment (typical bulk RNA-seq)

hisat2 -p 16 --dta -x genome_hs2 \
    -1 reads_R1.fq.gz -2 reads_R2.fq.gz \
    --rg-id sample1 --rg SM:sample1 --rg PL:ILLUMINA --rg LB:lib1 \
    -S sample1.sam
samtools sort -@ 8 -o sample1.bam sample1.sam
samtools index sample1.bam
rm sample1.sam

--dta (downstream-transcriptome-assembly) is required if you'll run StringTie; it reports alignments tailored to transcript assembly.

Single-end alignment

hisat2 -p 16 --dta -x genome_hs2 -U reads.fq.gz --rg-id s1 --rg SM:s1 |
  samtools sort -@ 8 -o s1.bam -

rRNA-aware alignment (filter rRNA first, or use --un-gz to drop)

hisat2 -p 16 --dta --un-gz unmapped.fq.gz -x genome_hs2 -1 R1.fq -2 R2.fq |
  samtools sort -@ 8 -o s.bam -

--un-gz writes reads that didn't align (often rRNA or contaminant) for downstream QC.

Strand-specific libraries (dUTP / Ligation)

HISAT2 doesn't natively set XS tags; the convention is to use featureCounts or StringTie to infer strand from spliced alignments. For library prep-specific strand:

# Ligation protocol (Illumina TruSeq stranded)
# HISAT2 reports XS:A:+ / XS:A:- via the spliced alignment orientation
# featureCounts -s 2 (reverse stranded) will pick this up

Long-read cDNA (ONT / PacBio Iso-Seq)

hisat2 -p 16 --dta -x genome_hs2 -U iso_seq.fq.gz --no-temp-splicesite |
  samtools sort -@ 8 -o iso.bam -

nf-core integration

nf-core/rnaseq defaults to STAR. To use HISAT2, pass --aligner hisat2 on the CLI.

Common pitfalls

  • Forgetting --dta for transcriptome assembly. StringTie/Cufflinks require the special scoring.
  • Building an index without splice sites. The basic index works but is less sensitive for novel junctions.
  • Mixing up --rna-strandness (legacy flag removed in 2.2). In HISAT2 2.2+, use downstream tools (featureCounts -s) to handle strand.
  • Not using --rg-id. featureCounts and StringTie need read groups for multi-sample merges.
  • STAR's memory cost is too high → HISAT2 with low sensitivity. If STAR fails on RAM, HISAT2 with the basic index will also miss junctions. Consider subsampling reads or using a known-splice-site index.

Validation

  • samtools flagstat s.bam — high mapping rate expected (≥80% for human bulk RNA-seq).
  • samtools view -c -f 2 s.bam — properly-paired count.
  • samtools view s.bam | grep -c 'N:M:' — spliced alignment count (look for N in CIGAR).
  • samtools view s.bam | awk '$6 ~ /N/' | wc -l — spliced reads.
  • rRNA fraction should be < 10% for poly-A selected, < 25% for ribo-depleted.

Open alternatives

NeedTool
Best novel junction discoverySTAR
Lower memory footprintHISAT2 (this skill)
Long-read cDNAminimap2 -ax splice:hq
Pseudo-alignment (transcripts only)salmon, kallisto
Standard bulk RNA-seqnf-core/rnaseq (default STAR, --aligner hisat2 optional)

References

  • HISAT2 paper: Kim et al. 2019, Nature Methods — 10.1038/s41587-019-0201-4
  • HISAT2 manual: http://daehwankimlab.github.io/hisat2/manual/
  • Companion: ors-bioinformatics-sequence-star-alignment, ors-bioinformatics-sequence-bwa-alignment.

Changelog

  • 1.0.0 (2026-06-10): Initial adaptation by Pradyumna Jayaram from bio-hisat2-alignment (bioSkills-main/read-alignment/hisat2-alignment)."

Cross-references

Other skills in this category:

  • batch-processing
  • bowtie2-alignment
  • bwa-alignment
  • bwa-mem2-alignment
  • codon-usage
  • compressed-sequence-files
  • fastq-quality-scores
  • filter-sequences
  • format-conversion
  • motif-search
  • paired-end-fastq
  • pysam-genomics
  • read-write-sequences
  • reverse-complement
  • sam-bam-basics
  • samtools-bam-processing
  • seq-objects
  • sequence-properties
  • sequence-slicing
  • sequence-statistics
  • star-alignment
  • transcription-translation

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.