scverse / pertpy

Perturbation Analysis in the scverse ecosystem.
https://pertpy.readthedocs.io/en/latest/
MIT License
91 stars 19 forks source link

Add examples to plotting functions #511

Closed namsaraeva closed 4 months ago

namsaraeva commented 5 months ago

Added plots:

namsaraeva commented 5 months ago

Decided to merge the issues #458 and #447 to avoid possible conflicts in the future since I am editing docstrings.

namsaraeva commented 5 months ago

A little bit more context to the tasscoda issue:

tasccoda.plot_draw_tree(mdata, tree="lineage") fails with Import Error: to use tasscoda please install ete3 with pip install ete3

even though ete3 is installed (see session info below), so I couldn't generate example plots for all tasscoda plotting functions.

session_info.txt

namsaraeva commented 5 months ago

Augur example code:

import pertpy as pt
adata = pt.dt.bhattacherjee()
ag_rfc = pt.tl.Augur("random_forest_classifier")

data_15 = ag_rfc.load(adata, condition_label="Maintenance_Cocaine", treatment_label="withdraw_15d_Cocaine")
adata_15, results_15 = ag_rfc.predict(data_15, random_state=None, n_threads=4)
adata_15_permute, results_15_permute = ag_rfc.predict(data_15, augur_mode="permute", n_subsamples=100, random_state=None, n_threads=4)

data_48 = ag_rfc.load(adata, condition_label="Maintenance_Cocaine", treatment_label="withdraw_48h_Cocaine")
adata_48, results_48 = ag_rfc.predict(data_48, random_state=None, n_threads=4)
adata_48_permute, results_48_permute = ag_rfc.predict(data_48, augur_mode="permute", n_subsamples=100, random_state=None, n_threads=4)
pvals = ag_rfc.predict_differential_prioritization(augur_results1=results_15, augur_results2=results_48, permuted_results1=results_15_permute, permuted_results2=results_48_permute)
ag_rfc.plot_dp_scatter(pvals)

fails too.

pvals = ag_rfc.predict_differential_prioritization(augur_results1=results_15, augur_results2=results_48, permuted_results1=results_15_permute, permuted_results2=results_48_permute) can't be calculated due to TypeError: Passing a set as an indexer is not supported. Use a list instead.

Bildschirmfoto 2024-01-25 um 12 16 09

See session info in the comment above.

namsaraeva commented 5 months ago

Milo:

Bildschirmfoto 2024-01-25 um 13 01 16

Couldn't find the reason for this error either

codecov[bot] commented 5 months ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (d49872c) 63.99% compared to head (8a37d15) 64.07%. Report is 15 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #511 +/- ## ========================================== + Coverage 63.99% 64.07% +0.07% ========================================== Files 43 43 Lines 4969 4982 +13 ========================================== + Hits 3180 3192 +12 - Misses 1789 1790 +1 ``` | [Files](https://app.codecov.io/gh/theislab/pertpy/pull/511?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab) | Coverage Δ | | |---|---|---| | [pertpy/data/\_\_init\_\_.py](https://app.codecov.io/gh/theislab/pertpy/pull/511?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab#diff-cGVydHB5L2RhdGEvX19pbml0X18ucHk=) | `100.00% <ø> (ø)` | | | [pertpy/data/\_dataloader.py](https://app.codecov.io/gh/theislab/pertpy/pull/511?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab#diff-cGVydHB5L2RhdGEvX2RhdGFsb2FkZXIucHk=) | `100.00% <ø> (ø)` | | | [pertpy/data/\_datasets.py](https://app.codecov.io/gh/theislab/pertpy/pull/511?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab#diff-cGVydHB5L2RhdGEvX2RhdGFzZXRzLnB5) | `100.00% <ø> (ø)` | | | [pertpy/plot/\_coda.py](https://app.codecov.io/gh/theislab/pertpy/pull/511?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab#diff-cGVydHB5L3Bsb3QvX2NvZGEucHk=) | `100.00% <ø> (ø)` | | | [pertpy/tools/\_coda/\_base\_coda.py](https://app.codecov.io/gh/theislab/pertpy/pull/511?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab#diff-cGVydHB5L3Rvb2xzL19jb2RhL19iYXNlX2NvZGEucHk=) | `56.08% <ø> (ø)` | | | [pertpy/tools/\_dialogue.py](https://app.codecov.io/gh/theislab/pertpy/pull/511?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab#diff-cGVydHB5L3Rvb2xzL19kaWFsb2d1ZS5weQ==) | `13.70% <ø> (ø)` | | | [pertpy/tools/\_distances/\_distances.py](https://app.codecov.io/gh/theislab/pertpy/pull/511?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab#diff-cGVydHB5L3Rvb2xzL19kaXN0YW5jZXMvX2Rpc3RhbmNlcy5weQ==) | `88.60% <100.00%> (ø)` | | | [pertpy/tools/\_enrichment.py](https://app.codecov.io/gh/theislab/pertpy/pull/511?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab#diff-cGVydHB5L3Rvb2xzL19lbnJpY2htZW50LnB5) | `52.02% <ø> (ø)` | | | [pertpy/tools/\_milo.py](https://app.codecov.io/gh/theislab/pertpy/pull/511?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab#diff-cGVydHB5L3Rvb2xzL19taWxvLnB5) | `49.00% <ø> (ø)` | | | [pertpy/tools/\_mixscape.py](https://app.codecov.io/gh/theislab/pertpy/pull/511?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab#diff-cGVydHB5L3Rvb2xzL19taXhzY2FwZS5weQ==) | `79.80% <ø> (-0.20%)` | :arrow_down: | | ... and [4 more](https://app.codecov.io/gh/theislab/pertpy/pull/511?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=theislab) | |