MIXSCAPE - ms.plot_barplot(mdata["rna"], guide_rna_column="NT") shows no graph output with papalexi_2021 provided data
VittoriaDBocchi opened this issue · 11 comments
Report
when runnung
ms.plot_barplot(mdata["rna"], guide_rna_column="NT") during the mixscape pipeline with the data provided by the authors (mdata = pt.dt.papalexi_2021()) I get no output:
Version information
anndata 0.10.7
matplotlib 3.8.4
mudata 0.2.3
muon 0.1.6
numpy 1.26.4
pandas 2.2.2
pertpy 0.7.0
scanpy 1.10.1
scipy 1.13.0
seaborn 0.13.2
session_info 1.0.0
PIL 10.3.0
absl NA
adjustText 1.1.1
arrow 1.3.0
arviz 0.18.0
asttokens NA
attr 23.2.0
backcall 0.2.0
blitzgsea NA
certifi 2024.02.02
chardet 5.2.0
charset_normalizer 3.3.2
chex 0.1.86
colorama 0.4.6
comm 0.1.2
contextlib2 NA
custom_inherit 2.4.1
cycler 0.12.1
cython_runtime NA
dateutil 2.8.2
debugpy 1.6.7
decorator 5.1.1
decoupler 1.6.0
docrep 0.3.2
etils 1.8.0
executing 0.8.3
flax 0.8.3
fsspec 2024.3.1
h5py 3.11.0
idna 3.7
igraph 0.11.5
importlib_resources NA
ipykernel 6.25.0
jax 0.4.27
jaxlib 0.4.27
jaxopt NA
jedi 0.18.1
joblib 1.4.2
kiwisolver 1.4.5
legacy_api_wrap NA
leidenalg 0.10.2
lightning 2.1.4
lightning_fabric 2.2.4
lightning_utilities 0.11.2
llvmlite 0.42.0
matplotlib_inline 0.1.6
ml_collections NA
ml_dtypes 0.4.0
mpl_toolkits NA
mpmath 1.3.0
msgpack 1.0.8
multipledispatch 0.6.0
natsort 8.4.0
numba 0.59.1
numpyro 0.14.0
opt_einsum v3.3.0
optax 0.2.2
ott 0.4.6
packaging 23.1
parso 0.8.3
patsy 0.5.6
pexpect 4.8.0
pickleshare 0.7.5
pkg_resources NA
platformdirs 3.10.0
ply 3.11
png 0.20220715.0
pretty_errors 1.2.25
prompt_toolkit 3.0.36
psutil 5.9.0
ptyprocess 0.7.0
pubchempy 1.0.4
pure_eval 0.2.2
pyarrow 16.0.0
pydev_ipython NA
pydevconsole NA
pydevd 2.9.5
pydevd_file_utils NA
pydevd_plugins NA
pydevd_tracing NA
pygments 2.15.1
pynndescent 0.5.12
pyomo 6.7.1
pyparsing 3.1.2
pyro 1.9.0
pytorch_lightning 2.2.4
pytz 2024.1
reportlab 4.2.0
requests 2.31.0
rich NA
scvi 1.1.2
six 1.16.0
sklearn 1.4.2
skmisc 0.3.1
sparsecca 0.3.1
stack_data 0.2.0
statsmodels 0.14.2
texttable 1.7.0
threadpoolctl 3.5.0
toolz 0.12.1
torch 2.3.0+cu121
torchgen NA
torchmetrics 1.4.0
tornado 6.3.3
toyplot 1.0.3
toytree 2.0.5
tqdm 4.66.4
traitlets 5.7.1
tree 0.1.8
typing_extensions NA
umap 0.5.6
urllib3 2.2.1
wcwidth 0.2.5
xarray 2024.3.0
xarray_einstats 0.7.0
yaml 6.0.1
zmq 25.1.0
IPython 8.15.0
jupyter_client 8.6.0
jupyter_core 5.5.0
Python 3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0]
Linux-3.10.0-1160.45.1.el7.x86_64-x86_64-with-glibc2.17
Session information updated at 2024-09-19 15:21
Thanks! We'll look into it
Ohh, I see that you're running version 0.7.0. Could you please upgrade to the latest version with pip install -U pertpy
to see whether the issue persists?
Thank you for the prompt response. It does persist even with pertpy version 0.9.4. I notice that in the previous step (ms.mixscape(adata=mdata["rna"], control="sg_non_targeting", labels="GuidesGene", layer="X_pert") ) I get this warning: RuntimeWarning: invalid value encountered in log2
self.stats[group_name, "logfoldchanges"] = np.log2(
...envs/pertpy/lib/python3.11/site-packages/scanpy/tools/_rank_genes_groups.py:455: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling frame.insert
many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use newframe = frame.copy()
self.stats[group_name, "logfoldchanges"] = np.log2(
finished: added to .uns['rank_genes_groups']
'names', sorted np.recarray to be indexed by group ids
'scores', sorted np.recarray to be indexed by group ids
'logfoldchanges', sorted np.recarray to be indexed by group ids
'pvals', sorted np.recarray to be indexed by group ids
'pvals_adj', sorted np.recarray to be indexed by group ids (0:00:19)
...envs/pertpy/lib/python3.11/site-packages/pertpy/tools/_mixscape.py:318: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '[0.74430524 0.92261884 0.78700851 0.8451406 0.24272429 0.17320238... could this have anything to do with it? Thanks again!
Hi @VittoriaDBocchi! Thanks for testing with the updated pertpy version. I've just tested it myself but everything works fine on my end. When I run the example below, the plot is properly displayed:
mdata = pt.dt.papalexi_2021()
ms_pt = pt.tl.Mixscape()
ms_pt.perturbation_signature(mdata["rna"], "perturbation", "NT", "replicate")
ms_pt.mixscape(adata=mdata["rna"], control="NT", labels="gene_target", layer="X_pert")
ms_pt.plot_barplot(mdata["rna"], guide_rna_column="NT")
Did you run the exact same code? One possible issue I can think of is that the generated plot is quite large. How are you running the code— in a Jupyter notebook? Have large plots caused any issues for you before?
I'm also running into this issue. I think the problem has to do with the function call returning 0 axes, as is in my case:
<Figure size 640x480 with 0 Axes>
I'm running this in a jupyter notebook and the figure is not very large. I've ran into this problem both on my own dataset and the papalexi2021 dataset. The data are fine as I can recreate the plot manually with a plotting library.
Hi @plaffon1, thanks for reporting! I'll try to look into this over the next few days.
Hi @plaffon1, hi @VittoriaDBocchi!
This issue should be fixed with PR #667. Please let me know and reopen the issue if you're still facing problems.
Best,
Lilly
Hello,
Looks like this is raising a different error now: ValueError: cannot insert mixscape_class_global, already exists
Weird, I didn't encounter any issues when running the code above. Could you please send the entire code snippet you ran, along with the error traceback?