Sanger indel spectrum (editing efficiency without NGS)
sanger_indel_spectrumQuantify CRISPR editing from a pair of Sanger traces — an unedited control and the edited pool — by decomposing the edited trace onto shifted copies of the control. Returns the indel spectrum (how much of the pool carries each insertion or deletion size), the unedited fraction, and the R² of the decomposition, which is the number that says whether the model fits your traces at all. Non-negative least squares, so no allele is ever assigned a negative share. Does not work for base editing, which makes a mixed base rather than a shift. PREDICTED, NOT MEASURED. Every run reports its own R²: how much of the observed window the shifted-control basis actually explains. That is a measured adequacy of the model on YOUR traces, and a low value means the assumption is wrong here rather than that the edit is weak. On accuracy against a reference method for real samples, none is published for this implementation — the underlying decomposition is TIDE's, whose authors report their own concordance with amplicon sequencing, and that number does not transfer to this code so it is not quoted. This implementation's exact recovery of synthetic mixtures is deliberately not offered as validation either: it tests the arithmetic, not whether the model fits a real trace. Valid for: A pool of alleles that differ from one control read by simple insertions or deletions at a known cut site, where both reads come from the same amplicon and chemistry and both extend well past the cut. NOT valid for substitution-only edits — base editing produces a mixed base, not a shift, and this model cannot see it — nor for a knock-in whose insert is novel sequence rather than a frame shift of the control, nor for any run whose R² comes back low.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| guard | No | Bases skipped immediately after the cut, where the trace is least reliable. | |
| offset | No | Override the alignment offset between the reads. By default it is found from the base calls upstream of the cut, which is reported back along with the identity achieved. | |
| maxIndel | No | Largest indel to include in the basis, in bp (max 20). Every shift from −maxIndel to +maxIndel is fitted. | |
| cutPosition | Yes | 1-based position of the expected cut, in CONTROL read coordinates. | |
| editedBases | Yes | Base calls of the edited pool's read. | |
| controlBases | Yes | Base calls of the UNEDITED control read. | |
| windowLength | No | Bases downstream of the cut used for the decomposition (20-300). Longer is better conditioned but needs more clean read. | |
| editedChannels | Yes | Per-base [A, C, G, T] intensities of the edited read, same convention. | |
| controlChannels | Yes | Per-base [A, C, G, T] intensities of the control read, one row per called base, read at that base's peak location (trace arrays are indexed by scan, not by base). |