#!/usr/bin/perl

$H_sam{"18390"} = "pos";
$H_sam{"19099"} = "pos";
$H_sam{"20196"} = "pos";
$H_sam{"20361"} = "pos";
$H_sam{"20880"} = "pos";
$H_sam{"20280"} = "neg";
$H_sam{"20419"} = "neg";
$H_sam{"20462"} = "neg"; 
$H_sam{"20734"} = "neg";
$H_sam{"21364"} = "neg";

@A_type = ("pos", "neg");

foreach $posneg (@A_type) {

$val = 0;
	$txt = qq {track cotinine_$posneg
type bigWig
container multiWig
shortLabel cotinine_$posneg
longLabel cotinine_$posneg
visibility full
aggregate none
autoScale on
showSubtrackColorOnUi on
maxHeightPixels 100:48:8
priority 1
};
	print $txt;

	my @A_files;
	@A_files = </mnt/www/webroot/hg19/others/cotinine/*bw>;
	foreach $file (@A_files) {
		$file =~ s/\/home\/tkwan\/webroot\///;

		($name) = $file =~ /cotinine\/(.*)\.bw/;
		($samp) = $name =~ /(.*)-BS_2/;

		$type = $H_sam{$samp};
		next if ($type ne $posneg);

		if ($type eq "pos") { $color = "0,$val,$val"; }
		else                { $color = "$val,$val,0"; }

		$txt = qq {
track $samp
bigDataUrl http://pastinenlab.genome.mcgill.ca/hg19/others/cotinine/$name.bw
shortLabel $samp
longLabel $samp
parent cotinine_$type
type bigWig
autoScale on
color $color
};
		print "$txt\n";
		$val+=50;
	}
}

