src/utils/qa/makeFilledBlockBed.csh 1.5

1.5 2009/05/21 01:28:08 rhead
Changed getChromlist.csh so that it does not create a file, just prints results. Changed all of the scripts that call it to redirect output to a unique file name, and then remove only that file at the end. Added onintr command that allow for cleanup of files created if scripts are ended prematurely.
Index: src/utils/qa/makeFilledBlockBed.csh
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/utils/qa/makeFilledBlockBed.csh,v
retrieving revision 1.4
retrieving revision 1.5
diff -b -B -U 4 -r1.4 -r1.5
--- src/utils/qa/makeFilledBlockBed.csh	17 Apr 2009 16:31:59 -0000	1.4
+++ src/utils/qa/makeFilledBlockBed.csh	21 May 2009 01:28:08 -0000	1.5
@@ -7,8 +7,10 @@
 #  make bed file of large blocks, ignoring intron/exons
 #
 ####################
 
+onintr cleanup
+
 set split=""
 set db=""
 set table=""
 set chr=""
@@ -71,14 +73,13 @@
 rm -f $outfile
 if ( $split == "" ) then
     hgsql -Ne "SELECT $chr, $start, $end FROM $table" $db > $outfile
 else
-  if (! -e $db.chromlist ) then
-    getChromlist.csh $db > /dev/null
-  endif
-  foreach chrom (`cat $db.chromlist`)
+  getChromlist.csh $db > $db.chromlist$$
+  foreach chrom (`cat $db.chromlist$$`)
     hgsql -Ne "SELECT $chr, $start, $end FROM ${chrom}_$table" $db >> $outfile
   end
 endif
 
-rm -f $db.chromlist
+cleanup:
+rm -f $db.chromlist$$
 exit