Answers.Body: <p>Conversion into HDF5 from Python3 is straight forward, if this is a simple key: value dictionary format then it <em>should</em> be easy to mimic the CellRanger format. If it is a more complex data structure that would be tricky.  The key to HDF5 is 'the HDF5 key' which you need to find (you would call it the directory)</p>
  <p>To find the 'key' one approach is do is download <a href="https://www.hdfgroup.org/downloads/hdfview/" rel="nofollow noreferrer">https://www.hdfgroup.org/downloads/hdfview/</a> and then forward a screenshot of the CellRanger HDF5 file here. The directories are what HDF5 call 'keys' and you need these to write to and call from HDF5. There is a CLI for this operation.</p>
  <p>An example of the data you are writing to would be needed.If per chance the data is in a Python dataframe you're in business, because these easily IO to HDF5</p>
  <p>All you do is put the data into a simple dictionary and assign the dictionary to a key which is written to HDF5. Parsing the data from e.g. an AlignIO/SeqIO object to the dictionary is more complicated. When the HDF5 is read, the key has to be supplied then the dictionary is extracted and assembled back into an object.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-17T22:42:42.497Z
Answers.LastActivityDate: 2022-06-18T02:52:06.687Z
Answers.LastEditDate: 2022-06-18T02:52:06.687Z
Answers.UserDisplayName: M__
Answers.Body: <p>Answered on biostars (<a href="https://www.biostars.org/p/9527636/#9527638" rel="nofollow noreferrer">https://www.biostars.org/p/9527636/#9527638</a>) as well as on reddit: (<a href="https://www.reddit.com/r/bioinformatics/comments/veku5r/how_to_convert_10x_matrix_tsv_files_to_hdf5_format/icqsfwn/" rel="nofollow noreferrer">https://www.reddit.com/r/bioinformatics/comments/veku5r/how_to_convert_10x_matrix_tsv_files_to_hdf5_format/icqsfwn/</a>)</p>
  <p>The biostars answer is better as it needs just one package (DropletUtils) as opposed to the 2-3 required by the Seurat-allied packages suggested on reddit. Plus, Seurat can take forever to load a dataset.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-17T18:43:15.243Z
Answers.LastActivityDate: 2022-06-17T18:43:15.243Z
Answers.UserDisplayName: Ram RS
Body: <p>I have a bunch of folders containing barcodes.tsv.gz, features.tsv.gz, and matrix.mtx.gz from the Cellranger Count output for a single-cell dataset that was sent to me from another lab. I need the .h5 version of these count matrices, but I do not have access to the original Cellranger Count output which contains the generated .h5 files.</p>
  <p>Is there an R or Python function that can reliably convert these files into the proper hdf5 format? I haven't found anything online yet.</p>
  <p>(x-post: <a href="https://www.reddit.com/r/bioinformatics/comments/veku5r/how_to_convert_10x_matrix_tsv_files_to_hdf5_format/" rel="nofollow noreferrer">https://www.reddit.com/r/bioinformatics/comments/veku5r/how_to_convert_10x_matrix_tsv_files_to_hdf5_format/</a>)</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-06-17T22:35:30.867Z
Comments.Text: Conversion into HDF5 from Python3 is straight forward. Could you please forward your CellRanger output example? The key is ... the key and I'd need to see the stuff you want to write and look at the keys in a CellRanger file (keys are everything in HDF5)
Comments.UserDisplayName: M__
Tags: <single-cell><cellranger><hdf5>
Title: How to convert 10x matrix.mtx.gz files to hdf5 format?
ThreadText: # How to convert 10x matrix.mtx.gz files to hdf5 format?
  
  (Asked by: username_0 on 2022-06-17)
  
  I have a bunch of folders containing barcodes.tsv.gz, features.tsv.gz, and matrix.mtx.gz from the Cellranger Count output for a single-cell dataset that was sent to me from another lab. I need the .h5 version of these count matrices, but I do not have access to the original Cellranger Count output which contains the generated .h5 files.
  
  Is there an R or Python function that can reliably convert these files into the proper hdf5 format? I haven't found anything online yet.
  
  (x-post: <https://www.reddit.com/r/bioinformatics/comments/veku5r/how_to_convert_10x_matrix_tsv_files_to_hdf5_format/>)
  
  **Tags:** single-cell, cellranger, hdf5
  
  > **Comments:**
  > **username_1**: Conversion into HDF5 from Python3 is straight forward. Could you please forward your CellRanger output example? The key is ... the key and I'd need to see the stuff you want to write and look at the keys in a CellRanger file (keys are everything in HDF5)  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2022-06-17. Score: 0
  
  Conversion into HDF5 from Python3 is straight forward, if this is a simple key: value dictionary format then it *should* be easy to mimic the CellRanger format. If it is a more complex data structure that would be tricky. The key to HDF5 is 'the HDF5 key' which you need to find (you would call it the directory)
  
  To find the 'key' one approach is do is download <https://www.hdfgroup.org/downloads/hdfview/> and then forward a screenshot of the CellRanger HDF5 file here. The directories are what HDF5 call 'keys' and you need these to write to and call from HDF5. There is a CLI for this operation.
  
  An example of the data you are writing to would be needed.If per chance the data is in a Python dataframe you're in business, because these easily IO to HDF5
  
  All you do is put the data into a simple dictionary and assign the dictionary to a key which is written to HDF5. Parsing the data from e.g. an AlignIO/SeqIO object to the dictionary is more complicated. When the HDF5 is read, the key has to be supplied then the dictionary is extracted and assembled back into an object.
  
  
  ---
  
  ### Answer by username_2 on 2022-06-17. Score: 0
  
  Answered on biostars (<https://www.biostars.org/p/9527636/#9527638>) as well as on reddit: (<https://www.reddit.com/r/bioinformatics/comments/veku5r/how_to_convert_10x_matrix_tsv_files_to_hdf5_format/icqsfwn/>)
  
  The biostars answer is better as it needs just one package (DropletUtils) as opposed to the 2-3 required by the Seurat-allied packages suggested on reddit. Plus, Seurat can take forever to load a dataset.
  
  
  ---
  
  