#!/usr/bin/perl

$rgb = "0,128,255";

$refGenome = "hg38";
$idColumns = 5;

$path = `pwd`; $path =~ s/\s//g;
$path =~ s/\/data\/wade\///;

%sKey = ("H3K27me3.ActiveMotif.1_50.1_100.CaCl2_30-rep1" => "x1", "H3K27me3.ActiveMotif.1_50.1_100.CaCl2_30-rep2" => "x2", "H3K27me3.Epicypher.1_50.1_100.CaCl2_30-rep1" => "x3", "H3K27me3.Epicypher.1_50.1_100.CaCl2_30-rep2" => "x4");

$ls = `ls -1 H3K27me3*.bigBed`;
foreach $bbfile (split/\n/, $ls) {
  @ar = split/\./, $bbfile;
  @arX = splice(@ar, 0, $idColumns);
  $id = join(".", @arX);
  $outId = "$sKey{$id}"."-$ar[1]";
  print "track type=bigBed name=\"$outId peaks\" db=$refGenome visibility=dense color=$rgb bigDataUrl=https://snpinfo.niehs.nih.gov/ucscview/$path/$bbfile\n";
}

