#!/usr/bin/perl

open(KEY, "hub_tracks_key_24july2014.txt");
while (<KEY>) {
  chomp $_; ($id, $path) = split/\t/, $_;
  next if ($id eq "" || $_ =~ /^composite/ || $_ =~ /^\#/);
  if (-e $path) {
    if ($path =~ /bigBed/) { $newfile = "$id.peaks.bigBed"; }
    elsif ($path =~ /bigWig/) { $newfile = "$id.depth.bigWig"; }
    else { print "ERROR:  Unexpected file type for $path\n\n"; next; }
    unless (-e $newfile) { system "cp $path $newfile"; }
  }
  else { print "ERROR:  File does not exist.\n$path\n\n"; next; }
}
close(KEY);

