Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added smillie_2019 dataloader and renamed smillie dataset to tasccoda_example #450

Merged
merged 4 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion pertpy/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@
schraivogel_2020_tap_screen_chr11,
sciplex3_raw,
shifrut_2018,
smillie,
smillie_2019,
srivatsan_2020_sciplex2,
srivatsan_2020_sciplex3,
srivatsan_2020_sciplex4,
stephenson_2021_subsampled,
tasccoda_example,
tian_2019_day7neuron,
tian_2019_ipsc,
tian_2021_crispra,
Expand Down
36 changes: 33 additions & 3 deletions pertpy/data/_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,12 @@ def sciplex3_raw() -> AnnData: # pragma: no cover
return adata


def smillie() -> AnnData: # pragma: no cover
"""scRNA-seq data of the small intestine of mice under Ulcerative Colitis.
def tasccoda_example() -> AnnData: # pragma: no cover
"""Example for the coda part of a mudata object.

Resulting AnnData object (mudata['coda']) when preparing a dataset for processing with tascCODA.
Created using the smillie dataset, which comprises scRNA-seq data of the small intestine of mice under Ulcerative Colitis.
The full dataset containing the actual count data can be obtained via smillie_2019().

References:
Smillie, Christopher S et al. “Intra- and Inter-cellular Rewiring of the Human Colon during Ulcerative Colitis.”
Expand All @@ -143,7 +147,7 @@ def smillie() -> AnnData: # pragma: no cover
Returns:
:class:`~anndata.AnnData` object of the dataset.
"""
output_file_name = "smillie.h5ad"
output_file_name = "tasccoda_smillie.h5ad"
output_file_path = settings.datasetdir.__str__() + "/" + output_file_name
if not Path(output_file_path).exists():
_download(
Expand Down Expand Up @@ -1460,3 +1464,29 @@ def dong_2023() -> AnnData: # pragma: no cover
adata = sc.read_h5ad(output_file_path)

return adata


def smillie_2019() -> AnnData: # pragma: no cover
"""scRNA-seq data of the small intestine of mice under Ulcerative Colitis.
Lilly-May marked this conversation as resolved.
Show resolved Hide resolved

The resulting AnnData when preparing this dataset for processing with tascCODA is available via tasccoda_example().

References:
Smillie, Christopher S et al. “Intra- and Inter-cellular Rewiring of the Human Colon during Ulcerative Colitis.”
Cell vol. 178,3 (2019): 714-730.e22. doi:10.1016/j.cell.2019.06.029

Returns:
:class:`~anndata.AnnData` object of the dataset.
"""
output_file_name = "smillie_2019.h5ad.zip"
output_file_path = settings.datasetdir.__str__() + "/" + output_file_name.replace(".zip", "")
if not Path(output_file_path).exists():
_download(
url="https://figshare.com/ndownloader/files/43317285",
output_file_name=output_file_name,
output_path=settings.datasetdir,
is_zip=True,
)
adata = sc.read_h5ad(output_file_path)

return adata
4 changes: 2 additions & 2 deletions pertpy/plot/_coda.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ def draw_tree( # pragma: no cover
Examples:
Example with tascCODA:
>>> import pertpy as pt
>>> adata = pt.dt.smillie()
>>> adata = pt.dt.tasccoda_example()
>>> tasccoda = pt.tl.Tasccoda()
>>> mdata = tasccoda.load(
>>> adata, type="sample_level",
Expand Down Expand Up @@ -815,7 +815,7 @@ def draw_effects( # pragma: no cover
Examples:
Example with tascCODA:
>>> import pertpy as pt
>>> adata = pt.dt.smillie()
>>> adata = pt.dt.tasccoda_example()
>>> tasccoda = pt.tl.Tasccoda()
>>> mdata = tasccoda.load(
>>> adata, type="sample_level",
Expand Down
2 changes: 1 addition & 1 deletion pertpy/tools/_coda/_base_coda.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ def get_node_df(self, data: AnnData | MuData, modality_key: str = "coda"):
Examples:
Example with tascCODA (works only for model of type tree_agg, i.e. a tascCODA model):
>>> import pertpy as pt
>>> adata = pt.dt.smillie()
>>> adata = pt.dt.tasccoda_example()
>>> tasccoda = pt.tl.Tasccoda()
>>> mdata = tasccoda.load(
>>> adata, type="sample_level",
Expand Down
16 changes: 8 additions & 8 deletions pertpy/tools/_coda/_tasccoda.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def load(

Examples:
>>> import pertpy as pt
>>> adata = pt.dt.smillie()
>>> adata = pt.dt.tasccoda_example()
>>> tasccoda = pt.tl.Tasccoda()
>>> mdata = tasccoda.load(
>>> adata, type="sample_level",
Expand Down Expand Up @@ -176,7 +176,7 @@ def prepare(

Examples:
>>> import pertpy as pt
>>> adata = pt.dt.smillie()
>>> adata = pt.dt.tasccoda_example()
>>> tasccoda = pt.tl.Tasccoda()
>>> mdata = tasccoda.load(
>>> adata, type="sample_level",
Expand Down Expand Up @@ -322,7 +322,7 @@ def set_init_mcmc_states(self, rng_key: None, ref_index: np.ndarray, sample_adat

Examples:
>>> import pertpy as pt
>>> adata = pt.dt.smillie()
>>> adata = pt.dt.tasccoda_example()
>>> tasccoda = pt.tl.Tasccoda()
>>> mdata = tasccoda.load(
>>> adata, type="sample_level",
Expand Down Expand Up @@ -486,7 +486,7 @@ def make_arviz( # type: ignore

Examples:
>>> import pertpy as pt
>>> adata = pt.dt.smillie()
>>> adata = pt.dt.tasccoda_example()
>>> tasccoda = pt.tl.Tasccoda()
>>> mdata = tasccoda.load(
>>> adata, type="sample_level",
Expand Down Expand Up @@ -597,7 +597,7 @@ def run_nuts(
"""
Examples:
>>> import pertpy as pt
>>> adata = pt.dt.smillie()
>>> adata = pt.dt.tasccoda_example()
>>> tasccoda = pt.tl.Tasccoda()
>>> mdata = tasccoda.load(
>>> adata, type="sample_level",
Expand All @@ -617,7 +617,7 @@ def summary(self, data: AnnData | MuData, extended: bool = False, modality_key:
"""
Examples:
>>> import pertpy as pt
>>> adata = pt.dt.smillie()
>>> adata = pt.dt.tasccoda_example()
>>> tasccoda = pt.tl.Tasccoda()
>>> mdata = tasccoda.load(
>>> adata, type="sample_level",
Expand All @@ -638,7 +638,7 @@ def credible_effects(self, data: AnnData | MuData, modality_key: str = "coda", e
"""
Examples:
>>> import pertpy as pt
>>> adata = pt.dt.smillie()
>>> adata = pt.dt.tasccoda_example()
>>> tasccoda = pt.tl.Tasccoda()
>>> mdata = tasccoda.load(
>>> adata, type="sample_level",
Expand All @@ -659,7 +659,7 @@ def set_fdr(self, data: AnnData | MuData, est_fdr: float, modality_key: str = "c
"""
Examples:
>>> import pertpy as pt
>>> adata = pt.dt.smillie()
>>> adata = pt.dt.tasccoda_example()
>>> tasccoda = pt.tl.Tasccoda()
>>> mdata = tasccoda.load(
>>> adata, type="sample_level",
Expand Down
2 changes: 1 addition & 1 deletion tests/tools/_coda/test_tasccoda.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TesttascCODA:

@pytest.fixture
def smillie_adata(self):
smillie_adata = pt.dt.smillie()
smillie_adata = pt.dt.tasccoda_example()
smillie_adata = sc.pp.subsample(smillie_adata, 0.1, copy=True)

return smillie_adata
Expand Down
Loading