Chapter 4 Build the STAR genome index

4.1 Prerequisites

Activate the IOBRpy environment:

conda activate iobrpy

Choose a base directory for the index:

export BASE=/path/to/index/dir
mkdir -p "$BASE"

4.2 Build STAR index

# Move to the base directory for references
cd "$BASE"

# Download the primary assembly and GTF (GENCODE v44)
wget -c https://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_44/GRCh38.primary_assembly.genome.fa.gz
wget -c https://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_44/gencode.v44.annotation.gtf.gz

# Decompress the downloads
gunzip -f GRCh38.primary_assembly.genome.fa.gz
gunzip -f gencode.v44.annotation.gtf.gz

# Paths
STAR_INDEX="$BASE/star"
genome_fa="$BASE/GRCh38.primary_assembly.genome.fa"
gtf="$BASE/gencode.v44.annotation.gtf"

# Create output directory for STAR index
mkdir -p "$STAR_INDEX"

# Build STAR genome index
STAR --runMode genomeGenerate \
     --genomeDir "$STAR_INDEX" \
     --genomeFastaFiles "$genome_fa" \
     --sjdbGTFfile "$gtf" \
     --runThreadN 4 \
     --sjdbOverhang 100

4.3 Notes

  • Release/assembly: This guide uses GENCODE v44 (GRCh38).
  • Threads: This tutorial uses 4 threads.
  • Storage: STAR indexes are large (tens of GB). Ensure you have enough disk space.