predictive_accuracy/: 2D histogram plot showing how well NMF explains cell2location output spatial/: NMF weights across locatinos in spatial coordinates location_factors_mean/: the data used for the plot in spatial coordiantes stability_plots/: stability of NMF weights between training restarts 检查...
plt import plot_spatial # select up to 6 clusters clust_labels = ['T_CD4+_naive', 'B_naive', 'FDC'] clust_col = ['' + str(i) for i in clust_labels] # in case column names differ from labels slide = select_slide(adata_vis, 'V1_Human_Lymph_Node') with mpl.rc_context({'...
整合算法很多,我们按照排名一个一个来,这次我们先介绍cell2location以及代码实战。 Cell2location发表于2022年的Nature Biotechnology,题为《Cell2location maps fine-grained cell types in spatial transcriptomics》。该方法依赖于贝叶斯模型,旨在解析空间转录组数据中更为精细的细胞类型的,并创建不同组织的细胞组成图谱。
mod.plot_QC() plt.savefig('04-mod.plot_QC.png') # 保存为PNG格式 14.可视化细胞丰度 adata_vis.obsm['means_cell_abundance_w_sf'] adata_vis.uns['spatial'].keys() # 帮助我们去确定下边的select_slide中需要填写的参数名称 # add 5% quantile, representing confident cell abundance, 'at leas...
from cell2location.plt import plot_spatial # select up to 6 clusters clust_labels = ['T_CD4+_naive','B_naive','FDC'] clust_col = [''+ str(i)foriinclust_labels]# in case column names differ from labels clust_col slide = select_slide(adata_vis,'V1_Human_Lymph_Node')...
("main"=useful_features,"juxta"=useful_features)# Define spatial context of each view ---view_types<-list("main"="intra","juxta"="juxta")# Define additional parameters (l in case of paraview,# n of neighbors in case of juxta) ---view_params<-list("main"=NULL,"juxta"=6)misty_ou...
Cell2location: spatial mapping # find shared genes and subset both anndata and reference signatures intersect = np.intersect1d(adata_vis.var_names, inf_aver.index) adata_vis = adata_vis[:, intersect].copy() inf_aver = inf_aver.loc[intersect, :].copy() ...
# adata.var['mt']=[gene.startswith('MT-')forgeneinadata.var['SYMBOL']]# removeMTgenesforspatialmapping(keeping their countsinthe object)adata.obsm['mt']=adata[:,adata.var['mt'].values].X.toarray()# 这里是把线粒体基因的表达信息嵌入到每个细胞中 ...
cell2location.plt.plot_density_1D(adata_c2l, subset = subset_19pcw, saving = False, scaling = 0.05, power = 1, pws = [0,0,100,500,1000,3000,6000,10000], figureSize = (12,8), dimName = 'VCDepth', areaName = 'roi_dimension', xlab = 'Cortical Depth', colourCode = colourCode...
(i) for i in clust_labels] slide = select_slide(adata_vis, 'V1_Human_Lymph_Node') with mpl.rc_context({'figure.figsize': (15, 15)}): fig = plot_spatial( adata=slide, color=clust_col, labels=clust_labels, show_img=True, style='fast', max_color_quantile=0.992, circle_diameter...