#!/bin/bash # Define output files HUB_FILE="hub.txt" GENOME_FILE="genomes.txt" TRACK_DB_FILE="trackDb.txt" # Create hub.txt cat < $HUB_FILE hub MyHg19Hub shortLabel My Hg19 Hub longLabel Custom Hg19 Track Hub genomesFile genomes.txt email your_email@example.com EOF # Create genomes.txt cat < $GENOME_FILE genome hg19 trackDb trackDb.txt EOF # Create trackDb.txt echo "" > $TRACK_DB_FILE # Clear previous trackDb.txt # Define colors for tracks COLORS=("0,0,255" "255,0,0" "0,255,0" "255,165,0" "128,0,128" "0,255,255") # Loop through all bigWig files ending with -HG19.bw count=0 for file in *-HG19.bw; do # Extract the base filename without extension base_name=$(basename "$file" .bw) # Assign a color from the array (cycle through if more files) color=${COLORS[$((count % ${#COLORS[@]}))]} # Append track information to trackDb.txt cat <> $TRACK_DB_FILE track $base_name bigDataUrl $file shortLabel $base_name longLabel $base_name bigWig Track type bigWig visibility full color $color EOF ((count++)) done echo "✅ UCSC track hub files generated: hub.txt, genomes.txt, trackDb.txt"