#!/usr/bin/perl

my $version=$ARGV[0];

my $dir="/share/data/umw_biocore/genome_data/bacillus/bt407";
my $fine=1;
while ($fine)
{
 `./prepRSEM.bash $version>$dir/res.txt 2>&1`;
 $a=`grep N[MR] $dir/res.txt`;
 print "[$a]\n";
 if ($a=~/(N[MR][\d\_]+)/ || $a=~/cannot find (N[MR]_.+)\'s gene_id/)
 {
   print $1."\n";
   `grep -v $1 $dir/ucsc.gtf > $dir/ucs1c.gtf`;
   `mv $dir/ucs1c.gtf $dir/ucsc.gtf`;
 }
 else
 {
   $fine=0;
 }
}
