Potency compared between cell types

Potency compared between cell types#

Whether a gene responds at a lower dose in one cell type than in another: its Hill curves in two cell types fitted together, the ratio of their EC50s with its interval and tests; Potency compared between cell types explains the fits, the covariance between cell types and how to read them.

Whether a gene responds at a lower dose in one cell type than in another.

The cell types of a pseudobulk series come from the same samples, so one animal’s profiles in two cell types co-vary: in the TCDD-dosed mouse livers of GSE184506 the residuals of the two hepatocyte zones’ profiles of one mouse correlate at a median of 0.70 over the genes of the repository’s fixture that pass both zones’ gates. Two EC50 intervals read apart then misstate the difference between the cell types, and no regulatory document defines a comparison of potency between cell types. compare_potency() fits a gene’s Hill curves in two cell types of a dose_response() result together, with the covariance between the two cell types’ dose-group means taken from the samples they share, and reads the ratio of their EC50s with its profile-likelihood interval, a test of equal potency and, at a margin set in advance, a test of equivalence, under three fits: a shared shape, as in the parallel-curve assays of relative potency (Slob 2002), where the ratio is that of the doses giving any change; a shared Hill slope; and free shapes (Ritz et al. 2006), each with a test of what it shares against free shapes (https://docs.nygen.io/CytePool/statistics/potency#potency-between-cell-types).

References

Slob W (2002). Dose-response modeling of continuous endpoints. Toxicological Sciences 66, 298-312. doi:10.1093/toxsci/66.2.298

Ritz C, Cedergreen N, Jensen JE, Streibig JC (2006). Relative potency in nonsimilar dose-response curves. Weed Science 54, 407-412. doi:10.1614/WS-05-185R.1

Zellner A (1962). An efficient method of estimating seemingly unrelated regressions and tests for aggregation bias. Journal of the American Statistical Association 57, 348-368. doi:10.1080/01621459.1962.10480664

Schuirmann DJ (1987). A comparison of the two one-sided tests procedure and the power approach for assessing the equivalence of average bioavailability. Journal of Pharmacokinetics and Biopharmaceutics 15, 657-680. doi:10.1007/BF01068419

Berger RL, Hsu JC (1996). Bioequivalence trials, intersection-union tests and equivalence confidence sets. Statistical Science 11, 283-319. doi:10.1214/ss/1032280304

GraphPad Software (2026). Fitting the ratio of two EC50 values. FAQ 901, read 2026-12-01. https://www.graphpad.com/support/faqid/901/

Golub GH, Pereyra V (1973). The differentiation of pseudo-inverses and nonlinear least squares problems whose variables separate. SIAM Journal on Numerical Analysis 10, 413-432. doi:10.1137/0710036

Kaufman L (1975). A variable projection method for solving separable nonlinear least squares problems. BIT 15, 49-57. doi:10.1007/BF01932995

Brent RP (1973). Algorithms for Minimization without Derivatives. Prentice-Hall, Englewood Cliffs.

cytepool.compare_potency(result, groups, *, genes, equivalence_fold=None)#

Test whether genes respond at a lower dose in one cell type than in another.

For each gene, its Hill curves in two cell types of a dose_response() result fitted together, by generalised least squares on the two cell types’ dose-group means stacked, with their covariance: each cell type’s own, as its curves read it, and between the cell types the covariance from the samples they share, from the correlation of their standardised residuals over those samples (seemingly unrelated regressions; Zellner 1962). The ratio is the first cell type’s EC50 over the second’s, below 1 where the first responds at lower doses, with its two-sided 95% profile-likelihood interval and the F-test of a ratio of 1, under three fits:

  • "shared_shape": one Hill slope and one maximal change, each cell type its own level at dose 0, so that one curve is the other shifted along log dose and the ratio is that of the doses giving any change, benchmark doses at an absolute benchmark response included, as in parallel-curve assays of relative potency (Slob 2002) and Prism’s EC50 shift, which shares the levels too (GraphPad FAQ 901). Relative potency in a bioassay is the inverse, the second cell type’s EC50 over the first’s.

  • "shared_slope": one Hill slope, each cell type its own maximal change; the ratio is that of the half-maximal doses.

  • "free_shapes": the ratio of half-maximal doses of curves that need not be parallel, which differs from the ratio at other levels of response (Ritz et al. 2006).

Each fit has the F-test of what it shares against free shapes (shape_p_value) and of the curves against free dose-group means (lack_of_fit_p_value). Read the shared shape where both tests give p of 0.1 or more, then the shared slope where its shape test does, and free shapes otherwise; where the row read has a lack-of-fit p below 0.1, its ratio is approximate. Better, choose the fit before seeing the data where the question allows, since choosing it by a test moves the coverage of the interval. At a true ratio of 1, the shared fits’ test of equal potency rejected in 5.9% of genes at 9 dose groups x 3 with changes of 6 to 12 SDs, in 6% to 7% at 2 replicates or 5 doses, and in 10% to 12% with changes of 2 to 4 SDs, where the free shapes’ test rejected in 3% or less; for weak responses, read a shared fit’s p-value near 0.05 as borderline. The curves are fitted together, so the covariance between the cell types moves each cell type’s EC50s: the free shapes’ EC50s equal each cell type’s own only when the cell types share no sample, and where a curve misses its means they can move far from them, so compare them with table(group, "ec50s") before reading them as each cell type’s own. With equivalence_fold, the two one-sided tests of a ratio within [1/fold, fold] (Schuirmann 1987), each from the deviance over its null region, and their larger p-value (Berger and Hsu 1996).

The tests and intervals read F(1, df), df the smaller of the two cell types’ degrees of freedom and, with shared samples, of the correlation’s (correlation_df). Each call computes the two cell types’ fits again (DoseResponseResult.fit, the time of their analyses), then takes about 0.6 s of computing per gene on 2 threads for the three fits, their intervals and the equivalence test; the genes are shared among the analysis’s threads, and results do not depend on the threads. https://docs.nygen.io/CytePool/statistics/potency#potency-between-cell-types explains the fits, the covariance and how to read them.

Parameters:
  • result – A dose_response() result of a cube’s genes with models "ll4", "dromics" or "dosefinding", whose Hill curve ("ll4", or the sigmoid Emax model) is compared, in any variance mode.

  • groups – The two cell types, in order: the ratio is the first’s EC50 over the second’s.

  • genes – A feature id or symbol, or a list of them, each with curves in both cell types. Name genes that pass the gate in both cell types: a flat gene’s EC50 is arbitrary, and so is a ratio of two. Each gene costs about 0.6 s.

  • equivalence_fold – None for no equivalence test, or a factor above 1, such as 3, which the ratio must lie within.

Returns:

The ratios, tests and curves of each gene under each fit.

Raises:
  • TypeError – If result is not a DoseResponseResult, groups is not a list of cell types (str), genes is not a feature id or symbol or a list of them, or equivalence_fold is not a real number.

  • ValueError – If the result tests scores or the composition of cell types, ran rules, has no curves or curves of "epa" or "bmdexpress", or weighted or moderated curves with limma’s approximate standard errors; groups does not name two distinct cell types; a cell type supports only description or was not fitted, or its Hill curve was not fitted; genes is empty, names a gene twice, or names a symbol that is a different gene in each cell type; or equivalence_fold is not finite and above 1, or lies beyond the ratios the two cell types’ EC50 bounds allow.

  • KeyError – If a cell type was not checked, or genes have no curves in a cell type; the message names them all.

Used in: Dose response per cell type

Explained in: Choosing a method, Potency and points of departure

class cytepool.PotencyComparison(groups, model_set, model, variance, unit, equivalence_fold, n_shared_samples, feature_ids, symbols, residual_correlation, correlation_df, df, passes_gate, not_compared_reason, weighted_sum_of_squares, converged, ec50_ratio, ec50_ratio_lower, ec50_ratio_upper, p_value, adjusted_p_value, shape_p_value, lack_of_fit_p_value, equivalence_p_value, adjusted_equivalence_p_value, interval_not_computed, ec50, hill_slope, bottom_plateau, top_plateau, ec50_status, two_doses_beyond_each_bend, parameters_at_bounds)#

The EC50 ratios of genes between two cell types, from compare_potency().

Arrays have one row per gene, in the order given; those of the fits a column per fit, in the order shared_shape, shared_slope, free_shapes; those of the curves a last axis per cell type, in the order of groups. They are read-only. A gene that was not compared has NaN in every row and its reason in not_compared_reason. https://docs.nygen.io/CytePool/statistics/potency#potency-between-cell-types explains how to read them.

Variables:
  • groups – The two cell types; each ratio is the first’s EC50 over the second’s.

  • model_set – The result’s set of curves.

  • model – The Hill curve compared, "ll4" or "sigmoid_emax".

  • variance – The variance mode of the result’s curves.

  • unit – The dose axis’s unit, of the EC50s.

  • equivalence_fold – The margin of the equivalence test, None without it.

  • n_shared_samples – The samples both cell types fitted.

  • feature_ids – (n_genes,) the genes’ ids.

  • symbols – (n_genes,) their symbols; None when the cube has none.

  • residual_correlation – (n_genes,) the correlation of the two cell types’ standardised residuals over the shared samples; NaN without them.

  • correlation_df – (n_genes,) the degrees of freedom of the correlation: the residuals’ expected cross-product over the shared samples in units of the correlation, n - K when every sample is shared; 0 without shared samples.

  • df – (n_genes,) the denominator degrees of freedom of the tests and intervals: the smaller of the two cell types’ and, with shared samples, of correlation_df.

  • passes_gate – (n_genes, 2) the gate’s call in each cell type; None where the gate did not run in both.

  • not_compared_reason – (n_genes,) why a gene was not compared, empty where it was.

  • weighted_sum_of_squares – (n_genes, 3) each fit’s sum of squares of the stacked means about the curves, weighted by the inverse of their covariance.

  • converged – (n_genes, 3) False where a fit’s refinement stopped at its iteration limit before converging; such a fit is read as it stands.

  • ec50_ratio – (n_genes, 3) the first cell type’s EC50 over the second’s.

  • ec50_ratio_lower – (n_genes, 3) the lower end of its two-sided 95% profile-likelihood interval, 0 at an open end, NaN where the profile found a better curve than the fit.

  • ec50_ratio_upper – (n_genes, 3) the upper end, infinity at an open end.

  • p_value – (n_genes, 3) the F-test of a ratio of 1.

  • adjusted_p_value – (n_genes, 3) Benjamini-Hochberg’s adjustment of p_value over the genes within each fit.

  • shape_p_value – (n_genes, 3) the F-test of the fit against free shapes, NaN for free shapes.

  • lack_of_fit_p_value – (n_genes, 3) the F-test of the fit against free dose-group means in both cell types.

  • equivalence_p_value – (n_genes, 3) the two one-sided tests of a ratio within [1/fold, fold]; None without a fold.

  • adjusted_equivalence_p_value – (n_genes, 3) their Benjamini-Hochberg adjustment over the genes within each fit; None without a fold.

  • interval_not_computed – (n_genes, 3) whether a profile found a curve better than the fit, so that the fit was not the minimum; its interval and tests of equal potency and equivalence are then NaN.

  • ec50 – (n_genes, 3, 2) each cell type’s EC50, defined as in table(group, "ec50s"), from the joint fit.

  • hill_slope – (n_genes, 3, 2) each cell type’s Hill slope, in GraphPad Prism’s sign.

  • bottom_plateau – (n_genes, 3, 2) each cell type’s lower plateau.

  • top_plateau – (n_genes, 3, 2) each cell type’s upper plateau.

  • ec50_status – (n_genes, 3, 2) where each EC50 lies, "within the doses", "below the lowest dose" or "above the top dose"; "no curve" for a cell type without a Hill curve or a fit that found none, and "not compared" for the other cell type of a gene that was not compared.

  • two_doses_beyond_each_bend – (n_genes, 3, 2) Sebaugh’s condition for reporting an EC50.

  • parameters_at_bounds – (n_genes, 3, 2) "ec50", "hill_slope" or both, where the curve sits at a bound or within 0.01% of it.

Explained in: Potency and points of departure

table(name='ratios')#

Return the ratios or the curves as a table.

"ratios": one row per gene and fit, genes in the order given and each gene’s fits in the order shared_shape, shared_slope, free_shapes: feature_id, symbol (when the cube has one), fit, ec50_ratio, ec50_ratio_lower, ec50_ratio_upper, p_value, adjusted_p_value, shape_p_value, lack_of_fit_p_value, df, residual_correlation, passes_both_gates (where the gate ran in both cell types), ec50s_within_the_doses (both EC50s from the lowest positive dose to the top dose), parameters_at_bounds (each with its cell type, or "shared" for a shared slope, such as "hill_slope (shared)"), converged, not_compared_reason, and with a fold equivalence_p_value and adjusted_equivalence_p_value.

"curves": one row per gene, fit and cell type: feature_id, symbol, fit, group_id, ec50, hill_slope, bottom_plateau, top_plateau, ec50_status, passes_gate (where the gate ran in both cell types), two_doses_beyond_each_bend, parameters_at_bounds and not_compared_reason, as a row of the result’s table "ec50s".

Raises:
  • TypeError – If name is not a string.

  • ValueError – If name is not "ratios" or "curves".

Explained in: Potency and points of departure