#!/usr/bin/perl

#http://pastinenlab.genome.mcgill.ca/hg19/rna_seq/v_2/EMC_Asthma/hg19/wiggle_tracks/600-0002_Eos_RNASeq_1.forward.bigwig
#http://pastinenlab.genome.mcgill.ca/hg19/rna_seq/v_2/EMC_Asthma/hg19/wiggle_tracks/600-0002_Eos_RNASeq_1.reverse.bigwig

open (FH, "<$ARGV[0]");
while (<FH>) {
	$line =$_; chomp($line);
	push (@A_sample, $line);
}

@A_cell = ("CD4", "Eos");
foreach $cell (@A_cell) {

$txt = qq {
track $cell
type bigWig
container multiWig
shortLabel $cell
longLabel $cell
visibility full
aggregate none
autoScale on
showSubtrackColorOnUi on
maxHeightPixels 50:25:10
priority 1
};

	print $txt;

	foreach $file (@A_sample) {
		next if ($file !~ /$cell/);
		($sample) = $file =~ /wiggle_tracks\/(.*)\.bigwig/;

if ($file =~ /forward/)    { $color = "128,0,0"; }
elsif ($file =~ /reverse/) { $color = "0,100,0"; }

		$txt = qq {
track $sample
bigDataUrl $file
shortLabel $sample
longLabel $sample
parent $cell
type bigWig
autoScale on
color $color
};
		print $txt;
	}
}
