code: def write_hdf5_genes(E, gene_list, filename):
      '''SPRING standard: filename = main_spring_dir + "counts_norm_sparse_genes.hdf5"'''
  
      E = E.tocsc()
  
      hf = h5py.File(filename, 'w')
      counts_group = hf.create_group('counts')
      cix_group = hf.create_group('cell_ix')
  
      hf.attrs['ncells'] = E.shape[0]
      hf.attrs['ngenes'] = E.shape[1]
  
      for iG, g in enumerate(gene_list):
          counts = E[:,iG].A.squeeze()
          cell_ix = np.nonzero(counts)[0]
          counts = counts[cell_ix]
          counts_group.create_dataset(g, data = counts)
          cix_group.create_dataset(g, data = cell_ix)
  
      hf.close(f write_hdf5_genes(E, gene_list, filename):
      '''SPRING standard: filename = main_spring_dir + "counts_norm_sparse_genes.hdf5"'''
  
      E = E.tocsc()
  
      hf = h5py.File(filename, 'w')
      counts_group = hf.create_group('counts')
      cix_group = hf.create_group('cell_ix')
  
      hf.attrs['ncells'] = E.shape[0]
      hf.attrs['ngenes'] = E.shape[1]
  
      for iG, g in enumerate(gene_list):
          counts = E[:,iG].A.squeeze()
          cell_ix = np.nonzero(counts)[0]
          counts = counts[cell_ix]
          counts_group.create_dataset(g, data = counts)
          cix_group.create_dataset(g, data = cell_ix)
  
      hf.close()
docs: SPRING standard: filename = main_spring_dir + "counts_norm_sparse_genes.hdf5"