Skip to content

Polar basecalling - #208

Open
jshleap wants to merge 28 commits into
mainfrom
polar-basecalling
Open

Polar basecalling#208
jshleap wants to merge 28 commits into
mainfrom
polar-basecalling

Conversation

@jshleap

@jshleap jshleap commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Adding options for sign encoding and polar basecalling methods

joshua-gould and others added 20 commits August 17, 2026 09:21
Implements a parameter-free polar decoder separating amplitude (R, dark-base
detection) from direction (angle theta, base identity).

Two strategies, chosen from encoding matrix E (no chemistry-specific if/else
on channel count):
  Orthogonal E (4-ch identity, 3-ch dark-base): argmax(d . E_bright.T)
  Non-orthogonal E (2-col Illumina, A fires both channels):
    atan2-based angular classification with xtalk-inferred thresholds

Angle thresholds derived parameter-free from the xtalk correction matrix
via _polar_thresholds_from_wcor (midpoints between E_soft centroids).

Results matching polar_basecalling.ipynb:
  4-ch Exp C:    mapping_rate ~79.4%   cells ~74.7%  (2,966 watershed cells)
  3-ch NIS-seq:  mapping_rate ~43.5%   nuclei ~85%   (1,001 CellPose nuclei)
  2-col NIS-seq: mapping_rate ~29.4%   nuclei ~84%   (superior cell coverage vs SE)

Test data added to scallops/tests/data/:
  experimentC/cells.npy      watershed cell mask (1024x1024)
  nis_seq/                   pre-processed NIS-seq HeLa tile40
    spots_3ch_corrected.npy  (17520, 14, 3) xtalk-corrected 3-ch spots
    spots_2col_corrected.npy (17520, 14, 2) synthesised 2-col channels
    w_cor_3ch.npy            (3, 3) xtalk correction matrix
    peaks/labels/nuclei.npy  spot metadata and segmentation
    barcodes_whitelist.npy   154,646 RC Brunello barcodes
    secondary_thr.npy        per-chemistry secondary peak thresholds
@jshleap
jshleap requested a review from joshua-gould August 27, 2026 20:14
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.

2 participants