#!/usr/bin/perl

$refGenome = "hg38";
$idColumns = 2;  # number of period-separated text chunks from bigwig file name to use as identifier
$string = "bigBed";

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

$ls = `ls -1 *.$string`;
foreach $bbfile (split/\n/, $ls) {
  @ar = split/\./, $bbfile;
  @arX = splice(@ar, 0, $idColumns);
  $id = join(" ", @arX);
  print "track type=bigBed name=\"$id cb\" db=$refGenome visibility=dense itemRgb=on bigDataUrl=https://snpinfo.niehs.nih.gov/ucscview/$path/$bbfile\n";
}

