code: def estimate_optim(data, testfile, ipyclient):
      
      ## count the len of one file and assume all others are similar len
      insize = os.path.getsize(testfile)
      tmp_file_name = os.path.join(data.paramsdict["project_dir"], "tmp-step1-count.fq")
      if testfile.endswith(".gz"):
          infile = gzip.open(testfile)
          outfile = gzip.open(tmp_file_name, 'wb', compresslevel=5)
      else:
          infile = open(testfile)
          outfile = open(tmp_file_name, 'w')
          
      ## We'll take the average of the size of a file based on the
      ## first 10000 reads to approximate number of reads in the main file
      outfile.write("".join(itertools.islice(infile, 40000)))
      outfile.close()
      infile.close()
  
      ## Get the size of the tmp file
      tmp_size = os.path.getsize(tmp_file_name)
  
      ## divide by the tmp file size and multiply by 10000 to approximate
      ## the size of the input .fq files
      inputreads = int(insize / tmp_size) * 10000
      os.remove(tmp_file_name)
  
      return inputreads
docs: Estimate a reasonable optim value by grabbing a chunk of sequences, 
      decompressing and counting them, to estimate the full file size.