pinellolab / STREAM

STREAM: Single-cell Trajectories Reconstruction, Exploration And Mapping of single-cell data
http://stream.pinellolab.org
GNU Affero General Public License v3.0
173 stars 46 forks source link

st.plot_stream error #138

Closed l-magnificence closed 2 years ago

l-magnificence commented 2 years ago

when I run st.plot_stream(adata,root='S4',color=['Phase'],factor_min_win=1.5), error occur:

ValueError                                Traceback (most recent call last)
/tmp/ipykernel_90883/1597493436.py in <module>
      1 #stream plots
----> 2 st.plot_stream(adata,root='S4',color=['Phase'],factor_min_win=1.5)

~/.conda/envs/env_stream/lib/python3.7/site-packages/stream/core.py in plot_stream(adata, root, color, preference, dist_scale, factor_num_win, factor_min_win, factor_width, factor_nrow, factor_ncol, log_scale, factor_zoomin, fig_size, fig_legend_order, fig_legend_ncol, vmin, vmax, pad, w_pad, h_pad, save_fig, fig_path, fig_format)
   3129         cal_stream_polygon_string(adata,dict_ann,root=root,preference=preference,dist_scale=dist_scale,
   3130                                   factor_num_win=factor_num_win,factor_min_win=factor_min_win,factor_width=factor_width,
-> 3131                                   log_scale=log_scale,factor_zoomin=factor_zoomin)  
   3132         dict_plot['string'] = [dict_verts,dict_extent]
   3133 

~/.conda/envs/env_stream/lib/python3.7/site-packages/stream/extra.py in cal_stream_polygon_string(adata, dict_ann, root, preference, dist_scale, factor_num_win, factor_min_win, factor_width, log_scale, factor_zoomin)
    927         if x in nx.get_edge_attributes(flat_tree,'id').values():
    928             id_cells = np.where(df_stream['branch_id']==x)[0]
--> 929             df_stream.loc[df_stream.index[id_cells],'edge'] = [x]
    930             df_stream.loc[df_stream.index[id_cells],'lam_ordered'] = df_stream.loc[df_stream.index[id_cells],'branch_lam']
    931         else:

~/.conda/envs/env_stream/lib/python3.7/site-packages/pandas/core/indexing.py in __setitem__(self, key, value)
    721 
    722         iloc = self if self.name == "iloc" else self.obj.iloc
--> 723         iloc._setitem_with_indexer(indexer, value, self.name)
    724 
    725     def _validate_key(self, key, axis: int):

~/.conda/envs/env_stream/lib/python3.7/site-packages/pandas/core/indexing.py in _setitem_with_indexer(self, indexer, value, name)
   1728         if take_split_path:
   1729             # We have to operate column-wise
-> 1730             self._setitem_with_indexer_split_path(indexer, value, name)
   1731         else:
   1732             self._setitem_single_block(indexer, value, name)

~/.conda/envs/env_stream/lib/python3.7/site-packages/pandas/core/indexing.py in _setitem_with_indexer_split_path(self, indexer, value, name)
   1767 
   1768             elif np.ndim(value) == 2:
-> 1769                 self._setitem_with_indexer_2d_value(indexer, value)
   1770 
   1771             elif len(ilocs) == 1 and lplane_indexer == len(value) and not is_scalar(pi):

~/.conda/envs/env_stream/lib/python3.7/site-packages/pandas/core/indexing.py in _setitem_with_indexer_2d_value(self, indexer, value)
   1828         if len(ilocs) != value.shape[1]:
   1829             raise ValueError(
-> 1830                 "Must have equal len keys and value when setting with an ndarray"
   1831             )
   1832 

ValueError: Must have equal len keys and value when setting with an ndarray

What dose this mean? How to solve it? Thanks!

l-magnificence commented 2 years ago

install the latest version can solve it