Closed simonmfr closed 5 months ago
Hi Simon, Sorry for the late reply. Just getting around to responding to the issues (will be quicker next time!).
I think the issue is that there are only 20 colors. Could you try using a different color scheme so that there are enough colors (I suspect at lower lambda you are getting more (>20) clusters).
Hi Simon, apologies again for the late reply. I'd just add to Vipul's reply that you can use the zeileis_28
colour scheme (which has 28 colors) by importing from utils:
from banksy_utils.color_lists import zeileis_28
And use `color_list = zeileis_28
as an argument in the run_banksy_multiparam
function
Note that this colour scheme has a different look from spagcn_color
. You can also directly input your own set of colours for plotting as a python list.
Great, many thanks!
Hi, Banksy runs perfectly fine with
lambda_list = [.8]
, however, once I set lambda_list below that I get the following error fromrun_banksy_multiparam
:IndexError: list index out of range
Do I need to adjust other parameters when decreasing lambda?
I am running Banksy on MERFISH data.
Parameters
``` resolutions = [1.0] # clustering resolution for Leiden clustering pca_dims = [20] # number of dimensions to keep after PCA lambda_list = [.6] k_geom = 20 # spatial neighbours max_m = 1 nbr_weight_decay = "scaled_gaussian" # can also be "reciprocal", "uniform" or "ranked" save_fig = False output_folder = os.path.join(os.getcwd(), 'data', 'merfish', 'tmp_png', f'{cluster_algorithm}', f'seed{random_seed}') annotation_key = 'leiden_res1_0' num_clusters = 10 coord_keys = ('x', 'y', 'spatial') ```Error message
``` --------------------------------------------------------------------------- IndexError Traceback (most recent call last) Cell In[64], line 1 ----> 1 results_df = run_banksy_multiparam( 2 adatas[key], banksy_dict, lambda_list, resolutions, 3 color_list = spagcn_color, max_m = max_m, 4 filepath = output_folder, pca_dims = pca_dims, 5 annotation_key = annotation_key, key = coord_keys, 6 max_labels = num_clusters, cluster_algorithm = cluster_algorithm, 7 match_labels = False, savefig = False, add_nonspatial = False, variance_balance = False, 8 ) File ~/miniconda3/envs/spatial-banksy/Banksy_Py/banksy/run_banksy.py:113, in run_banksy_multiparam(adata, banksy_dict, lambda_list, resolutions, color_list, max_m, filepath, key, match_labels, pca_dims, savefig, annotation_key, max_labels, variance_balance, cluster_algorithm, partition_seed, add_nonspatial, **kwargs) 111 raw_labels = raw_labels.dense 112 for i in raw_labels: --> 113 raw_clusters.append(color_list[i]) 115 fig = plt.figure(figsize=(8, 8), constrained_layout=True) 116 ax = fig.gca() IndexError: list index out of range ```