Skip to content

Convert: CellBender remove-background output h5 #29

Description

@Claptar

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions