DingWB / PyComplexHeatmap

PyComplexHeatmap: A Python package to plot complex heatmap (clustermap)
https://dingwb.github.io/PyComplexHeatmap/
MIT License
249 stars 28 forks source link

How to use the row_split_order parameter of ClusterMapPlotter function? #48

Closed Xinfeng-Yao closed 10 months ago

Xinfeng-Yao commented 11 months ago

Hello! After using the row_split parameter to group the row items, I want to use the row_split_order parameter to set the group order, but it does not work. What I should input for the row_split_order parameter? Bool, group names list or row item index? Thanks!

DingWB commented 11 months ago

row_split_order and col_split_order should be a list, the values should be the values of [row/col]_split. for example:

plt.figure(figsize=(4, 8))
cm = ClusterMapPlotter(data=data1,
                       top_annotation=col_ha,left_annotation=row_ha,
                       col_cluster=True,row_cluster=True,
                       col_split=df_cols1.loc[:,['CellType']],
                       row_split=df_rows1.loc[:,['CellType']],
                       row_split_order=df_rows1.CellType.unique().tolist(),
                       col_split_order=df_rows1.CellType.unique().tolist(),
                       col_split_gap=0.5,row_split_gap=0.5,
                       label='AvgBeta',row_dendrogram=False,
                       show_rownames=False,show_colnames=False,
                       verbose=0,legend_gap=5,
                       cmap='viridis',rasterized=True)

Here, row_split_order is a list, and the value is the unique of df_rows1.CellType.