0

我已经解决了我发布的关于如何从 Seurat 对象的元数据中提取数据的问题。但是,我想做更多的分析,想知道标记基因在其簇外表达的比例。我得到了这个函数,但它产生了在 cluster_in 之外表示的 marker_in 的比率,而不是在其集群之外表示的 marker_in 计数的比率。有人可以帮忙吗?

ratio_out_3 = function(marker_in, cluster_in){
all_cells_one_gene <- glioblastoma@assays$RNA@counts[marker_in,]
selected_cells_one_gene <- all_cells_one_gene[cluster_in!=Idents(glioblastoma)]
gene_count_out_cluster <- glioblastoma@assays$RNA@counts[,cluster_in!=Idents(glioblastoma)]
ratio_out_3 <- sum(selected_cells_one_gene)/sum(gene_count_out_cluster)
if (marker_in %!in% row.names(FindMarkers(glioblastoma, ident.1 = cluster_in, only.pos = TRUE))) sprintf("The gene %s is not a marker gene for the scRNA-seq cluster %s and its count ratio outside cluster %s is %s", marker_in, cluster_in, cluster_in, ratio_out_3)
else 
    sprintf("The gene %s is a marker gene for the scRNA-seq cluster %s", marker_in, cluster_in)
}

例如,CXCL8 是簇 0 的标记基因, ratio_out_3("CXCL8", 1) 将打印簇 1 外表达的 CXCL8 的比率,但我想要的是簇 0 外的 CXCL8 的比率(因为 CXCL8 是集群 0)。有没有办法在没有集群 0 的情况下对标识(胶质母细胞瘤)进行子集化?谢谢你。

4

0 回答 0