Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
d00724b
Compute multivariate t probabilities and quantiles with their errors
parashardhapola Nov 20, 2026
78530fe
Test several contrasts of each gene at one error rate per gene
parashardhapola Nov 20, 2026
01700f1
Check multiple contrast tests against mvtnorm, multcomp and mpmath
parashardhapola Nov 20, 2026
7491073
Explain multiple contrast tests and use them in the bulk RNA-seq guide
parashardhapola Nov 20, 2026
d95cd0e
Test the running maximum that keeps p-values in order within a gene
parashardhapola Nov 20, 2026
6898921
Search quantiles between their exact bounds and test limits per coord…
parashardhapola Nov 20, 2026
4bd2367
Test a moderated fit's contrasts and refuse groups and covariances th…
parashardhapola Nov 20, 2026
aaefc60
Correct the Bonferroni gap and read contrasts at stageR's confirmatio…
parashardhapola Nov 20, 2026
c6fe18f
Check limits per coordinate and deep tails of general correlations
parashardhapola Nov 20, 2026
02acc6c
Point mismatched contrasts of a fit and an intercept to remedies that…
parashardhapola Nov 20, 2026
13ad4ff
Record the rerun of the multiple contrast validation
parashardhapola Nov 20, 2026
824a75a
Execute the bulk RNA-seq guide on the final code
parashardhapola Nov 20, 2026
7c1a59e
Cite QUADPACK for the quadrature of two-coordinate boxes
parashardhapola Nov 20, 2026
3af7821
Point the dose chapter's tests of each dose to multiple contrast tests
parashardhapola Nov 20, 2026
ce00438
Print the strongest genes of the multiple contrast test rounded
parashardhapola Nov 20, 2026
87d77a0
Print the spline's strongest genes in the dose guide rounded
parashardhapola Nov 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions cytepool/design/_contrast_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,25 @@ def _is_or_are(items: Sequence[Any]) -> str:


def contrast_matrix(
contrasts: Any, names: Sequence[str] | None, coefficient_names: tuple[str, ...]
contrasts: Any,
names: Sequence[str] | None,
coefficient_names: tuple[str, ...],
*,
target: str = "the fit's coefficients",
remedy: str | None = None,
) -> tuple[FloatArray, tuple[str, ...]]:
"""The contrast matrix, rows in the order of the coefficients, and its names.

Weights that name their coefficients are matched to them by name, by the
rule of :func:`weights_on_columns`; the others
are taken in order.
are taken in order. Messages name the coefficients as ``target`` and end a
mismatch with ``remedy``, by default how to make contrasts that match a fit.
"""
reject_masked_contrasts(contrasts, "contrasts")
reject_masked(names, "names")
n_coefficients = len(coefficient_names)
remedy = _contrasts_remedy(coefficient_names)
if remedy is None:
remedy = _contrasts_remedy(coefficient_names)
named = is_named_contrasts(contrasts)
if (named or isinstance(contrasts, Mapping)) and names is not None:
raise ValueError(
Expand All @@ -189,7 +196,7 @@ def contrast_matrix(
contrasts,
coefficient_names,
label="the contrasts",
target="the fit's coefficients",
target=target,
remedy=remedy,
)
matrix = real_array(weights, "contrasts")
Expand All @@ -207,13 +214,13 @@ def contrast_matrix(
vector,
coefficient_names,
label=f"contrast {key!r}",
target="the fit's coefficients",
target=target,
remedy=remedy,
)
values = real_array(weights, f"contrast {key!r}")
if values.shape != (n_coefficients,):
raise ValueError(
f"contrast {key!r} must have one value per coefficient "
f"contrast {key!r} must have one value for each of {target} "
f"({n_coefficients}), got shape {values.shape}"
)
vectors.append(values)
Expand All @@ -232,15 +239,15 @@ def contrast_matrix(
contrasts,
coefficient_names,
label="the contrasts",
target="the fit's coefficients",
target=target,
remedy=remedy,
)
matrix = real_array(weights, "contrasts")
if matrix.ndim == 1:
matrix = matrix[:, np.newaxis]
if matrix.ndim != 2 or matrix.shape[0] != n_coefficients:
raise ValueError(
"contrasts must have one row per coefficient of the fit "
f"contrasts must have one row for each of {target} "
f"({n_coefficients}), got shape {matrix.shape}"
)
if matrix.shape[1] == 0:
Expand Down
9 changes: 5 additions & 4 deletions cytepool/stats/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Statistical building blocks on arrays: distributions and special functions, multiple
testing, linear and mixed models, empirical Bayes moderation, voom and dream's weights,
sample weights, count models, combined p-values, meta-analysis, SumRank and fractions of
variance. The functions an analysis starts from are at the top level, ``cytepool``."""
"""Statistical building blocks on arrays: distributions and special functions,
multivariate t probabilities, multiple testing and multiple contrast tests, linear and
mixed models, empirical Bayes moderation, voom and dream's weights, sample weights,
count models, combined p-values, meta-analysis, SumRank and fractions of variance. The
functions an analysis starts from are at the top level, ``cytepool``."""
4 changes: 2 additions & 2 deletions cytepool/stats/_result_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def coefficient_position(value: Any, names: tuple[str, ...]) -> int:
position = integral_number(value, "coefficient", expected="a name or a position")
if not -len(names) <= position < len(names):
raise IndexError(
f"coefficient position {position} is out of range for {len(names)} "
"coefficients"
f"position {position} is out of range for {len(names)} coefficients or "
"contrasts"
)
return position % len(names)
Loading