Skip to content

Write gene_id_to_name.tsv when indexing a probe set CSV#202

Open
an-altosian wants to merge 1 commit into
COMBINE-lab:mainfrom
an-altosian:feat/index-probe-csv-gene-id-to-name
Open

Write gene_id_to_name.tsv when indexing a probe set CSV#202
an-altosian wants to merge 1 commit into
COMBINE-lab:mainfrom
an-altosian:feat/index-probe-csv-gene-id-to-name

Conversation

@an-altosian

Copy link
Copy Markdown
Contributor

What

simpleaf index --probe-csv now writes a gene_id_to_name.tsv mapping into the reference dir and copies it into the built index, when the probe set CSV carries a gene-symbol column (gene_name or gene_symbol).

Why

The gene_id→name mapping was only generated on the auto-build path used by multiplex-quant/quant (via probe_utils::convert_probe_csv_to_reference_files). When a user prebuilds a probe index with simpleaf index --probe-csv and passes it via --index, no mapping was produced, so downstream quant could only surface Ensembl gene IDs, not names. The GTF/roers reference path already emits gene_id_to_name.tsv; this brings the probe-CSV path to parity.

Behavior

  • Includes every gene in the probe set, independent of the included flag (a complete gene annotation, not matrix contents).
  • Conflicting names for the same gene_id are rejected with a clear error (matches probe_utils semantics).
  • Sets index_info["gene_id_to_name"]; the existing copy step propagates the file into the final index dir, so quant picks it up automatically.

Tests

  • New unit test insert_gene_name_dedups_and_detects_conflicts (dedup + conflict).
  • Verified end-to-end: simpleaf index --probe-csv on a 3-gene CSV (including an excluded-only gene) produces ref/gene_id_to_name.tsv and index/gene_id_to_name.tsv with all genes mapped.

Scope

Single-file change: src/simpleaf_commands/indexing.rs.

When `simpleaf index` builds from a 10x probe set CSV that carries a gene
symbol column (`gene_name` or `gene_symbol`), it now emits a
`gene_id_to_name.tsv` mapping into the reference and the built index.

Previously this mapping was only produced on the auto-build path inside
`multiplex-quant`/`quant` (via probe_utils), so a prebuilt probe index
passed with `--index` carried no gene names. The GTF/roers path already
wrote the file; this brings the probe-csv path to parity, letting
downstream `quant` surface gene names for prebuilt probe indexes.

The mapping covers every gene in the probe set independent of the
`included` flag (it is a complete gene annotation, not matrix contents);
conflicting names for the same gene_id are rejected.

The insert-with-conflict-check and TSV-write logic are factored into two
shared `probe_utils` helpers (`insert_gene_name`, `write_gene_id_to_name`)
used by BOTH the auto-build path and `simpleaf index`, so the logic is not
duplicated. Adds a unit test for the dedup/conflict behavior.
@an-altosian
an-altosian force-pushed the feat/index-probe-csv-gene-id-to-name branch from ac97387 to 272f649 Compare June 5, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant