4ed6ecc032c24fe0af2f52026950de6574bdefb7
kuhn
  Tue Jan 25 13:57:59 2011 -0800
added logic to compute number of items for each x in histogram for casae where only one table is displayed
diff --git src/utils/qa/countPerChrom.csh src/utils/qa/countPerChrom.csh
index d9618d9..56569e3 100755
--- src/utils/qa/countPerChrom.csh
+++ src/utils/qa/countPerChrom.csh
@@ -190,30 +190,35 @@
     cat XgraphFile0$$ | awk '{print $1, $3}' > XgraphFile2$$ 
     graph.csh XgraphFile1$$ $histosize1 > Xgraph1$$
     graph.csh XgraphFile2$$ $histosize2 > Xgraph2$$
     # put a . into files where the value is blank, to keep join from collapsing
     cat Xgraph1$$ | egrep "." | awk '{ if ($2 == "") { $2 = "."; } print $1, $2; }' > Xgraph1b$$
     cat Xgraph2$$ | egrep "." | awk '{ if ($2 == "") { $2 = "."; } print $1, $2; }' > Xgraph2b$$
     # output header
     echo
     echo "chr \t$db \t$oldDb$machineOut" | awk '{printf("%3s %'$histosize1's %-'$histosize2's\n", $1, $2, $3)}'
     echo
     # join on first col, retaining everything from first col
     join -a1 -j1 Xgraph1b$$ Xgraph2b$$ | awk '{printf("%3s %'$histosize1's %-'$histosize2's\n", $1, $2, $3)}'
     echo "max = $max | each x = $eachX"
     echo
   else
+    if ($max1 > $histosize) then
+      set eachX=`echo $max1 $histosize | awk '{printf("%2d", $1/$2)}'`
+    else
+      set eachX=1
+    endif
     graph.csh XgraphFile0$$ | awk '{printf("%3s %-36s\n", $1, $2)}'
     echo "max = $max1 | each x = $eachX"
     echo
   endif
 else
   # output header
   echo "chrom \t$db \t$oldDb$machineOut" 
   cat Xout$$
 endif
 
 rm -f Xgraph1$$
 rm -f Xgraph2$$
 rm -f Xgraph1b$$
 rm -f Xgraph2b$$
 rm -f XgraphFile0$$