#!/bin/bash

# Directory containing the bigwig files
dir="/data/web/sites/171023_Lina_RFP/mm10"
path_2="http://upnaesrv1.epfl.ch/171023_Lina_RFP/mm10/"

# Output file
output="trackDb.txt"

# Clear output file
> $output

# Loop through each bigwig file in the directory
for file in $(ls $dir/*.bw); do
    # Extract filename without extension
    filename=$(basename -- "$file")
    name="${filename%.*}"
    
    # Write track configuration to output file
    echo "track $name" >> $output
    echo "bigDataUrl ${path_2}${filename}" >> $output
    echo "shortLabel $name" >> $output
    echo "longLabel $name" >> $output
    echo "type bigWig" >> $output
    echo "visibility full" >> $output
    echo "autoScale on" >> $output
    echo "" >> $output
done

