spacr.thresholds

Calculate effect-size thresholds for regression coefficients.

The estimators describe the spread around the coefficient centre. When negative-control guides are available, callers should estimate that spread from the controls so biological effects do not widen the null distribution. Each estimator returns a width in coefficient units except var, which is retained for compatibility and returns squared units.

Functions

canonical(→ str)

The canonical name for method.

coefficient_threshold(→ Tuple[Optional[float], str])

(threshold, sentence) for a set of control coefficients.

describe(→ str)

One line saying what a method measures.

Module Contents

spacr.thresholds.canonical(method) → str[source]

The canonical name for method.

Parameters:

method – threshold method name or accepted alias; falsey values mean "none".

Raises:

ValueError – naming every method, rather than falling back to a default the caller did not ask for.

spacr.thresholds.coefficient_threshold(values: Sequence[float], method='mad', multiplier: float = 3.0, centre: float | None = None) → Tuple[float | None, str][source]

(threshold, sentence) for a set of control coefficients.

Parameters:
  • values – the control coefficients – the null.

  • method – one of METHODS, or an alias.

  • multiplier – how many spreads wide the cut is.

  • centre – what to measure from; the MEDIAN of values by default, which is not moved by one control guide with a real phenotype. This screen has one – 000000_22 is a non-targeting control and the strongest effect in the run at +4.37.

Returns:

(None, reason) when no cut can be made, never a silent 0.

The sentence is not decoration: a threshold a reader cannot attribute is a threshold they cannot report, and it goes on the panel beside the line.

spacr.thresholds.describe(method) → str[source]

One line saying what a method measures.

Parameters:

method – threshold method name or accepted alias to describe.