code: def convert_chain(
          txtfiles,
          headers,
          h5file,
          chunksize):
      
  
      h5 = h5py.File(h5file, 'w')
  
      for h in headers:
          h5.create_dataset(h,
                            shape=(0,),
                            maxshape=(None,),
                            dtype=np.float64,
                            chunks=(chunksize,),
                            compression='gzip',
                            shuffle=True)
  
      for txtfile in txtfiles:
  
          d = np.loadtxt(txtfile, dtype=np.float64)
  
          if len(d.shape) == 1:
              d = np.array([d])
  
          dnrows = d.shape[0]
  
          for pos, h in enumerate(headers):
              x = h5[h]
              xnrows = x.shape[0]
              x.resize(dnrows+xnrows, axis=0)
              x[xnrows:] = d[:,pos]
  
      h5.close()
docs: Converts chain in plain text format into HDF5 format.
  
      Keyword arguments:
      txtfiles -- list of paths to the plain text chains.
      headers -- name of each column.
      h5file -- where to put the resulting HDF5 file.
      chunksize -- how large the HDF5 chunk, i.e. number of rows.
  
      Chunking - How to pick a chunksize
      TODO Optimal chunk size unknown, our usage make caching irrelevant, and
      we use all read variable. Larger size should make compression more efficient,
      and less require less IO reads. Measurements needed.