Skip to content

B8a: 10x family, MTX and Parse converters #99

Closed

Description

@Claptar

Part of #87.

wave 2 · 0.17.5 · size M · starts after: nothing

Goal. 10x, CellBender, MTX and Parse round-trips are lossless, and their refusals are clear.

Owns: conversion/{tenx,features,cellbender,mtx,parse}.py, docs/reference/formats/{10x-h5,10x-mtx,cellbender,parse}.md

Approach:

  • Flex/probe export: write the right feature ids and boolean tags (F045, F048). --gene-*-column keeps the ids path (F046).
  • 10x h5 export:
    • float16 is widened (F049);
    • UTF-8 strings are written as UTF-8 (F110);
    • the consistency check covers every array (F109).
  • Refusals:
    • a --genome plus --feature-type combination with no features is refused (F101);
    • --from cellbender checks it really is CellBender (F098);
    • --raw that is not HDF5 gets a clear message (F099);
    • CellBender 0.2 global arrays (F097).
  • Move CellBender's scatter onto core/scatter.py. That is an existing STATUS follow-up, and it fixes F094. Also keep layers['cellranger'] index dtypes (F131).
  • MTX and Parse:
    • filtered/ and raw/ layouts (F105);
    • quote names safely on export (F106);
    • gzipped Parse tables (F108);
    • the all-well era (F107, plausible).
  • Docs: soften the scanpy-parity claim (F152).

Findings

Ref Sev Finding Where
F045 M Exporting an imported Flex (probe-level) matrix writes gene ids, or invented suffixed ids, as features/id and drops the probe ids src/adata/conversion/features.py:347
F046 M --gene-names-column or --gene-ids-column turns off the 'var names are ids' path, which gives a false 'no gene ids' refusal or, with … src/adata/conversion/features.py:347
F048 M Boolean feature tags (Flex filtered_probes) are exported as 'True'/'False' strings and read back as always-truthy strings src/adata/conversion/tenx.py:503
F049 M float16 X exported to 10x h5 (and loom) round-trips into a float16 CSR that anndata cannot read src/adata/conversion/tenx.py:548
F094 M CellBender's copy of the row-scatter lacks RowScatter's empty-scratch guard: zero kept droplets crash an h5ad output and give a 0-cell Zarr … src/adata/conversion/cellbender.py:611
F097 L CellBender 0.2: a global 1-D numeric array whose length happens to equal n_features is written into var as a per-feature column src/adata/conversion/cellbender.py:143
F098 L --from cellbender on a plain 10x file is accepted and writes a fake 'CellBender 0.2' result src/adata/conversion/cellbender.py:170
F099 L --raw given a file that is not HDF5 fails with h5py's 'file signature not found' instead of the intended message src/adata/conversion/cellbender.py:272
F101 L --genome G with --feature-type T silently writes a zero-feature output when no T feature belongs to G src/adata/conversion/features.py:135
F105 L An MTX folder holding filtered/ and raw/ subfolders is taken for a Cell Ranger 2 genome layout src/adata/conversion/mtx.py:185
F106 L 10x-mtx export writes names that break pandas/R TSV readers: a leading double quote, or an empty barcode src/adata/conversion/mtx.py:481
F107 L Parse import: the all-well era (split-pipe < 1.1) wrote DGE.mtx, which is not recognised (plausible) src/adata/conversion/parse.py:78
F108 L Parse import: gzipped all_genes.csv / cell_metadata.csv are not found though a gzipped matrix is src/adata/conversion/parse.py:82
F109 L The consistency check covers ids and names but not feature_type, gene_id, filtered_barcodes, indptr end or index range, so a malformed file … src/adata/conversion/tenx.py:220
F110 L 10x h5 export writes UTF-8 bytes into ASCII-typed fixed-width strings; scanpy.read_10x_h5 crashes on non-ASCII names src/adata/conversion/tenx.py:575
F131 L layers['cellranger'] from --raw is written with int32 indices and default layout, unlike X, which keeps the source's src/adata/conversion/cellbender.py:338
F152 L Docs and docstrings claim column-for-column parity with scanpy.read_10x_h5, which holds only with --var-names gene_symbols, and the 10x-h5 … docs/reference/formats/10x-h5.md:39

Done when one PR on fix/b8a closes this, with a regression test against an oracle for every finding, and docs and changelog in the same PR.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions