Open Sawyerxu opened 2 months ago
And i run this command clustree(data=data_frame, prefix='resolution_',images='/home/data') and raise this error:
clustree(data=data_frame, prefix='resolution_',images='/home/data')
--------------------------------------------------------------------------- KeyError Traceback (most recent call last) Cell In[50], line 2 1 from clustree import clustree ----> 2 clustree(data=data_frame, prefix='resolution_',images=save_dir) File [~/miniforge3/envs/singlecell2/lib/python3.10/site-packages/clustree/_graph.py:157](http://10.102.34.21:9872/home/vv/miniforge3/envs/singlecell2/lib/python3.10/site-packages/clustree/_graph.py#line=156), in clustree(data, prefix, images, output_path, draw, node_color, node_color_aggr, node_cmap, edge_color, edge_cmap, orientation, layout_reingold_tilford, min_cluster_number, border_size, figsize, arrows, node_size, node_size_edge, dpi, kk) 154 if kk < 13: 155 layout_reingold_tilford = True --> 157 config = ClustreeConfig( 158 prefix=prefix, 159 kk=kk, 160 data=_data, 161 node_color=node_color, 162 node_color_aggr=node_color_aggr, 163 node_cmap=node_cmap, 164 edge_color=edge_color, 165 edge_cmap=edge_cmap, 166 start_at_1=start_at_1, 167 ) 169 dg = construct_clustree(cf=config) 170 if draw or output_path: File [~/miniforge3/envs/singlecell2/lib/python3.10/site-packages/clustree/_config.py:73](http://10.102.34.21:9872/home/vv/miniforge3/envs/singlecell2/lib/python3.10/site-packages/clustree/_config.py#line=72), in ClustreeConfig.__init__(self, kk, data, prefix, node_color, node_color_aggr, node_cmap, edge_color, edge_cmap, start_at_1, _setup_cf) 71 self.set_sample_information(data=cluster_membership) 72 if _setup_cf["node_color"]: ---> 73 self.set_node_color( 74 node_color=node_color, 75 aggr=node_color_aggr, 76 cmap=node_cmap, 77 prefix=prefix, 78 data=data, 79 ) 80 if _setup_cf["edge_color"]: 81 self.set_edge_color(edge_color=edge_color, cmap=edge_cmap, prefix=prefix) File [~/miniforge3/envs/singlecell2/lib/python3.10/site-packages/clustree/_config.py:151](http://10.102.34.21:9872/home/vv/miniforge3/envs/singlecell2/lib/python3.10/site-packages/clustree/_config.py#line=150), in ClustreeConfig.set_node_color(self, node_color, cmap, aggr, data, prefix) 148 if node_color == prefix: 149 for node_id, attr in self.node_cf.items(): 150 self.node_cf[node_id]["node_color"] = mpl.colors.to_rgba( --> 151 f"C{attr['res']}" 152 ) 153 elif (use_samples := node_color == "samples") or (node_color in data.columns): 154 # create to_parse = {node_id: value} 155 if use_samples: KeyError: 'res'
Is my datafram format wrong? Thanks.
And i run this command
clustree(data=data_frame, prefix='resolution_',images='/home/data')
and raise this error:Is my datafram format wrong? Thanks.