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

Incorporate use case tutorials #665

Merged
merged 4 commits into from
Sep 30, 2024
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
Binary file added docs/_static/tutorials/mcfarland.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/tutorials/norman.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/tutorials/zhang.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,7 @@
"tutorials/notebooks/differential_gene_expression": "_static/tutorials/dge.png",
"tutorials/notebooks/metadata_annotation": "_static/tutorials/metadata.png",
"tutorials/notebooks/ontology_mapping": "_static/tutorials/ontology.png",
"tutorials/notebooks/norman_use_case": "_static/tutorials/norman.png",
"tutorials/notebooks/mcfarland_use_case": "_static/tutorials/mcfarland.png",
"tutorials/notebooks/zhang_use_case": "_static/tutorials/zhang.png",
}
30 changes: 25 additions & 5 deletions docs/tutorials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,23 @@ Many are also designed to work seamlessly in Google colab.
For questions about the usage of pertpy use the [scverse discourse](https://discourse.scverse.org/).
:::

## Quick start
## Quick start: Tool specific tutorials

### Data transformation
```{eval-rst}
.. nbgallery::

notebooks/guide_rna_assignment
notebooks/mixscape
notebooks/perturbation_space
notebooks/metadata_annotation
notebooks/ontology_mapping
```

### Knowledge inference
```{eval-rst}
.. nbgallery::

notebooks/augur
notebooks/sccoda
notebooks/sccoda_extended
Expand All @@ -29,13 +39,23 @@ For questions about the usage of pertpy use the [scverse discourse](https://disc
notebooks/distance_tests
notebooks/cinemaot
notebooks/scgen_perturbation_prediction
notebooks/perturbation_space
notebooks/differential_gene_expression
notebooks/metadata_annotation
notebooks/ontology_mapping
```

### Glossary
## Use cases
Our use cases showcase a variety of pertpy tools applied to one dataset.
They are designed to give you a sense of how to use pertpy in a real-world scenario.
The use cases featured here are those we present in the pertpy [preprint](https://www.biorxiv.org/content/10.1101/2024.08.04.606516v1).

```{eval-rst}
.. nbgallery::

notebooks/norman_use_case
notebooks/mcfarland_use_case
notebooks/zhang_use_case
```

## Glossary

```{eval-rst}
.. tab-set::
Expand Down
9 changes: 4 additions & 5 deletions pertpy/metadata/_cell_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ def annotate_bulk_rna(
# then we can compare these keys and fetch the corresponding metadata.
if query_id not in adata.obs.columns:
raise ValueError(
f"The specified `query_id` {query_id} can't be found in the `adata.obs`.\n"
"Ensure that you are using one of the available query IDs present in the adata.obs for the annotation.\n"
f"The specified `query_id` {query_id} can't be found in the `adata.obs`. \n"
"Ensure that you are using one of the available query IDs present in the adata.obs for the annotation."
"If the desired query ID is not available, you can fetch the cell line metadata "
"using the `annotate()` function before calling 'annotate_bulk_rna()'. "
"This ensures that the required query ID is included in your data, e.g. stripped_cell_line_name, DepMap ID."
Expand All @@ -359,9 +359,8 @@ def annotate_bulk_rna(
else:
reference_id = "DepMap_ID"
logger.warning(
"To annotate bulk RNA data from Broad Institue, `DepMap_ID` is used as default reference and query identifier if no `reference_id` is given.\n"
"Ensure that `DepMap_ID` is available in 'adata.obs'.\n"
"Alternatively, use `annotate()` to annotate the cell line first "
"To annotate bulk RNA data from Broad Institue, `DepMap_ID` is used as default reference and query identifier if no `reference_id` is given."
"If `DepMap_ID` isn't available in 'adata.obs', use `annotate()` to annotate the cell line first."
)
if self.bulk_rna_broad is None:
self._download_bulk_rna(cell_line_source="broad")
Expand Down
2 changes: 1 addition & 1 deletion pertpy/tools/_differential_gene_expression/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def data(self):
if self.layer is None:
return self.adata.X
else:
return self.adata.layer[self.layer]
return self.adata.layers[self.layer]

@classmethod
@abstractmethod
Expand Down
Loading