Skip to content

Commit 1ff95f5

Browse files
committed
Merge branch 'main' of https://github.com/theislab/pertpy
2 parents 2d2d59b + b29d3a9 commit 1ff95f5

File tree

1 file changed

+48
-17
lines changed

1 file changed

+48
-17
lines changed

pertpy/tools/_coda/_sccoda.py

Lines changed: 48 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ def load(
9090
>>> import pertpy as pt
9191
>>> haber_cells = pt.dt.haber_2017_regions()
9292
>>> sccoda = pt.tl.Sccoda()
93-
>>> mdata = sccoda.load(haber_cells, type="cell_level", generate_sample_level=True, cell_type_identifier="cell_label", \
94-
sample_identifier="batch", covariate_obs=["condition"])
93+
>>> mdata = sccoda.load(haber_cells,
94+
>>> type="cell_level",
95+
>>> generate_sample_level=True,
96+
>>> cell_type_identifier="cell_label",
97+
>>> sample_identifier="batch", covariate_obs=["condition"])
9598
"""
9699
if type == "cell_level":
97100
if generate_sample_level:
@@ -144,8 +147,12 @@ def prepare(
144147
>>> import pertpy as pt
145148
>>> haber_cells = pt.dt.haber_2017_regions()
146149
>>> sccoda = pt.tl.Sccoda()
147-
>>> mdata = sccoda.load(haber_cells, type="cell_level", generate_sample_level=True, cell_type_identifier="cell_label", \
148-
sample_identifier="batch", covariate_obs=["condition"])
150+
>>> mdata = sccoda.load(haber_cells,
151+
>>> type="cell_level",
152+
>>> generate_sample_level=True,
153+
>>> cell_type_identifier="cell_label",
154+
>>> sample_identifier="batch",
155+
>>> covariate_obs=["condition"])
149156
>>> mdata = sccoda.prepare(mdata, formula="condition", reference_cell_type="Endocrine")
150157
"""
151158
if isinstance(data, MuData):
@@ -193,10 +200,14 @@ def set_init_mcmc_states(self, rng_key: None, ref_index: np.ndarray, sample_adat
193200
>>> import pertpy as pt
194201
>>> haber_cells = pt.dt.haber_2017_regions()
195202
>>> sccoda = pt.tl.Sccoda()
196-
>>> mdata = sccoda.load(haber_cells, type="cell_level", generate_sample_level=True, cell_type_identifier="cell_label", \
197-
sample_identifier="batch", covariate_obs=["condition"])
203+
>>> mdata = sccoda.load(haber_cells,
204+
>>> type="cell_level",
205+
>>> generate_sample_level=True,
206+
>>> cell_type_identifier="cell_label",
207+
>>> sample_identifier="batch",
208+
>>> covariate_obs=["condition"])
198209
>>> mdata = sccoda.prepare(mdata, formula="condition", reference_cell_type="Endocrine")
199-
>>> adata = sccoda.set_init_mcmc_states(rng_key=42, ref_index=0, sample_adata=mdata['coda'])
210+
>>> adata = sccoda.set_init_mcmc_states(rng_key=42, ref_index=0, sample_adata=mdata["coda"])
200211
"""
201212
# data dimensions
202213
N, D = sample_adata.obsm["covariate_matrix"].shape
@@ -312,8 +323,12 @@ def make_arviz( # type: ignore
312323
>>> import pertpy as pt
313324
>>> haber_cells = pt.dt.haber_2017_regions()
314325
>>> sccoda = pt.tl.Sccoda()
315-
>>> mdata = sccoda.load(haber_cells, type="cell_level", generate_sample_level=True, cell_type_identifier="cell_label", \
316-
sample_identifier="batch", covariate_obs=["condition"])
326+
>>> mdata = sccoda.load(haber_cells,
327+
>>> type="cell_level",
328+
>>> generate_sample_level=True,
329+
>>> cell_type_identifier="cell_label",
330+
>>> sample_identifier="batch",
331+
>>> covariate_obs=["condition"])
317332
>>> mdata = sccoda.prepare(mdata, formula="condition", reference_cell_type="Endocrine")
318333
>>> sccoda.run_nuts(mdata, num_warmup=100, num_samples=1000, rng_key=42)
319334
>>> arviz_data = sccoda.make_arviz(mdata, num_prior_samples=100)
@@ -414,8 +429,12 @@ def run_nuts(
414429
>>> import pertpy as pt
415430
>>> haber_cells = pt.dt.haber_2017_regions()
416431
>>> sccoda = pt.tl.Sccoda()
417-
>>> mdata = sccoda.load(haber_cells, type="cell_level", generate_sample_level=True, cell_type_identifier="cell_label", \
418-
sample_identifier="batch", covariate_obs=["condition"])
432+
>>> mdata = sccoda.load(haber_cells,
433+
>>> type="cell_level",
434+
>>> generate_sample_level=True,
435+
>>> cell_type_identifier="cell_label",
436+
>>> sample_identifier="batch",
437+
>>> covariate_obs=["condition"])
419438
>>> mdata = sccoda.prepare(mdata, formula="condition", reference_cell_type="Endocrine")
420439
>>> sccoda.run_nuts(mdata, num_warmup=100, num_samples=1000, rng_key=42)
421440
"""
@@ -429,8 +448,12 @@ def credible_effects(self, data: AnnData | MuData, modality_key: str = "coda", e
429448
>>> import pertpy as pt
430449
>>> haber_cells = pt.dt.haber_2017_regions()
431450
>>> sccoda = pt.tl.Sccoda()
432-
>>> mdata = sccoda.load(haber_cells, type="cell_level", generate_sample_level=True, cell_type_identifier="cell_label", \
433-
sample_identifier="batch", covariate_obs=["condition"])
451+
>>> mdata = sccoda.load(haber_cells,
452+
>>> type="cell_level",
453+
>>> generate_sample_level=True,
454+
>>> cell_type_identifier="cell_label",
455+
>>> sample_identifier="batch",
456+
>>> covariate_obs=["condition"])
434457
>>> mdata = sccoda.prepare(mdata, formula="condition", reference_cell_type="Endocrine")
435458
>>> sccoda.run_nuts(mdata, num_warmup=100, num_samples=1000, rng_key=42)
436459
>>> credible_effects = sccoda.credible_effects(mdata)
@@ -445,8 +468,12 @@ def summary(self, data: AnnData | MuData, extended: bool = False, modality_key:
445468
>>> import pertpy as pt
446469
>>> haber_cells = pt.dt.haber_2017_regions()
447470
>>> sccoda = pt.tl.Sccoda()
448-
>>> mdata = sccoda.load(haber_cells, type="cell_level", generate_sample_level=True, cell_type_identifier="cell_label", \
449-
sample_identifier="batch", covariate_obs=["condition"])
471+
>>> mdata = sccoda.load(haber_cells,
472+
>>> type="cell_level",
473+
>>> generate_sample_level=True,
474+
>>> cell_type_identifier="cell_label",
475+
>>> sample_identifier="batch",
476+
>>> covariate_obs=["condition"])
450477
>>> mdata = sccoda.prepare(mdata, formula="condition", reference_cell_type="Endocrine")
451478
>>> sccoda.run_nuts(mdata, num_warmup=100, num_samples=1000, rng_key=42)
452479
>>> sccoda.summary(mdata)
@@ -461,8 +488,12 @@ def set_fdr(self, data: AnnData | MuData, est_fdr: float, modality_key: str = "c
461488
>>> import pertpy as pt
462489
>>> haber_cells = pt.dt.haber_2017_regions()
463490
>>> sccoda = pt.tl.Sccoda()
464-
>>> mdata = sccoda.load(haber_cells, type="cell_level", generate_sample_level=True, cell_type_identifier="cell_label", \
465-
sample_identifier="batch", covariate_obs=["condition"])
491+
>>> mdata = sccoda.load(haber_cells,
492+
>>> type="cell_level",
493+
>>> generate_sample_level=True,
494+
>>> cell_type_identifier="cell_label",
495+
>>> sample_identifier="batch",
496+
>>> covariate_obs=["condition"])
466497
>>> mdata = sccoda.prepare(mdata, formula="condition", reference_cell_type="Endocrine")
467498
>>> sccoda.run_nuts(mdata, num_warmup=100, num_samples=1000, rng_key=42)
468499
>>> sccoda.set_fdr(mdata, est_fdr=0.4)

0 commit comments

Comments
 (0)