code: def readlen(args):
      
      p = OptionParser(readlen.__doc__)
      p.set_firstN()
      p.add_option("--silent", default=False, action="store_true",
                   help="Do not print read length stats")
      p.add_option("--nocheck", default=False, action="store_true",
                   help="Do not check file type suffix")
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(not p.print_help())
  
      f, = args
      if (not opts.nocheck) and (not is_fastq(f)):
          logging.debug("File `{}` does not endswith .fastq or .fq".format(f))
          return 0
  
      s = calc_readlen(f, opts.firstN)
      if not opts.silent:
          print("\t".join(str(x) for x in (f, s.min, s.max, s.mean, s.median)))
  
      return int(s.max)
docs: %prog readlen fastqfile
  
      Calculate read length, will only try the first N reads. Output min, max, and
      avg for each file.