Open OMIC-coding opened 1 year ago
Hi. Your platform is Visium or stereo-seq? Please set rad_cutoff=150
for Visium to have ~6 neighbors. You can adjust rad_cutoff
to keep about 5-10 neighbors.
Batch_list = [] adj_list = [] sp_data_folder = '/data/project/liziyu/NAFLD/data/ST/' section_ids = os.listdir(sp_data_folder) group_dict = {'KZ-CTR-161':'HD','CTR-179':'HD','KZ-CTR-180':'HD','CYG-1495':'NAFL','CYL-1501':'NASH','HJD-1478':'NASH','HJJ-1480':'NASH','LCQ-1481':'NASH','LLF-1492':'NAFL','LP-1494':'NASH','LSH-1498':'NAFL','XRP-1493':'NAFL','YM-171':'NAFL','ZHT-1475':'NASH','ZLM-1497':'NAFL','ZTH-1479':'NAFL'} for section_id in section_ids: adata = sc.read_visium(path=os.path.join(sp_data_folder,section_id),count_file='filtered_feature_bc_matrix.h5',load_images=True) adata.var_names_make_unique(join='++') adata.obs['group'] = group_dict.get(list(adata.uns['spatial'].keys())[0])
adata.obs_names = [section_id+'_'+x for x in adata.obs_names]
#Constructing the spatial network
STAligner.Cal_Spatial_Net(adata,rad_cutoff=150) #the spatial network are saved in adata.uns['adj]
STAligner.Stats_Spatial_Net(adata) #plot the number of spatial neighbors
#Normalization
sc.pp.highly_variable_genes(adata,flavor='seurat_v3',n_top_genes=10000) #ensure enough common HVGs in the combined matrix
sc.pp.normalize_total(adata,target_sum=1e4)
sc.pp.log1p(adata)
adata = adata[:,adata.var['highly_variable']]
adj_list.append(adata.uns['adj'])
Batch_list.append(adata)
I have already set the rad_cutoff parameter to 150, but there is 0 edge still
You can increase rad_cutoff
until reaching enough neighbors.
How exactly this parameter rad_cutoff should be set appropriately?My data is from the same tumour but from different samples, not adjacent slices, the parameter is set small and the calculated edges are 0 edges
I finally successfully installed the STAligner package and I can follow the pipeline in the tutorial file. However, I encountered the error when I run this procedure: STAligner.Cal_Spatial_Net I got similar feedback for each sample as follows: 0.000 neighbors per cell on average