-
Notifications
You must be signed in to change notification settings - Fork 672
Milestone
Description
Since I update to scanpy==1.4.5.1 I am getting multiple plotting errors. sc.pl.rank_genes_groups() and sc.pl.violin()
are still working fine but I am getting errors in the rank_genes functions like sc.pl.rank_genes_groups_violin(
) and sc.pl.tracksplot()
##still working fine
sc.tl.rank_genes_groups(adata, 'louvain', method='wilcoxon')
sc.pl.rank_genes_groups(adata, n_genes=25, sharey=False)
result = adata.uns['rank_genes_groups']
groups = result['names'].dtype.names
pd.DataFrame(
{group + '_' + key[:1]: result[key][group]
for group in groups for key in ['names', 'pvals']}).head(5)
##gives error
sc.pl.rank_genes_groups_violin(adata, groups='2', n_genes=8)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in _ensure_valid_index(self, value)
3169 try:
-> 3170 value = Series(value)
3171 except:
~/anaconda3/lib/python3.7/site-packages/pandas/core/series.py in __init__(self, data, index, dtype, name, copy, fastpath)
273 data = _sanitize_array(data, index, dtype, copy,
--> 274 raise_cast_failure=True)
275
~/anaconda3/lib/python3.7/site-packages/pandas/core/series.py in _sanitize_array(data, index, dtype, copy, raise_cast_failure)
4160 if isinstance(data, np.ndarray):
-> 4161 raise Exception('Data must be 1-dimensional')
4162 else:
Exception: Data must be 1-dimensional
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-23-ccdbf8b7836c> in <module>
----> 1 sc.pl.rank_genes_groups_violin(adata, groups='2', n_genes=8) ## 200316 error fix later, also when I run the entire script from the start
~/anaconda3/lib/python3.7/site-packages/scanpy/plotting/_tools/__init__.py in rank_genes_groups_violin(adata, groups, n_genes, gene_names, gene_symbols, use_raw, key, split, scale, strip, jitter, size, ax, show, save)
727 if issparse(X_col): X_col = X_col.toarray().flatten()
728 new_gene_names.append(g)
--> 729 df[g] = X_col
730 df['hue'] = adata.obs[groups_key].astype(str).values
731 if reference == 'rest':
~/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in __setitem__(self, key, value)
3114 else:
3115 # set column
-> 3116 self._set_item(key, value)
3117
3118 def _setitem_slice(self, key, value):
~/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in _set_item(self, key, value)
3188 """
3189
-> 3190 self._ensure_valid_index(value)
3191 value = self._sanitize_column(key, value)
3192 NDFrame._set_item(self, key, value)
~/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in _ensure_valid_index(self, value)
3170 value = Series(value)
3171 except:
-> 3172 raise ValueError('Cannot set a frame with no defined index '
3173 'and a value that cannot be converted to a '
3174 'Series')
ValueError: Cannot set a frame with no defined index and a value that cannot be converted to a Series
Versions:
scanpy==1.4.5.1 anndata==0.7.1 umap==0.3.10 numpy==1.18.1 scipy==1.4.1 pandas==0.23.0 scikit-learn==0.21.3 statsmodels==0.11.0 python-igraph==0.7.1 louvain==0.6.1
scvelo==0.1.25 scanpy==1.4.5.1 anndata==0.7.1 loompy==3.0.6 numpy==1.18.1 scipy==1.4.1 matplotlib==3.1.3 sklearn==0.21.3 pandas==0.23.0