【AUCell】单细胞基因集打分

单细胞层次给基因集打分除了和GSVA等分析一样可以做富集以外,还可以通过cell marker gene set做亚群注释(需要注意细胞比例的问题,数量少的群体不行,可作辅助)。前面写过的scMetabolism包是给代谢通路打分,思路一样。

AUCell 是ranking-based,所以具体哪种标准化方法不重要,只要不影响每个细胞内基因表达量的排序就好。总的来讲,分为三步:

1,build the rankings

2,calculate the AUC

3,set the assignment threshold

安装R包

if (!requireNamespace("BiocManager", quietly=TRUE))
    install.packages("BiocManager")

Biocmanager::install("AUCell")

# To support paralell execution:
BiocManager::install(c("doMC", "doRNG","doSNOW"))
# For the main example:
BiocManager::install(c("mixtools", "GEOquery", "SummarizedExperiment"))
# For the examples in the follow-up section of the tutorial:
BiocManager::install(c("DT", "plotly", "NMF", "d3heatmap", "shiny", "rbokeh",
                       "dynamicTreeCut","R2HTML","Rtsne", "zoo"))

  • load the scRNA expression matrix and gene set
# i.e. Reading from a text file
#exprMatrix <- read.table("myCountsMatrix.tsv")
#exprMatrix <- as.matrix(exprMatrix)

# or using an expression set
#exprMatrix <- exprs(myExpressionSet)




# (This may take a few minutes)
library(GEOquery)
attemptsLeft <- 20
while(attemptsLeft>0)
{
  geoFile <- tryCatch(getGEOSuppFiles("GSE60361", makeDirectory=FALSE), error=identity) 
  if(methods::is(geoFile,"error")) 
  {
    attemptsLeft <- attemptsLeft-1
    Sys.sleep(5)
  }
  else
    attemptsLeft <- 0
}

gzFile <- grep(".txt.gz", basename(rownames(geoFile)), fixed=TRUE, value=TRUE)
message(gzFile)
txtFile <- gsub(".gz", "", gzFile, fixed=TRUE)
message(txtFile)
gunzip(filename=gzFile, destname=txtFile, remove=TRUE)

library(data.table)
geoData <- fread(txtFile, sep="\t")
gene
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值