I wrote a notebook a while back to use Banksy on brain spatial data (from slideseqv2_analysis.ipynb vignette). It worked without any issue, I re run it today and the only result I get is the clustering when no spatial information is used (i.e. results_df only has one row: the decay=nonspatial one, the scaled_gaussian is completely missing and also the scatterplot of the scaled_gaussian decay is missing from the output).
# set params
plot_graph_weights = True
k_geom = 8 # n neighbors
max_m = 1 # azumithal transform up to kth order
nbr_weight_decay = "scaled_gaussian" # can also be "reciprocal", "uniform" or "ranked"
# Find median distance to closest neighbours, the median distance will be `sigma`
nbrs = median_dist_to_nearest_neighbour(adata, key = coord_keys[2])
banksy_dict = initialize_banksy(
adata,
coord_keys,
k_geom,
nbr_weight_decay=nbr_weight_decay,
max_m=max_m,
plt_edge_hist=True,
plt_nbr_weights=True,
plt_agf_angles=False, # takes long time to plot
plt_theta=True,
)
# Main hyperparameters for BANKSY:
resolutions = [0.5] # clustering resolution for UMAP
pca_dims = [20] # Dimensionality in which PCA reduces to
lambda_list = [1] # list of lambda parameters
banksy_dict, banksy_matrix = generate_banksy_matrix(adata, banksy_dict, lambda_list, max_m)
banksy_dict["nonspatial"] = {
# Here we simply append the nonspatial matrix (adata.X) to obtain the nonspatial clustering results
0.0: {"adata": concatenate_all([adata.X], 0, adata=adata), }
}
pca_umap(banksy_dict,
pca_dims = pca_dims,
add_umap = True,
plt_remaining_var = False)
results_df, max_num_labels = run_Leiden_partition(
banksy_dict,
resolutions,
num_nn = 50,
num_iterations = -1,
partition_seed = seed,
match_labels = True)
output_path = '../banksy_output/'
c_map = 'tab20' # specify color map
weights_graph = banksy_dict['scaled_gaussian']['weights'][0]
plot_results(
results_df,
weights_graph,
c_map,
match_labels = True,
coord_keys = coord_keys,
max_num_labels = max_num_labels,
save_path = output_path,
save_fig = True, # save the spatial map of all clusters
save_seperate_fig = True, # save the figure of all clusters plotted seperately
)
Hi,
I wrote a notebook a while back to use Banksy on brain spatial data (from slideseqv2_analysis.ipynb vignette). It worked without any issue, I re run it today and the only result I get is the clustering when no spatial information is used (i.e. results_df only has one row: the decay=nonspatial one, the scaled_gaussian is completely missing and also the scatterplot of the scaled_gaussian decay is missing from the output).
My code: