Part of #20. Depends on the 10x h5 reader in #23.
Format
output.h5 / output_filtered.h5 are 10x-v3 compatible under /matrix, plus:
/droplet_latents: barcode_indices_for_latents, cell_probability, cell_size, background_fraction, droplet_efficiency, gene_expression_encoding
/global_latents: ambient_expression, empty_droplet_size_lognormal_loc, posterior_probs, …
/metadata: learning curve, target fpr, and more
Mapping
Options
--raw RAW.h5 adds the raw Cell Ranger counts as layers["raw"], aligned by barcode (like cellbender.remove_background.downstream.load_anndata_from_input_and_output)
--filtered keeps only barcodes with cell_probability > 0.5 when converting the unfiltered file (threshold configurable)
Gotchas
CellBender 0.3.0 wrote h5 files that scanpy failed to read until 0.3.2 added a ptrepack fix. Accept both 0.2.x and 0.3.x layouts.
Tests
h5py fixtures mimicking 0.2 and 0.3 outputs; verify against a real CellBender run from cellgeni tickets; compare X with scanpy.read_10x_h5 on the same file.
Part of #20. Depends on the 10x h5 reader in #23.
Format
output.h5/output_filtered.h5are 10x-v3 compatible under/matrix, plus:/droplet_latents:barcode_indices_for_latents,cell_probability,cell_size,background_fraction,droplet_efficiency,gene_expression_encoding/global_latents:ambient_expression,empty_droplet_size_lognormal_loc,posterior_probs, …/metadata: learning curve, target fpr, and moreMapping
X← denoised counts (via Convert: 10x HDF5 (Cell Ranger*_feature_bc_matrix.h5), import and export #23)obscolumns, scattered bybarcode_indices_for_latents; NaN for droplets not analysedgene_expression_encoding→obsm["X_cellbender"]ambient_expression→var["ambient_expression"]uns["cellbender"]Options
--raw RAW.h5adds the raw Cell Ranger counts aslayers["raw"], aligned by barcode (likecellbender.remove_background.downstream.load_anndata_from_input_and_output)--filteredkeeps only barcodes withcell_probability > 0.5when converting the unfiltered file (threshold configurable)Gotchas
CellBender 0.3.0 wrote h5 files that scanpy failed to read until 0.3.2 added a
ptrepackfix. Accept both 0.2.x and 0.3.x layouts.Tests
h5py fixtures mimicking 0.2 and 0.3 outputs; verify against a real CellBender run from cellgeni tickets; compare
Xwithscanpy.read_10x_h5on the same file.