Fix the track_indices name desync, and restore predict-and-plot

#1

Four fixes on top of the pipeline, all tested against the checkpoint on CPU.

1. track_indices desynced the channel names, silently

track_indices narrowed the tensor but not track_ids, so out.track(id) indexed the wrong column. On chr19:6,700,000-6,716,384 asking for ENCSR056HPM and ENCSR000AKO:

sub.tracks.shape     -> (6144, 2)
len(sub.track_ids)   -> 7362          # still the full panel

sub.track("kai1")    -> mean 0.00568903
  real kai1          -> mean 0.0778583     not this
  real ENCSR056HPM   -> mean 0.00568902    this

The call succeeded and returned a different track than the name asked for, 14x off. A name whose index sat past the narrowed width raised IndexError instead. Since track_indices is how you avoid an 11.6 GB forward at 1 Mb, this hit exactly the people using it as intended.

Fixed by resolving the channel set in one place, _select_channels, called from preprocess. The names and the indices are produced together, so they cannot drift. _forward no longer takes them as a separate parameter.

2. Selecting tracks by id, and plot=True was silently ignored

plot and tracks_to_plot were swallowed by _sanitize_parameters: the call returned normally and drew nothing. There was no plotting in the file. This restores the one-call predict-and-plot from the 2025 Space, which is the interface people are used to:

out = predictor({"chrom": "chr19", "start": 6_700_000, "end": 6_732_768, "species": "human"},
                plot=True, tracks_to_plot={"K562 RNA-seq": "ENCSR056HPM"})

Adds track_ids=["ENCSR..."] to select by id rather than by integer, and tracks_to_plot implies it, so plotting two tracks computes two channels instead of 7,362. Verified bit-comparable to slicing the full panel, max diff 1.2e-07. matplotlib is imported lazily inside the plot helper, so the pipeline still has no hard dependency on it. plot=True without tracks_to_plot now raises rather than doing nothing.

3. Three assemblies bypassed the "pass 'seq' directly" message

That message only fired on a 200 carrying no dna. An assembly UCSC does not host answers 400, or with something that is not JSON, so pig, wheat and cotton raised a bare HTTPError or JSONDecodeError. The fetch now catches those and explains.

Pig also just works now: UCSC answers to Sscrofa11.1, while track_metadata says Sscrofa11. That is the only assembly name needing a translation, so it is a one-entry UCSC_ASSEMBLY_ALIASES rather than a table. I checked all 15 against the live API: 13 resolve under the config's own name, and only IWGSC and Gossypium_hirsutum_v2.1 are genuinely not hosted, which is what the improved message is for.

4. skip_lm_head=True

The pipeline never returns the language-model logits, and at 1 Mb that head is not free.

Tested

Full panel, track_ids, track_indices, plotting, plot without tracks, and pig, wheat, cotton and arabidopsis by coordinates. Values match the plain AutoModel path. pyflakes clean.

Nothing else in the repo is touched, and config.json is unchanged.

Yanisadel changed pull request status to merged

Sign up or log in to comment