Monocle是單細(xì)胞分析的常用R包之一,可進(jìn)行細(xì)胞類型鑒定、差異表達(dá)、偽時(shí)間分析等。
1.安裝Monocle
支持環(huán)境R3.4以上版本
獲取Mnonocle:
先安裝Bioconductor?
source("http://bioconductor.org/biocLite.R")?
biocLite()?
已經(jīng)安裝了Bioconductor的可直接安裝Monocle和支持包
檢測(cè)安裝是否成功
?library(monocle)
?2.推薦分析protocol
工作流程:上傳數(shù)據(jù)到CellDataSet對(duì)象中——用已知Marker進(jìn)行細(xì)胞分類——聚類細(xì)胞——偽時(shí)間排序——差異表達(dá)分析
上傳數(shù)據(jù)到CDS中
pd <- new("AnnotatedDataFrame", data = sample_sheet)
?fd <- new("AnnotatedDataFrame", data = gene_annotation)
?cds <- newCellDataSet(expr_matrix, phenoData = pd, featureData = fd)
expr_matrix的colnames必須與pd的rownames一致
用Marker分類細(xì)胞
cth <- newCellTypeHierarchy()?
MYF5_id <- row.names(subset(fData(cds), gene_short_name == "MYF5"))?
ANPEP_id <- row.names(subset(fData(cds), gene_short_name == "ANPEP"))
?cth <- addCellType(cth, "Myoblast", classify_func = function(x) { x[MYF5_id,] >= 1 })
?cth <- addCellType(cth, "Fibroblast", classify_func = function(x) { x[MYF5_id,] < 1 & x[ANPEP_id,] > 1 } )?
cds <- classifyCells(cds, cth, 0.1)?
聚類細(xì)胞
cds <- clusterCells(cds)
偽時(shí)間分析
disp_table <- dispersionTable(cds)?
ordering_genes <- subset(disp_table, mean_expression >= 0.1)?
cds <- setOrderingFilter(cds, ordering_genes)
?cds <- reduceDimension(cds)
?cds <- orderCells(cds)?
差異表達(dá)分析
diff_test_res <- differentialGeneTest(cds, fullModelFormulaStr = "~Media")?
sig_genes <- subset(diff_test_res, qval < 0.1)