code: def fillstats(args):
      
      from jcvi.utils.cbook import SummaryStats, percentage, thousands
  
      p = OptionParser(fillstats.__doc__)
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(not p.print_help())
  
      fillfile, = args
      fp = open(fillfile)
      scaffolds = 0
      gaps = []
      for row in fp:
          if row[0] == ">":
              scaffolds += 1
              continue
          fl = FillLine(row)
          gaps.append(fl)
  
      print("{0} scaffolds in total".format(scaffolds), file=sys.stderr)
  
      closed = [x for x in gaps if x.closed]
      closedbp = sum(x.before for x in closed)
      notClosed = [x for x in gaps if not x.closed]
      notClosedbp = sum(x.before for x in notClosed)
  
      totalgaps = len(closed) + len(notClosed)
  
      print("Closed gaps: {0} size: {1} bp".\
                          format(percentage(len(closed), totalgaps), thousands(closedbp)), file=sys.stderr)
      ss = SummaryStats([x.after for x in closed])
      print(ss, file=sys.stderr)
  
      ss = SummaryStats([x.delta for x in closed])
      print("Delta:", ss, file=sys.stderr)
  
      print("Remaining gaps: {0} size: {1} bp".\
                          format(percentage(len(notClosed), totalgaps), thousands(notClosedbp)), file=sys.stderr)
      ss = SummaryStats([x.after for x in notClosed])
      print(ss, file=sys.stderr)
docs: %prog fillstats genome.fill
  
      Build stats on .fill file from GapCloser.