#!/bin/bash if [ $# -ne 1 ]; then echo "Usage: $0 " exit 1 fi input_gtf="$1" output_prefix="output" sorted_gtf="${output_prefix}.sorted.gtf" sorted_gtf_gz="${sorted_gtf}.gz" module load htslib # Sort the input GTF file sort -k1,1 -k4,4n -s "$input_gtf" > "$sorted_gtf" # Compress the sorted GTF file bgzip -c "$sorted_gtf" > "$sorted_gtf_gz" # Index the compressed GTF file tabix "$sorted_gtf_gz" # Remove intermediate files rm "$sorted_gtf" echo "done"