← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / skills / bioskills / bio-read-alignment-star-alignment / references / usage-guide.md

STAR RNA-seq Alignment - Usage Guide

Overview

STAR is the fast, splice-aware RNA-seq aligner that places reads across exon-exon junctions on the genome. It is the choice when the deliverable needs genomic coordinates -- novel isoforms, fusions, RNA variant calling, coverage tracks, splicing QC, or single-cell counting (STARsolo) -- and has memory to spare (~30 GB for human). The decisions that actually shape the result are the splice-junction database (built from a GTF at sjdbOverhang = readlength - 1), the per-sample vs cohort two-pass choice, the 255-for-unique MAPQ that breaks GATK, and the strand column STAR reports; this skill emphasizes those over the basic command.

Prerequisites

conda install -c bioconda star samtools

Quick Start

Tell your AI agent what you want to do: - "Build a STAR index for my genome and GTF with the right sjdbOverhang for 150 bp reads" - "Align my paired-end RNA-seq reads with STAR in two-pass mode and get gene counts" - "Detect my library strandedness from the STAR GeneCounts output" - "Align RNA-seq for GATK variant calling without the empty-VCF MAPQ problem" - "Run STAR for fusion detection with STAR-Fusion"

Example Prompts

Index generation

"Create a STAR index for genome.fa with genes.gtf for 150 bp reads, and reduce genomeSAindexNbases appropriately because my genome is a 5 Mb bacterial assembly."

Two-pass and counts

"Align my paired-end RNA-seq with STAR two-pass, output a coordinate-sorted BAM and gene counts, and tell me from the counts whether my library is stranded."

RNA variant calling

"Align RNA-seq with STAR for GATK variant calling and make sure the unique-read MAPQ does not cause an empty VCF."

Cohort splicing

"I am doing differential splicing across 30 samples -- how do I run STAR two-pass so the junction set is identical across samples instead of per-sample?"

Fusion detection

"Run STAR with chimeric output for STAR-Fusion on my tumor RNA-seq."

What the Agent Will Do

  1. Build the index with --sjdbGTFfile and --sjdbOverhang = readlength - 1, reducing --genomeSAindexNbases for small genomes.
  2. Align to a coordinate-sorted BAM (STAR sorts natively; a later samtools sort is redundant), adding --quantMode GeneCounts to also read strandedness.
  3. Choose per-sample two-pass for novel-junction work, or the cohort pooling recipe (shared SJ.out.tab) for splicing comparisons.
  4. Set --outSAMmapqUnique 60 for any STAR -> GATK path so the 255 uniques are not dropped.
  5. Avoid MAPQ-filtering RNA output for counting (it deletes multimappers), and route multimapper handling to the counter.
  6. Reconcile genome/GTF contig naming and run the QC gate (alignment-files/bam-statistics) before counting or calling.

Index sjdbOverhang by Read Length

Read length sjdbOverhang
50 bp 49
75 bp 74
100 bp 99
150 bp 149

Strandedness from GeneCounts

Library type ReadsPerGene column Equivalent counter setting
Unstranded column 2 htseq -s no / featureCounts -s 0
Forward (Ligation) column 3 htseq -s yes / featureCounts -s 1
Reverse (dUTP, TruSeq -- the common case) column 4 htseq -s reverse / featureCounts -s 2

Tips

STAR vs HISAT2

Factor STAR HISAT2
Memory (human) ~30 GB ~7 GB
Speed very fast fast
Native gene counts yes (GeneCounts) no
Fusion detection yes (chimeric) no
MAPQ for GATK 255 -> set 60 60 (GATK-friendly)
Downstream coupling featureCounts, RSEM, STAR-Fusion, STARsolo StringTie/Cufflinks via --dta