code: def first(args):
      
      from jcvi.apps.base import need_update
  
      p = OptionParser(first.__doc__)
      p.set_outfile()
      opts, args = p.parse_args(args)
  
      if len(args) < 2:
          sys.exit(not p.print_help())
  
      N = int(args[0])
      nlines = N * 4
      fastqfiles = args[1:]
      fastqfile = fastqfiles[0]
      outfile = opts.outfile
      if not need_update(fastqfiles, outfile):
          logging.debug("File `{0}` exists. Will not overwrite.".format(outfile))
          return
  
      gz = fastqfile.endswith(".gz")
      for fastqfile in fastqfiles:
          if gz:
              cmd = "zcat {0} | head -n {1}".format(fastqfile, nlines)
          else:
              cmd = "head -n {0} {1}".format(nlines, fastqfile)
  
          sh(cmd, outfile=opts.outfile, append=True)
docs: %prog first N fastqfile(s)
  
      Get first N reads from file.