#!/usr/bin/perl -w 



print "
DROP TABLE IF EXISTS `chromInfo`;
CREATE TABLE `chromInfo` (
  `chrom` varchar(255) NOT NULL,
  `size` int(10) unsigned NOT NULL,
  `fileName` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`chrom`(7))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

";

#('chrIV',1531933,'/gbdb/sacCer3/sacCer3.2bit'),
open(IF,"chrom.sizes");
print "INSERT INTO `chromInfo` VALUES \n"; 
$n=0;
while($a=<IF>){
chomp($a);
$list[$n] = $a;
$n++;
}


$pwd = `pwd`;
chomp($pwd);
$pwd =~ s/\/data//;
@b = split(/\//,$pwd);
$genome = $b[2];
$twobit = $pwd . "/$genome.2bit";

for($i=0;$i<$n;$i++){
@b=split(/\t/,$list[$i]);
print "('$b[0]',$b[1],'$twobit')";
if($i==$n-1){print ";\n";}
else{print ",\n";}
}
print "\n";




