SpiDEResults

SpiDEResults(table, condition, contrast, procedure, fdr, fit)

The results of spiDE’s niche tests, returned by spidepy.test_spide and spidepy.spide; read it with results.

Attributes

Name Type Description
table pandas.DataFrame One row per (gene, index, niche, test): gene, index, niche, test, estimate, se, t, df, p, n_patients, p.heterogeneity (R p.heterogeneity; NA for the sandwich engine), q and in_family.
condition str or None The condition tested.
contrast str E.g. "Responder - Non-responder" (second level minus first; "" without a condition).
procedure str The condition test’s family.
fdr float The FDR level of the filter.
fit SpiDEFit The fit that was tested.

See Also

test_spide : Creates a SpiDEResults. results : Function form of SpiDEResults.results.

Examples

from spidepy import build_niches, fit_spide, test_spide
from spidepy.datasets import toy_spide
fit = fit_spide(build_niches(toy_spide(), sigma=30), condition="condition", verbose=False)
res = test_spide(fit)
print(res)
SpiDEResults (slopes engine)
  pooled across patients: 120 tests, 2 at FDR 0.05
  condition-specific (Responder - Non-responder; pooled_or_heterogeneity family): 2 tests, 1 at FDR 0.05
res.table.shape[1]
13

Methods

Name Description
results The results table (R results), ordered by p-value (missing last).

results

SpiDEResults.results(test=None, fdr=None)

The results table (R results), ordered by p-value (missing last).

Parameters

Name Type Description Default
test ('condition', 'pooled', 'both') Which test’s rows (default: the condition test if the table has one, else pooled). "condition"
fdr float Keep only the rows in a BH family with q <= fdr. None

Returns

Name Type Description
pandas.DataFrame The SpiDEResults.table rows of the chosen test, ordered by p (missing last).

See Also

results : Function form.

Examples

>>> from spidepy import build_niches, fit_spide, test_spide
>>> from spidepy.datasets import toy_spide
>>> fit = fit_spide(build_niches(toy_spide(), sigma=30), condition="condition", verbose=False)
>>> res = test_spide(fit)
>>> res.results(test="pooled").shape
(120, 13)
>>> res.results(fdr=0.05)[["gene", "index", "niche"]].values.tolist()
[['G1', 'A', 'B']]