code: def count(args):
      
      from jcvi.utils.table import loadtable, write_csv
  
      p = OptionParser(count.__doc__)
      p.add_option("--dir",
                  help="Sub-directory where FASTQC was run [default: %default]")
      p.add_option("--human", default=False, action="store_true",
                  help="Human friendly numbers [default: %default]")
      p.set_table()
      p.set_outfile()
      opts, args = p.parse_args(args)
  
      if len(args) < 1:
          sys.exit(not p.print_help())
  
      filenames = args
      subdir = opts.dir
      header = "Filename|Total Sequences|Sequence length|Total Bases".split("|")
      rows = []
      human = opts.human
      for f in filenames:
          folder = f.replace(".gz", "").rsplit(".", 1)[0] + "_fastqc"
          if subdir:
              folder = op.join(subdir, folder)
          summaryfile = op.join(folder, "fastqc_data.txt")
  
          fqcdata = FastQCdata(summaryfile, human=human)
          row = [fqcdata[x] for x in header]
          rows.append(row)
  
      print(loadtable(header, rows), file=sys.stderr)
      write_csv(header, rows, sep=opts.sep,
                filename=opts.outfile, align=opts.align)
docs: %prog count *.gz
  
      Count reads based on FASTQC results. FASTQC needs to be run on all the input
      data given before running this command.