Skip to content

Track merged guides, fix the measured-gene lookup, and carry the annotation tables - #15

Merged
emattei merged 3 commits into
mainfrom
feat/track-merged-guides
Oct 15, 2026
Merged

emattei merged 3 commits into
mainfrom
feat/track-merged-guides

Conversation

@emattei

@emattei emattei commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Three things, each its own commit.

oligo and n_oligos

Two library entries of one spacer are one feature in any reference built on
the spacer, and their reads land together. This library has 12 such pairs,
each a 20-mer and the same spacer with a 5' G.

They cannot be separated, and not for want of a better reference. The leader
ends in a poly-G run, so the extra base is indistinguishable from the
leader's own, and splitcode extracts a fixed 20 nt anchored on the scaffold,
which both entries yield identically. Cell Ranger keeps all 43,778 features
and assigns the 21-mer zero reads in all 12 pairs
-- its counts for those
guides are the 20-mer's alone, so the extra feature buys nothing.

So spacer stays what the reads can resolve and the feature count stays
43,766. oligo records what was ordered, n_oligos says how many entries
share the spacer, and above one a guide is not comparable with one ordered
once. Both reach guide_metadata.tsv, and so guide.var.

Measured: 24 entries flagged over 12 spacers; 33,164 of 43,778 entries carry
an extra 5' base, so oligo differs from spacer for three quarters of the
library.

The measured-gene lookup

chr:start-end is browser notation and therefore 1-based, while a pairs
table built from a BED's own columns is 0-based. The exact string match
between them found nothing, so all 26 validated enhancers carried no
putative_target_genes
-- silently.

180 of 340 enhancer guides now gain a gene. The remaining 160 are 14 elements
the BED marks e2g_validated that have no row in the pairs table at all.

The annotation tables in guide.uns

The signed distances, promoter transcripts and other-gene-type overlaps were
nowhere in the MuData. They cannot go in var: the annotation is one row per
guide per site per gene, 45,501 for 43,766 guides. Both tables are now
carried whole under --guide-annotation and --element-mapping, deciding
nothing.

730 tests pass.

🤖 Generated with Claude Code

emattei and others added 3 commits October 15, 2026 11:40
Two library entries of one spacer are one feature in any reference built on
the spacer, and their reads land together. This library has 12 such pairs,
each a 20-mer and the same spacer with a 5' G added for U6 transcription.

They cannot be separated, and not for want of a better reference: the leader
ends in a poly-G run, so the extra base is indistinguishable from the
leader's own, and splitcode extracts a fixed 20 nt anchored on the scaffold,
which both entries yield identically. Cell Ranger keeps all 43,778 features
and assigns the 21-mer zero reads in every one of the 12 pairs; its counts
for those guides are the 20-mer's alone.

So the spacer stays what the reads can resolve, and the table says which
guides carry a sum: `oligo` records what was ordered, `n_oligos` how many
entries share the spacer. Above one, a guide is not comparable with one
ordered once. Both columns travel into guide_metadata.tsv.

Measured on the hiPSC-to-EC library: 24 entries flagged over 12 spacers, and
33,164 of 43,778 entries carry an extra 5' base, so oligo differs from
spacer for three quarters of the library.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
chr:start-end is what a genome browser takes, and a browser is 1-based, so
an element named that way starts one base after the BED row it came from. A
pairs table that concatenated the BED's own columns is 0-based, and the exact
string match between them found nothing: all 26 validated enhancers of the
hiPSC-to-EC library carried no putative_target_genes, silently, until someone
asked where the target genes had gone.

The lookup now falls back to that one offset. Only that direction: the
reverse does not arise from the convention and would risk matching the
element next door.

On the library, 180 of 340 enhancer guides gain a gene. The other 160 are 14
elements the BED marks e2g_validated but which have no row in the pairs
table, so their genes are missing from the source rather than from the join.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
guide.var holds the IGVF columns, and the signed distances, promoter
transcripts and other-gene-type overlaps were nowhere in the object. They
cannot go in var either: guide_gene_annotation.tsv is one row per guide per
site per gene, 45,501 for 43,766 guides, and collapsing it would force a
rule on multi-site guides that nothing downstream asked for.

So both tables are carried whole in mod['guide'].uns, by --guide-annotation
and --element-mapping. Nothing is decided; the rows are there to be joined.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@emattei
emattei merged commit 6eac79d into main Oct 15, 2026
9 checks passed
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